mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix the jsdoc syntax and docs API methods
This commit is contained in:
parent
4aff2ae08a
commit
e234c19ca8
@ -39,6 +39,7 @@ RED.history = (function () {
|
|||||||
* & (AddEvent | DeleteEvent | EditEvent | MoveEvent | MultiEvent | ReorderEvent |
|
* & (AddEvent | DeleteEvent | EditEvent | MoveEvent | MultiEvent | ReorderEvent |
|
||||||
* ReplaceEvent | CreateSubflowEvent | DeleteSubflowEvent | AddToGroupEvent |
|
* ReplaceEvent | CreateSubflowEvent | DeleteSubflowEvent | AddToGroupEvent |
|
||||||
* CreateGroupEvent | UngroupEvent | RemoveFromGroupEvent) } HistoryEvent
|
* CreateGroupEvent | UngroupEvent | RemoveFromGroupEvent) } HistoryEvent
|
||||||
|
* @memberof RED.history
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -76,11 +77,13 @@ RED.history = (function () {
|
|||||||
* @property {Array<Group>} [groups] An array with added groups
|
* @property {Array<Group>} [groups] An array with added groups
|
||||||
* @property {Array<Junction>} [junctions] An array with added junctions
|
* @property {Array<Junction>} [junctions] An array with added junctions
|
||||||
* @property {Array<Link>} [links] An array with added links
|
* @property {Array<Link>} [links] An array with added links
|
||||||
* @property {Array<Node>} [nodes] An array with added nodes
|
* @property {Array<string>} [nodes] An array with added node ids
|
||||||
* @property {Array<Link>} [removedLinks] An array with removed links
|
* @property {Array<Link>} [removedLinks] An array with removed links
|
||||||
* @property {{ id: string; changed?: boolean; instances: Array<Node>; }} [subflow]
|
* @property {{ id: string, changed: boolean | undefined,
|
||||||
|
* instances: Array<Node> }} [subflow]
|
||||||
* @property {Array<Subflow>} [subflows] An array with added subflows (tabs)
|
* @property {Array<Subflow>} [subflows] An array with added subflows (tabs)
|
||||||
* @property {Array<Workspace>} [workspaces] An array with added workspaces
|
* @property {Array<Workspace>} [workspaces] An array with added workspaces
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {AddEvent} ev The history event to undo
|
* @param {AddEvent} ev The history event to undo
|
||||||
* @param {object} [modifiedTabs]
|
* @param {object} [modifiedTabs]
|
||||||
@ -220,17 +223,22 @@ RED.history = (function () {
|
|||||||
* @typedef {object} DeleteEvent
|
* @typedef {object} DeleteEvent
|
||||||
* @property {"delete"} t The history event type
|
* @property {"delete"} t The history event type
|
||||||
* @property {Record<string, object>} [changes] An object with changes.
|
* @property {Record<string, object>} [changes] An object with changes.
|
||||||
* The key is the id of a node and the value is an object with the changes to apply
|
* The key is the id of a node and the value is an object with the changes
|
||||||
|
* to apply
|
||||||
* @property {Array<Link>} [createdLinks] An array with created links
|
* @property {Array<Link>} [createdLinks] An array with created links
|
||||||
* @property {Array<Group>} [groups] An array with removed groups
|
* @property {Array<Group>} [groups] An array with removed groups
|
||||||
* @property {Array<Junction>} [junctions] An array with removed junctions
|
* @property {Array<Junction>} [junctions] An array with removed junctions
|
||||||
* @property {Array<Link>} [links] An array with removed links
|
* @property {Array<Link>} [links] An array with removed links
|
||||||
* @property {Array<Node>} [nodes] An array with removed nodes
|
* @property {Array<Node>} [nodes] An array with removed nodes
|
||||||
* @property {{ id?: string; instances?: Array<Node>; status?: string;}} [subflow]
|
* @property {{ id: string | undefined, instances: Array<Node> | undefined,
|
||||||
* @property {Array<SubflowNode>} [subflowInputs] An array with removed subflow input
|
* status: string | undefined }} [subflow]
|
||||||
* @property {Array<SubflowNode>} [subflowOutputs] An array with removed subflow outputs
|
* @property {Array<SubflowNode>} [subflowInputs] An array with removed
|
||||||
|
* subflow input
|
||||||
|
* @property {Array<SubflowNode>} [subflowOutputs] An array with removed
|
||||||
|
* subflow outputs
|
||||||
* @property {Array<Subflow>} [subflows] An array with removed subflows (tabs)
|
* @property {Array<Subflow>} [subflows] An array with removed subflows (tabs)
|
||||||
* @property {Array<Workspace>} [workspaces] An array with removed workspace
|
* @property {Array<Workspace>} [workspaces] An array with removed workspace
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {DeleteEvent} ev The history event to undo
|
* @param {DeleteEvent} ev The history event to undo
|
||||||
* @param {object} [modifiedTabs]
|
* @param {object} [modifiedTabs]
|
||||||
@ -436,10 +444,12 @@ RED.history = (function () {
|
|||||||
* @property {"move"} t The history event type
|
* @property {"move"} t The history event type
|
||||||
* @property {Group} [addToGroup] The group in which the nodes were added
|
* @property {Group} [addToGroup] The group in which the nodes were added
|
||||||
* @property {Array<Link>} [links]
|
* @property {Array<Link>} [links]
|
||||||
* @property {Array<{ n: Node; ox: number; oy: number; dx: number;
|
* @property {Array<{ n: Node, ox: number, oy: number, dx: number,
|
||||||
* dy: number; }>} nodes An array with nodes moved
|
* dy: number }>} nodes An array with nodes moved
|
||||||
* @property {Array<Link>} [removedLinks]
|
* @property {Array<Link>} [removedLinks]
|
||||||
* @property {Group} [removeFromGroup] The group in which the nodes were removed
|
* @property {Group} [removeFromGroup] The group in which the nodes were
|
||||||
|
* removed
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {MoveEvent} ev The history event to undo
|
* @param {MoveEvent} ev The history event to undo
|
||||||
* @returns {MoveEvent} The generated history event to redo
|
* @returns {MoveEvent} The generated history event to redo
|
||||||
@ -506,8 +516,9 @@ RED.history = (function () {
|
|||||||
* @property {Array<string>} [nodes] An array with subflow node ids
|
* @property {Array<string>} [nodes] An array with subflow node ids
|
||||||
* @property {Array<Link>} [removedLinks] An array with removed links
|
* @property {Array<Link>} [removedLinks] An array with removed links
|
||||||
* (during conversion to Subflow - links from active workspace)
|
* (during conversion to Subflow - links from active workspace)
|
||||||
* @property {{ subflow: Subflow; offsetX?: number;
|
* @property {{ subflow: Subflow, offsetX: number | undefined,
|
||||||
* offsetY?: number; }} subflow The subflow created to delete
|
* offsetY: number | undefined }} subflow The subflow created to delete
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {CreateSubflowEvent} ev The history event to undo
|
* @param {CreateSubflowEvent} ev The history event to undo
|
||||||
* @returns {DeleteSubflowEvent} The generated history event to redo
|
* @returns {DeleteSubflowEvent} The generated history event to redo
|
||||||
@ -580,10 +591,11 @@ RED.history = (function () {
|
|||||||
* undo conversion to Subflow - links inside the subflow)
|
* undo conversion to Subflow - links inside the subflow)
|
||||||
* @property {Array<Node>} [movedNodes] An array with nodes to move to the
|
* @property {Array<Node>} [movedNodes] An array with nodes to move to the
|
||||||
* subflow to create
|
* subflow to create
|
||||||
* @property {{ subflow: Subflow; offsetX?: number;
|
* @property {{ subflow: Subflow, offsetX: number | undefined,
|
||||||
* offsetY?: number; }} subflow The deleted subflow to create
|
* offsetY: number | undefined }} subflow The deleted subflow to create
|
||||||
* @property {Array<Subflow>} [subflows] An array with subflow nodes
|
* @property {Array<Subflow>} [subflows] An array with subflow nodes
|
||||||
* (redo conversion to subflow)
|
* (redo conversion to subflow)
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {DeleteSubflowEvent} ev The history event to undo
|
* @param {DeleteSubflowEvent} ev The history event to undo
|
||||||
* @returns {CreateSubflowEvent} The generated history event to redo
|
* @returns {CreateSubflowEvent} The generated history event to redo
|
||||||
@ -655,10 +667,11 @@ RED.history = (function () {
|
|||||||
*
|
*
|
||||||
* @typedef {object} ReorderEvent
|
* @typedef {object} ReorderEvent
|
||||||
* @property {"reorder"} t The history event type
|
* @property {"reorder"} t The history event type
|
||||||
* @property {{ from: string; to: string; z: string; }} [nodes]
|
* @property {{ from: string, to: string, z: string }} [nodes]
|
||||||
* @property {object} [workspaces]
|
* @property {object} [workspaces]
|
||||||
* @property {Array<string>} workspaces[].from Ordered array of workspace ids
|
* @property {Array<string>} workspaces[].from Ordered array of workspace ids
|
||||||
* @property {Array<string>} workspaces[].to Ordered array of workspace ids
|
* @property {Array<string>} workspaces[].to Ordered array of workspace ids
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {ReorderEvent} ev The history event to undo
|
* @param {ReorderEvent} ev The history event to undo
|
||||||
* @returns {ReorderEvent} The generated history event to redo
|
* @returns {ReorderEvent} The generated history event to redo
|
||||||
@ -696,6 +709,7 @@ RED.history = (function () {
|
|||||||
* @typedef {object} CreateGroupEvent
|
* @typedef {object} CreateGroupEvent
|
||||||
* @property {"createGroup"} t The history event type
|
* @property {"createGroup"} t The history event type
|
||||||
* @property {Array<Group>} [groups] An array with groups to remove
|
* @property {Array<Group>} [groups] An array with groups to remove
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {CreateGroupEvent} ev The history event to undo
|
* @param {CreateGroupEvent} ev The history event to undo
|
||||||
* @returns {UngroupEvent} The generated history event to redo
|
* @returns {UngroupEvent} The generated history event to redo
|
||||||
@ -724,6 +738,7 @@ RED.history = (function () {
|
|||||||
* @typedef {object} UngroupEvent
|
* @typedef {object} UngroupEvent
|
||||||
* @property {"ungroup"} t The history event type
|
* @property {"ungroup"} t The history event type
|
||||||
* @property {Array<Group>} [groups] An array with groups to create
|
* @property {Array<Group>} [groups] An array with groups to create
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {UngroupEvent} ev The history event to undo
|
* @param {UngroupEvent} ev The history event to undo
|
||||||
* @returns {CreateGroupEvent} The generated history event to redo
|
* @returns {CreateGroupEvent} The generated history event to redo
|
||||||
@ -766,6 +781,7 @@ RED.history = (function () {
|
|||||||
* @property {Array<Node> | Node} [nodes] An array of nodes or one node
|
* @property {Array<Node> | Node} [nodes] An array of nodes or one node
|
||||||
* to remove from the group
|
* to remove from the group
|
||||||
* @property {boolean} [reparent] Either to re-add to parent group
|
* @property {boolean} [reparent] Either to re-add to parent group
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {AddToGroupEvent} ev The history event to undo
|
* @param {AddToGroupEvent} ev The history event to undo
|
||||||
* @returns {RemoveFromGroupEvent} The generated history event to redo
|
* @returns {RemoveFromGroupEvent} The generated history event to redo
|
||||||
@ -796,6 +812,7 @@ RED.history = (function () {
|
|||||||
* @property {Array<Node> | Node} [nodes] An array of nodes or one node
|
* @property {Array<Node> | Node} [nodes] An array of nodes or one node
|
||||||
* to add to the group
|
* to add to the group
|
||||||
* @property {boolean} [reparent] Either to re-add to parent group
|
* @property {boolean} [reparent] Either to re-add to parent group
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {RemoveFromGroupEvent} ev The history event to undo
|
* @param {RemoveFromGroupEvent} ev The history event to undo
|
||||||
* @returns {AddToGroupEvent} The generated history event to redo
|
* @returns {AddToGroupEvent} The generated history event to redo
|
||||||
@ -828,8 +845,10 @@ RED.history = (function () {
|
|||||||
* @property {Array<Link>} [links] An array with removed links
|
* @property {Array<Link>} [links] An array with removed links
|
||||||
* @property {Node} node The current node/subflow
|
* @property {Node} node The current node/subflow
|
||||||
* @property {object} [outputMap]
|
* @property {object} [outputMap]
|
||||||
* @property {{ instances?: Array<Node>; inputCount?: number;
|
* @property {{ instances: Array<Node> | undefined,
|
||||||
* outputCount?: number; status?: string; }} [subflow] Subflow properties
|
* inputCount: number | undefined, outputCount: number | undefined,
|
||||||
|
* status: string | undefined }} [subflow] Subflow properties
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {EditEvent} ev The history event to undo
|
* @param {EditEvent} ev The history event to undo
|
||||||
* @returns {EditEvent} The generated history event to redo
|
* @returns {EditEvent} The generated history event to redo
|
||||||
@ -1019,6 +1038,7 @@ RED.history = (function () {
|
|||||||
* @property {Record<string, boolean>} moved An object with a node id
|
* @property {Record<string, boolean>} moved An object with a node id
|
||||||
* as key and the node moved property as value
|
* as key and the node moved property as value
|
||||||
* @property {string} rev A revision version
|
* @property {string} rev A revision version
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @typedef {object} IncompleteReplaceEvent
|
* @typedef {object} IncompleteReplaceEvent
|
||||||
* @property {"replace"} t The history event type
|
* @property {"replace"} t The history event type
|
||||||
@ -1026,8 +1046,10 @@ RED.history = (function () {
|
|||||||
* property contains the complete flows
|
* property contains the complete flows
|
||||||
* @property {Array<Node>} config An array with config nodes and/or
|
* @property {Array<Node>} config An array with config nodes and/or
|
||||||
* subflow definitions to replace.
|
* subflow definitions to replace.
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @typedef {CompleteReplaceEvent|IncompleteReplaceEvent} ReplaceEvent
|
* @typedef {CompleteReplaceEvent|IncompleteReplaceEvent} ReplaceEvent
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {ReplaceEvent} ev The history event to undo
|
* @param {ReplaceEvent} ev The history event to undo
|
||||||
* @returns {ReplaceEvent} The generated history event to redo
|
* @returns {ReplaceEvent} The generated history event to redo
|
||||||
@ -1111,6 +1133,7 @@ RED.history = (function () {
|
|||||||
* @typedef {object} MultiEvent
|
* @typedef {object} MultiEvent
|
||||||
* @property {"multi"} t The history event type
|
* @property {"multi"} t The history event type
|
||||||
* @property {Array<HistoryEvent>} events An array with events
|
* @property {Array<HistoryEvent>} events An array with events
|
||||||
|
* @memberof RED.history
|
||||||
*
|
*
|
||||||
* @param {MultiEvent} ev The history event to undo
|
* @param {MultiEvent} ev The history event to undo
|
||||||
* @returns {MultiEvent} The generated history event to redo
|
* @returns {MultiEvent} The generated history event to redo
|
||||||
@ -1131,7 +1154,7 @@ RED.history = (function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called to undo the history event
|
* Called to undo/redo the history event
|
||||||
*
|
*
|
||||||
* @param {HistoryEvent} ev The history event to undo
|
* @param {HistoryEvent} ev The history event to undo
|
||||||
* @returns {HistoryEvent} The generated history event to redo
|
* @returns {HistoryEvent} The generated history event to redo
|
||||||
@ -1200,21 +1223,50 @@ RED.history = (function () {
|
|||||||
undoHistory[i].dirty = true;
|
undoHistory[i].dirty = true;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Returns a list with undo events.
|
||||||
|
* @returns {Array<HistoryEvent>} The list with undo events
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
list: function () {
|
list: function () {
|
||||||
return undoHistory;
|
return undoHistory;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Returns a list with redo events.
|
||||||
|
* @returns {Array<HistoryEvent>} The list with redo events
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
listRedo: function () {
|
listRedo: function () {
|
||||||
return redoHistory;
|
return redoHistory;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Returns the size of the list with redo events.
|
||||||
|
* @returns {number} The size of the redo list
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
depth: function () {
|
depth: function () {
|
||||||
return undoHistory.length;
|
return undoHistory.length;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Pushes an event to the History. This event can be undo by
|
||||||
|
* calling {@link RED.history.pop pop}.
|
||||||
|
* @param {HistoryEvent} ev The event to push
|
||||||
|
* @returns {void}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
push: function (ev) {
|
push: function (ev) {
|
||||||
undoHistory.push(ev);
|
undoHistory.push(ev);
|
||||||
redoHistory = [];
|
redoHistory = [];
|
||||||
RED.menu.setDisabled("menu-item-edit-undo", false);
|
RED.menu.setDisabled("menu-item-edit-undo", false);
|
||||||
RED.menu.setDisabled("menu-item-edit-redo", true);
|
RED.menu.setDisabled("menu-item-edit-redo", true);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Called to undo an event.
|
||||||
|
* Takes the last event of the undo list, do undo event and adds
|
||||||
|
* the redo event generated to the redo list.
|
||||||
|
* @returns {void}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
pop: function () {
|
pop: function () {
|
||||||
const ev = undoHistory.pop();
|
const ev = undoHistory.pop();
|
||||||
const rev = undoEvent(ev);
|
const rev = undoEvent(ev);
|
||||||
@ -1226,9 +1278,21 @@ RED.history = (function () {
|
|||||||
RED.menu.setDisabled("menu-item-edit-undo", undoHistory.length === 0);
|
RED.menu.setDisabled("menu-item-edit-undo", undoHistory.length === 0);
|
||||||
RED.menu.setDisabled("menu-item-edit-redo", redoHistory.length === 0);
|
RED.menu.setDisabled("menu-item-edit-redo", redoHistory.length === 0);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Returns the last event of undo list.
|
||||||
|
* @returns {HistoryEvent}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
peek: function () {
|
peek: function () {
|
||||||
return undoHistory[undoHistory.length - 1];
|
return undoHistory[undoHistory.length - 1];
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Replaces the last event of undo list by the event given
|
||||||
|
* in parameter.
|
||||||
|
* @param {HistoryEvent} ev The event to replace
|
||||||
|
* @returns {void}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
replace: function (ev) {
|
replace: function (ev) {
|
||||||
if (undoHistory.length === 0) {
|
if (undoHistory.length === 0) {
|
||||||
RED.history.push(ev);
|
RED.history.push(ev);
|
||||||
@ -1236,12 +1300,24 @@ RED.history = (function () {
|
|||||||
undoHistory[undoHistory.length - 1] = ev;
|
undoHistory[undoHistory.length - 1] = ev;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Clears the undo list and redo list.
|
||||||
|
* @returns {void}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
clear: function () {
|
clear: function () {
|
||||||
undoHistory = [];
|
undoHistory = [];
|
||||||
redoHistory = [];
|
redoHistory = [];
|
||||||
RED.menu.setDisabled("menu-item-edit-undo", true);
|
RED.menu.setDisabled("menu-item-edit-undo", true);
|
||||||
RED.menu.setDisabled("menu-item-edit-redo", true);
|
RED.menu.setDisabled("menu-item-edit-redo", true);
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
* Called to redo an event.
|
||||||
|
* Takes the last event of the redo list, do redo event and adds
|
||||||
|
* the undo event generated to the undo list.
|
||||||
|
* @returns {void}
|
||||||
|
* @memberof RED.history
|
||||||
|
*/
|
||||||
redo: function () {
|
redo: function () {
|
||||||
const ev = redoHistory.pop();
|
const ev = redoHistory.pop();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user