@apia/tree 3.0.1 → 3.0.6
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/dist/index.d.ts +415 -7
- package/dist/index.js +1547 -6
- package/dist/index.js.map +1 -1
- package/package.json +11 -7
- package/dist/OOTree/OOTreeChildren.d.ts +0 -14
- package/dist/OOTree/OOTreeChildren.d.ts.map +0 -1
- package/dist/OOTree/OOTreeChildren.js +0 -17
- package/dist/OOTree/OOTreeChildren.js.map +0 -1
- package/dist/OOTree/OOTreeNode.d.ts +0 -30
- package/dist/OOTree/OOTreeNode.d.ts.map +0 -1
- package/dist/OOTree/OOTreeNode.js +0 -133
- package/dist/OOTree/OOTreeNode.js.map +0 -1
- package/dist/OOTree/index.d.ts +0 -36
- package/dist/OOTree/index.d.ts.map +0 -1
- package/dist/OOTree/index.js +0 -126
- package/dist/OOTree/index.js.map +0 -1
- package/dist/OOTree/types.d.ts +0 -11
- package/dist/OOTree/types.d.ts.map +0 -1
- package/dist/SearchLabel.js +0 -32
- package/dist/SearchLabel.js.map +0 -1
- package/dist/Tree.d.ts +0 -7
- package/dist/Tree.d.ts.map +0 -1
- package/dist/Tree.js +0 -131
- package/dist/Tree.js.map +0 -1
- package/dist/TreeContext.d.ts +0 -13
- package/dist/TreeContext.d.ts.map +0 -1
- package/dist/TreeContext.js +0 -22
- package/dist/TreeContext.js.map +0 -1
- package/dist/TreeDataController.d.ts +0 -116
- package/dist/TreeDataController.d.ts.map +0 -1
- package/dist/TreeDataController.js +0 -616
- package/dist/TreeDataController.js.map +0 -1
- package/dist/TreeItem.js +0 -51
- package/dist/TreeItem.js.map +0 -1
- package/dist/TreeItemChildren.js +0 -20
- package/dist/TreeItemChildren.js.map +0 -1
- package/dist/TreeItemLabel.js +0 -72
- package/dist/TreeItemLabel.js.map +0 -1
- package/dist/getDomProps.js +0 -37
- package/dist/getDomProps.js.map +0 -1
- package/dist/renderers/DefaultIconRenderer.js +0 -18
- package/dist/renderers/DefaultIconRenderer.js.map +0 -1
- package/dist/renderers/DefaultLabelRenderer.js +0 -10
- package/dist/renderers/DefaultLabelRenderer.js.map +0 -1
- package/dist/renderers/Spacer.js +0 -10
- package/dist/renderers/Spacer.js.map +0 -1
- package/dist/types.d.ts +0 -211
- package/dist/types.d.ts.map +0 -1
- package/dist/useTreeData.d.ts +0 -25
- package/dist/useTreeData.d.ts.map +0 -1
- package/dist/useTreeData.js +0 -131
- package/dist/useTreeData.js.map +0 -1
- package/dist/util.js +0 -220
- package/dist/util.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeDataController.js","sources":["../src/TreeDataController.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-dynamic-delete */\n/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable max-classes-per-file */\nimport React, { RefObject, useEffect, useState } from 'react';\nimport {\n TDataNode,\n TDataNodeContainer,\n TId,\n TTreeDataControllerConfig,\n TTreeDataControllerState,\n} from './types';\nimport {\n getFirstNonFilteredChild,\n getLastVisibleChild,\n getNextChild,\n getNextNodeWithKey,\n getPreviousChild,\n selectAllNodesBetweenTwoNodes,\n} from './util';\nimport {\n EventEmitter,\n PropsStore,\n TModify,\n TRequireOnlyOne,\n addBoundary,\n getSpecificParent,\n TUpdateFieldConfiguration,\n TPropsConfiguration,\n usePropsSelector,\n useMount,\n useLatest,\n shallowEqual,\n} from '@apia/util';\n\nconst trees: Record<string, TreeDataController> = {};\nconst treesRecordEmitter = new (class TreesRecordEmitter extends EventEmitter<{\n addController: { name: string; controller: TreeDataController };\n}> {\n emit<K extends 'addController'>(\n eventName: K,\n params: {\n addController: {\n name: string;\n controller: TreeDataController;\n };\n }[K],\n ): void {\n super.emit(eventName, params);\n\n trees[params.name] = params.controller;\n }\n})();\n\nexport function useTreeDataController<\n TreeType extends TreeDataController<any, any> = TreeDataController<any, any>,\n>(name: string) {\n const [controller, setDataController] = useState<TreeDataController>(\n trees[name],\n );\n\n useEffect(() => {\n if (trees[name] !== controller) setDataController(trees[name]);\n\n return treesRecordEmitter.on('addController', (ev) => {\n if (ev.name === name) setDataController(ev.controller);\n });\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return controller as unknown as TreeType;\n}\n\nexport function getTreeDataController<TreeType = TreeDataController>(\n name: string,\n) {\n return trees[name] as unknown as TreeType;\n}\n\nexport function deleteTreeDataController(name: string) {\n delete trees[name];\n}\n\nclass TreeDataController<\n NodeProps extends Record<string, unknown> = Record<string, unknown>,\n NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>,\n> extends EventEmitter<{\n onArrowUpOnFirstElement: boolean;\n expandNode: NodeType;\n mustFocus: TId;\n stateUpdate: null;\n}> {\n _configuration: RefObject<TTreeDataControllerConfig<NodeProps, NodeType>>;\n\n get configuration() {\n return { ...this._configuration };\n }\n\n hasApendedFirstChild = false;\n\n /**\n * Este array se usa para conocer los padres faltantes al momento de la\n * construcción del árbol, de forma de optimizar el proceso\n */\n missingParents: TId[] = [];\n\n nonEmittedUpdates: TId[] = [];\n\n get state() {\n return this.propsStore.getFieldProps<TTreeDataControllerState>(\n this.stateKey,\n );\n }\n\n stateKey = 'treeState';\n\n get stateStore() {\n return this.propsStore as unknown as PropsStore<TTreeDataControllerState>;\n }\n\n constructor(\n public name: string,\n configuration: RefObject<\n Partial<TTreeDataControllerConfig<NodeProps, NodeType>>\n >,\n public propsStore = new PropsStore<NodeType>({\n logCommands: {\n propsStore: `treeProps_${name}`,\n propsLog: `treeLog_${name}`,\n propsSuscriptors: `propsSuscriptors_${name}`,\n updateProp: `updateProp_${name}`,\n },\n }),\n ) {\n super();\n\n this._configuration = (configuration ?? {\n current: { emitUpdates: true },\n }) as RefObject<Partial<TTreeDataControllerConfig<NodeProps, NodeType>>>;\n\n (this._configuration.current as TTreeDataControllerConfig).emitUpdates =\n (this._configuration.current as TTreeDataControllerConfig).emitUpdates ??\n true;\n\n this.setState(this.getInitialState());\n treesRecordEmitter.emit('addController', {\n name,\n controller: this as unknown as TreeDataController,\n });\n this.initRoot();\n }\n\n destructor() {\n this.propsStore.destructor();\n }\n\n append(\n node: Omit<\n TModify<\n NodeType,\n { children?: NodeType['children']; parentId?: NodeType['parentId'] }\n >,\n 'nodeProps' | 'actualParentId'\n > &\n Partial<Pick<NodeType, 'nodeProps'>>,\n ) {\n const newNode = { ...(node as NodeType), nodeProps: node.nodeProps ?? {} };\n\n // Se busca el padre, si el padre no existe se agrega a la raíz\n let father: TId;\n if (\n newNode.parentId !== undefined &&\n this.propsStore.getFieldProps(newNode.parentId)?.children\n ) {\n father = newNode.parentId;\n } else {\n father = 'root';\n if (newNode.parentId) this.missingParents.push(newNode.parentId);\n newNode.actualParentId = newNode.parentId;\n newNode.parentId = 'root';\n }\n\n this.propsStore.updateField(\n newNode.id,\n {\n ...newNode,\n children: newNode.children ?? [],\n },\n { isUrgent: true },\n );\n this.setState({ length: this.state.length + 1 });\n\n // Se buscan elementos que estén en la raíz y sean hijos del nodo que se\n // está agregando. De esta forma al crear el árbol nos aseguramos que ningún\n // nodo quede afuera y evitamos iteraciones innecesarias\n if (this.missingParents.includes(newNode.id)) {\n this.propsStore.getFieldProps('root').children.forEach((currentChild) => {\n if (\n this.propsStore.getFieldProps(currentChild).actualParentId ===\n newNode.id\n ) {\n this.move(currentChild, newNode.id);\n }\n });\n this.missingParents = this.missingParents.filter(\n (current) => current !== newNode.id,\n );\n }\n\n // Se agrega el nodo a los hijos del padre\n this.propsStore.updateField(\n father,\n {\n children: [\n ...this.propsStore.getFieldProps(father).children,\n newNode.id,\n ],\n hasLoaded: true,\n },\n { noEmit: this._configuration.current?.emitUpdates === false },\n );\n\n if (this._configuration.current?.emitUpdates === false)\n this.nonEmittedUpdates.push(father);\n\n if (!this.hasApendedFirstChild) {\n this.hasApendedFirstChild = true;\n this.setFocusedNode(newNode.id, true);\n }\n\n if (newNode.isExpanded) this.toggleNodeExpandedState(newNode.id, true);\n }\n\n /**\n * Cuando se quieren agregar muchos nodos, es conveniente llamar primero al\n * método batchInit y luego de finalizar, al método batchFinish()\n */\n batchInit() {\n this.config({ emitUpdates: false });\n this.setState({ isLoading: true }, { isUrgent: true });\n }\n\n private getNodesRecursive(nodeId: TId = 'root'): TId[] {\n const node = this.propsStore.getFieldProps(nodeId);\n\n return node.children.reduce<TId[]>(\n (prev, current) => [...prev, ...this.getNodesRecursive(current)],\n [...node.children],\n );\n }\n\n /**\n * Cuando se quieren agregar muchos nodos, es conveniente llamar primero al\n * método batchInit y luego de finalizar, al método batchFinish()\n */\n batchFinish() {\n this.config({ emitUpdates: true });\n setTimeout(() => this.setState({ isLoading: false }), 0);\n\n const children = [...this.getNodesRecursive()];\n\n const deleteNodes = this.previousNodes.filter(\n (current) => !children.find((search) => search === current),\n );\n deleteNodes.forEach((current) => this.remove(current));\n\n this.config({ emitUpdates: true });\n setTimeout(() => this.setState({ isLoading: false }), 0);\n }\n\n config(newConf: Partial<TTreeDataControllerConfig<NodeProps, NodeType>>) {\n if (\n this._configuration.current?.emitUpdates === false &&\n newConf.emitUpdates !== false\n ) {\n this.nonEmittedUpdates.forEach((current) =>\n this.propsStore.updateField(current, {\n children: [...this.propsStore.getFieldProps(current).children],\n }),\n );\n this.nonEmittedUpdates = [];\n }\n Object.assign(\n this._configuration.current as TTreeDataControllerConfig,\n newConf,\n );\n }\n\n deselectAll() {\n this.state.selectedNodes.forEach((currentId) =>\n this.propsStore.updateField(currentId, { isSelected: false }),\n );\n this.setState({ selectedNodes: [] });\n }\n\n forceEmitUpdate() {\n this.propsStore.updateField<{ forceUpdate: number }>('root', {\n forceUpdate:\n (this.propsStore.getFieldProps<{ forceUpdate: number }>('root')\n .forceUpdate ?? 0) + 1,\n });\n }\n\n getInitialState(): TTreeDataControllerState {\n return {\n expandedNodes: [],\n filteredNodes: [],\n focusedNode: null,\n isLoading: false,\n length: 0,\n selectedNodes: [],\n };\n }\n\n getNodesAsArray() {\n const allFields = { ...this.propsStore.fields };\n delete allFields[this.stateKey];\n delete allFields.root;\n return Object.values(allFields);\n }\n\n /**\n * Devuelve un array que contiene el id de todos los nodos pertenecientes al\n * árbol\n */\n getNodesIds() {\n const allFields = { ...this.propsStore.fields };\n delete allFields[this.stateKey];\n delete allFields.root;\n return Object.keys(allFields);\n }\n\n getParentId(parentId: TId) {\n return this.propsStore.getFieldProps(parentId).parentId;\n }\n\n /**\n * Este método permite controlar el comportamiento con el teclado desde fuera\n * del componente.\n */\n handleKey(ev: React.KeyboardEvent) {\n const focusedId = this.state.focusedNode as TId;\n const nodeProps = this.propsStore.getFieldProps(focusedId);\n if (ev.key === '*') {\n if (this.state.focusedNode === null) return;\n const parent = this.propsStore.getFieldProps(\n this.propsStore.getFieldProps(this.state.focusedNode).parentId,\n );\n parent.children.forEach((current) =>\n this.toggleNodeExpandedState(current, true),\n );\n } else if (ev.key.match(/^\\w$/)) {\n const nextChildWithKey = getNextNodeWithKey(\n this,\n focusedId,\n ev.key,\n true,\n );\n if (nextChildWithKey !== null) {\n this.setFocusedNode(nextChildWithKey);\n this.emit('mustFocus', nextChildWithKey);\n }\n } else\n switch (ev.code) {\n case 'Home': {\n const firstChild = getFirstNonFilteredChild(this, 'root');\n if (firstChild === null) return;\n if (ev.shiftKey && ev.ctrlKey && this.state.focusedNode !== null) {\n selectAllNodesBetweenTwoNodes(\n this,\n firstChild,\n this.state.focusedNode,\n true,\n );\n }\n this.setFocusedNode(firstChild);\n this.emit('mustFocus', firstChild);\n break;\n }\n case 'End': {\n const lastVisibleChild = getLastVisibleChild(this, 'root', true);\n if (lastVisibleChild !== null) {\n if (ev.shiftKey && ev.ctrlKey && this.state.focusedNode !== null) {\n selectAllNodesBetweenTwoNodes(\n this,\n lastVisibleChild,\n this.state.focusedNode,\n true,\n );\n }\n this.setFocusedNode(lastVisibleChild);\n this.emit('mustFocus', lastVisibleChild);\n }\n break;\n }\n case 'ArrowRight': {\n if (nodeProps.isLeaf) return;\n ev.preventDefault();\n if (nodeProps.isExpanded) {\n const firstChild = getFirstNonFilteredChild(this, nodeProps.id);\n if (firstChild !== null) {\n this.setFocusedNode(firstChild);\n this.emit('mustFocus', firstChild);\n }\n } else this.toggleNodeExpandedState(nodeProps.id, true);\n break;\n }\n case 'ArrowLeft': {\n ev.preventDefault();\n if (nodeProps.isLeaf || !nodeProps.isExpanded) {\n if (\n nodeProps.parentId !== 'root' &&\n nodeProps.parentId !== undefined\n ) {\n this.setFocusedNode(nodeProps.parentId);\n this.emit('mustFocus', nodeProps.parentId);\n }\n } else this.toggleNodeExpandedState(nodeProps.id, false);\n break;\n }\n case 'ArrowUp': {\n ev.preventDefault();\n const prevChild = getPreviousChild(this, nodeProps.id, true);\n if (prevChild !== null) {\n if (ev.shiftKey) this.toggleNodeSelectedState(prevChild, true);\n this.setFocusedNode(prevChild);\n this.emit('mustFocus', prevChild);\n } else this.emit('onArrowUpOnFirstElement', true);\n break;\n }\n case 'ArrowDown': {\n ev.preventDefault();\n const nextChild = getNextChild(this, nodeProps.id, false, true);\n if (nextChild !== null) {\n if (ev.shiftKey) this.toggleNodeSelectedState(nextChild, true);\n this.setFocusedNode(nextChild);\n this.emit('mustFocus', nextChild);\n }\n break;\n }\n case 'Space': {\n if (this._configuration.current?.disableSelection) return;\n ev.preventDefault();\n this.toggleNodeSelectedState(nodeProps.id);\n break;\n }\n default:\n break;\n }\n }\n\n isNode(\n node: NodeType | TDataNodeContainer<NodeProps> | TId,\n ): node is NodeType {\n return typeof node === 'object' && 'parentId' in node;\n }\n\n isNodeContainer(\n node: NodeType | TDataNodeContainer<NodeProps> | TId,\n ): node is TDataNodeContainer<NodeProps> {\n return typeof node === 'object' && !this.isNode(node);\n }\n\n includes(searchNode: NodeType) {\n return !!this.propsStore.getFieldProps(searchNode.id);\n }\n\n initRoot() {\n this.propsStore.updateField(\n 'root',\n { children: [], id: 'root' },\n { isUrgent: true },\n );\n }\n\n move(\n moveNode: TId,\n destinationNode: TId,\n afterOrBefore?: TRequireOnlyOne<{\n after: NodeType | TId;\n before: NodeType | TId;\n position: number;\n }>,\n ) {\n const currentFather = this.propsStore.getFieldProps(\n this.propsStore.getFieldProps(moveNode).parentId,\n );\n const newFather = this.propsStore.getFieldProps(destinationNode);\n\n if (!currentFather) {\n console.warn('The current node does not belong to the tree.', moveNode);\n return;\n }\n\n if (!newFather) {\n console.warn(\n 'The destination node does not belong to the tree. No action will be made',\n destinationNode,\n );\n return;\n }\n\n currentFather.children = currentFather.children?.filter(\n (search) => search !== moveNode,\n );\n if (!newFather.children) newFather.children = [];\n if (!afterOrBefore) newFather.children.push(moveNode);\n else if (afterOrBefore.position) {\n newFather.children.splice(afterOrBefore.position - 1, 0, moveNode);\n } else {\n const key = afterOrBefore.after\n ? afterOrBefore.after\n : afterOrBefore.before;\n\n const relatedNodeKey = key && this.isNode(key) ? key.id : key;\n const relatedNodeIndex = newFather.children.findIndex(\n (search) => search === relatedNodeKey,\n );\n\n const actualIndex = addBoundary(\n afterOrBefore.before !== undefined\n ? relatedNodeIndex\n : relatedNodeIndex + 1,\n 0,\n );\n\n if (actualIndex === -1 || actualIndex === newFather.children.length)\n newFather.children.push(moveNode);\n else newFather.children.splice(actualIndex, 0, moveNode);\n }\n\n this.propsStore.updateField(currentFather.id, {\n children: [...(currentFather.children ?? [])],\n });\n this.propsStore.updateField(newFather.id, {\n children: [...newFather.children],\n });\n this.propsStore.updateField(moveNode, {\n parentId: newFather.id,\n });\n }\n\n /**\n * Borra el nodo del árbol, y dependiendo del parámetro removeChildren, borra\n * también sus hijos.\n *\n * @param removeChildren - Si se pasa en false, los nodos hijos son movidos al root\n */\n remove(removeNode: NodeType | TId, removeChildren = true) {\n const removeNodeId = this.isNode(removeNode) ? removeNode.id : removeNode;\n\n const removingNode = this.propsStore.getFieldProps(removeNodeId);\n if (!removingNode) return;\n\n const father = this.propsStore.getFieldProps(removingNode.parentId);\n if (father) {\n this.propsStore.updateField(father.id, {\n children: father.children?.filter((search) => search !== removeNodeId),\n });\n }\n\n removingNode.children?.forEach((current) => {\n if (removeChildren) {\n this.remove(current);\n } else {\n this.move(current, 'root');\n }\n });\n\n this.setState({\n selectedNodes: this.state.selectedNodes.filter(\n (current) => current !== removeNodeId,\n ),\n focusedNode:\n this.state.focusedNode === removeNodeId ? null : this.state.focusedNode,\n length: this.state.length - 1,\n });\n this.propsStore.removeField(removeNodeId);\n }\n\n removeMultiple(nodes: TId[], removeChildren = true) {\n nodes.forEach((current) => this.remove(current, removeChildren));\n }\n\n previousNodes: TId[] = [];\n /**\n * Borra todos los nodos del árbol.\n */\n removeAll() {\n if (this.configuration.current?.emitUpdates === false) {\n this.previousNodes = this.getNodesIds();\n this.propsStore.updateField(\n 'root',\n { children: [], id: 'root' },\n { isUrgent: true, noEmit: true },\n );\n /* this.previousNodes.forEach((current) =>\n this.propsStore.removeField(current),\n ); */\n } else {\n this.hasApendedFirstChild = false;\n this.setState({ focusedNode: null }, { isUrgent: true });\n this.setSelectedNodes([]);\n this.initRoot();\n Object.keys(this.propsStore.fields).forEach((current) => {\n if (!['root', this.stateKey].includes(current))\n this.propsStore.removeField(current);\n });\n }\n }\n\n selectAll() {\n this.setState({\n selectedNodes: this.getNodesIds(),\n });\n this.state.selectedNodes.forEach((currentId) =>\n this.propsStore.updateField(currentId, { isSelected: true }),\n );\n }\n\n setExpandedNodes(nodes: TId[]) {\n this.state.expandedNodes.forEach((current) =>\n this.propsStore.updateField(current, { isExpanded: false }),\n );\n\n this.setState({ expandedNodes: nodes });\n nodes.forEach((current) =>\n this.propsStore.updateField(current, { isExpanded: true }),\n );\n }\n\n setFocusedNode(key: TId, avoidSelection?: boolean) {\n if (this.state.focusedNode !== null)\n this.propsStore.updateField(this.state.focusedNode, { isFocused: false });\n this.setState({\n focusedNode: key,\n });\n if (\n !this._configuration.current?.isMultiple &&\n !avoidSelection &&\n (this._configuration.current?.selectionMode ?? 'onFocus') === 'onFocus'\n )\n this.setSelectedNodes([key]);\n this.propsStore.updateField(key, { isFocused: true });\n }\n\n setSelectedNodes(nodes: TId[], force = false) {\n if (this._configuration.current?.disableSelection && !force) return;\n this.state.selectedNodes.forEach((current) =>\n this.propsStore.updateField(current, { isSelected: false }),\n );\n this.setState({\n selectedNodes: nodes.filter((current) => {\n const { isSelectable } = this.propsStore.getFieldProps(current);\n if (isSelectable !== false)\n this.propsStore.updateField(current, { isSelected: true });\n return isSelectable !== false;\n }),\n });\n }\n\n setSelectedNodesByClickEvent(ev: React.MouseEvent) {\n if (this._configuration.current?.disableSelection) return;\n const nodeKey = getSpecificParent(\n ev.target as HTMLElement,\n (current) => current.getAttribute('role') === 'treeitem',\n )?.getAttribute('data-key');\n if (nodeKey) {\n const nodeProps = this.propsStore.getFieldProps(nodeKey);\n if (nodeProps.isDisabled || nodeProps.isSelectable === false) return;\n\n const previousSelectionKeys = [...this.state.selectedNodes];\n const allowMultiple =\n this._configuration.current?.isMultiple &&\n (this._configuration.current?.selectionMode !== 'explicitMultiple' ||\n ev.ctrlKey ||\n ev.shiftKey);\n\n // eslint-disable-next-line no-nested-ternary\n const newSelection: TId[] = allowMultiple\n ? nodeProps.isSelected\n ? previousSelectionKeys.filter((current) => current !== nodeKey)\n : [...previousSelectionKeys, nodeKey]\n : [nodeKey];\n\n this.setSelectedNodes(newSelection);\n } else console.warn('Cannot set selection, no treeitem found', ev);\n }\n\n setState = (\n updateProps: Partial<TTreeDataControllerState>,\n conf?: TUpdateFieldConfiguration,\n ) => {\n this.propsStore.updateField<TTreeDataControllerState>(\n this.stateKey,\n {\n ...this.state,\n ...updateProps,\n },\n conf,\n );\n this.emit('stateUpdate', null);\n };\n\n useState = <T>(selector: (state: TTreeDataControllerState) => T) => {\n const [selectedState, setSelectedState] = useState(selector(this.state));\n const latestState = useLatest(selectedState);\n\n useMount(() => {\n return this.on('stateUpdate', () => {\n const newSelection = selector(this.state);\n\n if (!shallowEqual(newSelection, latestState.current)) {\n setSelectedState(newSelection);\n }\n });\n });\n\n return selectedState;\n };\n\n toggleNodeExpandedState(key: TId, shouldExpand?: boolean) {\n const nodeProps = this.propsStore.getFieldProps(key);\n if (nodeProps.isDisabled || nodeProps.isLeaf || nodeProps.isLoading) return;\n\n if (this._configuration.current?.onLoadData && !nodeProps.hasLoaded) {\n this.propsStore.updateField(key, { isLoading: true });\n this._configuration.current?.onLoadData(nodeProps).finally(() => {\n this.propsStore.updateField(key, {\n isLoading: false,\n isExpanded: true,\n hasLoaded: true,\n });\n\n this.setState({\n expandedNodes: [...this.state.expandedNodes, key],\n });\n this._configuration.current?.onExpand?.(\n this.propsStore.getFieldProps(key),\n );\n });\n } else {\n const { expandedNodes } = this.state;\n const shouldExpandInner =\n shouldExpand !== undefined\n ? shouldExpand\n : !expandedNodes.includes(key);\n if (this.propsStore.getFieldProps(key)?.isDisabled) return;\n\n this.setState({\n expandedNodes: shouldExpandInner\n ? [...expandedNodes, key]\n : expandedNodes.filter((current) => current !== key),\n });\n this.propsStore.updateField(key, { isExpanded: shouldExpandInner });\n this._configuration.current?.onExpand?.(\n this.propsStore.getFieldProps(key),\n );\n }\n }\n\n toggleNodeSelectedState(key: TId, isSelected?: boolean) {\n if (this._configuration.current?.disableSelection) return;\n const nodeProps = this.propsStore.getFieldProps(key);\n if (nodeProps.isDisabled || nodeProps.isSelectable === false) return;\n\n const shouldSelect =\n isSelected !== undefined\n ? isSelected\n : !this.state.selectedNodes.includes(key);\n\n if (\n (shouldSelect && nodeProps.isSelected) ||\n (isSelected === false && !nodeProps.isSelected)\n )\n return;\n\n if (\n shouldSelect &&\n !this._configuration.current?.isMultiple &&\n this.state.selectedNodes[0]\n )\n this.toggleNodeSelectedState(this.state.selectedNodes[0], false);\n this.propsStore.updateField(key, { isSelected: shouldSelect });\n this.setState({\n selectedNodes: shouldSelect\n ? [...this.state.selectedNodes, key]\n : this.state.selectedNodes.filter((current) => current !== key),\n });\n }\n}\n\n/**\n * Este hook permite escuchar las props de un árbol, para ello es necesario\n * pasar el handler.\n *\n * @param handler\n * @param configuration\n * @returns\n */\nexport function useTreeSelector<\n NodeProps extends Record<string, unknown> = Record<string, unknown>,\n NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>,\n Selected = Record<string, unknown>,\n PropsType extends Record<string, unknown> = TTreeDataControllerState,\n>(\n handler: TreeDataController<NodeProps, NodeType>,\n configuration?: TPropsConfiguration<Selected, PropsType>,\n): Selected {\n return usePropsSelector<Selected, PropsType>(\n handler?.stateKey ?? '__NO__TREE__KEY__',\n {\n propsStore: handler?.propsStore as unknown as PropsStore<PropsType>,\n ...configuration,\n },\n );\n}\n\n/**\n * Este hook permite escuchar las props de un árbol, para ello es necesario\n * pasar el handler.\n *\n * @param handler\n * @param configuration\n * @returns\n */\nexport function useTreeSelectorByName<\n NodeProps extends Record<string, unknown> = Record<string, unknown>,\n NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>,\n Selected = Record<string, unknown>,\n PropsType extends Record<string, unknown> = TTreeDataControllerState,\n>(\n treeName: string,\n configuration?: TPropsConfiguration<Selected, PropsType>,\n): {\n handler: TreeDataController<NodeProps, NodeType>;\n selection: Selected;\n} {\n const handler =\n useTreeDataController<TreeDataController<NodeProps, NodeType>>(treeName);\n const selection = usePropsSelector<Selected, PropsType>(\n handler?.stateKey ?? '__NO__TREE__KEY__',\n {\n propsStore: handler?.propsStore as unknown as PropsStore<PropsType>,\n ...configuration,\n },\n );\n return { selection, handler };\n}\n\nexport default TreeDataController;\n"],"names":[],"mappings":";;;;;;;;;;AAkCA,MAAM,QAA4C,EAAC,CAAA;AACnD,MAAM,kBAAqB,GAAA,IAAK,MAAM,kBAAA,SAA2B,YAE9D,CAAA;AAAA,EACD,IAAA,CACE,WACA,MAMM,EAAA;AACN,IAAM,KAAA,CAAA,IAAA,CAAK,WAAW,MAAM,CAAA,CAAA;AAE5B,IAAM,KAAA,CAAA,MAAA,CAAO,IAAI,CAAA,GAAI,MAAO,CAAA,UAAA,CAAA;AAAA,GAC9B;AACF,CAAG,EAAA,CAAA;AAEI,SAAS,sBAEd,IAAc,EAAA;AACd,EAAM,MAAA,CAAC,UAAY,EA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EAAO,OAAA,gBAAA;AAAA,IACL,SAAS,QAAY,IAAA,mBAAA;AAAA,IACrB;AAAA,MACE,YAAY,OAAS,EAAA,UAAA;AAAA,MACrB,GAAG,aAAA;AAAA,KACL;AAAA,GACF,CAAA;AACF,CAAA;AAUgB,SAAA,qBAAA,CAMd,UACA,aAIA,EAAA;AACA,EAAM,MAAA,OAAA,GACJ,sBAA+D,QAAQ,CAAA,CAAA;AACzE,EAAA,MAAM,SAAY,GAAA,gBAAA;AAAA,IAChB,SAAS,QAAY,IAAA,mBAAA;AAAA,IACrB;AAAA,MACE,YAAY,OAAS,EAAA,UAAA;AAAA,MACrB,GAAG,aAAA;AAAA,KACL;AAAA,GACF,CAAA;AACA,EAAO,OAAA,EAAE,WAAW,OAAQ,EAAA,CAAA;AAC9B,CAAA;AAEA,2BAAe,kBAAA;;;;"}
|
package/dist/TreeItem.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment, jsxs } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { shallowEqual } from 'react-redux';
|
|
4
|
-
import { Box } from '@apia/theme';
|
|
5
|
-
import { getDomProps } from './getDomProps.js';
|
|
6
|
-
import { useTreeContext } from './TreeContext.js';
|
|
7
|
-
import TreeItemChildren from './TreeItemChildren.js';
|
|
8
|
-
import TreeItemLabel from './TreeItemLabel.js';
|
|
9
|
-
import { usePropsSelector } from '@apia/util';
|
|
10
|
-
|
|
11
|
-
const TreeItem = ({ level, treeKey }) => {
|
|
12
|
-
const { handler, name, forceUpdate, treeProps } = useTreeContext();
|
|
13
|
-
const props = usePropsSelector(treeKey, {
|
|
14
|
-
selector: (current) => current,
|
|
15
|
-
comparator: (prevProps, newProps) => {
|
|
16
|
-
return shallowEqual(prevProps, newProps) && shallowEqual(prevProps?.children, newProps?.children);
|
|
17
|
-
},
|
|
18
|
-
propsStore: handler.propsStore
|
|
19
|
-
});
|
|
20
|
-
const nodes = React.useMemo(
|
|
21
|
-
() => props.children?.map(
|
|
22
|
-
(current) => handler.propsStore.getFieldProps(current)
|
|
23
|
-
) ?? [],
|
|
24
|
-
[props.children, handler.propsStore]
|
|
25
|
-
);
|
|
26
|
-
const domProps = getDomProps(treeProps, name, "node", props);
|
|
27
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(
|
|
28
|
-
Box,
|
|
29
|
-
{
|
|
30
|
-
as: "li",
|
|
31
|
-
...domProps,
|
|
32
|
-
className: `${domProps.className ?? ""} tree__item`,
|
|
33
|
-
children: [
|
|
34
|
-
/* @__PURE__ */ jsx(TreeItemLabel, { level, treeKey }),
|
|
35
|
-
props.isExpanded && /* @__PURE__ */ jsx(
|
|
36
|
-
TreeItemChildren,
|
|
37
|
-
{
|
|
38
|
-
forceUpdate,
|
|
39
|
-
role: "group",
|
|
40
|
-
level,
|
|
41
|
-
nodes
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
) });
|
|
47
|
-
};
|
|
48
|
-
var TreeItem$1 = React.memo(TreeItem);
|
|
49
|
-
|
|
50
|
-
export { TreeItem$1 as default };
|
|
51
|
-
//# sourceMappingURL=TreeItem.js.map
|
package/dist/TreeItem.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeItem.js","sources":["../src/TreeItem.tsx"],"sourcesContent":["import React from 'react';\nimport { shallowEqual } from 'react-redux';\nimport { Box } from '@apia/theme';\nimport { getDomProps } from './getDomProps';\nimport { useTreeContext } from './TreeContext';\nimport TreeItemChildren from './TreeItemChildren';\nimport TreeItemLabel from './TreeItemLabel';\nimport { TDataNode, TId } from './types';\nimport { usePropsSelector } from '@apia/util';\n\nconst TreeItem = ({ level, treeKey }: { level: number; treeKey: TId }) => {\n const { handler, name, forceUpdate, treeProps } = useTreeContext();\n\n const props = usePropsSelector<TDataNode, TDataNode>(treeKey, {\n selector: (current) => current,\n comparator: (prevProps, newProps) => {\n return (\n shallowEqual(prevProps, newProps) &&\n shallowEqual(prevProps?.children, newProps?.children)\n );\n },\n propsStore: handler.propsStore,\n });\n\n const nodes = React.useMemo(\n () =>\n props.children?.map((current) =>\n handler.propsStore.getFieldProps(current),\n ) ?? [],\n [props.children, handler.propsStore],\n );\n\n const domProps = getDomProps(treeProps, name, 'node', props);\n\n return (\n <>\n <Box\n as=\"li\"\n {...domProps}\n className={`${domProps.className ?? ''} tree__item`}\n >\n <TreeItemLabel level={level} treeKey={treeKey} />\n {props.isExpanded && (\n <TreeItemChildren\n forceUpdate={forceUpdate}\n role=\"group\"\n level={level}\n nodes={nodes}\n />\n )}\n </Box>\n </>\n );\n};\n\nexport default React.memo(TreeItem);\n"],"names":[],"mappings":";;;;;;;;;;AAUA,MAAM,QAAW,GAAA,CAAC,EAAE,KAAA,EAAO,SAA+C,KAAA;AACxE,EAAA,MAAM,EAAE,OAAS,EAAA,IAAA,EAAM,WAAa,EAAA,SAAA,KAAc,cAAe,EAAA,CAAA;AAEjE,EAAM,MAAA,KAAA,GAAQ,iBAAuC,OAAS,EAAA;AAAA,IAC5D,QAAA,EAAU,CAAC,OAAY,KAAA,OAAA;AAAA,IACvB,UAAA,EAAY,CAAC,SAAA,EAAW,QAAa,KAAA;AACnC,MACE,OAAA,YAAA,CAAa,WAAW,QAAQ,CAAA,IAChC,aAAa,SAAW,EAAA,QAAA,EAAU,UAAU,QAAQ,CAAA,CAAA;AAAA,KAExD;AAAA,IACA,YAAY,OAAQ,CAAA,UAAA;AAAA,GACrB,CAAA,CAAA;AAED,EAAA,MAAM,QAAQ,KAAM,CAAA,OAAA;AAAA,IAClB,MACE,MAAM,QAAU,EAAA,GAAA;AAAA,MAAI,CAAC,OAAA,KACnB,OAAQ,CAAA,UAAA,CAAW,cAAc,OAAO,CAAA;AAAA,SACrC,EAAC;AAAA,IACR,CAAC,KAAA,CAAM,QAAU,EAAA,OAAA,CAAQ,UAAU,CAAA;AAAA,GACrC,CAAA;AAEA,EAAA,MAAM,QAAW,GAAA,WAAA,CAAY,SAAW,EAAA,IAAA,EAAM,QAAQ,KAAK,CAAA,CAAA;AAE3D,EAAA,uBAEI,GAAA,CAAA,QAAA,EAAA,EAAA,QAAA,kBAAA,IAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,EAAG,EAAA,IAAA;AAAA,MACF,GAAG,QAAA;AAAA,MACJ,SAAW,EAAA,CAAA,EAAG,QAAS,CAAA,SAAA,IAAa,EAAE,CAAA,WAAA,CAAA;AAAA,MAEtC,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,aAAA,EAAA,EAAc,OAAc,OAAkB,EAAA,CAAA;AAAA,QAC9C,MAAM,UACL,oBAAA,GAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,WAAA;AAAA,YACA,IAAK,EAAA,OAAA;AAAA,YACL,KAAA;AAAA,YACA,KAAA;AAAA,WAAA;AAAA,SACF;AAAA,OAAA;AAAA,KAAA;AAAA,GAGN,EAAA,CAAA,CAAA;AAEJ,CAAA,CAAA;AAEA,iBAAe,KAAA,CAAM,KAAK,QAAQ,CAAA;;;;"}
|
package/dist/TreeItemChildren.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { Box } from '@apia/theme';
|
|
4
|
-
import { useTreeContext } from './TreeContext.js';
|
|
5
|
-
import TreeItem from './TreeItem.js';
|
|
6
|
-
|
|
7
|
-
const TreeItemChildren = React.forwardRef(({ level, nodes, forceUpdate, ...props }, ref) => {
|
|
8
|
-
const { handler } = useTreeContext();
|
|
9
|
-
return /* @__PURE__ */ jsx(Box, { ref, as: "ul", ...props, children: nodes?.map((current) => {
|
|
10
|
-
const currentProps = handler.propsStore.getFieldProps(current.id);
|
|
11
|
-
if (!currentProps)
|
|
12
|
-
return null;
|
|
13
|
-
return currentProps.isFiltered ? null : /* @__PURE__ */ jsx(TreeItem, { level: level + 1, treeKey: current.id }, current.id);
|
|
14
|
-
}) });
|
|
15
|
-
});
|
|
16
|
-
TreeItemChildren.displayName = "TreeItemChildren";
|
|
17
|
-
var TreeItemChildren$1 = React.memo(TreeItemChildren);
|
|
18
|
-
|
|
19
|
-
export { TreeItemChildren$1 as default };
|
|
20
|
-
//# sourceMappingURL=TreeItemChildren.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeItemChildren.js","sources":["../src/TreeItemChildren.tsx"],"sourcesContent":["import React from 'react';\nimport { Box, BoxProps } from '@apia/theme';\nimport { useTreeContext } from './TreeContext';\nimport TreeItem from './TreeItem';\nimport { TDataNode } from './types';\n\nconst TreeItemChildren = React.forwardRef<\n HTMLDivElement,\n {\n forceUpdate: number;\n level: number;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n nodes: TDataNode<any>[];\n } & BoxProps\n>(({ level, nodes, forceUpdate, ...props }, ref) => {\n const { handler } = useTreeContext();\n\n return (\n <Box ref={ref} as=\"ul\" {...props}>\n {nodes?.map((current) => {\n const currentProps = handler.propsStore.getFieldProps(current.id);\n if (!currentProps) return null;\n\n return currentProps.isFiltered ? null : (\n <TreeItem level={level + 1} key={current.id} treeKey={current.id} />\n );\n })}\n </Box>\n );\n});\n\nTreeItemChildren.displayName = 'TreeItemChildren';\n\nexport default React.memo(TreeItemChildren);\n"],"names":[],"mappings":";;;;;;AAMA,MAAM,gBAAA,GAAmB,KAAM,CAAA,UAAA,CAQ7B,CAAC,EAAE,KAAO,EAAA,KAAA,EAAO,WAAa,EAAA,GAAG,KAAM,EAAA,EAAG,GAAQ,KAAA;AAClD,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,cAAe,EAAA,CAAA;AAEnC,EACE,uBAAA,GAAA,CAAC,GAAI,EAAA,EAAA,GAAA,EAAU,EAAG,EAAA,IAAA,EAAM,GAAG,KACxB,EAAA,QAAA,EAAA,KAAA,EAAO,GAAI,CAAA,CAAC,OAAY,KAAA;AACvB,IAAA,MAAM,YAAe,GAAA,OAAA,CAAQ,UAAW,CAAA,aAAA,CAAc,QAAQ,EAAE,CAAA,CAAA;AAChE,IAAA,IAAI,CAAC,YAAA;AAAc,MAAO,OAAA,IAAA,CAAA;AAE1B,IAAA,OAAO,YAAa,CAAA,UAAA,GAAa,IAC/B,mBAAA,GAAA,CAAC,QAAS,EAAA,EAAA,KAAA,EAAO,KAAQ,GAAA,CAAA,EAAoB,OAAS,EAAA,OAAA,CAAQ,EAA7B,EAAA,EAAA,OAAA,CAAQ,EAAyB,CAAA,CAAA;AAAA,GAErE,CACH,EAAA,CAAA,CAAA;AAEJ,CAAC,CAAA,CAAA;AAED,gBAAA,CAAiB,WAAc,GAAA,kBAAA,CAAA;AAE/B,yBAAe,KAAA,CAAM,KAAK,gBAAgB,CAAA;;;;"}
|
package/dist/TreeItemLabel.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { jsxs, jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import { shallowEqual } from 'react-redux';
|
|
4
|
-
import { Box, Spinner } from '@apia/theme';
|
|
5
|
-
import DefaultIconRenderer from './renderers/DefaultIconRenderer.js';
|
|
6
|
-
import DefaultLabelRenderer from './renderers/DefaultLabelRenderer.js';
|
|
7
|
-
import Spacer from './renderers/Spacer.js';
|
|
8
|
-
import { useTreeContext } from './TreeContext.js';
|
|
9
|
-
import { usePropsSelector } from '@apia/util';
|
|
10
|
-
import { Icon } from '@apia/icons';
|
|
11
|
-
|
|
12
|
-
const TreeItemLabel = ({ level, treeKey }) => {
|
|
13
|
-
const {
|
|
14
|
-
handler,
|
|
15
|
-
treeProps: { toggleNodesOnLabelClick }
|
|
16
|
-
} = useTreeContext();
|
|
17
|
-
const props = usePropsSelector(treeKey, {
|
|
18
|
-
selector: (current) => current,
|
|
19
|
-
comparator: (prevProps, newProps) => {
|
|
20
|
-
return shallowEqual(prevProps, newProps) && shallowEqual(prevProps?.children, newProps?.children);
|
|
21
|
-
},
|
|
22
|
-
propsStore: handler.propsStore
|
|
23
|
-
});
|
|
24
|
-
const Renderer = React.useMemo(
|
|
25
|
-
() => props.labelRenderer ?? DefaultLabelRenderer,
|
|
26
|
-
[props.labelRenderer]
|
|
27
|
-
);
|
|
28
|
-
const handleToggle = React.useCallback(() => {
|
|
29
|
-
handler.toggleNodeExpandedState(treeKey);
|
|
30
|
-
}, [handler, treeKey]);
|
|
31
|
-
const IconRenderer = React.useMemo(() => {
|
|
32
|
-
return typeof props.icon === "string" ? DefaultIconRenderer : props.icon;
|
|
33
|
-
}, [props.icon]);
|
|
34
|
-
const onClick = React.useCallback(() => {
|
|
35
|
-
if (props.allowToggleExpandedFromLabel !== false)
|
|
36
|
-
handler.toggleNodeExpandedState(treeKey);
|
|
37
|
-
}, [handler, props.allowToggleExpandedFromLabel, treeKey]);
|
|
38
|
-
return /* @__PURE__ */ jsxs(
|
|
39
|
-
Box,
|
|
40
|
-
{
|
|
41
|
-
as: "span",
|
|
42
|
-
className: `tree__nodeItemLabel ${props.isFocused ? "focus" : ""}`,
|
|
43
|
-
children: [
|
|
44
|
-
/* @__PURE__ */ jsx(Spacer, { level }),
|
|
45
|
-
(props.isLoading || props.isExpanded && props.isLeaf !== true || props.isLeaf === false || (props.children?.length ?? 0) > 0 || props.isLeaf === void 0 && !props.hasLoaded && handler.configuration.current?.onLoadData) && /* @__PURE__ */ jsx(Box, { className: "tree__expanderWrapper", children: props.isLoading ? /* @__PURE__ */ jsx(Spinner, { sx: { width: "iconSm", height: "iconSm" } }) : /* @__PURE__ */ jsx(
|
|
46
|
-
Icon,
|
|
47
|
-
{
|
|
48
|
-
className: "tree__expandIcon",
|
|
49
|
-
onClick: handleToggle,
|
|
50
|
-
name: props.isExpanded ? "ArrowDownThin" : "ArrowRightThin",
|
|
51
|
-
title: "",
|
|
52
|
-
size: 20
|
|
53
|
-
}
|
|
54
|
-
) }),
|
|
55
|
-
props.icon && IconRenderer && /* @__PURE__ */ jsx(IconRenderer, { ...props }),
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
Box,
|
|
58
|
-
{
|
|
59
|
-
as: "span",
|
|
60
|
-
className: "tree__nodeItemLabelRenderer",
|
|
61
|
-
onClick: toggleNodesOnLabelClick !== false ? onClick : void 0,
|
|
62
|
-
children: /* @__PURE__ */ jsx(Renderer, { ...props, level })
|
|
63
|
-
}
|
|
64
|
-
)
|
|
65
|
-
]
|
|
66
|
-
}
|
|
67
|
-
);
|
|
68
|
-
};
|
|
69
|
-
var TreeItemLabel$1 = React.memo(TreeItemLabel);
|
|
70
|
-
|
|
71
|
-
export { TreeItemLabel$1 as default };
|
|
72
|
-
//# sourceMappingURL=TreeItemLabel.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeItemLabel.js","sources":["../src/TreeItemLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { shallowEqual } from 'react-redux';\nimport { Box, Spinner } from '@apia/theme';\nimport DefaultIconRenderer from './renderers/DefaultIconRenderer';\nimport DefaultLabelRenderer from './renderers/DefaultLabelRenderer';\nimport Spacer from './renderers/Spacer';\nimport { useTreeContext } from './TreeContext';\nimport { TDataNode, TId } from './types';\nimport { usePropsSelector } from '@apia/util';\nimport { Icon } from '@apia/icons';\n\nconst TreeItemLabel = ({ level, treeKey }: { level: number; treeKey: TId }) => {\n const {\n handler,\n treeProps: { toggleNodesOnLabelClick },\n } = useTreeContext();\n\n const props = usePropsSelector<TDataNode, TDataNode>(treeKey, {\n selector: (current) => current,\n comparator: (prevProps, newProps) => {\n return (\n shallowEqual(prevProps, newProps) &&\n shallowEqual(prevProps?.children, newProps?.children)\n );\n },\n propsStore: handler.propsStore,\n });\n\n const Renderer = React.useMemo(\n () => props.labelRenderer ?? DefaultLabelRenderer,\n [props.labelRenderer],\n );\n\n const handleToggle = React.useCallback(() => {\n handler.toggleNodeExpandedState(treeKey);\n }, [handler, treeKey]);\n\n const IconRenderer = React.useMemo(() => {\n return typeof props.icon === 'string' ? DefaultIconRenderer : props.icon;\n }, [props.icon]);\n\n const onClick = React.useCallback(() => {\n if (props.allowToggleExpandedFromLabel !== false)\n handler.toggleNodeExpandedState(treeKey);\n }, [handler, props.allowToggleExpandedFromLabel, treeKey]);\n\n return (\n <Box\n as=\"span\"\n className={`tree__nodeItemLabel ${props.isFocused ? 'focus' : ''}`}\n >\n <Spacer level={level} />\n {(props.isLoading ||\n (props.isExpanded && props.isLeaf !== true) ||\n props.isLeaf === false ||\n (props.children?.length ?? 0) > 0 ||\n (props.isLeaf === undefined &&\n !props.hasLoaded &&\n handler.configuration.current?.onLoadData)) && (\n <Box className=\"tree__expanderWrapper\">\n {props.isLoading ? (\n <Spinner sx={{ width: 'iconSm', height: 'iconSm' }} />\n ) : (\n <Icon\n className=\"tree__expandIcon\"\n onClick={handleToggle}\n name={props.isExpanded ? 'ArrowDownThin' : 'ArrowRightThin'}\n title=\"\"\n size={20}\n />\n )}\n </Box>\n )}\n {props.icon && IconRenderer && <IconRenderer {...props} />}\n <Box\n as=\"span\"\n className=\"tree__nodeItemLabelRenderer\"\n onClick={toggleNodesOnLabelClick !== false ? onClick : undefined}\n >\n <Renderer {...props} level={level} />\n </Box>\n </Box>\n );\n};\n\nexport default React.memo(TreeItemLabel);\n"],"names":[],"mappings":";;;;;;;;;;;AAWA,MAAM,aAAgB,GAAA,CAAC,EAAE,KAAA,EAAO,SAA+C,KAAA;AAC7E,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,SAAA,EAAW,EAAE,uBAAwB,EAAA;AAAA,MACnC,cAAe,EAAA,CAAA;AAEnB,EAAM,MAAA,KAAA,GAAQ,iBAAuC,OAAS,EAAA;AAAA,IAC5D,QAAA,EAAU,CAAC,OAAY,KAAA,OAAA;AAAA,IACvB,UAAA,EAAY,CAAC,SAAA,EAAW,QAAa,KAAA;AACnC,MACE,OAAA,YAAA,CAAa,WAAW,QAAQ,CAAA,IAChC,aAAa,SAAW,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function getActiveDescendantName(treeName, nodeId) {
|
|
4
|
-
return `${treeName}__${nodeId}`;
|
|
5
|
-
}
|
|
6
|
-
function getDomProps(_, treeName, type, par) {
|
|
7
|
-
switch (type) {
|
|
8
|
-
case "node": {
|
|
9
|
-
const node = par;
|
|
10
|
-
const tree = getTreeDataController(treeName);
|
|
11
|
-
return {
|
|
12
|
-
"aria-disabled": node.isDisabled,
|
|
13
|
-
"aria-expanded": node.isLeaf ? void 0 : !!node.isExpanded,
|
|
14
|
-
"aria-label": node.label,
|
|
15
|
-
...tree.configuration.current?.disableSelection ? void 0 : {
|
|
16
|
-
"aria-selected": node.isSelectable !== false && !node.isDisabled ? !!node.isSelected : void 0
|
|
17
|
-
},
|
|
18
|
-
className: node.className,
|
|
19
|
-
color: node.color,
|
|
20
|
-
"data-key": node.id,
|
|
21
|
-
id: getActiveDescendantName(treeName, node.id),
|
|
22
|
-
role: "treeitem",
|
|
23
|
-
title: node.title
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
default: {
|
|
27
|
-
const tree = par;
|
|
28
|
-
return {
|
|
29
|
-
role: "tree",
|
|
30
|
-
"aria-multiselectable": tree.isMultiple
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export { getActiveDescendantName, getDomProps };
|
|
37
|
-
//# sourceMappingURL=getDomProps.js.map
|
package/dist/getDomProps.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getDomProps.js","sources":["../src/getDomProps.ts"],"sourcesContent":["import { BoxProps } from '@apia/theme';\nimport { TTreeProps, TDataNode, TId } from './types';\nimport TreeDataController, {\n getTreeDataController,\n} from './TreeDataController';\n\nexport type TDomProps = Omit<BoxProps, 'as'> & Record<string, unknown>;\n\nexport function getActiveDescendantName(treeName: string, nodeId: TId) {\n return `${treeName}__${nodeId}`;\n}\n\nexport function getDomProps(\n treeProps: TTreeProps,\n treeName: string,\n type: 'tree',\n node: TTreeProps,\n controller: TreeDataController,\n): BoxProps;\nexport function getDomProps(\n treeProps: TTreeProps,\n treeName: string,\n type: 'node',\n node: TDataNode,\n): BoxProps;\nexport function getDomProps(\n _: TTreeProps,\n treeName: string,\n type: 'tree' | 'node',\n par: TDataNode | TTreeProps,\n): TDomProps {\n switch (type) {\n case 'node': {\n const node = par as TDataNode;\n const tree = getTreeDataController(treeName);\n return {\n 'aria-disabled': node.isDisabled,\n 'aria-expanded': node.isLeaf ? undefined : !!node.isExpanded,\n 'aria-label': node.label,\n ...(tree.configuration.current?.disableSelection\n ? undefined\n : {\n 'aria-selected':\n node.isSelectable !== false && !node.isDisabled\n ? !!node.isSelected\n : undefined,\n }),\n className: node.className,\n color: node.color,\n 'data-key': node.id,\n id: getActiveDescendantName(treeName, node.id),\n role: 'treeitem',\n title: node.title,\n };\n }\n default: {\n const tree = par as TTreeProps;\n return {\n role: 'tree',\n 'aria-multiselectable': tree.isMultiple,\n };\n }\n }\n}\n"],"names":[],"mappings":";;AAQgB,SAAA,uBAAA,CAAwB,UAAkB,MAAa,EAAA;AACrE,EAAO,OAAA,CAAA,EAAG,QAAQ,CAAA,EAAA,EAAK,MAAM,CAAA,CAAA,CAAA;AAC/B,CAAA;AAeO,SAAS,WACd,CAAA,CAAA,EACA,QACA,EAAA,IAAA,EACA,GACW,EAAA;AACX,EAAA,QAAQ,IAAM;AAAA,IACZ,KAAK,MAAQ,EAAA;AACX,MAAA,MAAM,IAAO,GAAA,GAAA,CAAA;AACb,MAAM,MAAA,IAAA,GAAO,sBAAsB,QAAQ,CAAA,CAAA;AAC3C,MAAO,OAAA;AAAA,QACL,iBAAiB,IAAK,CAAA,UAAA;AAAA,QACtB,iBAAiB,IAAK,CAAA,MAAA,GAAS,KAAY,CAAA,GAAA,CAAC,CAAC,IAAK,CAAA,UAAA;AAAA,QAClD,cAAc,IAAK,CAAA,KAAA;AAAA,QACnB,GAAI,IAAA,CAAK,aAAc,CAAA,OAAA,EAAS,mBAC5B,KACA,CAAA,GAAA;AAAA,UACE,eAAA,EACE,IAAK,CAAA,YAAA,KAAiB,KAAS,IAAA,CAAC,KAAK,UACjC,GAAA,CAAC,CAAC,IAAA,CAAK,UACP,GAAA,KAAA,CAAA;AAAA,SACR;AAAA,QACJ,WAAW,IAAK,CAAA,SAAA;AAAA,QAChB,OAAO,IAAK,CAAA,KAAA;AAAA,QACZ,YAAY,IAAK,CAAA,EAAA;AAAA,QACjB,EAAI,EAAA,uBAAA,CAAwB,QAAU,EAAA,IAAA,CAAK,EAAE,CAAA;AAAA,QAC7C,IAAM,EAAA,UAAA;AAAA,QACN,OAAO,IAAK,CAAA,KAAA;AAAA,OACd,CAAA;AAAA,KACF;AAAA,IACA,SAAS;AACP,MAAA,MAAM,IAAO,GAAA,GAAA,CAAA;AACb,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,MAAA;AAAA,QACN,wBAAwB,IAAK,CAAA,UAAA;AAAA,OAC/B,CAAA;AAAA,KACF;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import { Icon } from '@apia/icons';
|
|
3
|
-
|
|
4
|
-
const DefaultIconRenderer = (props) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(
|
|
6
|
-
Icon,
|
|
7
|
-
{
|
|
8
|
-
name: props.icon,
|
|
9
|
-
title: "",
|
|
10
|
-
size: props.iconSize ?? "iconSm",
|
|
11
|
-
className: "tree__node__icon"
|
|
12
|
-
}
|
|
13
|
-
);
|
|
14
|
-
};
|
|
15
|
-
var DefaultIconRenderer$1 = DefaultIconRenderer;
|
|
16
|
-
|
|
17
|
-
export { DefaultIconRenderer$1 as default };
|
|
18
|
-
//# sourceMappingURL=DefaultIconRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultIconRenderer.js","sources":["../../src/renderers/DefaultIconRenderer.tsx"],"sourcesContent":["import { Icon, TIconName } from '@apia/icons';\nimport { TTreeIconRenderer } from '../types';\n\nconst DefaultIconRenderer: TTreeIconRenderer = (props) => {\n return (\n <Icon\n name={props.icon as TIconName}\n title=\"\"\n size={props.iconSize ?? 'iconSm'}\n className=\"tree__node__icon\"\n />\n );\n};\n\nexport default DefaultIconRenderer;\n"],"names":[],"mappings":";;;AAGA,MAAM,mBAAA,GAAyC,CAAC,KAAU,KAAA;AACxD,EACE,uBAAA,GAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACC,MAAM,KAAM,CAAA,IAAA;AAAA,MACZ,KAAM,EAAA,EAAA;AAAA,MACN,IAAA,EAAM,MAAM,QAAY,IAAA,QAAA;AAAA,MACxB,SAAU,EAAA,kBAAA;AAAA,KAAA;AAAA,GACZ,CAAA;AAEJ,CAAA,CAAA;AAEA,4BAAe,mBAAA;;;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import { Box } from '@apia/theme';
|
|
3
|
-
|
|
4
|
-
const DefaultLabelRenderer = (props) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(Box, { as: "span", children: props.label });
|
|
6
|
-
};
|
|
7
|
-
var DefaultLabelRenderer$1 = DefaultLabelRenderer;
|
|
8
|
-
|
|
9
|
-
export { DefaultLabelRenderer$1 as default };
|
|
10
|
-
//# sourceMappingURL=DefaultLabelRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultLabelRenderer.js","sources":["../../src/renderers/DefaultLabelRenderer.tsx"],"sourcesContent":["import { Box } from '@apia/theme';\nimport { TTreeLabelRenderer } from '../types';\n\nconst DefaultLabelRenderer: TTreeLabelRenderer = (props) => {\n return <Box as=\"span\">{props.label}</Box>;\n};\n\nexport default DefaultLabelRenderer;\n"],"names":[],"mappings":";;;AAGA,MAAM,oBAAA,GAA2C,CAAC,KAAU,KAAA;AAC1D,EAAA,uBAAQ,GAAA,CAAA,GAAA,EAAA,EAAI,EAAG,EAAA,MAAA,EAAQ,gBAAM,KAAM,EAAA,CAAA,CAAA;AACrC,CAAA,CAAA;AAEA,6BAAe,oBAAA;;;;"}
|
package/dist/renderers/Spacer.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx, Fragment } from '@apia/theme/jsx-runtime';
|
|
2
|
-
import { Box } from '@apia/theme';
|
|
3
|
-
|
|
4
|
-
const Spacer = ({ level }) => {
|
|
5
|
-
return /* @__PURE__ */ jsx(Fragment, { children: Array(level).fill("").map((_, i) => i).map((current) => /* @__PURE__ */ jsx(Box, { className: "spacer" }, current)) });
|
|
6
|
-
};
|
|
7
|
-
var Spacer$1 = Spacer;
|
|
8
|
-
|
|
9
|
-
export { Spacer$1 as default };
|
|
10
|
-
//# sourceMappingURL=Spacer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Spacer.js","sources":["../../src/renderers/Spacer.tsx"],"sourcesContent":["import React from 'react';\nimport { Box } from '@apia/theme';\n\nconst Spacer: React.FunctionComponent<{ level: number }> = ({ level }) => {\n return (\n <>\n {Array(level)\n .fill('')\n .map((_, i) => i)\n .map((current) => (\n <Box className=\"spacer\" key={current} />\n ))}\n </>\n );\n};\n\nexport default Spacer;\n"],"names":[],"mappings":";;;AAGA,MAAM,MAAqD,GAAA,CAAC,EAAE,KAAA,EAAY,KAAA;AACxE,EACE,uBAAA,GAAA,CAAA,QAAA,EAAA,EACG,gBAAM,KAAK,CAAA,CACT,KAAK,EAAE,CAAA,CACP,GAAI,CAAA,CAAC,CAAG,EAAA,CAAA,KAAM,CAAC,CACf,CAAA,GAAA,CAAI,CAAC,OACJ,qBAAA,GAAA,CAAC,OAAI,SAAU,EAAA,QAAA,EAAA,EAAc,OAAS,CACvC,CACL,EAAA,CAAA,CAAA;AAEJ,CAAA,CAAA;AAEA,eAAe,MAAA;;;;"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import TreeDataController from './TreeDataController.js';
|
|
3
|
-
import { TIconName } from '@apia/icons';
|
|
4
|
-
|
|
5
|
-
type TId = string | number;
|
|
6
|
-
type TDataNodeContainer<NodeProps extends Record<string, unknown> = Record<string, unknown>> = Pick<TDataNode<NodeProps>, 'children' | 'id'>;
|
|
7
|
-
type TTreeDataControllerConfig<NodeProps extends Record<string, unknown> = Record<string, unknown>, NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>> = {
|
|
8
|
-
emitUpdates?: boolean;
|
|
9
|
-
} & Pick<TTreeProps<NodeProps, NodeType>, 'isMultiple' | 'onLoadData' | 'onExpand' | 'disableSelection' | 'selectionMode'>;
|
|
10
|
-
type TTreeDataControllerState = {
|
|
11
|
-
expandedNodes: TId[];
|
|
12
|
-
filteredNodes: TId[];
|
|
13
|
-
focusedNode: TId | null;
|
|
14
|
-
isLoading: boolean;
|
|
15
|
-
length: number;
|
|
16
|
-
selectedNodes: TId[];
|
|
17
|
-
};
|
|
18
|
-
type TTreeLabelRenderer<NodeProps extends Record<string, unknown> = Record<string, unknown>> = React__default.FunctionComponent<TDataNode<NodeProps> & {
|
|
19
|
-
level: number;
|
|
20
|
-
}>;
|
|
21
|
-
type TNodesExpandEvent<NodeProps extends Record<string, unknown> = Record<string, unknown>> = TDataNode<NodeProps>;
|
|
22
|
-
type TNodesSelectionEvent<NodeProps extends Record<string, unknown> = Record<string, unknown>> = TDataNode<NodeProps>[];
|
|
23
|
-
type TTreeProps<NodeProps extends Record<string, unknown> = Record<string, unknown>, NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>> = {
|
|
24
|
-
/**
|
|
25
|
-
* Debe ser un texto descriptivo, se usa para las personas no videntes
|
|
26
|
-
* principalmente.
|
|
27
|
-
*/
|
|
28
|
-
label: string;
|
|
29
|
-
name: string;
|
|
30
|
-
} & Partial<{
|
|
31
|
-
className: string;
|
|
32
|
-
/**
|
|
33
|
-
* Permite pasar un controller propio.
|
|
34
|
-
*/
|
|
35
|
-
controller?: TreeDataController<NodeProps, NodeType>;
|
|
36
|
-
disableSelection: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Si se pasa un filterString !== undefined => los nodos del árbol cuyo label
|
|
39
|
-
* no coincida serán ocultados, a menos que alguno de sus hijos si coincida.
|
|
40
|
-
*/
|
|
41
|
-
filterString: string;
|
|
42
|
-
/**
|
|
43
|
-
* Es posible alterar el comportamiento por defecto cada vez que el usuario
|
|
44
|
-
* selecciona un elemento de la lista mediante esta función, indicando al tree
|
|
45
|
-
* sobre qué elemento debe colocar el foco.
|
|
46
|
-
*
|
|
47
|
-
* Esta función debe tomar el liElement que recibe como parámetro y mediante
|
|
48
|
-
* querySelectors o el método que se considere correcto devolver la referencia
|
|
49
|
-
* al hijo sobre el cual se desea colocar el foco.
|
|
50
|
-
*
|
|
51
|
-
* @param liElement - Es el li que renderiza el nodo. Los hijos más importantes de este li son:
|
|
52
|
-
*
|
|
53
|
-
* - .tree__nodeItemLabel: Es el wrapper del botón de expandir, del ícono
|
|
54
|
-
* del nodo y del (custom?)Renderer. - ul[role="group"]: Es el wrapper de
|
|
55
|
-
* todos los hijos del nodo actual.*/
|
|
56
|
-
focusGetter: (liElement: HTMLElement) => HTMLElement;
|
|
57
|
-
/**
|
|
58
|
-
* Esta función es llamada cuando el árbol inicializó con la referencia al
|
|
59
|
-
* handler como parámetro.
|
|
60
|
-
*/
|
|
61
|
-
getHandler: (handler: TreeDataController<NodeProps, NodeType>) => unknown;
|
|
62
|
-
/**
|
|
63
|
-
* Permite ocultar todos los nodos de tipo folder que no tengan hijos.
|
|
64
|
-
*/
|
|
65
|
-
hideEmptyFolders: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Permite ocultar la etiqueta de búsqueda
|
|
68
|
-
*/
|
|
69
|
-
hideSearchLabel: boolean;
|
|
70
|
-
initialNodes: NodeType[];
|
|
71
|
-
/**
|
|
72
|
-
* Pone el mismo spinner que mientras está en modo batch.
|
|
73
|
-
*/
|
|
74
|
-
isLoading: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* Habilita la selección múltiple, por defecto está deshabilitada.
|
|
77
|
-
*/
|
|
78
|
-
isMultiple: boolean;
|
|
79
|
-
/**
|
|
80
|
-
* Este callback es llamado cuando se presiona la flecha arriba en el primer
|
|
81
|
-
* elemento del árbol. Está pensado para mover el foco hacia el cuadro de
|
|
82
|
-
* búsqueda.
|
|
83
|
-
*/
|
|
84
|
-
onArrowUpOnFirstElement?: () => unknown;
|
|
85
|
-
onDeleteFilterString?: () => unknown;
|
|
86
|
-
onExpand: (ev: TNodesExpandEvent<NodeProps>) => unknown;
|
|
87
|
-
/**
|
|
88
|
-
* Esta función debe devolver una promesa. Cuando se expande un nodo que no
|
|
89
|
-
* tiene hijos, esta función es llamada y el nodo es puesto en estado de carga
|
|
90
|
-
* hasta que la promesa se resuelve.
|
|
91
|
-
*/
|
|
92
|
-
onLoadData: (node: NodeType) => Promise<void>;
|
|
93
|
-
/**
|
|
94
|
-
* Cada vez que se hace click sobre un nodo o se presiona enter estando
|
|
95
|
-
* éste en foco, se llama este callback informando de la acción.
|
|
96
|
-
*/
|
|
97
|
-
onNodeClick: (ev: React__default.KeyboardEvent | React__default.MouseEvent, node: NodeType) => unknown;
|
|
98
|
-
onSelect: (ev: TNodesSelectionEvent<NodeProps>) => unknown;
|
|
99
|
-
/**
|
|
100
|
-
* Si se pasa **onFocus**, el nodo será seleccionado al recibir foco (por
|
|
101
|
-
* ejemplo, al navegarlo con las flechas).
|
|
102
|
-
*
|
|
103
|
-
* Si se pasa **explicit**, solamente se
|
|
104
|
-
* hará seleccionará al hacerle click (o presionar enter o espacio).
|
|
105
|
-
*
|
|
106
|
-
* Si se pasa **explicitMultiple**, solamente se hará selección al hacer
|
|
107
|
-
* click o presionar enter o espacio, y además la selección múltiple solamente
|
|
108
|
-
* funcionará si las teclas Shift o Ctrl están presionadas.
|
|
109
|
-
*
|
|
110
|
-
* @default "onFocus"
|
|
111
|
-
*/
|
|
112
|
-
selectionMode: 'onFocus' | 'explicit' | 'explicitMultiple';
|
|
113
|
-
/**
|
|
114
|
-
* Si se pasa en false, los nodos padre solamente se podrán expandir/colapsar
|
|
115
|
-
* al hacer click en los íconos.
|
|
116
|
-
*/
|
|
117
|
-
toggleNodesOnLabelClick: boolean;
|
|
118
|
-
variant: string;
|
|
119
|
-
}>;
|
|
120
|
-
type TTreeIconRenderer<NodeProps extends Record<string, unknown> = Record<string, unknown>> = React__default.FunctionComponent<TDataNode<NodeProps>>;
|
|
121
|
-
type TDataNode<NodeProps extends Record<string, unknown> = Record<string, unknown>> = {
|
|
122
|
-
actualParentId?: TId;
|
|
123
|
-
children: TId[];
|
|
124
|
-
id: TId;
|
|
125
|
-
label: string;
|
|
126
|
-
/**
|
|
127
|
-
* Un objeto arbitrario con propiedades de nodo que no están relacionados a
|
|
128
|
-
* la estructura del árbol, sino de la estructura de información que
|
|
129
|
-
* representa.
|
|
130
|
-
*/
|
|
131
|
-
nodeProps: NodeProps;
|
|
132
|
-
parentId: TId;
|
|
133
|
-
} & Partial<{
|
|
134
|
-
/**
|
|
135
|
-
* Con esta prop se puede evitar que el nodo sea colapsado desde el label
|
|
136
|
-
*/
|
|
137
|
-
allowToggleExpandedFromLabel?: boolean;
|
|
138
|
-
className?: string;
|
|
139
|
-
color?: string;
|
|
140
|
-
/**
|
|
141
|
-
* Esta prop marca que ya se pidieron los datos mediante onLoadData para este
|
|
142
|
-
* nodo.
|
|
143
|
-
*/
|
|
144
|
-
hasLoaded: boolean;
|
|
145
|
-
/**
|
|
146
|
-
* El icon puede ser el nombre de uno de los elementos del mapa de íconos de
|
|
147
|
-
* Icon.tsx o un TTreeIconRenderer que permite utilizar un componente para
|
|
148
|
-
* renderizar el ícono.*/
|
|
149
|
-
icon: TIconName | TTreeIconRenderer<NodeProps>;
|
|
150
|
-
/**
|
|
151
|
-
* Este string se usa como height y width del ícono, de modo que se puede
|
|
152
|
-
* pasar cualquier expresión válida de ThemeUI.
|
|
153
|
-
*/
|
|
154
|
-
iconSize: string;
|
|
155
|
-
/**
|
|
156
|
-
* Cuando un nodo está deshabilitado, no se pondrá foco en él.
|
|
157
|
-
*/
|
|
158
|
-
isDisabled: boolean;
|
|
159
|
-
/**
|
|
160
|
-
* Indica si un nodo está o no expandido, en caso de que se establezca en
|
|
161
|
-
* true, el mismo será expandido. Esto puede ser útil para controlar el árbol
|
|
162
|
-
* desde fuera, en cuyo caso se deben modificar las propiedades mediante
|
|
163
|
-
* handler.propsStore.updateField(node.id, { newProps }).
|
|
164
|
-
*/
|
|
165
|
-
isExpanded: boolean;
|
|
166
|
-
/**
|
|
167
|
-
* Indica que el nodo no debe mostrarse ya que no coincide con los criterios
|
|
168
|
-
* de filtrado.
|
|
169
|
-
*/
|
|
170
|
-
isFiltered: boolean;
|
|
171
|
-
/**
|
|
172
|
-
* Indica si un nodo está en foco, es importante notar que alterar esta
|
|
173
|
-
* propiedad no va a alterar qué nodo del árbol está en foco ya que ese
|
|
174
|
-
* control lo hace internamente el árbol. En caso de querer modificar esto en
|
|
175
|
-
* forma externa, se deben usar los métodos correspondientes del handler.
|
|
176
|
-
*/
|
|
177
|
-
isFocused: boolean;
|
|
178
|
-
/**
|
|
179
|
-
* Esta prop se usa para decir que un nodo es un sub-árbol, aún cuando no
|
|
180
|
-
* tiene hijos. Esto es especialmente útil cuando se quiere hacer carga
|
|
181
|
-
* asíncrona de datos, ya que al expandirse, se llamará al método onLoadData
|
|
182
|
-
* del tree.
|
|
183
|
-
*/
|
|
184
|
-
isLeaf: boolean;
|
|
185
|
-
/**
|
|
186
|
-
* Se setea en true al momento de llamar a onLoadData y en false al finalizar
|
|
187
|
-
* la carga de datos.
|
|
188
|
-
*/
|
|
189
|
-
isLoading: boolean;
|
|
190
|
-
/**
|
|
191
|
-
* Por defecto todos los nodos son seleccionables, se debe pasar false
|
|
192
|
-
* explícitamente para deshabilitar la selección.
|
|
193
|
-
*/
|
|
194
|
-
isSelectable: boolean;
|
|
195
|
-
/**
|
|
196
|
-
* Indica si un nodo está o no seleccionado. Esto puede ser útil para
|
|
197
|
-
* controlar el árbol desde fuera, en cuyo caso se deben modificar las
|
|
198
|
-
* propiedades mediante handler.propsStore.updateField(node.id, { newProps }).
|
|
199
|
-
*/
|
|
200
|
-
isSelected: boolean;
|
|
201
|
-
/**
|
|
202
|
-
* Si se pasa un labelRenderer se utilizará en lugar de
|
|
203
|
-
* DefaultLabelRenderer.tsx. El labelRenderer es el responsable de hacer caso
|
|
204
|
-
* de los eventos de click para la selección del nodo.
|
|
205
|
-
*/
|
|
206
|
-
labelRenderer: TTreeLabelRenderer<NodeProps>;
|
|
207
|
-
title: string;
|
|
208
|
-
}>;
|
|
209
|
-
|
|
210
|
-
export type { TDataNode, TDataNodeContainer, TId, TNodesExpandEvent, TNodesSelectionEvent, TTreeDataControllerConfig, TTreeDataControllerState, TTreeIconRenderer, TTreeLabelRenderer, TTreeProps };
|
|
211
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/useTreeData.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import TreeDataController from './TreeDataController.js';
|
|
3
|
-
import { TDataNode, TId, TTreeProps } from './types.js';
|
|
4
|
-
|
|
5
|
-
interface IUseTreeData<NodeProps extends Record<string, unknown> = Record<string, unknown>, NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>> {
|
|
6
|
-
name: string;
|
|
7
|
-
treeProps: TTreeProps<NodeProps, NodeType>;
|
|
8
|
-
}
|
|
9
|
-
declare function useTreeData<NodeProps extends Record<string, unknown> = Record<string, unknown>, NodeType extends TDataNode<NodeProps> = TDataNode<NodeProps>>({ name, treeProps }: IUseTreeData<NodeProps, NodeType>): {
|
|
10
|
-
data: {
|
|
11
|
-
children: TId[];
|
|
12
|
-
forceUpdate: number;
|
|
13
|
-
};
|
|
14
|
-
handler: TreeDataController<NodeProps, NodeType>;
|
|
15
|
-
keyHandler: {
|
|
16
|
-
id: string;
|
|
17
|
-
onKeyDown: (ev: React__default.KeyboardEvent) => void;
|
|
18
|
-
onMouseDown: (ev: React__default.MouseEvent) => void;
|
|
19
|
-
onClick: (ev: React__default.MouseEvent) => void;
|
|
20
|
-
ref: React__default.MutableRefObject<HTMLDivElement | null>;
|
|
21
|
-
};
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export { useTreeData as default };
|
|
25
|
-
//# sourceMappingURL=useTreeData.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useTreeData.d.ts","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|