Browse Source

无jira任务 去掉ie8相关的兼容

es6
imp 3 years ago
parent
commit
126f6b976d
  1. 6
      .npmignore
  2. 321
      dist/fix/fix.compact.ie.js
  3. 68
      dist/fix/fix.compact.js
  4. 1050
      dist/fix/fix.ie.js
  5. 4
      lib/postbuild/postbuild.js
  6. 47
      webpack/attachments.js
  7. 1
      webpack/dirs.js
  8. 11
      webpack/webpack.common.js
  9. 3
      webpack/webpack.prod.js

6
.npmignore

@ -12,8 +12,6 @@
!dist/fineui_without_normalize.min.css
!dist/fineui.min.js
!dist/fineui.min.js.map
!dist/fineui.ie.min.js
!dist/fineui.ie.min.js.map
!dist/core.css
!dist/core.js
!dist/resource.css
@ -23,8 +21,6 @@
!dist/utils.min.js
!dist/utils.min.js.map
!dist/fineui_without_jquery_polyfill.js
!dist/2.0/fineui.ie.min.js
!dist/2.0/fineui.ie.min.js.map
!dist/2.0/fineui.css
!dist/2.0/fineui.js
!dist/2.0/fineui.js.map
@ -40,4 +36,4 @@
!dist/router.js
!babel.config.js
!babel.config.ie8.js
!.eslintrc
!.eslintrc

321
dist/fix/fix.compact.ie.js vendored

