ant-design-vue/index.js

31 lines
806 B
JavaScript
Raw Normal View History

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