FIX: form basics initialization

This commit is contained in:
Tony Air 2020-06-25 16:53:52 +07:00
parent f30b21d633
commit 6475a5a47b
7 changed files with 26 additions and 12 deletions

2
dist/css/app.css vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
dist/js/app.js vendored

File diff suppressed because one or more lines are too long

2
dist/js/app.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "@a2nt/ss-bootstrap-ui-webpack-boilerplate",
"version": "2.2.1",
"version": "2.2.2",
"author": "Tony Air <tony@twma.pro>",
"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.",

View File

@ -25,6 +25,9 @@ const FormBasics = (($) => {
const $el = $(el);
ui._el = el;
ui.dispose();
console.log(`${NAME}: init`);
$el.data(DATA_KEY, this);
//$('[data-inputmask]').inputmask();
@ -36,7 +39,9 @@ const FormBasics = (($) => {
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"]');
$selectFields.each((i, el) => {
@ -90,16 +95,24 @@ const FormBasics = (($) => {
// Public methods
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) => {
$(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`);
$.removeData(this._el, DATA_KEY);
this._el = null;
}
static _jQueryInterface() {
@ -119,7 +132,7 @@ const FormBasics = (($) => {
// jQuery interface
$.fn[NAME] = FormBasics._jQueryInterface;
$.fn[NAME].Constructor = FormBasics;
$.fn[NAME].noConflict = function() {
$.fn[NAME].noConflict = function () {
$.fn[NAME] = JQUERY_NO_CONFLICT;
return FormBasics._jQueryInterface;
};

View File

@ -29,6 +29,7 @@ img {
.a {
cursor: pointer;
color: $link-color;
}
.a,