@fangzhongya/fang-ui 0.1.71 → 0.1.73

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.
@@ -7,6 +7,7 @@ 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 getTreeObj = require("@fangzhongya/utils/tree/getTreeObj");
10
11
  const index$3 = require("../../../hooks/model/index.cjs");
11
12
  const menuLl_vue_vue_type_script_lang = require("./menu-ll2.cjs");
12
13
  const _sfc_main = /* @__PURE__ */ vue.defineComponent({
@@ -31,28 +32,13 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
31
32
  ...props.config
32
33
  };
33
34
  });
34
- function getChildrenValue(list, value2, config2) {
35
- for (const element of list) {
36
- const p = config2.prop;
37
- if (p && element[p] == value2) {
38
- return element;
39
- }
40
- }
41
- }
42
35
  function getChildren(list, arr, config2) {
43
- let arrObj = [];
44
- let listarr = list;
45
- for (const value2 of arr) {
46
- let v = getChildrenValue(listarr, value2, config2);
47
- if (v) {
48
- arrObj.push({ ...v });
49
- const c = config2.children;
50
- if (c) {
51
- listarr = v[c];
52
- }
53
- }
54
- }
55
- return arrObj;
36
+ const obj = getTreeObj.treeToArray(list, {
37
+ id: config2.prop,
38
+ children: config2.children,
39
+ fid: config2.prop
40
+ }).obj;
41
+ return arr.map((o) => obj[o]);
56
42
  }
57
43
  function onSelect(id, arr) {
58
44
  let arrObj = getChildren(props.list, arr, 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 { treeToArray } from "@fangzhongya/utils/tree/getTreeObj";
8
9
  import { useModel } from "../../../hooks/model/index.js";
9
10
  import _sfc_main$1 from "./menu-ll2.js";
10
11
  const _sfc_main = /* @__PURE__ */ defineComponent({
@@ -29,28 +30,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
29
30
  ...props.config
30
31
  };
31
32
  });
32
- function getChildrenValue(list, value2, config2) {
33
- for (const element of list) {
34
- const p = config2.prop;
35
- if (p && element[p] == value2) {
36
- return element;
37
- }
38
- }
39
- }
40
33
  function getChildren(list, arr, config2) {
41
- let arrObj = [];
42
- let listarr = list;
43
- for (const value2 of arr) {
44
- let v = getChildrenValue(listarr, value2, config2);
45
- if (v) {
46
- arrObj.push({ ...v });
47
- const c = config2.children;
48
- if (c) {
49
- listarr = v[c];
50
- }
51
- }
52
- }
53
- return arrObj;
34
+ const obj = treeToArray(list, {
35
+ id: config2.prop,
36
+ children: config2.children,
37
+ fid: config2.prop
38
+ }).obj;
39
+ return arr.map((o) => obj[o]);
54
40
  }
55
41
  function onSelect(id, arr) {
56
42
  let arrObj = getChildren(props.list, arr, config.value);
@@ -8,6 +8,7 @@ const use = require("../../common/use.cjs");
8
8
  const index$1 = require("../../../hooks/cssname/index.cjs");
9
9
  const util = require("./util.cjs");
10
10
  const util$1 = require("../../../utils/util.cjs");
11
+ const only = require("../../../utils/only.cjs");
11
12
  const index = require("../../../hooks/props-default/index.cjs");
12
13
  const name = "menu-li";
13
14
  const dataProps = {
@@ -101,7 +102,7 @@ const _sfc_main = vue.defineComponent({
101
102
  if (!use.useHide(obj, props.value)) {
102
103
  const v = obj[config.prop];
103
104
  const c = obj[config.children];
104
- const i = setIndexValue(v, obj, props.config);
105
+ const i = setIndexValue(v, obj, props.config) || only.getOnly();
105
106
  if (c && c.length > 0) {
106
107
  arr.push(
107
108
  vue.h(
@@ -6,6 +6,7 @@ import { useHide } from "../../common/use.js";
6
6
  import { useCssName } from "../../../hooks/cssname/index.js";
7
7
  import { setLabel } from "./util.js";
8
8
  import { getFathers } from "../../../utils/util.js";
9
+ import { getOnly } from "../../../utils/only.js";
9
10
  import { usePropsDefault, getProps } from "../../../hooks/props-default/index.js";
10
11
  const name = "menu-li";
11
12
  const dataProps = {
@@ -99,7 +100,7 @@ const _sfc_main = defineComponent({
99
100
  if (!useHide(obj, props.value)) {
100
101
  const v = obj[config.prop];
101
102
  const c = obj[config.children];
102
- const i = setIndexValue(v, obj, props.config);
103
+ const i = setIndexValue(v, obj, props.config) || getOnly();
103
104
  if (c && c.length > 0) {
104
105
  arr.push(
105
106
  h(
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "prefix": "fang-ui",
3
3
  "info": {},
4
- "lastModified": 1768836568904,
4
+ "lastModified": 1768973064466,
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> "
@@ -3,4 +3,5 @@ export * from './css';
3
3
  export * from './enums';
4
4
  export * from './getOnlyKey';
5
5
  export * from './local';
6
+ export * from './only';
6
7
  export * from './util';
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ function getOnly() {
4
+ return "i" + Date.now() + "-" + Math.random().toString(36).substring(2, 7);
5
+ }
6
+ exports.getOnly = getOnly;
@@ -0,0 +1 @@
1
+ export declare function getOnly(): string;
@@ -0,0 +1,6 @@
1
+ function getOnly() {
2
+ return "i" + Date.now() + "-" + Math.random().toString(36).substring(2, 7);
3
+ }
4
+ export {
5
+ getOnly
6
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fangzhongya/fang-ui",
3
3
  "private": false,
4
- "version": "0.1.71",
4
+ "version": "0.1.73",
5
5
  "type": "module",
6
6
  "description ": "fang-ui",
7
7
  "keywords": [
@@ -52,12 +52,12 @@
52
52
  "vue-tsc": "^3.2.2",
53
53
  "vxe-table": "4.6.20",
54
54
  "@fang-ui/components": "0.0.1-0",
55
- "@fang-ui/icons": "0.0.1-0",
56
55
  "@fang-ui/hooks": "0.0.1-0",
56
+ "@fang-ui/icons": "0.0.1-0",
57
57
  "@fang-ui/locale": "0.0.1-0",
58
58
  "@fang-ui/directives": "0.0.1-0",
59
- "@fang-ui/types": "0.0.1-0",
60
59
  "@fang-ui/theme": "0.0.1-0",
60
+ "@fang-ui/types": "0.0.1-0",
61
61
  "@fang-ui/utils": "0.0.1-0"
62
62
  },
63
63
  "main": "./dist/index.cjs",
File without changes
File without changes
File without changes
File without changes