You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
2.8 KiB
1 line
2.8 KiB
{"ast":null,"code":"const NODE_KEY = \"$treeNodeId\";\nconst markNodeData = function (node, data) {\n if (!data || data[NODE_KEY]) return;\n Object.defineProperty(data, NODE_KEY, {\n value: node.id,\n enumerable: false,\n configurable: false,\n writable: false\n });\n};\nconst getNodeKey = function (key, data) {\n if (!key) return data[NODE_KEY];\n return data[key];\n};\nconst handleCurrentChange = (store, emit, setCurrent) => {\n const preCurrentNode = store.value.currentNode;\n setCurrent();\n const currentNode = store.value.currentNode;\n if (preCurrentNode === currentNode) return;\n emit(\"current-change\", currentNode ? currentNode.data : null, currentNode);\n};\nexport { NODE_KEY, getNodeKey, handleCurrentChange, markNodeData };","map":{"version":3,"names":["NODE_KEY","markNodeData","node","data","Object","defineProperty","value","id","enumerable","configurable","writable","getNodeKey","key","handleCurrentChange","store","emit","setCurrent","preCurrentNode","currentNode"],"sources":["../../../../../../../packages/components/tree/src/model/util.ts"],"sourcesContent":["import type { SetupContext } from 'vue'\nimport type Node from './node'\nimport type { RootTreeType, TreeKey, TreeNodeData } from '../tree.type'\n\nexport const NODE_KEY = '$treeNodeId'\n\nexport const markNodeData = function (node: Node, data: TreeNodeData): void {\n if (!data || data[NODE_KEY]) return\n Object.defineProperty(data, NODE_KEY, {\n value: node.id,\n enumerable: false,\n configurable: false,\n writable: false,\n })\n}\n\nexport const getNodeKey = function (key: TreeKey, data: TreeNodeData): any {\n if (!key) return data[NODE_KEY]\n return data[key]\n}\n\nexport const handleCurrentChange = (\n store: RootTreeType['store'],\n emit: SetupContext['emit'],\n setCurrent: () => void\n) => {\n const preCurrentNode = store.value.currentNode\n setCurrent()\n const currentNode = store.value.currentNode\n if (preCurrentNode === currentNode) return\n\n emit('current-change', currentNode ? currentNode.data : null, currentNode)\n}\n"],"mappings":"AAAY,MAACA,QAAQ,GAAG;AACZ,MAACC,YAAY,GAAG,SAAAA,CAASC,IAAI,EAAEC,IAAI,EAAE;EAC/C,IAAI,CAACA,IAAI,IAAIA,IAAI,CAACH,QAAQ,CAAC,EACzB;EACFI,MAAM,CAACC,cAAc,CAACF,IAAI,EAAEH,QAAQ,EAAE;IACpCM,KAAK,EAAEJ,IAAI,CAACK,EAAE;IACdC,UAAU,EAAE,KAAK;IACjBC,YAAY,EAAE,KAAK;IACnBC,QAAQ,EAAE;EACd,CAAG,CAAC;AACJ;AACY,MAACC,UAAU,GAAG,SAAAA,CAASC,GAAG,EAAET,IAAI,EAAE;EAC5C,IAAI,CAACS,GAAG,EACN,OAAOT,IAAI,CAACH,QAAQ,CAAC;EACvB,OAAOG,IAAI,CAACS,GAAG,CAAC;AAClB;AACY,MAACC,mBAAmB,GAAGA,CAACC,KAAK,EAAEC,IAAI,EAAEC,UAAU,KAAK;EAC9D,MAAMC,cAAc,GAAGH,KAAK,CAACR,KAAK,CAACY,WAAW;EAC9CF,UAAU,EAAE;EACZ,MAAME,WAAW,GAAGJ,KAAK,CAACR,KAAK,CAACY,WAAW;EAC3C,IAAID,cAAc,KAAKC,WAAW,EAChC;EACFH,IAAI,CAAC,gBAAgB,EAAEG,WAAW,GAAGA,WAAW,CAACf,IAAI,GAAG,IAAI,EAAEe,WAAW,CAAC;AAC5E","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]} |