Build/component (#656)

* build: update build conf

* chore: update

* chore: update

* chore: update

* fix: rm mixin
This commit is contained in:
zazzaz 2020-11-23 13:55:48 +08:00 committed by GitHub
parent a9c8b7cebf
commit 5a424d4a43
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 26 additions and 31 deletions

View File

@ -10,6 +10,8 @@ const typescript = require('rollup-plugin-typescript2')
const deps = Object.keys(pkg.dependencies)
const noElPrefixFile = /(utils|directives|hooks|locale)/
const runBuild = async () => {
let index = 0
const pkgs = await getPackages()
@ -52,12 +54,20 @@ const runBuild = async () => {
|| deps.some(k => new RegExp('^' + k).test(id))
},
}
const getOutFile = () => {
const compName = name.split('@element-plus/')[1]
if(noElPrefixFile.test(name)) {
return `lib/${compName}/index.js`
}
return `lib/el-${compName}/index.js`
}
const outOptions = {
format: 'es',
file: `lib/${name.split('@element-plus/')[1]}/index.js`,
file: getOutFile(),
paths(id) {
if (/^@element-plus/.test(id)) {
return id.replace('@element-plus', '..')
if (noElPrefixFile.test(id)) return id.replace('@element-plus', '..')
return id.replace('@element-plus/', '../el-')
}
},
}

View File

@ -21,7 +21,6 @@ export default [
terser(),
nodeResolve(),
// commonjs(),
css(),
vue({
target: 'browser',
css: false,
@ -29,6 +28,9 @@ export default [
}),
typescript({
tsconfigOverride: {
compilerOptions: {
declaration: false,
},
'include': [
'packages/**/*',
'typings/vue-shim.d.ts',

View File

@ -51,7 +51,7 @@
import { defineComponent, PropType, inject, computed, ref } from 'vue'
import { CollapseProvider } from './collapse'
import { generateId } from '@element-plus/utils/util'
import ElCollapseTransition from '@element-plus/transition/collapse-transition/index.vue'
import ElCollapseTransition from '@element-plus/collapse-transition'
export default defineComponent({
name: 'ElCollapseItem',

View File

@ -159,6 +159,7 @@
import {
extractDateFormat,
extractTimeFormat,
TimePickPanel,
} from '@element-plus/time-picker'
import { t } from '@element-plus/locale'
import ElInput from '@element-plus/input'
@ -169,7 +170,7 @@ import dayjs, { Dayjs } from 'dayjs'
import DateTable from './basic-date-table.vue'
import MonthTable from './basic-month-table.vue'
import YearTable from './basic-year-table.vue'
import TimePickPanel from '@element-plus/time-picker/src/time-picker-com/panel-time-pick.vue'
import {
defineComponent,
computed,

View File

@ -217,7 +217,7 @@ import {
extractDateFormat,
extractTimeFormat,
} from '@element-plus/time-picker'
import TimePickPanel from '@element-plus/time-picker/src/time-picker-com/panel-time-pick.vue'
import { TimePickPanel } from '@element-plus/time-picker'
import { ClickOutside } from '@element-plus/directives'
import dayjs, { Dayjs } from 'dayjs'
import DateTable from './basic-date-table.vue'

View File

@ -1,5 +1,5 @@
import { DEFAULT_FORMATS_DATE, DEFAULT_FORMATS_DATEPICKER } from '@element-plus/time-picker/src/common/constant'
import Picker from '@element-plus/time-picker/src/common/picker.vue'
import { CommonPicker } from '@element-plus/time-picker'
import DatePickPanel from './date-picker-com/panel-date-pick.vue'
import DateRangePickPanel from './date-picker-com/panel-date-range.vue'
import MonthRangePickPanel from './date-picker-com/panel-month-range.vue'
@ -42,7 +42,7 @@ export default {
},
setup(props) {
const format = DEFAULT_FORMATS_DATEPICKER[props.type] || DEFAULT_FORMATS_DATE
return () => h(Picker, {
return () => h(CommonPicker, {
format,
type: props.type,
...props,

View File

@ -1,6 +1,5 @@
import { mount } from '@vue/test-utils'
import { t, use } from '../index'
import localeMixin from '../mixin'
import zhCn from '../lang/zh-cn'
import en from '../lang/en'
@ -18,13 +17,4 @@ describe('Locale', () => {
expect(t('el.popconfirm.confirmButtonText')).toBe('确定')
use(en)
})
test('mixin', () => {
const component = {
template: `<p>{{ t('el.popconfirm.cancelButtonText') }}</p>`,
mixins: [localeMixin],
} as any
const wrapper = mount(component)
expect(wrapper.text()).toContain('No')
})
})

View File

@ -1,9 +0,0 @@
import { t } from './index'
export default {
methods: {
t(...args) {
return t.apply(this, args)
},
},
}

View File

@ -10,5 +10,3 @@ export default defineComponent({
props: { },
})
</script>
<style scoped>
</style>

View File

@ -100,7 +100,7 @@ import {
onBeforeMount,
onBeforeUnmount,
} from 'vue'
import ElCollapseTransition from '@element-plus/transition/collapse-transition/index.vue'
import ElCollapseTransition from '@element-plus/collapse-transition'
import { ISubmenuProps, RootMenuProvider, SubMenuProvider } from './menu'
import useMenu from './useMenu'
import ElPopper from '@element-plus/popper'

View File

@ -1,9 +1,12 @@
import { App } from 'vue'
import TimePicker from './src/time-picker'
import CommonPicker from './src/common/picker.vue'
import TimePickPanel from './src/time-picker-com/panel-time-pick.vue'
export * from './src/common/date-utils'
TimePicker.install = (app: App): void => {
app.component(TimePicker.name, TimePicker)
}
export { CommonPicker, TimePickPanel }
export default TimePicker

View File

@ -77,7 +77,7 @@
</template>
<script lang='ts'>
import { defineComponent, getCurrentInstance, ref, watch, nextTick, inject, provide, PropType, ComponentInternalInstance } from 'vue'
import ElCollapseTransition from '@element-plus/transition/collapse-transition/index.vue'
import ElCollapseTransition from '@element-plus/collapse-transition'
import ElCheckbox from '@element-plus/checkbox'
import NodeContent from './tree-node-content.vue'
import { getNodeKey as getNodeKeyUtil } from './model/util'

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB