This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
libecho:classes:inventory [2022/05/22 12:11] – [onClose( config )] lee | libecho:classes:inventory [2022/05/22 18:29] – lee | ||
---|---|---|---|
Line 24: | Line 24: | ||
* item: the thing to be added to the Inventory. | * item: the thing to be added to the Inventory. | ||
* actor: the (optional, can be null) Person that is doing the adding. | * actor: the (optional, can be null) Person that is doing the adding. | ||
- | * force: if true, the item will be added regardless | + | * force: if true, the pre- and post- functions will not be called, and item will be added regardless. |
* Returns: true if the item was added or was already in the inventory, or false if the item could not be added to the inventory. | * Returns: true if the item was added or was already in the inventory, or false if the item could not be added to the inventory. | ||
Line 34: | Line 34: | ||
* item: the thing to be removed from the Inventory. | * item: the thing to be removed from the Inventory. | ||
* actor: the (optional, can be null) Person that is doing the removal. | * actor: the (optional, can be null) Person that is doing the removal. | ||
- | * force: if true, the item will be removed regardless | + | * force: if true, the pre- and post- functions will not be called, and item will be removed regardless. |
* Returns: true if the item was removed or was not in the inventory to begin with, or false if the item could not be removed from the inventory. | * Returns: true if the item was removed or was not in the inventory to begin with, or false if the item could not be removed from the inventory. | ||
Line 105: | Line 105: | ||
==== The Configuration Object ==== | ==== The Configuration Object ==== | ||
- | The configuration object can contain a number of fields. | + | The configuration object can contain a number of fields. |
For more information, | For more information, | ||
Line 137: | Line 137: | ||
=== allowClose( config ) === | === allowClose( config ) === | ||
If this function returns a String, that value will be printed in place of the " | If this function returns a String, that value will be printed in place of the " | ||
- | * Type: Function | + | * Type: Function |
+ | * Returns: | ||
* Default: undefined | * Default: undefined | ||
* Optional | * Optional | ||
Line 149: | Line 150: | ||
=== leftAction === | === leftAction === | ||
The action label for moving item from left inventory. | The action label for moving item from left inventory. | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: " | * Default: " | ||
* Optional | * Optional | ||
Line 155: | Line 156: | ||
=== leftActioned === | === leftActioned === | ||
The left action success word. " | The left action success word. " | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: " | * Default: " | ||
* Optional | * Optional | ||
Line 161: | Line 162: | ||
=== rightAction === | === rightAction === | ||
The action label for moving item from right inventory. | The action label for moving item from right inventory. | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: " | * Default: " | ||
* Optional | * Optional | ||
Line 167: | Line 168: | ||
=== rightActioned === | === rightActioned === | ||
The left action success word. " | The left action success word. " | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: " | * Default: " | ||
* Optional | * Optional | ||
- | === canShowOnLeft === | + | === canShowOnLeft( item, config ) === |
Called to check if the object will be displayed in left inventory at all. | Called to check if the object will be displayed in left inventory at all. | ||
- | * Type: Boolean | + | * Type: Function |
+ | * Returns: Boolean | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
* Default: true | * Default: true | ||
* Optional | * Optional | ||
- | === canShowOnRight === | + | === canShowOnRight( item, config ) === |
Called to check if the object will be displayed in right inventory at all. | Called to check if the object will be displayed in right inventory at all. | ||
- | * Type: Boolean | + | * Type: Function |
+ | * Returns: Boolean | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
* Default: true | * Default: true | ||
* Optional | * Optional | ||
- | === canMoveFromLeft === | + | === canMoveFromLeft( item, config ) === |
The item will be shown in the left inventory, but will we show the control to move it to the right inventory? | The item will be shown in the left inventory, but will we show the control to move it to the right inventory? | ||
- | * Type: Boolean | + | * Type: Function |
+ | * Returns: Boolean | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
* Default: true | * Default: true | ||
* Optional | * Optional | ||
- | === canMoveFromRight === | + | === canMoveFromRight( item, config ) === |
The item will be shown in the right inventory, but will we show the control to move it to the right inventory? | The item will be shown in the right inventory, but will we show the control to move it to the right inventory? | ||
- | * Type: Boolean | + | * Type: Function |
+ | * Returns: Boolean | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
* Default: true | * Default: true | ||
* Optional | * Optional | ||
- | === getSortCategory === | + | === getSortCategory( item, inventory, config ) === |
Return object category for the sort selector. | Return object category for the sort selector. | ||
- | * Type: String | + | * Type: Function |
+ | * Returns: String | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * // | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
* Default: item.inventoryCategory | " | * Default: item.inventoryCategory | " | ||
* Optional | * Optional | ||
Line 203: | Line 220: | ||
=== canShowLeftSelector === | === canShowLeftSelector === | ||
Will the left selector be shown? | Will the left selector be shown? | ||
- | * Type: Boolean | + | * Type: Boolean | or Function(config) returning |
* Default: true | * Default: true | ||
* Optional | * Optional | ||
Line 209: | Line 226: | ||
=== canShowRightSelector === | === canShowRightSelector === | ||
Will the right selector be shown? | Will the right selector be shown? | ||
- | * Type: Boolean | + | * Type: Boolean | or Function(config) returning |
* Default: true | * Default: true | ||
* Optional | * Optional | ||
- | === moveFromLeft === | + | === moveFromLeft( item, config ) === |
Function to call to move item from left to right inventory. If undefined, the built-in implementation will be used. | Function to call to move item from left to right inventory. If undefined, the built-in implementation will be used. | ||
- | * Type: Function (returning void) | + | * Type: Function |
- | * Default: | + | * Returns: Void |
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
+ | * Default: | ||
* Optional | * Optional | ||
- | === moveFromRight === | + | === moveFromRight( item, config ) === |
Function to call to move item from right to left inventory. If undefined, the built-in implementation will be used. | Function to call to move item from right to left inventory. If undefined, the built-in implementation will be used. | ||
- | * Type: Function (returning | + | * Type: Function |
- | * Default: | + | * Returns: Void |
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
+ | * Default: the builtin implementation is used if none is defined in the config object | ||
+ | * Optional | ||
+ | |||
+ | === leftTitle === | ||
+ | Override the left title. | ||
+ | * Type: String | Function(config) | ||
+ | * Default: if the left inventory is a Person then " | ||
+ | * Optional | ||
+ | |||
+ | === rightTitle === | ||
+ | Override the right title. | ||
+ | * Type: String | Function(config) returning String | ||
+ | * Default: if the right inventory is a Person then " | ||
+ | * Optional | ||
+ | |||
+ | === leftName( item, config ) === | ||
+ | Override the left label for item. | ||
+ | * Type: Function | ||
+ | * Returns: String | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
+ | * Default: the item's AName | ||
+ | * Optional | ||
+ | |||
+ | === rightName( item, config ) === | ||
+ | Override the right label for item. | ||
+ | * Type: Function | ||
+ | * Returns: String | ||
+ | * //item//: The item which we are checking whether or not we should show. | ||
+ | * //config//: The config object that was passed to InventoryIU.render(). | ||
+ | * Default: | ||
* Optional | * Optional | ||
=== outerTpl === | === outerTpl === | ||
Override the builtin outer HTML template. | Override the builtin outer HTML template. | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: undefined | * Default: undefined | ||
* Optional | * Optional | ||
Line 233: | Line 286: | ||
=== listitemTplLeft === | === listitemTplLeft === | ||
Override the builtin left list item HTML template. | Override the builtin left list item HTML template. | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: undefined | * Default: undefined | ||
* Optional | * Optional | ||
Line 239: | Line 292: | ||
=== listitemTplRight === | === listitemTplRight === | ||
Override the builtin right list item HTML template. | Override the builtin right list item HTML template. | ||
- | * Type: String | + | * Type: String | Function(config) returning |
* Default: undefined | * Default: undefined | ||
* Optional | * Optional | ||
- | === leftTitle | + | === detailsTpl |
- | Override the left title. | + | Override the builtin item details HTML template. |
- | * Type: String | + | * Type: String |
- | * Default: undefined | + | |
- | * Optional | + | |
- | + | ||
- | === rightTitle === | + | |
- | Override the right title. | + | |
- | * Type: String | + | |
* Default: undefined | * Default: undefined | ||
* Optional | * Optional | ||