/* global global:writable */ import { Utility } from '../../core/utility'; import { Datepicker } from '../form/datepicker'; import './mass-input.sass'; const MASS_INPUT_CELL_SELECTOR = '.massinput__cell'; const MASS_INPUT_ADD_CELL_SELECTOR = '.massinput__cell--add'; const MASS_INPUT_SUBMIT_BUTTON_CLASS = 'massinput__submit-button'; const MASS_INPUT_INITIALIZED_CLASS = 'mass-input--initialized'; const MASS_INPUT_ADD_CHANGE_FIELD_SELECTOR = 'select, input[type=radio]'; // const MASS_INPUT_SAFETY_SUBMITTED_CLASS = 'massinput--safety-submitted'; // const MASS_INPUT_SAFETY_SUBMITTED_TIMEOUT = 1000; @Utility({ selector: '[uw-mass-input]', }) export class MassInput { _element; _app; _global; _massInputId; _massInputFormSubmitHandler; _massInputForm; _changedAdd = new Array(); constructor(element, app) { if (!element) { throw new Error('Mass Input utility cannot be setup without an element!'); } this._element = element; this._app = app; if (global !== undefined) this._global = global; else if (window !== undefined) this._global = window; else throw new Error('Cannot setup Mass Input utility without window or global'); if (this._element.classList.contains(MASS_INPUT_INITIALIZED_CLASS)) { return false; } this._massInputId = this._element.dataset.massInputIdent || '_'; this._massInputForm = this._element.closest('form'); if (!this._massInputForm) { throw new Error('Mass Input utility cannot be setup without being wrapped in a