3 lines
1.8 KiB
JavaScript
3 lines
1.8 KiB
JavaScript
define("local_treestudyplan/bootstrap-vue/vue-functional-data-merge",["exports"],(function(_exports){Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.mergeData=function(){let prop,mergeTarget={},i=arguments.length;for(;i--;)for(prop of Object.keys(arguments[i]))if(null!=arguments[i][prop]){switch(prop){case"class":{let classes=[];{let value=mergeTarget.class;Array.isArray(value)&&(classes=value)}mergeTarget.class=classes.concat(arguments[i].class);continue}case"style":{let styles=[];{let value=mergeTarget.style;Array.isArray(value)&&(styles=value)}let thisStyle=[];Array.isArray(arguments[i].style)?thisStyle=arguments[i].style:thisStyle.push(arguments[i].style);for(let j=0;j<thisStyle.length;j++){let s=thisStyle[j];"string"==typeof s&&(thisStyle[j]=parseStyle(s))}mergeTarget[prop]=styles.concat(thisStyle);continue}case"id":case"key":case"ref":case"keepAlive":mergeTarget[prop]||(mergeTarget[prop]=arguments[i][prop]);continue}if(prop.startsWith("on")&&"on"!==prop){if(mergeTarget[prop]&&!Array.isArray(mergeTarget[prop])){mergeTarget[prop]=[mergeTarget[prop],arguments[i][prop]];continue}let targetValue=mergeTarget[prop],thisValue=arguments[i][prop];if(Array.isArray(targetValue)){Array.isArray(thisValue)?targetValue.push(...thisValue):targetValue.push(thisValue);continue}}mergeTarget[prop]=arguments[i][prop]}return mergeTarget};const pattern={kebab:/-(\w)/g,styleProp:/:(.*)/,styleList:/;(?![^(]*\))/g};function camelReplace(_substr,match){return match.toUpperCase()}function parseStyle(style){let styleMap={};for(let s of style.split(pattern.styleList)){let[key,val]=s.split(pattern.styleProp);key=key.trim(),key&&(val=val.trim(),styleMap[(str=key,str.replace(pattern.kebab,camelReplace))]=val)}var str;return styleMap}}));
|
|
|
|
//# sourceMappingURL=vue-functional-data-merge.min.js.map
|