CartControl

Cart control that syncs with a datasource and exposes pending vs verified state.

Import
the javascript logo
import { CartControl } from "@schukai/monster/source/components/form/cart-control.mjs";
Source
the git logo
Package
the npm logo
Since
1.0.0

HTML Structure

<monster-cart-control></monster-cart-control>

JavaScript Initialization

const element = document.createElement('monster-cart-control');
document.body.appendChild(element);

Exported

CartControl

Derived from

CustomControl

Options

The Options listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class. Therefore, it inherits Options from these parent classes. If you cannot find a specific Options in this list, we recommend consulting the documentation of the CustomControl.

Option
Type
Default
Description
templates
object
Template definitions
templates.main
string
undefined
Main template
labels
object
undefined
Labels
datasource
object
Datasource configuration
datasource.selector
string
Selector for datasource
datasource.rest
object
Rest datasource config
cart
object
Cart write configuration
mapping
object
Response mapping
state
object
Control state
actions
object
Callback actions

  • since
  • deprecated

Properties and Attributes

The Properties and Attributes listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits Properties and Attributes from these parent classes. If you cannot find a specific Properties and Attributes in this list, we recommend consulting the documentation of the CustomControl.

  • data-monster-options: Sets the configuration options for the collapse component when used as an HTML attribute.
  • data-monster-option-[name]: Sets the value of the configuration option [name] for the collapse component when used as an HTML attribute.

Methods

The methods listed in this section are defined directly within the class. This class is derived from several parent classes, including the CustomElement class and ultimately from HTMLElement. Therefore, it inherits methods from these parent classes. If you cannot find a specific method in this list, we recommend consulting the documentation of the CustomControl.

Behavioral methods

addOrChange(payload)
Parameters
  • payload {object}: payload
Add or change an item in the cart.
refresh()
Returns
  • {CartControl}
Re-apply mapped data from options or datasource.

Static methods

[instanceSymbol]()
No description available.
getCSSStyleSheet()
No description available.
getTag()
No description available.

Lifecycle methods

Lifecycle methods are called by the environment and are usually not intended to be called directly.

[assembleMethodSymbol]()
No description available.

Events

The component emits the following events:

  • monster-cart-control-pending
  • monster-cart-control-verified
  • monster-cart-control-error
  • monster-cart-control-update

For more information on how to handle events, see the mdn documentation.

The current width of the area is too small to display the content correctly.