@ -1,321 +0,0 @@
;(function () {
function initWatch (vm, watch) {
vm._watchers || (vm._watchers = []);
for (var key in watch) {
var handler = watch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i]));
}
} else {
vm._watchers.push(createWatcher(vm, key, handler));
}
}
BI.each(vm.$watchDelayCallbacks, function (i, watchDelayCallback) {
var innerWatch = watchDelayCallback[0];
var innerHandler = watchDelayCallback[1];
if (BI.isKey(innerWatch)) {
var key = innerWatch;
innerWatch = {};
innerWatch[key] = innerHandler;
}
for (var key in innerWatch) {
var handler = innerWatch[key];
if (BI.isArray(handler)) {
for (var i = 0; i < handler.length; i++) {
vm._watchers.push(createWatcher(vm, key, handler[i]));
}
} else {
vm._watchers.push(createWatcher(vm, key, handler));
}
}
});
}
function createWatcher (vm, keyOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
}
options = options || {};
return Fix.watch(vm.model, keyOrFn, _.bind(cb, vm), BI.extend(options, {
store: vm.store
}));
}
var target = null;
var targetStack = [];
function pushTarget (_target) {
if (target) targetStack.push(target);
Fix.Model.target = target = _target;
}
function popTarget () {
Fix.Model.target = target = targetStack.pop();
}
var oldWatch = Fix.watch;
Fix.watch = function (model, expOrFn, cb, options) {
if (BI.isPlainObject(cb)) {
options = cb;
cb = cb.handler;
}
if (typeof cb === "string") {
cb = model[cb];
}
return oldWatch.call(this, model, expOrFn, function () {
options && options.store && pushTarget(options.store);
var res = cb.apply(this, arguments);
options && options.store && popTarget();
return res;
}, options);
};
function findStore (widget) {
if (target != null) {
return target;
}
widget = widget || BI.Widget.context;
var p = widget;
while (p) {
if (p instanceof Fix.Model || p.store || p.__cacheStore) {
break;
}
p = p._parent || (p.options && p.options.element) || p._context;
}
if (p) {
if (p instanceof Fix.Model) {
return widget.__cacheStore = p;
}
widget.__cacheStore = p.store || p.__cacheStore;
return p.__cacheStore || p.store;
}
}
// _.each(["populate", "addItems", "prependItems"], function (name) {
// var old = BI.Loader.prototype[name];
// BI.Loader.prototype[name] = function () {
// BI.Widget.pushContext(this);
// var result = old.apply(this, arguments);
// BI.Widget.popContext();
// return result;
// };
// });
function createStore () {
var needPop = false;
if (_global.Fix && this._store) {
var store = findStore(this.options.context || this._parent || this.options.element || this._context);
if (store) {
pushTarget(store);
needPop = true;
}
this.store = this._store();
this.store && (this.store._widget = this);
needPop && popTarget();
needPop = false;
pushTarget(this.store);
if (this.store instanceof Fix.Model) {
this.model = this.store.model;
} else {
this.model = this.store;
}
needPop = true;
}
return needPop;
}
BI.Widget.prototype._initRender = function () {
if (this.beforeInit) {
this.__asking = true;
this.beforeInit(BI.bind(function () {
if (this.model && this.model.$vm) {
this.model.$vm.$digest();
}
this._render();
}, this));
if (this.__asking === true) {
this.__async = true;
}
} else {
this._render();
}
};
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {
var self = this;
var needPop = createStore.call(this);
_init.apply(this, arguments);
needPop && popTarget();
};
var _render = BI.Widget.prototype._render;
BI.Widget.prototype._render = function () {
var needPop = false;
if (_global.Fix && this._store) {
needPop = true;
pushTarget(this.store);
}
_render.apply(this, arguments);
if (_global.Fix && this._store) {
initWatch(this, this.watch);
}
needPop && popTarget();
};
var unMount = BI.Widget.prototype.__d;
BI.Widget.prototype.__d = function () {
unMount.apply(this, arguments);
this.store && BI.isFunction(this.store.destroy) && this.store.destroy();
BI.each(this._watchers, function (i, unwatches) {
unwatches = BI.isArray(unwatches) ? unwatches : [unwatches];
BI.each(unwatches, function (j, unwatch) {
unwatch();
});
});
this._watchers && (this._watchers = []);
if (this.store) {
this.store._parent && (this.store._parent = null);
this.store._widget && (this.store._widget = null);
this.store = null;
}
delete this.__cacheStore;
};
_.each(["_rendered", "_mount", "__afterMount"], function (name) {
var old = BI.Widget.prototype[name];
old && (BI.Widget.prototype[name] = function () {
this.store && pushTarget(this.store);
try {
var res = old.apply(this, arguments);
} catch (e) {
console.error(e);
}
this.store && popTarget();
return res;
});
});
var additionFunc = function () {
BI.nextTick(function () {
Fix && Fix.refreshAll && Fix.refreshAll();
});
};
$(document).ajaxComplete(additionFunc);
if (BI.history) {
var navigate = BI.history.navigate;
// navigate之后不会立即变化有一段延迟
BI.history.navigate = function () {
navigate.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 200);
};
var back = window.history.back;
window.history.back = function () {
back.apply(this, arguments);
BI.defer(function () {
additionFunc();
}, 200);
};
}
if (BI.Router) {
var execute = BI.Router.prototype.execute;
BI.Router.prototype.execute = function () {
execute.apply(this, arguments);
additionFunc();
};
}
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition",
"keys", "allKeys", "values", "pairs", "invert",
"mapObject", "findKey", "pick", "omit", "tap"], function (name) {
var old = BI[name];
BI[name] = function (obj, fn, context) {
return typeof fn === "function" ? old(obj, function (key, value) {
if (!(key in Fix.$$skipArray)) {
return fn.apply(this, arguments);
}
}, context) : old.apply(this, arguments);
};
});
BI.isEmpty = function (ob) {
if (BI.isPlainObject(ob) && ob.__ob__) {
return BI.keys(ob).length === 0;
}
return _.isEmpty(ob);
};
BI.keys = function (ob) {
var keys = _.keys(ob);
var nKeys = [];
for (var i = 0; i < keys.length; i++) {
if (!(keys[i] in Fix.$$skipArray)) {
nKeys.push(keys[i]);
}
}
return nKeys;
};
BI.values = function (ob) {
var keys = BI.keys(obj);
var length = keys.length;
var values = [];
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
BI.extend = function () {
var args = Array.prototype.slice.call(arguments);
if (args.length < 1) {
return {};
}
var object = args[0];
var i = 1;
while (i < args.length) {
BI.each(args[i], function (key, v) {
object[key] = v;
});
i++;
}
return object;
};
BI.size = function (ob) {
if (BI.isPlainObject(ob) && ob.__ob__) {
return BI.keys(ob).length;
}
return _.size(ob);
};
BI.isEmptyObject = function (ob) {
return BI.size(ob) === 0;
};
BI.deepClone = function (ob) {
return Fix.toJSON(ob);
};
Fix.set = function (obj, k, v) {
try {
if (obj) {
obj[k] = v;
}
} catch (e) {
} finally {
return _.cloneDeep(obj);
}
};
Fix.del = function (obj, k) {
try {
delete obj[k];
} catch (e) {
} finally {
return _.cloneDeep(obj);
}
};
}());

