Constructor
new ve.dm.InternalList(doc)
#
DataModel meta item.
Parameters:
| Name | Type | Description |
|---|---|---|
doc |
ve.dm.Document | Document model |
- Mixes in:
- Source:
Properties
documentprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
document |
ve.dm.Document | The document this internal list is in a 1:1 relationship with |
- Source:
groupsChangedprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
groupsChanged |
Array.<string> | Array of group names; array index is meaningless |
- Source:
itemHtmlQueueprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
itemHtmlQueue |
Array.<string> | Array of HTML strings. Emptied after |
- Source:
keyIndexesprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
keyIndexes |
Object.<string, number> | Internal item index, keyed by "listGroup/listKey" |
- Source:
listNodeprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
listNode |
ve.dm.InternalListNode
|
null
|
The corresponding data model node this meta
item belongs to. Lazy-initialized via |
- Source:
nodesprivate
#
Properties:
| Name | Type | Description |
|---|---|---|
nodes |
Object.<string, ve.dm.InternalListNodeGroup> | Keyed by group name |
- Source:
Methods
addNode(listGroup, listKey, listIndex, node)
#
Add a node.
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | |
listKey |
string | |
listIndex |
number | New item index, or an existing one to replace an item |
node |
ve.dm.Node | Reference node to add |
- Source:
clone([doc]) → {ve.dm.InternalList}
#
Clone this internal list.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
doc |
ve.dm.Document |
optional |
The new list's document. Defaults to this list's document. |
Returns:
- Type
- ve.dm.InternalList
- Source:
convertToData(converter, doc) → {Array.<ve.dm.LinearData.Item>}
#
Converts stored item HTML into linear data.
Each item is an InternalItem, and they are wrapped in an InternalList. If there are no items an empty array is returned.
Stored HTML is deleted after conversion.
Parameters:
| Name | Type | Description |
|---|---|---|
converter |
ve.dm.ModelFromDomConverter | |
doc |
HTMLDocument | Document to create nodes in |
Returns:
Linear model data
- Type
- Array.<ve.dm.LinearData.Item>
- Source:
getDocument() → {ve.dm.Document}
#
getItemInsertion(listGroup, listKey, data) → {Object}
#
Generate a transaction for inserting a new internal item node
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | |
listKey |
string | |
data |
Array.<ve.dm.LinearData.Item> | Linear model data |
Returns:
Object containing the transaction (or null if none required) and the new item's index within the list
- Type
- Object
- Source:
getItemNode(index) → {ve.dm.InternalItemNode|undefined}
#
undefined}
#
Get the item node from a specific index.
Parameters:
| Name | Type | Description |
|---|---|---|
index |
number | Item index, use |
Returns:
- Type
-
ve.dm.InternalItemNode
|
undefined
- Source:
getItemNodeCount() → {number}
#
Get the number it internal items in the internal list.
Returns:
- Type
- number
- Source:
getKeyIndex(listGroup, listKey) → {number|undefined}private
#
undefined}private
#
Get the internal item index of a group key if it already exists
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | |
listKey |
string |
Returns:
The index of the group key, or undefined if it doesn't exist yet
- Type
-
number
|
undefined
- Source:
getListGroupNames() → {Array.<string>}
#
getListNode() → {ve.dm.InternalListNode}
#
Get the list node
Returns:
List node
- Source:
getNextUniqueNumber() → {number}
#
Get the next number in a monotonically increasing series.
Returns:
One higher than the return value of the previous call, or 0 on the first call
- Type
- number
- Source:
getNodeGroup(listGroup) → {ve.dm.InternalListNodeGroup|undefined}
#
undefined}
#
Get the node group object for a specified group name.
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | Name of the group |
Returns:
Node group object, containing nodes and key order array
- Type
-
ve.dm.InternalListNodeGroup
|
undefined
- Source:
getNodeGroups() → {Object.<string, ve.dm.InternalListNodeGroup>}
#
Get all node groups.
Returns:
Node groups, keyed by group name
- Type
- Object.<string, ve.dm.InternalListNodeGroup>
- Source:
markGroupAsChanged(listGroup)private
#
Mark a node group as having been changed since the last transaction.
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | Name of group which has changed |
- Source:
merge(list, commonLength) → {Object}
#
Merge another internal list into this one.
This function updates the state of this list, and returns a mapping from indexes in list to indexes in this, as well as a set of ranges that should be copied from list's linear model into this list's linear model by the caller.
Parameters:
| Name | Type | Description |
|---|---|---|
list |
ve.dm.InternalList | Internal list to merge into this list |
commonLength |
number | The number of elements, counted from the beginning, that the lists have in common |
Returns:
mapping is an object mapping indexes in list to indexes in this; newItemRanges is an array of ranges of internal nodes in list's document that should be copied into our document
- Type
- Object
- Source:
onTransact()private
#
Handle document transaction events
Fires:
- Source:
queueItemHtml(listGroup, listKey, html) → {Object}
#
Queues up an item's html for parsing later.
If an item with the specified group and key already exists it will be ignored, unless the data already stored is an empty string.
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | |
listKey |
string | |
html |
string | Item contents |
Returns:
Object containing index of the item in the index-value store (and also its index in the internal list node), and a flag indicating if it is a new item.
- Type
- Object
- Source:
removeNode(listGroup, listKey, listIndex, node)
#
Remove a node.
Parameters:
| Name | Type | Description |
|---|---|---|
listGroup |
string | |
listKey |
string | |
listIndex |
number | |
node |
ve.dm.Node | Reference node to remove |
- Source: