59 lines
2.3 KiB
JavaScript
59 lines
2.3 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.install = install;
|
|
exports.IconPark = void 0;
|
|
|
|
var IconMap = _interopRequireWildcard(require("./map"));
|
|
|
|
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
|
|
|
|
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
|
|
function toPascalCase(val) {
|
|
return val.replace(/(^\w|-\w)/g, function (c) {
|
|
return c.slice(-1).toUpperCase();
|
|
});
|
|
}
|
|
|
|
var options = {
|
|
name: 'icon-park',
|
|
props: ['type', 'theme', 'size', 'spin', 'fill', 'strokeLinecap', 'strokeLinejoin', 'strokeWidth'],
|
|
inheritAttrs: true,
|
|
render: function render(h) {
|
|
var type = toPascalCase(this.type);
|
|
var theme = this.theme,
|
|
size = this.size,
|
|
fill = this.fill,
|
|
strokeLinecap = this.strokeLinecap,
|
|
strokeLinejoin = this.strokeLinejoin,
|
|
strokeWidth = this.strokeWidth,
|
|
spin = this.spin;
|
|
|
|
if (!(type in IconMap)) {
|
|
throw new Error("".concat(type, " is not a valid icon type name"));
|
|
}
|
|
|
|
return h(IconMap[type], {
|
|
props: {
|
|
theme: theme,
|
|
size: size,
|
|
fill: fill,
|
|
strokeLinecap: strokeLinecap,
|
|
strokeLinejoin: strokeLinejoin,
|
|
strokeWidth: strokeWidth,
|
|
spin: spin
|
|
}
|
|
});
|
|
}
|
|
};
|
|
var IconPark = options;
|
|
exports.IconPark = IconPark;
|
|
|
|
function install(Vue, prefix) {
|
|
Object.values(IconMap).forEach(function (icon) {
|
|
Vue.component(prefix ? prefix + '-' + icon.name.slice(5) : icon.name, icon);
|
|
});
|
|
} |