author Dannon Baker <dannon.baker@gmail.com> 1580426715 -0500
committer Dannon Baker <dannon.baker@gmail.com> 1581649360 -0500

Drop bower exclusion from babel-loader.

We need to transpile bootstrap-vue, otherwise edge blows up.

Edge can't handle two events on the same element (?!?!?!) and silently
just doesn't fire change when there's also an input binding here?

Update commentary for babel stage excludes

Add IMask functionality for initial input masking (similar to previous functionality, but a little more robust).  We may want to work on the regex here.

Fix unused var/eslint

Adjust karma's webpack config to completely ignore node-modules for transpilation, fixes it messing with bootstrap-vue and failing

Client format...
This commit is contained in:
Dannon Baker
2020-02-13 22:07:37 -05:00
parent fc713a3cd5
commit 33f528a07a
3 changed files with 28 additions and 18 deletions
+17 -13
View File
@@ -1,4 +1,5 @@
import Backbone from "backbone";
import IMask from "imask";
import Utils from "utils/utils";
@@ -23,20 +24,23 @@ const View = Backbone.View.extend({
this.$text = this.$(".ui-form-slider-text");
this.$slider = this.$(".ui-form-slider-element");
// add text field event
this.$text
.on("change", e => {
this.value(e.currentTarget.value);
})
.on("input", e => {
const input = e.currentTarget;
if (this._isParameter(input.value)) {
return;
} else if (!this.model.get("precise")) {
input.value = input.value.split(".")[0];
IMask(this.$text[0], {
mask: value => {
if (this._isParameter(value)) {
return true;
}
input.value = input.value.replace(/[^0-9eE.-]/g, "");
});
if (!this.model.get("precise")) {
if (value != value.split(".")[0]) {
return false;
}
}
return value == value.replace(/[^0-9eE.-]/g, "");
}
});
this.$text[0].addEventListener("change", e => {
this.value(e.currentTarget.value);
});
// build slider, cannot be rebuild in render
const opts = this.model.attributes;
+5
View File
@@ -36,9 +36,14 @@ module.exports = (env, argv) => {
// Using babel-plugin-rewire to handle dependency mocking since webpack 4
// exports immutable bindings for ES modules but we still need a way to
// overwrite dependencies during unit-testing.
//
// Additionally, set exclude for babel-loader to completely ignore *all*
// node-modules, without our exceptions to support IE as in parent webpack
// config.
wpConfig.module.rules = wpConfig.module.rules.map(rule => {
if (rule.loader == "babel-loader") {
rule.exclude = [/(node_modules\/)/]
rule.options.plugins.push("rewire");
}
return rule;
+6 -5
View File
@@ -66,11 +66,12 @@ module.exports = (env = {}, argv = {}) => {
},
{
test: /\.js$/,
// Pretty sure we don't want anything except node_modules here
exclude: [
/(node_modules\/(?!(handsontable)\/)|bower_components)/,
libsBase
],
/*
* Babel transpile excludes for:
* - all node_modules except for handsontable, bootstrap-vue
* - statically included libs (like old jquery plugins, etc.)
*/
exclude: [/(node_modules\/(?!(handsontable|bootstrap-vue)\/))/, libsBase],
loader: "babel-loader",
options: {
cacheDirectory: true,