omi v1.5.1 - support ie8
This commit is contained in:
parent
c50acd805f
commit
c9aaccd533
28
README.md
28
README.md
|
@ -33,7 +33,7 @@ $ npm run dist //部署发布
|
|||
## 特性
|
||||
|
||||
* 超小的尺寸,7 kb (gzip)
|
||||
* 良好的兼容性,omi.js支持IE9, omi.lite.js和omi.mustache.js支持IE8 (请自行引用es5-shim或es5-sham)
|
||||
* 良好的兼容性,支持IE8(请自行引用es5-shim或es5-sham)
|
||||
* 完全面向对象的组件体系
|
||||
* 局部CSS,HTML+ Scoped CSS + JS组成可复用的组件
|
||||
* 更自由的更新,每个组件都有update方法,自由选择时机进行更新
|
||||
|
@ -65,12 +65,12 @@ $ npm install omi
|
|||
|
||||
## CDN
|
||||
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.min.js](https://unpkg.com/omi@1.5.0/dist/omi.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.js](https://unpkg.com/omi@1.5.0/dist/omi.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.lite.min.js](https://unpkg.com/omi@1.5.0/dist/omi.lite.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.lite.js](https://unpkg.com/omi@1.5.0/dist/omi.lite.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.mustache.min.js](https://unpkg.com/omi@1.5.0/dist/omi.mustache.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.mustache.js](https://unpkg.com/omi@1.5.0/dist/omi.mustache.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.min.js](https://unpkg.com/omi@1.5.1/dist/omi.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.js](https://unpkg.com/omi@1.5.1/dist/omi.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.lite.min.js](https://unpkg.com/omi@1.5.1/dist/omi.lite.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.lite.js](https://unpkg.com/omi@1.5.1/dist/omi.lite.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.mustache.min.js](https://unpkg.com/omi@1.5.1/dist/omi.mustache.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.mustache.js](https://unpkg.com/omi@1.5.1/dist/omi.mustache.js)
|
||||
|
||||
## 感谢
|
||||
|
||||
|
@ -101,7 +101,7 @@ $ npm run dist //release
|
|||
## Features
|
||||
|
||||
* Super tiny size, 7 KB (gzip)
|
||||
* Good compatibility, omi.js support IE9, omi.lite.js and omi.mustache.js support IE8(please import es5-shim or es5-sham by yourself)
|
||||
* Good compatibility, support IE8 (please import es5-shim or es5-sham by yourself)
|
||||
* Fully object-oriented component system
|
||||
* Support Scoped CSS, reusable components are composed of HTML, Scoped CSS and JS
|
||||
* More free updates, each component has a update method, free to choose the right time to update
|
||||
|
@ -134,12 +134,12 @@ if using 'omi.lite.js' (without [mustache.js](https://github.com/janl/mustache.j
|
|||
|
||||
## CDN
|
||||
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.min.js](https://unpkg.com/omi@1.5.0/dist/omi.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.js](https://unpkg.com/omi@1.5.0/dist/omi.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.lite.min.js](https://unpkg.com/omi@1.5.0/dist/omi.lite.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.lite.js](https://unpkg.com/omi@1.5.0/dist/omi.lite.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.mustache.min.js](https://unpkg.com/omi@1.5.0/dist/omi.mustache.min.js)
|
||||
* [https://unpkg.com/omi@1.5.0/dist/omi.mustache.js](https://unpkg.com/omi@1.5.0/dist/omi.mustache.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.min.js](https://unpkg.com/omi@1.5.1/dist/omi.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.js](https://unpkg.com/omi@1.5.1/dist/omi.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.lite.min.js](https://unpkg.com/omi@1.5.1/dist/omi.lite.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.lite.js](https://unpkg.com/omi@1.5.1/dist/omi.lite.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.mustache.min.js](https://unpkg.com/omi@1.5.1/dist/omi.mustache.min.js)
|
||||
* [https://unpkg.com/omi@1.5.1/dist/omi.mustache.js](https://unpkg.com/omi@1.5.1/dist/omi.mustache.js)
|
||||
|
||||
## Thanks
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omi-cli",
|
||||
"version": "0.2.10",
|
||||
"version": "0.3.0",
|
||||
"description": "CLI for scaffolding Omi.js projects.",
|
||||
"main": "bin/omi",
|
||||
"engines": {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Omi v1.5.0 By dntzhang
|
||||
* Omi v1.5.1 By dntzhang
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -92,9 +92,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
module.exports = _omi2['default'];
|
||||
}
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -344,6 +344,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Omi.componentConstructor[name] = ctor;
|
||||
Omi.componentConstructor[name.toLowerCase()] = ctor;
|
||||
Omi.customTags.push(name, name.toLowerCase());
|
||||
if (document.documentMode < 9) {
|
||||
document.createElement(name.toLowerCase());
|
||||
}
|
||||
};
|
||||
|
||||
Omi.tag = Omi.makeHTML;
|
||||
|
@ -438,22 +441,51 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
module.exports = Omi;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 2 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* WEBPACK VAR INJECTION */(function(module) {'use strict';
|
||||
|
||||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
|
||||
|
||||
/**
|
||||
* sodajs v0.4.1 by dorsywang
|
||||
* sodajs v0.4.3 by dorsywang
|
||||
* Light weight but powerful template engine for JavaScript
|
||||
* Github: https://github.com/AlloyTeam/sodajs
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
;(function () {
|
||||
if (!Array.prototype.map) {
|
||||
Array.prototype.map = function (func) {
|
||||
var arr = [];
|
||||
for (var i = 0; i < this.length; i++) {
|
||||
var item = this[i];
|
||||
|
||||
[].push(func && func.call(item, item, i));
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
}
|
||||
|
||||
if (!String.prototype.trim) {
|
||||
String.prototype.trim = function () {
|
||||
return this.replace(/^\s*|\s*$/g, '');
|
||||
};
|
||||
}
|
||||
|
||||
var nodes2Arr = function nodes2Arr(nodes) {
|
||||
var arr = [];
|
||||
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
arr.push(nodes[i]);
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
|
||||
var valueoutReg = /\{\{([^\}]*)\}\}/g;
|
||||
|
||||
var prefix = 'soda';
|
||||
|
@ -504,7 +536,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var attr = attrStr.substr(0, dotIndex);
|
||||
attrStr = attrStr.substr(dotIndex + 1);
|
||||
|
||||
// ??<3F><>attrStr<74>Ƿ<EFBFBD><C7B7><EFBFBD>???<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
// <EFBFBD>?查attrStr是否属<E590A6>?<3F>变量并转换
|
||||
if (typeof _data[attr] !== "undefined" && CONST_REG.test(attr)) {
|
||||
attr = _data[attr];
|
||||
}
|
||||
|
@ -522,12 +554,12 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
data: eventData
|
||||
}, eventData);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 如果还有
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
|
||||
// ??<3F><>attrStr<74>Ƿ<EFBFBD><C7B7><EFBFBD>???<3F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>
|
||||
// <EFBFBD>?查attrStr是否属<E590A6>?<3F>变量并转换
|
||||
if (typeof _data[attrStr] !== "undefined" && CONST_REG.test(attrStr)) {
|
||||
attrStr = _data[attrStr];
|
||||
}
|
||||
|
@ -556,16 +588,20 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return _getValue(_data, _attrStr);
|
||||
};
|
||||
|
||||
// ע<EFBFBD><EFBFBD>node
|
||||
// 注释node
|
||||
var commentNode = function commentNode(node) {};
|
||||
|
||||
// <EFBFBD><EFBFBD>ʶ??
|
||||
// 标识<EFBFBD>?
|
||||
var IDENTOR_REG = /[a-zA-Z_\$]+[\w\$]*/g;
|
||||
var STRING_REG = /"([^"]*)"|'([^']*)'/g;
|
||||
var NUMBER_REG = /\d+|\d*\.\d+/g;
|
||||
|
||||
var OBJECT_REG = /[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/g;
|
||||
// 非global 做test用
|
||||
var OBJECT_REG_NG = /[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/;
|
||||
|
||||
var ATTR_REG = /\[([^\[\]]*)\]/g;
|
||||
var ATTR_REG_NG = /\[([^\[\]]*)\]/;
|
||||
var ATTR_REG_DOT = /\.([a-zA-Z_\$]+[\w\$]*)/g;
|
||||
|
||||
var NOT_ATTR_REG = /[^\.|]([a-zA-Z_\$]+[\w\$]*)/g;
|
||||
|
@ -587,7 +623,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
};
|
||||
|
||||
var parseSodaExpression = function parseSodaExpression(str, scope) {
|
||||
// <EFBFBD><EFBFBD>filter<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 对filter进行处理
|
||||
str = str.replace(OR_REG, OR_REPLACE).split("|");
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
|
@ -597,23 +633,23 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
var expr = str[0] || "";
|
||||
var filters = str.slice(1);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>??
|
||||
// 将字符常量保存下<EFBFBD>?
|
||||
expr = expr.replace(STRING_REG, function (r, $1, $2) {
|
||||
var key = getRandom();
|
||||
scope[key] = $1 || $2;
|
||||
return key;
|
||||
});
|
||||
|
||||
while (ATTR_REG.test(expr)) {
|
||||
while (ATTR_REG_NG.test(expr)) {
|
||||
ATTR_REG.lastIndex = 0;
|
||||
|
||||
//<EFBFBD><EFBFBD>exprԤ<EFBFBD><EFBFBD>??
|
||||
//对expr预处<EFBFBD>?
|
||||
expr = expr.replace(ATTR_REG, function (r, $1) {
|
||||
var key = getAttrVarKey();
|
||||
// <EFBFBD><EFBFBD>???<3F><>?? Ϊ<>ַ<EFBFBD><D6B7><EFBFBD>??
|
||||
// 属<EFBFBD>?<3F>名<EFBFBD>? 为字符常<E7ACA6>?
|
||||
var attrName = parseSodaExpression($1, scope);
|
||||
|
||||
// <EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ǰ <20><>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD>??
|
||||
// 给一个特殊的前缀 表示是属性变<E680A7>?
|
||||
|
||||
scope[key] = attrName;
|
||||
|
||||
|
@ -638,8 +674,8 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
var stringReg = /^'.*'$|^".*"$/;
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
//<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>
|
||||
if (OBJECT_REG.test(args[i])) {
|
||||
//这里根据类型进行判断
|
||||
if (OBJECT_REG_NG.test(args[i])) {
|
||||
args[i] = "getValue(scope,'" + args[i] + "')";
|
||||
} else {}
|
||||
}
|
||||
|
@ -672,10 +708,10 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
};
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>attr
|
||||
// 解析指令
|
||||
// 解析attr
|
||||
var compileNode = function compileNode(node, scope) {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֻ<EFBFBD><EFBFBD><EFBFBD>ı<EFBFBD>
|
||||
// 如果只是文本
|
||||
if (node.nodeType === 3) {
|
||||
node.nodeValue = node.nodeValue.replace(valueoutReg, function (item, $1) {
|
||||
/*
|
||||
|
@ -695,7 +731,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
|
||||
if (node.attributes) {
|
||||
// ָ<EFBFBD><EFBFBD><EFBFBD>
|
||||
// 指令处理
|
||||
sodaDirectiveArr.map(function (item) {
|
||||
var name = item.name;
|
||||
|
||||
|
@ -706,32 +742,36 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
});
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> prefix-*
|
||||
// 处理输出 包含 prefix-*
|
||||
[].map.call(node.attributes, function (attr) {
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>dirctiveMap<EFBFBD>еľ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD>??
|
||||
// 如果dirctiveMap有的就跳过不再处<EFBFBD>?
|
||||
if (!sodaDirectiveMap[attr.name]) {
|
||||
if (prefixReg.test(attr.name)) {
|
||||
var attrName = attr.name.replace(prefixReg, '');
|
||||
|
||||
if (attrName) {
|
||||
var attrValue = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
if (attr.value) {
|
||||
var attrValue = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
|
||||
node.setAttribute(attrName, attrValue);
|
||||
node.setAttribute(attrName, attrValue);
|
||||
}
|
||||
}
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ﺬexpr <20><><EFBFBD><EFBFBD>
|
||||
// 对其他属性里含expr 处理
|
||||
} else {
|
||||
attr.value = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
if (attr.value) {
|
||||
attr.value = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
[].map.call([].slice.call(node.childNodes, []), function (child) {
|
||||
nodes2Arr(node.childNodes).map(function (child) {
|
||||
compileNode(child, scope);
|
||||
});
|
||||
};
|
||||
|
@ -806,13 +846,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
trackName = trackName || '$index';
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ??
|
||||
// 这里要处理一<EFBFBD>?
|
||||
var repeatObj = getValue(scope, valueName) || [];
|
||||
|
||||
var repeatFunc = function repeatFunc(i) {
|
||||
var itemNode = el.cloneNode(true);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD>ﴴ<EFBFBD><EFBFBD>??<3F><><EFBFBD>µ<EFBFBD>scope
|
||||
// 这里创建<EFBFBD>?个新的scope
|
||||
var itemScope = {};
|
||||
itemScope[trackName] = i;
|
||||
|
||||
|
@ -824,7 +864,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
el.parentNode.insertBefore(itemNode, el);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼ӵ<EFBFBD>dom, Ҫ<><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>??
|
||||
// 这里是新加的dom, 要单独编<E78BAC>?
|
||||
compileNode(itemNode, itemScope);
|
||||
};
|
||||
|
||||
|
@ -972,23 +1012,35 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
});
|
||||
|
||||
var sodaRender = function sodaRender(str, data) {
|
||||
// <EFBFBD><EFBFBD>directive<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 对directive进行排序
|
||||
sodaDirectiveArr.sort(function (b, a) {
|
||||
return Number(a.opt.priority || 0) - Number(b.opt.priority || 0);
|
||||
});
|
||||
|
||||
//console.log(sodaDirectiveArr);
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><EFBFBD>DOM
|
||||
// 解析模板DOM
|
||||
var div = document.createElement("div");
|
||||
|
||||
// 必须加入到body中去,不然自定义标签不生效
|
||||
if (document.documentMode < 9) {
|
||||
div.style.display = 'none';
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
div.innerHTML = str;
|
||||
|
||||
[].map.call([].slice.call(div.childNodes, []), function (child) {
|
||||
nodes2Arr(div.childNodes).map(function (child) {
|
||||
compileNode(child, data);
|
||||
});
|
||||
|
||||
return div.innerHTML;
|
||||
var innerHTML = div.innerHTML;
|
||||
|
||||
if (document.documentMode < 9) {
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
|
||||
return innerHTML;
|
||||
|
||||
// var frament = document.createDocumentFragment();
|
||||
// frament.innerHTML = div.innerHTML;
|
||||
|
@ -1064,13 +1116,13 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return sodaRender;
|
||||
}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));else if ((typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object') exports["soda"] = sodaRender;else window.soda = sodaRender;
|
||||
|
||||
// <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>쳣<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// 监听数据异常情况
|
||||
})();
|
||||
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3)(module)))
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 3 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
module.exports = function(module) {
|
||||
if(!module.webpackPolyfill) {
|
||||
|
@ -1084,9 +1136,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
}
|
||||
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 4 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1716,78 +1768,76 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
cmi._childRender(childStr);
|
||||
} else {
|
||||
(function () {
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
});
|
||||
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
}
|
||||
});
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
})();
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
}
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
@ -1797,9 +1847,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = Component;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1868,9 +1918,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
addStyle: addStyle
|
||||
};
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1894,9 +1944,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = scopedEvent;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
|
||||
|
||||
|
@ -2622,9 +2672,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return morphdom;
|
||||
});
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -2865,9 +2915,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = html2json;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -3009,7 +3059,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = Store;
|
||||
|
||||
/***/ }
|
||||
/***/ })
|
||||
/******/ ])
|
||||
});
|
||||
;
|
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Omi v1.5.0 By dntzhang
|
||||
* Omi v1.5.1 By dntzhang
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -89,9 +89,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
module.exports = _omi2['default'];
|
||||
}
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -341,6 +341,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Omi.componentConstructor[name] = ctor;
|
||||
Omi.componentConstructor[name.toLowerCase()] = ctor;
|
||||
Omi.customTags.push(name, name.toLowerCase());
|
||||
if (document.documentMode < 9) {
|
||||
document.createElement(name.toLowerCase());
|
||||
}
|
||||
};
|
||||
|
||||
Omi.tag = Omi.makeHTML;
|
||||
|
@ -435,11 +438,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
module.exports = Omi;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 2 */,
|
||||
/* 3 */,
|
||||
/* 4 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1069,78 +1072,76 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
cmi._childRender(childStr);
|
||||
} else {
|
||||
(function () {
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
});
|
||||
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
}
|
||||
});
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
})();
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
}
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
@ -1150,9 +1151,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = Component;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1221,9 +1222,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
addStyle: addStyle
|
||||
};
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1247,9 +1248,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = scopedEvent;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
|
||||
|
||||
|
@ -1975,9 +1976,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return morphdom;
|
||||
});
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -2218,9 +2219,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = html2json;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -2362,7 +2363,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = Store;
|
||||
|
||||
/***/ }
|
||||
/***/ })
|
||||
/******/ ])
|
||||
});
|
||||
;
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
/*!
|
||||
* Omi v1.5.0 By dntzhang
|
||||
* Omi v1.5.1 By dntzhang
|
||||
* Github: https://github.com/AlloyTeam/omi
|
||||
* MIT Licensed.
|
||||
*/
|
||||
|
@ -57,7 +57,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
/************************************************************************/
|
||||
/******/ ([
|
||||
/* 0 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -90,9 +90,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
module.exports = _omi2['default'];
|
||||
}
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 1 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -342,6 +342,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
Omi.componentConstructor[name] = ctor;
|
||||
Omi.componentConstructor[name.toLowerCase()] = ctor;
|
||||
Omi.customTags.push(name, name.toLowerCase());
|
||||
if (document.documentMode < 9) {
|
||||
document.createElement(name.toLowerCase());
|
||||
}
|
||||
};
|
||||
|
||||
Omi.tag = Omi.makeHTML;
|
||||
|
@ -436,11 +439,11 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
module.exports = Omi;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 2 */,
|
||||
/* 3 */,
|
||||
/* 4 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1070,78 +1073,76 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
cmi._childRender(childStr);
|
||||
} else {
|
||||
(function () {
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
var baseData = {};
|
||||
var dataset = {};
|
||||
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
var groupDataIndex = null;
|
||||
var omiID = null;
|
||||
var instanceName = null;
|
||||
var _omi_option = {};
|
||||
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
Object.keys(attr).forEach(function (key) {
|
||||
var value = attr[key];
|
||||
if (key.indexOf('on') === 0) {
|
||||
var handler = child[value];
|
||||
if (handler) {
|
||||
baseData[key] = handler.bind(child);
|
||||
}
|
||||
});
|
||||
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
} else if (key === 'omi-id') {
|
||||
omiID = value;
|
||||
} else if (key === 'name') {
|
||||
instanceName = value;
|
||||
} else if (key === 'group-data') {
|
||||
if (child._omiGroupDataCounter.hasOwnProperty(value)) {
|
||||
child._omiGroupDataCounter[value]++;
|
||||
} else {
|
||||
child._omiGroupDataCounter[value] = 0;
|
||||
}
|
||||
groupDataIndex = child._omiGroupDataCounter[value];
|
||||
dataset = _this13._extractPropertyFromString(value, child)[groupDataIndex];
|
||||
} else if (key.indexOf('data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace('data-', ''))] = value;
|
||||
} else if (key.indexOf(':data-') === 0) {
|
||||
dataset[_this13._capitalize(key.replace(':data-', ''))] = eval('(' + value + ')');
|
||||
} else if (key === ':data') {
|
||||
dataset = eval('(' + value + ')');
|
||||
} else if (key === 'data') {
|
||||
dataset = _this13._extractPropertyFromString(value, child);
|
||||
} else if (key === 'preventSelfUpdate' || key === 'psu') {
|
||||
_omi_option.preventSelfUpdate = true;
|
||||
} else if (key === 'selfDataFirst' || key === 'sdf') {
|
||||
_omi_option.selfDataFirst = true;
|
||||
} else if (key === 'domDiffDisabled' || key === 'ddd') {
|
||||
_omi_option.domDiffDisabled = true;
|
||||
} else if (key === 'ignoreStoreData' || key === 'isd') {
|
||||
_omi_option.ignoreStoreData = true;
|
||||
} else if (key === 'scopedSelfCSS' || key === 'ssc') {
|
||||
_omi_option.scopedSelfCSS = true;
|
||||
}
|
||||
});
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
})();
|
||||
var ChildClass = _omi2['default'].getClassFromString(name);
|
||||
if (!ChildClass) throw "Can't find Class called [" + name + "]";
|
||||
var sub_child = new ChildClass(Object.assign(baseData, child.childrenData[i], dataset), _omi_option);
|
||||
sub_child._omi_groupDataIndex = groupDataIndex;
|
||||
sub_child._omiChildStr = childStr;
|
||||
sub_child._omi_slotContent = slotContent;
|
||||
sub_child.parent = child;
|
||||
sub_child.$store = child.$store;
|
||||
sub_child.___omi_constructor_name = name;
|
||||
sub_child._dataset = {};
|
||||
sub_child.install();
|
||||
|
||||
omiID && (_omi2['default'].mapping[omiID] = sub_child);
|
||||
instanceName && (child[instanceName] = sub_child);
|
||||
|
||||
if (!cmi) {
|
||||
child.children.push(sub_child);
|
||||
} else {
|
||||
child.children[i] = sub_child;
|
||||
}
|
||||
|
||||
sub_child._childRender(childStr);
|
||||
}
|
||||
}
|
||||
}]);
|
||||
|
@ -1151,9 +1152,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = Component;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 5 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1222,9 +1223,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
addStyle: addStyle
|
||||
};
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 6 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
'use strict';
|
||||
|
||||
|
@ -1248,9 +1249,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports['default'] = scopedEvent;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 7 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
|
||||
|
||||
|
@ -1976,9 +1977,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return morphdom;
|
||||
});
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 8 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -2219,9 +2220,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = html2json;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 9 */
|
||||
/***/ function(module, exports) {
|
||||
/***/ (function(module, exports) {
|
||||
|
||||
"use strict";
|
||||
|
||||
|
@ -2363,9 +2364,9 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
|
||||
exports["default"] = Store;
|
||||
|
||||
/***/ },
|
||||
/***/ }),
|
||||
/* 10 */
|
||||
/***/ function(module, exports, __webpack_require__) {
|
||||
/***/ (function(module, exports, __webpack_require__) {
|
||||
|
||||
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;'use strict';
|
||||
|
||||
|
@ -2979,7 +2980,7 @@ return /******/ (function(modules) { // webpackBootstrap
|
|||
return mustache;
|
||||
});
|
||||
|
||||
/***/ }
|
||||
/***/ })
|
||||
/******/ ])
|
||||
});
|
||||
;
|
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "omi",
|
||||
"version": "1.5.0",
|
||||
"version": "1.5.1",
|
||||
"description": "Open and modern framework for building user interfaces.",
|
||||
"main": "dist/omi.js",
|
||||
"types": "index.d.ts",
|
||||
|
|
|
@ -212,11 +212,15 @@ Omi.getClassFromString = function(str) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
//以前是Component的静态方法,移到omi下来,不然makehtml 在ie下child访问不到父亲的静态方法
|
||||
Omi.makeHTML= function(name, ctor) {
|
||||
Omi.componentConstructor[name] = ctor
|
||||
Omi.componentConstructor[name.toLowerCase()] = ctor
|
||||
Omi.customTags.push(name, name.toLowerCase())
|
||||
if(document.documentMode < 9){
|
||||
document.createElement(name.toLowerCase());
|
||||
}
|
||||
}
|
||||
|
||||
Omi.tag = Omi.makeHTML
|
||||
|
|
124
src/soda.js
124
src/soda.js
|
@ -1,11 +1,41 @@
|
|||
/**
|
||||
* sodajs v0.4.1 by dorsywang
|
||||
* sodajs v0.4.3 by dorsywang
|
||||
* Light weight but powerful template engine for JavaScript
|
||||
* Github: https://github.com/AlloyTeam/sodajs
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
;(function() {
|
||||
if(! Array.prototype.map){
|
||||
Array.prototype.map = function(func){
|
||||
var arr = [];
|
||||
for(var i = 0; i < this.length; i ++){
|
||||
var item = this[i];
|
||||
|
||||
[].push(func && func.call(item, item, i));
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
}
|
||||
|
||||
if(! String.prototype.trim){
|
||||
String.prototype.trim = function(){
|
||||
return this.replace(/^\s*|\s*$/g, '');
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var nodes2Arr = function(nodes){
|
||||
var arr = [];
|
||||
|
||||
for(var i = 0; i < nodes.length; i ++){
|
||||
arr.push(nodes[i]);
|
||||
}
|
||||
|
||||
return arr;
|
||||
};
|
||||
|
||||
var valueoutReg = /\{\{([^\}]*)\}\}/g;
|
||||
|
||||
var prefix = 'soda';
|
||||
|
@ -57,7 +87,7 @@
|
|||
var attr = attrStr.substr(0, dotIndex);
|
||||
attrStr = attrStr.substr(dotIndex + 1);
|
||||
|
||||
// ??查attrStr是否属???变量并转换
|
||||
// <EFBFBD>?查attrStr是否属<E590A6>?<3F>变量并转换
|
||||
if (typeof _data[attr] !== "undefined" && CONST_REG.test(attr)) {
|
||||
attr = _data[attr];
|
||||
}
|
||||
|
@ -75,12 +105,12 @@
|
|||
data: eventData
|
||||
}, eventData);
|
||||
|
||||
// 如果还有
|
||||
// 如果还有
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
|
||||
// ??查attrStr是否属???变量并转换
|
||||
// <EFBFBD>?查attrStr是否属<E590A6>?<3F>变量并转换
|
||||
if (typeof _data[attrStr] !== "undefined" && CONST_REG.test(attrStr)) {
|
||||
attrStr = _data[attrStr];
|
||||
}
|
||||
|
@ -109,17 +139,21 @@
|
|||
return _getValue(_data, _attrStr);
|
||||
};
|
||||
|
||||
// 注释node
|
||||
// 注释node
|
||||
var commentNode = function (node) {
|
||||
};
|
||||
|
||||
// 标识??
|
||||
// 标识<EFBFBD>?
|
||||
var IDENTOR_REG = /[a-zA-Z_\$]+[\w\$]*/g;
|
||||
var STRING_REG = /"([^"]*)"|'([^']*)'/g
|
||||
var NUMBER_REG = /\d+|\d*\.\d+/g;
|
||||
|
||||
var OBJECT_REG = /[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/g;
|
||||
// 非global 做test用
|
||||
var OBJECT_REG_NG = /[a-zA-Z_\$]+[\w\$]*(?:\s*\.\s*(?:[a-zA-Z_\$]+[\w\$]*|\d+))*/;
|
||||
|
||||
var ATTR_REG = /\[([^\[\]]*)\]/g;
|
||||
var ATTR_REG_NG = /\[([^\[\]]*)\]/;
|
||||
var ATTR_REG_DOT = /\.([a-zA-Z_\$]+[\w\$]*)/g;
|
||||
|
||||
var NOT_ATTR_REG = /[^\.|]([a-zA-Z_\$]+[\w\$]*)/g;
|
||||
|
@ -141,7 +175,7 @@
|
|||
};
|
||||
|
||||
var parseSodaExpression = function (str, scope) {
|
||||
// 对filter进行处理
|
||||
// 对filter进行处理
|
||||
str = str.replace(OR_REG, OR_REPLACE).split("|");
|
||||
|
||||
for (var i = 0; i < str.length; i++) {
|
||||
|
@ -151,23 +185,23 @@
|
|||
var expr = str[0] || "";
|
||||
var filters = str.slice(1);
|
||||
|
||||
// 将字符常量保存下??
|
||||
// 将字符常量保存下<EFBFBD>?
|
||||
expr = expr.replace(STRING_REG, function (r, $1, $2) {
|
||||
var key = getRandom();
|
||||
scope[key] = $1 || $2;
|
||||
return key;
|
||||
});
|
||||
|
||||
while (ATTR_REG.test(expr)) {
|
||||
while (ATTR_REG_NG.test(expr)) {
|
||||
ATTR_REG.lastIndex = 0;
|
||||
|
||||
//对expr预处??
|
||||
//对expr预处<EFBFBD>?
|
||||
expr = expr.replace(ATTR_REG, function (r, $1) {
|
||||
var key = getAttrVarKey();
|
||||
// 属???名?? 为字符常??
|
||||
// 属<EFBFBD>?<3F>名<EFBFBD>? 为字符常<E7ACA6>?
|
||||
var attrName = parseSodaExpression($1, scope);
|
||||
|
||||
// 给一个特殊的前缀 表示是属性变??
|
||||
// 给一个特殊的前缀 表示是属性变<EFBFBD>?
|
||||
|
||||
scope[key] = attrName;
|
||||
|
||||
|
@ -193,8 +227,8 @@
|
|||
|
||||
var stringReg = /^'.*'$|^".*"$/;
|
||||
for (var i = 0; i < args.length; i++) {
|
||||
//这里根据类型进行判断
|
||||
if (OBJECT_REG.test(args[i])) {
|
||||
//这里根据类型进行判断
|
||||
if (OBJECT_REG_NG.test(args[i])) {
|
||||
args[i] = "getValue(scope,'" + args[i] + "')";
|
||||
} else {
|
||||
}
|
||||
|
@ -228,10 +262,10 @@
|
|||
}
|
||||
};
|
||||
|
||||
// 解析指令
|
||||
// 解析attr
|
||||
// 解析指令
|
||||
// 解析attr
|
||||
var compileNode = function (node, scope) {
|
||||
// 如果只是文本
|
||||
// 如果只是文本
|
||||
if (node.nodeType === 3) {
|
||||
node.nodeValue = node.nodeValue.replace(valueoutReg, function (item, $1) {
|
||||
/*
|
||||
|
@ -254,7 +288,7 @@
|
|||
}
|
||||
|
||||
if (node.attributes) {
|
||||
// 指令处理
|
||||
// 指令处理
|
||||
sodaDirectiveArr.map(function (item) {
|
||||
var name = item.name;
|
||||
|
||||
|
@ -265,33 +299,37 @@
|
|||
}
|
||||
});
|
||||
|
||||
// 处理输出 包含 prefix-*
|
||||
// 处理输出 包含 prefix-*
|
||||
[].map.call(node.attributes, function (attr) {
|
||||
// 如果dirctiveMap有的就跳过不再处??
|
||||
// 如果dirctiveMap有的就跳过不再处<EFBFBD>?
|
||||
if (!sodaDirectiveMap[attr.name]) {
|
||||
if (prefixReg.test(attr.name)) {
|
||||
var attrName = attr.name.replace(prefixReg, '');
|
||||
|
||||
if (attrName) {
|
||||
var attrValue = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
if(attr.value){
|
||||
var attrValue = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
|
||||
node.setAttribute(attrName, attrValue);
|
||||
node.setAttribute(attrName, attrValue);
|
||||
}
|
||||
}
|
||||
|
||||
// 对其他属性里含expr 处理
|
||||
// 对其他属性里含expr 处理
|
||||
} else {
|
||||
attr.value = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
if(attr.value){
|
||||
attr.value = attr.value.replace(valueoutReg, function (item, $1) {
|
||||
return parseSodaExpression($1, scope);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
[].map.call([].slice.call(node.childNodes, []), function (child) {
|
||||
nodes2Arr(node.childNodes).map(function (child) {
|
||||
compileNode(child, scope);
|
||||
});
|
||||
};
|
||||
|
@ -369,13 +407,13 @@
|
|||
|
||||
trackName = trackName || '$index';
|
||||
|
||||
// 这里要处理一??
|
||||
// 这里要处理一<EFBFBD>?
|
||||
var repeatObj = getValue(scope, valueName) || [];
|
||||
|
||||
var repeatFunc = function (i) {
|
||||
var itemNode = el.cloneNode(true);
|
||||
|
||||
// 这里创建??个新的scope
|
||||
// 这里创建<EFBFBD>?个新的scope
|
||||
var itemScope = {};
|
||||
itemScope[trackName] = i;
|
||||
|
||||
|
@ -387,7 +425,7 @@
|
|||
|
||||
el.parentNode.insertBefore(itemNode, el);
|
||||
|
||||
// 这里是新加的dom, 要单独编??
|
||||
// 这里是新加的dom, 要单独编<EFBFBD>?
|
||||
compileNode(itemNode, itemScope);
|
||||
|
||||
};
|
||||
|
@ -541,23 +579,35 @@
|
|||
});
|
||||
|
||||
var sodaRender = function (str, data) {
|
||||
// 对directive进行排序
|
||||
// 对directive进行排序
|
||||
sodaDirectiveArr.sort(function (b, a) {
|
||||
return (Number(a.opt.priority || 0) - Number(b.opt.priority || 0));
|
||||
});
|
||||
|
||||
//console.log(sodaDirectiveArr);
|
||||
|
||||
// 解析模板DOM
|
||||
// 解析模板DOM
|
||||
var div = document.createElement("div");
|
||||
|
||||
// 必须加入到body中去,不然自定义标签不生效
|
||||
if(document.documentMode < 9) {
|
||||
div.style.display = 'none';
|
||||
document.body.appendChild(div);
|
||||
}
|
||||
|
||||
div.innerHTML = str;
|
||||
|
||||
[].map.call([].slice.call(div.childNodes, []), function (child) {
|
||||
nodes2Arr(div.childNodes).map(function (child) {
|
||||
compileNode(child, data);
|
||||
});
|
||||
|
||||
return div.innerHTML;
|
||||
var innerHTML = div.innerHTML;
|
||||
|
||||
if(document.documentMode < 9) {
|
||||
document.body.removeChild(div);
|
||||
}
|
||||
|
||||
return innerHTML;
|
||||
|
||||
// var frament = document.createDocumentFragment();
|
||||
// frament.innerHTML = div.innerHTML;
|
||||
|
@ -653,5 +703,5 @@
|
|||
else
|
||||
window.soda = sodaRender;
|
||||
|
||||
// 监听数据异常情况
|
||||
// 监听数据异常情况
|
||||
})();
|
||||
|
|
Loading…
Reference in New Issue