reduce lodash size

editing
Ondřej Hruška 6 years ago
parent 6cfd5aa7e9
commit b1039ee984
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 127
      package-lock.json
  2. 7
      package.json
  3. 2
      resources/assets/js/base-setup.js
  4. 8
      resources/assets/js/components/RowEditor.vue
  5. 5
      resources/assets/js/udash.js
  6. 3
      webpack.mix.js

127
package-lock.json generated

@ -365,6 +365,12 @@
"integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=", "integrity": "sha1-NhIfhFwFeBct5Bmpfb6x0W7DRUI=",
"dev": true "dev": true
}, },
"async-limiter": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.0.tgz",
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true
},
"asynckit": { "asynckit": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
@ -1226,6 +1232,17 @@
"integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=", "integrity": "sha1-5tXqjF2tABMEpwsiY4RH9pyy+Ak=",
"dev": true "dev": true
}, },
"bfj-node4": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/bfj-node4/-/bfj-node4-5.3.1.tgz",
"integrity": "sha512-SOmOsowQWfXc7ybFARsK3C4MCOWzERaOMV/Fl3Tgjs+5dJWyzo3oa127jL44eMbQiAN17J7SvAs2TRxEScTUmg==",
"dev": true,
"requires": {
"bluebird": "^3.5.1",
"check-types": "^7.3.0",
"tryer": "^1.0.0"
}
},
"big.js": { "big.js": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz",
@ -1823,6 +1840,12 @@
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=", "integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=",
"dev": true "dev": true
}, },
"check-types": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/check-types/-/check-types-7.4.0.tgz",
"integrity": "sha512-YbulWHdfP99UfZ73NcUDlNJhEIDgm9Doq9GhpyXbF+7Aegi3CVV7qqMCKTTqJxlvEvnQBp9IA+dxsGN6xK/nSg==",
"dev": true
},
"chokidar": { "chokidar": {
"version": "2.0.4", "version": "2.0.4",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz",
@ -3254,6 +3277,12 @@
"ware": "^1.2.0" "ware": "^1.2.0"
} }
}, },
"duplexer": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.1.tgz",
"integrity": "sha1-rOb/gIwc5mtX0ev5eXessCM0z8E=",
"dev": true
},
"duplexer2": { "duplexer2": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz", "resolved": "https://registry.npmjs.org/duplexer2/-/duplexer2-0.1.4.tgz",
@ -3307,6 +3336,12 @@
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=", "integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0=",
"dev": true "dev": true
}, },
"ejs": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/ejs/-/ejs-2.6.1.tgz",
"integrity": "sha512-0xy4A/twfrRCnkhfk8ErDi5DqdAsAqeGxht4xkCUrsvhhbQNs7E+4jV0CN7+NKIY0aHE72+XvqtBIXzD31ZbXQ==",
"dev": true
},
"electron-to-chromium": { "electron-to-chromium": {
"version": "1.3.51", "version": "1.3.51",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.51.tgz", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.51.tgz",
@ -4043,6 +4078,12 @@
"trim-repeated": "^1.0.0" "trim-repeated": "^1.0.0"
} }
}, },
"filesize": {
"version": "3.6.1",
"resolved": "https://registry.npmjs.org/filesize/-/filesize-3.6.1.tgz",
"integrity": "sha512-7KjR1vv6qnicaPMi1iiTcI85CyYwRO/PSFCu6SvqL8jN2Wjt/NIYQTFtFs7fSDCYOstUkEWIQGFUg5YZQfjlcg==",
"dev": true
},
"fill-range": { "fill-range": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz",
@ -4338,14 +4379,12 @@
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"brace-expansion": { "brace-expansion": {
"version": "1.1.11", "version": "1.1.11",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"balanced-match": "^1.0.0", "balanced-match": "^1.0.0",
"concat-map": "0.0.1" "concat-map": "0.0.1"
@ -4360,20 +4399,17 @@
"code-point-at": { "code-point-at": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"concat-map": { "concat-map": {
"version": "0.0.1", "version": "0.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"console-control-strings": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
@ -4490,8 +4526,7 @@
"inherits": { "inherits": {
"version": "2.0.3", "version": "2.0.3",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"ini": { "ini": {
"version": "1.3.5", "version": "1.3.5",
@ -4503,7 +4538,6 @@
"version": "1.0.0", "version": "1.0.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"number-is-nan": "^1.0.0" "number-is-nan": "^1.0.0"
} }
@ -4518,7 +4552,6 @@
"version": "3.0.4", "version": "3.0.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"brace-expansion": "^1.1.7" "brace-expansion": "^1.1.7"
} }
@ -4526,14 +4559,12 @@
"minimist": { "minimist": {
"version": "0.0.8", "version": "0.0.8",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"minipass": { "minipass": {
"version": "2.2.4", "version": "2.2.4",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"safe-buffer": "^5.1.1", "safe-buffer": "^5.1.1",
"yallist": "^3.0.0" "yallist": "^3.0.0"
@ -4552,7 +4583,6 @@
"version": "0.5.1", "version": "0.5.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"minimist": "0.0.8" "minimist": "0.0.8"
} }
@ -4633,8 +4663,7 @@
"number-is-nan": { "number-is-nan": {
"version": "1.0.1", "version": "1.0.1",
"bundled": true, "bundled": true,
"dev": true, "dev": true
"optional": true
}, },
"object-assign": { "object-assign": {
"version": "4.1.1", "version": "4.1.1",
@ -4646,7 +4675,6 @@
"version": "1.4.0", "version": "1.4.0",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"wrappy": "1" "wrappy": "1"
} }
@ -4768,7 +4796,6 @@
"version": "1.0.2", "version": "1.0.2",
"bundled": true, "bundled": true,
"dev": true, "dev": true,
"optional": true,
"requires": { "requires": {
"code-point-at": "^1.0.0", "code-point-at": "^1.0.0",
"is-fullwidth-code-point": "^1.0.0", "is-fullwidth-code-point": "^1.0.0",
@ -5398,6 +5425,16 @@
"glogg": "^1.0.0" "glogg": "^1.0.0"
} }
}, },
"gzip-size": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-4.1.0.tgz",
"integrity": "sha1-iuCWJX6r59acRb4rZ8RIEk/7UXw=",
"dev": true,
"requires": {
"duplexer": "^0.1.1",
"pify": "^3.0.0"
}
},
"handle-thing": { "handle-thing": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz", "resolved": "https://registry.npmjs.org/handle-thing/-/handle-thing-1.2.5.tgz",
@ -6882,6 +6919,12 @@
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==",
"dev": true "dev": true
}, },
"lodash-es": {
"version": "4.17.10",
"resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.10.tgz",
"integrity": "sha512-iesFYPmxYYGTcmQK0sL8bX3TGHyM6b2qREaB4kamHfQyfPJP0xgoGxp19nsH16nsfquLdiyKyX3mQkfiSGV8Rg==",
"dev": true
},
"lodash._baseassign": { "lodash._baseassign": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz",
@ -8076,6 +8119,12 @@
"integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=",
"dev": true "dev": true
}, },
"opener": {
"version": "1.4.3",
"resolved": "https://registry.npmjs.org/opener/-/opener-1.4.3.tgz",
"integrity": "sha1-XG2ixdflgx6P+jlklQ+NZnSskLg=",
"dev": true
},
"opn": { "opn": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz", "resolved": "https://registry.npmjs.org/opn/-/opn-5.3.0.tgz",
@ -12957,6 +13006,12 @@
} }
} }
}, },
"tryer": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/tryer/-/tryer-1.0.1.tgz",
"integrity": "sha512-c3zayb8/kWWpycWYg87P71E1S1ZL6b6IJxfb5fvsUgsf0S2MVGaDhDXXjDMpdCpfWXqptc+4mXwmiy1ypXqRAA==",
"dev": true
},
"tty-browserify": { "tty-browserify": {
"version": "0.0.0", "version": "0.0.0",
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
@ -13703,6 +13758,26 @@
} }
} }
}, },
"webpack-bundle-analyzer": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/webpack-bundle-analyzer/-/webpack-bundle-analyzer-2.13.1.tgz",
"integrity": "sha512-rwxyfecTAxoarCC9VlHlIpfQCmmJ/qWD5bpbjkof+7HrNhTNZIwZITxN6CdlYL2axGmwNUQ+tFgcSOiNXMf/sQ==",
"dev": true,
"requires": {
"acorn": "^5.3.0",
"bfj-node4": "^5.2.0",
"chalk": "^2.3.0",
"commander": "^2.13.0",
"ejs": "^2.5.7",
"express": "^4.16.2",
"filesize": "^3.5.11",
"gzip-size": "^4.1.0",
"lodash": "^4.17.4",
"mkdirp": "^0.5.1",
"opener": "^1.4.3",
"ws": "^4.0.0"
}
},
"webpack-chunk-hash": { "webpack-chunk-hash": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/webpack-chunk-hash/-/webpack-chunk-hash-0.4.0.tgz", "resolved": "https://registry.npmjs.org/webpack-chunk-hash/-/webpack-chunk-hash-0.4.0.tgz",
@ -13981,6 +14056,16 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
"dev": true "dev": true
}, },
"ws": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-4.1.0.tgz",
"integrity": "sha512-ZGh/8kF9rrRNffkLFV4AzhvooEclrOH0xaugmqGsIfFgOE/pIz4fMc4Ef+5HSQqTEug2S9JZIWDR47duDSLfaA==",
"dev": true,
"requires": {
"async-limiter": "~1.0.0",
"safe-buffer": "~5.1.0"
}
},
"xtend": { "xtend": {
"version": "4.0.1", "version": "4.0.1",
"resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz",

@ -12,11 +12,12 @@
"devDependencies": { "devDependencies": {
"axios": "^0.18", "axios": "^0.18",
"bootstrap": "^4.0.0", "bootstrap": "^4.0.0",
"popper.js": "^1.12",
"cross-env": "^5.1", "cross-env": "^5.1",
"jquery": "^3.2", "jquery": "^3.2",
"laravel-mix": "^2.0", "laravel-mix": "^2.0",
"lodash": "^4.17.4", "lodash-es": "^4.17.10",
"vue": "^2.5.7" "popper.js": "^1.12",
"vue": "^2.5.7",
"webpack-bundle-analyzer": "^2.13.1"
} }
} }