68
dist/fix/fix.compact.js vendored

@ -196,72 +196,4 @@
return res;
});
});
if (BI.isIE9Below && BI.isIE9Below()) {
_.each(["each", "map", "reduce", "reduceRight", "find", "filter", "reject", "every", "all", "some", "any", "max", "min",
"sortBy", "groupBy", "indexBy", "countBy", "partition",
"keys", "allKeys", "values", "pairs", "invert",
"mapObject", "findKey", "pick", "omit", "tap"], function (name) {
var old = BI[name];
BI[name] = function (obj, fn, context) {
return typeof fn === "function" ? old(obj, function (key, value) {
if (!(key in Fix.$$skipArray)) {
return fn.apply(this, arguments);
}
}, context) : old.apply(this, arguments);
};
});
BI.isEmpty = function (ob) {
if (BI.isPlainObject(ob) && ob.__ob__) {
return BI.keys(ob).length === 0;
}
return _.isEmpty(ob);
};
BI.keys = function (ob) {
var keys = _.keys(ob);
var nKeys = [];
for (var i = 0; i < keys.length; i++) {
if (!(keys[i] in Fix.$$skipArray)) {
nKeys.push(keys[i]);
}
}
return nKeys;
};
BI.values = function (ob) {
var keys = BI.keys(obj);
var length = keys.length;
var values = [];
for (var i = 0; i < length; i++) {
values[i] = obj[keys[i]];
}
return values;
};
BI.extend = function () {
var args = Array.prototype.slice.call(arguments);
if (args.length < 1) {
return {};
}
var object = args[0];
var i = 1;
while (i < args.length) {
BI.each(args[i], function (key, v) {
object[key] = v;
});
i++;
}
return object;
};
BI.size = function (ob) {
if (BI.isPlainObject(ob) && ob.__ob__) {
return BI.keys(ob).length;
}
return _.size(ob);
};
BI.isEmptyObject = function (ob) {
return BI.size(ob) === 0;
};
BI.deepClone = function (ob) {
return Fix.toJSON(ob);
};
}
}());

1050
dist/fix/fix.ie.js vendored

File diff suppressed because it is too large Load Diff

4
lib/postbuild/postbuild.js

