ant-design-vue/index.js

31 lines
806 B
JavaScript
Raw Normal View History

2018-03-21 13:16:11 +00:00
/* eslint no-console:0 */
2019-01-12 03:33:27 +00:00
function camelCase(name) {
return (
name.charAt(0).toUpperCase() +
2018-03-21 13:16:11 +00:00
name.slice(1).replace(/-(\w)/g, (m, n) => {
2019-01-12 03:33:27 +00:00
return n.toUpperCase();
2018-03-21 13:16:11 +00:00
})
2019-01-12 03:33:27 +00:00
);
2018-03-21 13:16:11 +00:00
}
// Just import style for https://github.com/ant-design/ant-design/issues/3745
2019-01-12 03:33:27 +00:00
const req = require.context('./components', true, /^\.\/[^_][\w-]+\/style\/index\.js?$/);
2018-03-21 13:16:11 +00:00
2019-01-12 03:33:27 +00:00
req.keys().forEach(mod => {
let v = req(mod);
2018-03-21 13:16:11 +00:00
if (v && v.default) {
2019-01-12 03:33:27 +00:00
v = v.default;
2018-03-21 13:16:11 +00:00
}
2019-01-12 03:33:27 +00:00
const match = mod.match(/^\.\/([^_][\w-]+)\/index\.js?$/);
2018-03-21 13:16:11 +00:00
if (match && match[1]) {
if (match[1] === 'message' || match[1] === 'notification') {
// message & notification should not be capitalized
2019-01-12 03:33:27 +00:00
exports[match[1]] = v;
2018-03-21 13:16:11 +00:00
} else {
2019-01-12 03:33:27 +00:00
exports[camelCase(match[1])] = v;
2018-03-21 13:16:11 +00:00
}
}
2019-01-12 03:33:27 +00:00
});
2018-03-21 13:16:11 +00:00
2019-01-12 03:33:27 +00:00
module.exports = require('./components');