Sha256: e336f7fe39e15f095bd0bfa7eb5349c9462d88cee87e5389ff43d153ea6ec790
Contents?: true
Size: 1.31 KB
Versions: 44
Compression:
Stored size: 1.31 KB
Contents
((exports) => { class FieldDependentInputsComponent { constructor(options = {}) { this.controllerField = options.controllerField; this.wrapperSelector = options.wrapperSelector; this.dependentFieldsSelector = options.dependentFieldsSelector; this.dependentInputSelector = options.dependentInputSelector; this.enablingCondition = options.enablingCondition; this._bindEvent(); this._run(); } _run() { const $controllerField = this.controllerField; const $dependentFields = $controllerField.parents(this.wrapperSelector).find(this.dependentFieldsSelector); const $dependentInputs = $dependentFields.find(this.dependentInputSelector); if (this.enablingCondition($controllerField)) { $dependentInputs.prop("disabled", false); $dependentFields.show(); } else { $dependentInputs.prop("disabled", true); $dependentFields.hide(); } } _bindEvent() { this.controllerField.on("change", () => { this._run(); }); } } exports.DecidimAdmin = exports.DecidimAdmin || {}; exports.DecidimAdmin.FieldDependentInputsComponent = FieldDependentInputsComponent; exports.DecidimAdmin.createFieldDependentInputs = (options) => { return new FieldDependentInputsComponent(options); }; })(window);
Version data entries
44 entries across 44 versions & 1 rubygems