@ -14,13 +14,11 @@ if (!existsSync($dest)) {
}
const deleteList = [
"fineui.ie.min.css",
"fineui_without_jquery_polyfill.css",
"font.js",
"font.js.map",
"resource.js",
"resource.js.map",
"2.0/fineui.ie.min.css",
"2.0/fineui_without_normalize.js",
"2.0/fineui_without_normalize.js.map",
"2.0/fineui_without_normalize.min.js",
@ -47,7 +45,7 @@ fileList.forEach(filename => {
const paths = filename.split("/");
const name = paths[paths.length - 1];
const content = `${readFileSync(sourcefile, { encoding: 'utf8' })}
//# sourceMappingURL=./${name}.map`;

47
webpack/attachments.js

@ -10,28 +10,12 @@ function sync(patterns) {
const fixJs = "./dist/fix/fix.js";
const fixProxyJs = './dist/fix/fix.proxy.js';
const fixIEJs = "./dist/fix/fix.ie.js";
const fixCompact = "./dist/fix/fix.compact.js";
const fixIECompact = './dist/fix/fix.compact.ie.js';
const workerCompact = './dist/fix/worker.compact.js';
const lodashJs = "src/core/1.lodash.js";
const basicAttachmentMap = {
polyfill: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat(["@babel/polyfill", "es6-promise/auto"]),
polyfillIE: sync(["src/core/0.foundation.js", "src/polyfill/**/*.js"]).concat([
"core-js/features/object/define-property",
"core-js/features/object/create",
"core-js/features/object/assign",
"core-js/features/object/get-own-property-symbols",
"core-js/features/object/get-prototype-of",
"core-js/features/array/for-each",
"core-js/features/array/index-of",
"core-js/features/function/bind",
"core-js/features/promise",
"core-js/features/string/replace",
"core-js/es/map",
// "core-js",
]),
core: sync([
"src/less/core/**/*.less",
"src/less/theme/**/*.less",
@ -84,7 +68,6 @@ const basicAttachmentMap = {
]),
fix: [fixJs],
fixProxy: [fixProxyJs],
fixIE: [fixIEJs],
};
const bundle = [].concat(
@ -122,20 +105,6 @@ const resource = sync(["private/less/app.less", "private/less/**/*.less"]);
const config = sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]);
const bundleIE = [].concat(
basicAttachmentMap.polyfillIE,
basicAttachmentMap.core,
basicAttachmentMap.fixIE,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
sync(["public/less/app.less", "public/less/**/*.less"]),
[fixIECompact, workerCompact],
basicAttachmentMap.router,
sync(["public/js/**/*.js", "public/js/index.js", "i18n/i18n.cn.js"]),
basicAttachmentMap.ts,
);
const bundleWithoutNormalize = [].concat(
basicAttachmentMap.core_without_normalize,
sync([
@ -190,19 +159,6 @@ const fineuiProxy = [].concat(
basicAttachmentMap.ts,
);
const fineuiIE = [].concat(
basicAttachmentMap.polyfillIE,
basicAttachmentMap.core,
basicAttachmentMap.fixIE,
basicAttachmentMap.base,
basicAttachmentMap.case,
basicAttachmentMap.widget,
basicAttachmentMap.router,
[fixIECompact, workerCompact],
basicAttachmentMap.ui,
basicAttachmentMap.ts,
);
const fineuiWithoutJqueryAndPolyfillJs = [].concat(
sync([
"src/core/foundation.js",
@ -242,18 +198,15 @@ const demo = [].concat(
module.exports = {
fix: fixJs,
fixProxy: fixProxyJs,
fixIE: fixIEJs,
lodash: lodashJs,
font: basicAttachmentMap.font,
bundle: uniq(bundle),
bundleModern: uniq(bundleModern),
bundleIE: uniq(bundleIE),
fineuiWithoutNormalize: uniq(fineuiWithoutNormalize),
bundleWithoutNormalize: uniq(bundleWithoutNormalize),
fineui: uniq(fineui),
fineuiModern: uniq(fineuiModern),
fineuiProxy: uniq(fineuiProxy),
fineuiIE: uniq(fineuiIE),
fineuiWithoutJqueryAndPolyfillJs: uniq(fineuiWithoutJqueryAndPolyfillJs),
utils: uniq(basicAttachmentMap.utils),
demo: uniq(demo),

1
webpack/dirs.js

@ -4,7 +4,6 @@ module.exports = {
NODE_MODULES: path.resolve(__dirname, "../node_modules"),
PRIVATE: path.resolve(__dirname, "../private"),
BABEL_CONFIG: path.resolve(__dirname, "../babel.config.js"),
IE8_BABEL_CONFIG: path.resolve(__dirname, "../babel.config.ie8.js"),
TYPESCRIPT: path.resolve(__dirname, "../typescript"),
SRC: path.resolve(__dirname, "../src"),
DEMO: path.resolve(__dirname, "../demo"),

11
webpack/webpack.common.js

@ -44,7 +44,7 @@ module.exports = {
{
loader: 'babel-loader',
options: {
configFile: dirs.IE8_BABEL_CONFIG,
configFile: dirs.BABEL_CONFIG,
},
},
{
@ -101,15 +101,6 @@ module.exports = {
},
],
},
{
test: path.resolve(__dirname, '../', attachments.fixIE),
use: [
{
loader: 'expose-loader',
options: 'Fix',
},
],
},
{
test: /\.(css|less)$/,
use: [

3
webpack/webpack.prod.js

@ -19,11 +19,9 @@ module.exports = merge.smart(common, {
'fineui_without_normalize.min': attachments.fineuiWithoutNormalize,
"fineui.modern.min": attachments.fineuiModern,
"fineui.proxy.min": attachments.fineuiProxy,
"fineui.ie.min": attachments.fineuiIE,
utils: attachments.utils,
"utils.min": attachments.utils,
"fineui_without_jquery_polyfill": attachments.fineuiWithoutJqueryAndPolyfillJs,
"2.0/fineui.ie.min": attachments.bundleIE,
"2.0/fineui": attachments.bundle,
"2.0/fineui.min": attachments.bundle,
"2.0/fineui.modern.min": attachments.bundleModern,
@ -39,7 +37,6 @@ module.exports = merge.smart(common, {
parallel: true,
sourceMap: true,
terserOptions: {
ie8: true,
output: {
comments: false,
},

Loading…
Cancel
Save