@fangzhongya/fang-ui 0.1.67 → 0.1.68

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.
@@ -42,7 +42,7 @@ const dataProps = buildProps.buildProps({
42
42
  * @props { String } value
43
43
  * 当前选中的
44
44
  */
45
- value: {
45
+ modelValue: {
46
46
  type: String
47
47
  },
48
48
  /**
@@ -56,7 +56,7 @@ const dataProps = buildProps.buildProps({
56
56
  }
57
57
  }
58
58
  });
59
- const dataEmits = ["select"];
59
+ const dataEmits = ["select", "update:modelValue"];
60
60
  const dataSlot = {
61
61
  default: "default"
62
62
  };
@@ -41,7 +41,7 @@ export declare const dataProps: {
41
41
  * @props { String } value
42
42
  * 当前选中的
43
43
  */
44
- value: {
44
+ modelValue: {
45
45
  type: StringConstructor;
46
46
  };
47
47
  /**
@@ -40,7 +40,7 @@ const dataProps = buildProps({
40
40
  * @props { String } value
41
41
  * 当前选中的
42
42
  */
43
- value: {
43
+ modelValue: {
44
44
  type: String
45
45
  },
46
46
  /**
@@ -54,7 +54,7 @@ const dataProps = buildProps({
54
54
  }
55
55
  }
56
56
  });
57
- const dataEmits = ["select"];
57
+ const dataEmits = ["select", "update:modelValue"];
58
58
  const dataSlot = {
59
59
  default: "default"
60
60
  };
@@ -3,10 +3,11 @@ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toString
3
3
  const vue = require("vue");
4
4
  require("./menu-ll.cjs");
5
5
  const data = require("./data.cjs");
6
- const index$3 = require("../../menu/index.cjs");
6
+ const index$4 = require("../../menu/index.cjs");
7
7
  const index$2 = require("../../../hooks/cssname/index.cjs");
8
8
  const index$1 = require("../../../hooks/inherit/index.cjs");
9
9
  const index = require("../../../hooks/props-default/index.cjs");
10
+ const index$3 = require("../../../hooks/model/index.cjs");
10
11
  const menuLl_vue_vue_type_script_lang = require("./menu-ll2.cjs");
11
12
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
12
13
  __name: "index",
@@ -18,6 +19,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
18
19
  const attrs = index$1.useInherit(vue.useAttrs(), data.name);
19
20
  const cs = index$2.useCssName(data.name);
20
21
  const emit = __emit;
22
+ const value = index$3.useModel(props, emit);
21
23
  const slots = vue.useSlots();
22
24
  const config = vue.computed(() => {
23
25
  return {
@@ -29,10 +31,10 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
29
31
  ...props.config
30
32
  };
31
33
  });
32
- function getChildrenValue(list, value, config2) {
34
+ function getChildrenValue(list, value2, config2) {
33
35
  for (const element of list) {
34
36
  const p = config2.prop;
35
- if (p && element[p] == value) {
37
+ if (p && element[p] == value2) {
36
38
  return element;
37
39
  }
38
40
  }
@@ -40,8 +42,8 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
40
42
  function getChildren(list, arr, config2) {
41
43
  let arrObj = [];
42
44
  let listarr = list;
43
- for (const value of arr) {
44
- let v = getChildrenValue(listarr, value, config2);
45
+ for (const value2 of arr) {
46
+ let v = getChildrenValue(listarr, value2, config2);
45
47
  if (v) {
46
48
  arrObj.push({ ...v });
47
49
  const c = config2.children;
@@ -54,21 +56,22 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
54
56
  }
55
57
  function onSelect(id, arr) {
56
58
  let arrObj = getChildren(props.list, arr, config.value);
59
+ value.value = id;
57
60
  emit("select", id, arr, arrObj);
58
61
  }
59
62
  return (_ctx, _cache) => {
60
63
  return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
61
64
  class: vue.unref(cs).z()
62
65
  }, vue.unref(attrs).root), [
63
- vue.createVNode(vue.unref(index$3.Menu), vue.mergeProps(vue.unref(attrs).assem, {
66
+ vue.createVNode(vue.unref(index$4.Menu), vue.mergeProps(vue.unref(attrs).assem, {
64
67
  class: vue.unref(cs).z("menu"),
65
68
  onSelect,
66
- "default-active": vue.unref(props).value
69
+ "default-active": vue.unref(value)
67
70
  }), {
68
71
  default: vue.withCtx(() => [
69
72
  vue.createVNode(menuLl_vue_vue_type_script_lang.default, {
70
73
  compons: vue.unref(props).compons,
71
- value: vue.unref(props).value,
74
+ value: vue.unref(value),
72
75
  list: vue.unref(props).list,
73
76
  level: vue.unref(props).level,
74
77
  config: config.value
@@ -5,6 +5,7 @@ import { Menu } from "../../menu/index.js";
5
5
  import { useCssName } from "../../../hooks/cssname/index.js";
6
6
  import { useInherit } from "../../../hooks/inherit/index.js";
7
7
  import { usePropsDefault, getProps } from "../../../hooks/props-default/index.js";
8
+ import { useModel } from "../../../hooks/model/index.js";
8
9
  import _sfc_main$1 from "./menu-ll2.js";
9
10
  const _sfc_main = /* @__PURE__ */ defineComponent({
10
11
  __name: "index",
@@ -16,6 +17,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16
17
  const attrs = useInherit(useAttrs(), name);
17
18
  const cs = useCssName(name);
18
19
  const emit = __emit;
20
+ const value = useModel(props, emit);
19
21
  const slots = useSlots();
20
22
  const config = computed(() => {
21
23
  return {
@@ -27,10 +29,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
27
29
  ...props.config
28
30
  };
29
31
  });
30
- function getChildrenValue(list, value, config2) {
32
+ function getChildrenValue(list, value2, config2) {
31
33
  for (const element of list) {
32
34
  const p = config2.prop;
33
- if (p && element[p] == value) {
35
+ if (p && element[p] == value2) {
34
36
  return element;
35
37
  }
36
38
  }
@@ -38,8 +40,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
38
40
  function getChildren(list, arr, config2) {
39
41
  let arrObj = [];
40
42
  let listarr = list;
41
- for (const value of arr) {
42
- let v = getChildrenValue(listarr, value, config2);
43
+ for (const value2 of arr) {
44
+ let v = getChildrenValue(listarr, value2, config2);
43
45
  if (v) {
44
46
  arrObj.push({ ...v });
45
47
  const c = config2.children;
@@ -52,6 +54,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
52
54
  }
53
55
  function onSelect(id, arr) {
54
56
  let arrObj = getChildren(props.list, arr, config.value);
57
+ value.value = id;
55
58
  emit("select", id, arr, arrObj);
56
59
  }
57
60
  return (_ctx, _cache) => {
@@ -61,12 +64,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
64
  createVNode(unref(Menu), mergeProps(unref(attrs).assem, {
62
65
  class: unref(cs).z("menu"),
63
66
  onSelect,
64
- "default-active": unref(props).value
67
+ "default-active": unref(value)
65
68
  }), {
66
69
  default: withCtx(() => [
67
70
  createVNode(_sfc_main$1, {
68
71
  compons: unref(props).compons,
69
- value: unref(props).value,
72
+ value: unref(value),
70
73
  list: unref(props).list,
71
74
  level: unref(props).level,
72
75
  config: config.value
@@ -5,13 +5,22 @@ const use = require("../../common/use.cjs");
5
5
  function setLabel(value, obj, props, compons, emit, slots, index) {
6
6
  let label = value ?? obj.label ?? "";
7
7
  obj.label = label;
8
- return use.useVNodeComponDom(obj, props.value, slots, emit, {
9
- // options: {},
10
- compons,
11
- index,
12
- scope: {
13
- config: props
8
+ return use.useVNodeComponDom(
9
+ {
10
+ ...obj,
11
+ prop: "label"
12
+ },
13
+ obj,
14
+ slots,
15
+ emit,
16
+ {
17
+ // options: {},
18
+ compons,
19
+ index,
20
+ scope: {
21
+ config: props
22
+ }
14
23
  }
15
- });
24
+ );
16
25
  }
17
26
  exports.setLabel = setLabel;
@@ -3,14 +3,23 @@ import { useVNodeComponDom } from "../../common/use.js";
3
3
  function setLabel(value, obj, props, compons, emit, slots, index) {
4
4
  let label = value ?? obj.label ?? "";
5
5
  obj.label = label;
6
- return useVNodeComponDom(obj, props.value, slots, emit, {
7
- // options: {},
8
- compons,
9
- index,
10
- scope: {
11
- config: props
6
+ return useVNodeComponDom(
7
+ {
8
+ ...obj,
9
+ prop: "label"
10
+ },
11
+ obj,
12
+ slots,
13
+ emit,
14
+ {
15
+ // options: {},
16
+ compons,
17
+ index,
18
+ scope: {
19
+ config: props
20
+ }
12
21
  }
13
- });
22
+ );
14
23
  }
15
24
  export {
16
25
  setLabel
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1768544548153,
4
+ "lastModified": 1768572114954,
5
5
  "icons": {
6
6
  "bar": {
7
7
  "body": " <path fill=\"currentColor\" d=\"M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z\" ></path> "
@@ -46,7 +46,7 @@ function getNextValue(obj, currentValue) {
46
46
  if (obj.pars) {
47
47
  return objValue.getObjValue(obj.prop, currentValue) ?? obj.default;
48
48
  }
49
- return currentValue[obj.prop] ?? obj.default;
49
+ return (currentValue == null ? void 0 : currentValue[obj.prop]) ?? obj.default;
50
50
  }
51
51
  function executionMethod(fun, ...arr) {
52
52
  var _a;
@@ -44,7 +44,7 @@ function getNextValue(obj, currentValue) {
44
44
  if (obj.pars) {
45
45
  return getObjValue(obj.prop, currentValue) ?? obj.default;
46
46
  }
47
- return currentValue[obj.prop] ?? obj.default;
47
+ return (currentValue == null ? void 0 : currentValue[obj.prop]) ?? obj.default;
48
48
  }
49
49
  function executionMethod(fun, ...arr) {
50
50
  var _a;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.67",
4
+ "version": "0.1.68",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
File without changes
File without changes
File without changes
File without changes