Constructor
new AppTree(id, attachmentsBrowseropt, isModalopt, initopt)
Initialize properties and state for AIOTree component.
Also handles the responsiveness.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string | The HTML id (needed to localStorage support) | ||
attachmentsBrowser |
object |
<optional> |
The attachments browser (for media grid view) | |
isModal |
boolean |
<optional> |
false | If true the given app tree is a modal dialog |
init |
module:AppTree~AppTree~init |
<optional> |
- See:
-
- module:store.StoredAppTree
- module:react-aiot~Tree
Extends
- React.Component
Members
_handleDetails
Handle the details meta box.
handleReload
Handle refesh of content.
handleResize
When resizing the container set ideal width for attachments.
onTreeNodeRender
A node item should be an observer (mobx).
onTreeNodeRenderIcon
A node item icon is present as string.
renderCreatables
renderToolbarButtons
Methods
_handleBackboneFilterSelection(idopt)
Set the attachments browser location.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
int |
<optional> |
Current selected id | The id |
_handleRenameNode()
Handle rename node states (helper).
_handleSortNode()
Handle the sort node button.
_isMobile() → {boolean}
Checks if the current window size is mobile.
Returns:
- Type
- boolean
_updateCreatableButtons(selectedCreatableType)
Update the creatable buttons regarding the selected type.
Parameters:
Name | Type | Description |
---|---|---|
selectedCreatableType |
int |
componentDidMount()
Initiate draggable and droppable
componentDidUpdate()
When the component updates the droppable zone is reinitialized.
Also the toolbar buttons gets disabled or enabled depending on selected node.
componentWillUnmount()
Remove resize handler.
(async) fetchCounts(counts)
Update the folder count. If you pass no argument the folder count is
requested from server.
Parameters:
Name | Type | Description |
---|---|---|
counts |
object | Key value map of folder and count |
(async) fetchTree()
Fetch folder tree.
getBackboneFilter()
Return the backbone filter view for the given attachments browser.
Returns:
object
getSelectedId() → {string|int}
Get the selected node id.
Returns:
- Type
- string | int
getTreeItemById(idopt, excludeStaticopt) → {object}
Get tree item by id.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
id |
string | int |
<optional> |
Current | |
excludeStatic |
boolean |
<optional> |
true |
Returns:
Tree node
- Type
- object
handleAddClose()
(Pro only) Handle add close and remove the new node.
handleCloseMultiToolbar()
Disable the checked property for all checked nodes.
handleCreatableClick()
Handles the creatable click and creates a new node depending on the selected one.
handleDismissImportTaxNotice()
Dismiss the import tax notice for a given time (transient).
handleMultipleTrash()
Handle trashing of multiple categories.
handleOrderCancel()
Handle order cancel.
handleOrderClick()
Handle order click.
handleRenameCancel()
Handle rename cancel.
handleRenameClick()
Handle rename click and enable the input field if necessery.
handleRenameClose()
Handle rename close and depending on the save state create the new node.
handleSelect()
A node gets selected. Depending on the fast mode the page gets reloaded
or the wp list table gets reloaded.
handleSort()
Handle categories sorting and update the tree so the changes are visible. If sorting
is cancelled the old tree gets restored.
handleSortManual()
Handle manual sorting. The new location is already calculated by the RearrangeBox.
Returns:
boolean
handleTrash()
Handle trashing of a category. If the category has subcategories the
trash is forbidden.
handleWindowResize()
Handle responsiveness on window resize.
render()
Render AIO tree with tax switcher.
resolveStateRef() → {object}
Resolve single state ref key.
Returns:
- Type
- object
resolveStateRefs() → {object}
Iterates all available values in an object and resolve it with the available
this::stateRefs.
Returns:
- Type
- object
(async) updateCreateNode(modifier)
Updates the create node. That's the node without id and the input field.
Parameters:
Name | Type | Description |
---|---|---|
modifier |
object | The modifier object which is passed through Object.assign |
updateTreeItemById(callback, idopt, setHashopt)
Update a tree item by id.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
callback |
function | array | The callback with one argument (node draft) and should return the new node. | ||
id |
string | int |
<optional> |
Current | The id which should be updated |
setHash |
boolean |
<optional> |
false | If true the hash node is changed so a rerender is forced |
Type Definitions
init(state, tree) → {object}
Called on initialzation and allows you to modify the init state.
Parameters:
Name | Type | Description |
---|---|---|
state |
object | The default state |
tree |
AppTree | The AppTree component instance |
Returns:
The new state
- Type
- object