UNPKG

@aurigma/design-atoms-model

Version:

Design Atoms is a part of Customer's Canvas SDK which allows for manipulating individual design elements through your code.

72 lines 2.16 kB
import { ModelComponent } from "../ModelComponent"; import { equals } from "../../Utils/Utils"; import { arraysIsEqual } from "@aurigma/utils-js/algorithms/array"; export class InStringPlaceholder extends ModelComponent { constructor(id, name, mask, value, values) { super(); this.id = id; this._name = name; this._mask = mask; this._value = value; this._values = values; } get mask() { return this._mask; } set mask(value) { if (value == this._mask) return; this._mask = value; this._propertyChanged.notify(this, "mask"); } get value() { return this._value; } set value(value) { if (value == this._value) return; this._value = value; this._propertyChanged.notify(this, "value"); } get values() { return this._values; } set values(values) { if (values == this._values) return; this._values = values; this._propertyChanged.notify(this, "values"); } generateNewIds() { this._generateNewId(); } _copy(source, destination, generateNewIds) { super._copy(source, destination, false); destination.mask = source.mask; destination.value = source.value; destination.values = [...source.values]; return destination; } clone(generateNewIds = false) { const placeholder = new InStringPlaceholder(); this._copy(this, placeholder, generateNewIds); return placeholder; } equals(other) { return super.equals(other) && equals(this.mask, other.mask) && equals(this.value, other.value) && arraysIsEqual(this.values, other.values); } getSimplifiedObject() { return { id: this.id, mask: this.mask, value: this.value, values: this.values, name: this.name }; } } export default InStringPlaceholder; //# sourceMappingURL=InStringPlaceholder.js.map