FIX: form basics initialization
This commit is contained in:
parent
f30b21d633
commit
6475a5a47b
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
|
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"author": "Tony Air <tony@twma.pro>",
|
"author": "Tony Air <tony@twma.pro>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",
|
"description": "This UI Kit allows you to build Bootstrap 4 webapp with some extra UI features. It's easy to extend and easy to convert HTML templates to CMS templates.",
|
||||||
|
|
|
@ -25,6 +25,9 @@ const FormBasics = (($) => {
|
||||||
const $el = $(el);
|
const $el = $(el);
|
||||||
|
|
||||||
ui._el = el;
|
ui._el = el;
|
||||||
|
ui.dispose();
|
||||||
|
|
||||||
|
console.log(`${NAME}: init`);
|
||||||
$el.data(DATA_KEY, this);
|
$el.data(DATA_KEY, this);
|
||||||
|
|
||||||
//$('[data-inputmask]').inputmask();
|
//$('[data-inputmask]').inputmask();
|
||||||
|
@ -36,7 +39,9 @@ const FormBasics = (($) => {
|
||||||
new FormFieldUI(el);
|
new FormFieldUI(el);
|
||||||
});
|
});
|
||||||
|
|
||||||
const $selectFields = $el.find('select:not([readonly])');
|
const $selectFields = $el
|
||||||
|
.find('select:not([readonly])')
|
||||||
|
.not('.no-select2');
|
||||||
const $radioOptions = $el.find('input[type="radio"]');
|
const $radioOptions = $el.find('input[type="radio"]');
|
||||||
|
|
||||||
$selectFields.each((i, el) => {
|
$selectFields.each((i, el) => {
|
||||||
|
@ -90,16 +95,24 @@ const FormBasics = (($) => {
|
||||||
|
|
||||||
// Public methods
|
// Public methods
|
||||||
dispose() {
|
dispose() {
|
||||||
const $el = $(this._el);
|
console.log(`${NAME}: dispose`);
|
||||||
|
const ui = this;
|
||||||
|
|
||||||
const $selectFields = $el.find('select:not([readonly])');
|
const $el = $(ui._el);
|
||||||
|
|
||||||
|
const $selectFields = $el
|
||||||
|
.find('select:not([readonly])')
|
||||||
|
.not('.no-select2');
|
||||||
$selectFields.each((i, el) => {
|
$selectFields.each((i, el) => {
|
||||||
$(el).select2('destroy');
|
const $el = $(el);
|
||||||
|
if ($el.hasClass('select2-hidden-accessible')) {
|
||||||
|
$el.select2('destroy');
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.removeData(ui._el, DATA_KEY);
|
||||||
|
ui._el = null;
|
||||||
$el.removeClass(`${NAME}-active`);
|
$el.removeClass(`${NAME}-active`);
|
||||||
$.removeData(this._el, DATA_KEY);
|
|
||||||
this._el = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static _jQueryInterface() {
|
static _jQueryInterface() {
|
||||||
|
@ -119,7 +132,7 @@ const FormBasics = (($) => {
|
||||||
// jQuery interface
|
// jQuery interface
|
||||||
$.fn[NAME] = FormBasics._jQueryInterface;
|
$.fn[NAME] = FormBasics._jQueryInterface;
|
||||||
$.fn[NAME].Constructor = FormBasics;
|
$.fn[NAME].Constructor = FormBasics;
|
||||||
$.fn[NAME].noConflict = function() {
|
$.fn[NAME].noConflict = function () {
|
||||||
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
$.fn[NAME] = JQUERY_NO_CONFLICT;
|
||||||
return FormBasics._jQueryInterface;
|
return FormBasics._jQueryInterface;
|
||||||
};
|
};
|
||||||
|
|
|
@ -29,6 +29,7 @@ img {
|
||||||
|
|
||||||
.a {
|
.a {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
color: $link-color;
|
||||||
}
|
}
|
||||||
|
|
||||||
.a,
|
.a,
|
||||||
|
|
Loading…
Reference in New Issue