@ -1,4 +1,4 @@
window._ = require('lodash'); window._ = require('./udash');
window.Popper = require('popper.js').default window.Popper = require('popper.js').default
/** /**

@ -69,6 +69,7 @@ export default {
busy (yes) { busy (yes) {
$('#draft-busy').css('opacity', yes ? 1 : 0) $('#draft-busy').css('opacity', yes ? 1 : 0)
}, },
query (data, sucfn, erfn) { query (data, sucfn, erfn) {
this.busy(true) this.busy(true)
if (!sucfn) sucfn = ()=>{} if (!sucfn) sucfn = ()=>{}
@ -80,6 +81,7 @@ export default {
this.busy(false) this.busy(false)
}) })
}, },
toggleRowDelete(_id) { toggleRowDelete(_id) {
let remove = !this.rows[_id]._remove let remove = !this.rows[_id]._remove
@ -90,6 +92,7 @@ export default {
this.$set(this.rows, _id, resp.data) this.$set(this.rows, _id, resp.data)
}) })
}, },
submitRowChange(row) { submitRowChange(row) {
this.query({ this.query({
action: 'row.update', action: 'row.update',
@ -102,6 +105,7 @@ export default {
} }
}) })
}, },
toggleRowEditing(_id) { toggleRowEditing(_id) {
if (this.rows[_id]._remove) return false; // can't edit row marked for removal if (this.rows[_id]._remove) return false; // can't edit row marked for removal
@ -113,6 +117,7 @@ export default {
this.$set(this.rows[_id], '_editing', true); this.$set(this.rows[_id], '_editing', true);
} }
}, },
colClasses(col) { colClasses(col) {
return [ return [
'border-top-0', 'border-top-0',
@ -123,15 +128,18 @@ export default {
} }
] ]
}, },
rowStyle(row) { rowStyle(row) {
return { return {
opacity: row._remove? .8 : 1, opacity: row._remove? .8 : 1,
backgroundColor: row._remove? '#FFC4CC': 'transparent' backgroundColor: row._remove? '#FFC4CC': 'transparent'
} }
}, },
isChanged (row, colId) { isChanged (row, colId) {
return row._changed.indexOf(colId) > -1 return row._changed.indexOf(colId) > -1
}, },
revertCell(row, colId) { revertCell(row, colId) {
this.submitRowChange(_.merge({}, row, { [colId]: row._orig[colId] })) this.submitRowChange(_.merge({}, row, { [colId]: row._orig[colId] }))
} }

@ -0,0 +1,5 @@
// subset of used lodash modules
export { default as each } from 'lodash-es/each';
export { default as isUndefined } from 'lodash-es/isUndefined';
export { default as merge } from 'lodash-es/merge';

3
webpack.mix.js vendored

@ -1,5 +1,6 @@
let mix = require('laravel-mix'); let mix = require('laravel-mix');
let webpack = require('webpack'); let webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@ -24,7 +25,9 @@ mix.webpackConfig({
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
'$': 'jquery', '$': 'jquery',
jQuery: 'jquery', jQuery: 'jquery',
lodash: 'lodash-es',
}), }),
//new BundleAnalyzerPlugin(),
], ],
}); });

Loading…
Cancel
Save