@vrojs/element-plus 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +56 -0
- package/src/index.ts +13 -0
- package/src/locale/index.ts +3 -0
- package/src/locale/lang/zh-cn.ts +22 -0
- package/src/locale/types.ts +8 -0
- package/src/locale/useLocale.ts +42 -0
- package/src/style/base.scss +2 -0
- package/src/style/css.ts +2 -0
- package/src/style/deps.ts +9 -0
- package/src/style/index.scss +12 -0
- package/src/style/index.ts +2 -0
- package/src/utils/datePickerValueFormat.ts +6 -0
- package/src/utils/index.ts +2 -0
- package/src/vro-el-checkbox-group/README.md +83 -0
- package/src/vro-el-checkbox-group/index.ts +16 -0
- package/src/vro-el-checkbox-group/style/css.ts +2 -0
- package/src/vro-el-checkbox-group/style/deps.ts +2 -0
- package/src/vro-el-checkbox-group/style/index.scss +1 -0
- package/src/vro-el-checkbox-group/style/index.ts +2 -0
- package/src/vro-el-checkbox-group/types.ts +18 -0
- package/src/vro-el-checkbox-group/vro-el-checkbox-group.vue +33 -0
- package/src/vro-el-config-provider/README.md +65 -0
- package/src/vro-el-config-provider/index.ts +16 -0
- package/src/vro-el-config-provider/style/css.ts +2 -0
- package/src/vro-el-config-provider/style/deps.ts +0 -0
- package/src/vro-el-config-provider/style/index.scss +0 -0
- package/src/vro-el-config-provider/style/index.ts +2 -0
- package/src/vro-el-config-provider/types.ts +18 -0
- package/src/vro-el-config-provider/vro-el-config-provider.vue +19 -0
- package/src/vro-el-file-upload/README.md +89 -0
- package/src/vro-el-file-upload/index.ts +17 -0
- package/src/vro-el-file-upload/style/css.ts +2 -0
- package/src/vro-el-file-upload/style/deps.ts +2 -0
- package/src/vro-el-file-upload/style/index.scss +30 -0
- package/src/vro-el-file-upload/style/index.ts +2 -0
- package/src/vro-el-file-upload/types.ts +50 -0
- package/src/vro-el-file-upload/utils.ts +7 -0
- package/src/vro-el-file-upload/vro-el-file-upload.vue +95 -0
- package/src/vro-el-icon/README.md +68 -0
- package/src/vro-el-icon/index.ts +16 -0
- package/src/vro-el-icon/style/css.ts +2 -0
- package/src/vro-el-icon/style/deps.ts +1 -0
- package/src/vro-el-icon/style/index.scss +1 -0
- package/src/vro-el-icon/style/index.ts +2 -0
- package/src/vro-el-icon/types.ts +12 -0
- package/src/vro-el-icon/vro-el-icon.vue +28 -0
- package/src/vro-el-image-upload/README.md +99 -0
- package/src/vro-el-image-upload/index.ts +17 -0
- package/src/vro-el-image-upload/style/css.ts +2 -0
- package/src/vro-el-image-upload/style/deps.ts +4 -0
- package/src/vro-el-image-upload/style/index.scss +55 -0
- package/src/vro-el-image-upload/style/index.ts +2 -0
- package/src/vro-el-image-upload/types.ts +42 -0
- package/src/vro-el-image-upload/utils.ts +7 -0
- package/src/vro-el-image-upload/vro-el-image-upload.vue +134 -0
- package/src/vro-el-schema-form-dialog/README.md +64 -0
- package/src/vro-el-schema-form-dialog/function-call.ts +12 -0
- package/src/vro-el-schema-form-dialog/index.ts +17 -0
- package/src/vro-el-schema-form-dialog/style/css.ts +2 -0
- package/src/vro-el-schema-form-dialog/style/deps.ts +0 -0
- package/src/vro-el-schema-form-dialog/style/index.scss +1 -0
- package/src/vro-el-schema-form-dialog/style/index.ts +2 -0
- package/src/vro-el-schema-form-dialog/types.ts +5 -0
- package/src/vro-el-schema-form-dialog/vro-el-schema-form-dialog.vue +32 -0
- package/src/vro-el-select/README.md +83 -0
- package/src/vro-el-select/index.ts +16 -0
- package/src/vro-el-select/style/css.ts +2 -0
- package/src/vro-el-select/style/deps.ts +2 -0
- package/src/vro-el-select/style/index.scss +1 -0
- package/src/vro-el-select/style/index.ts +2 -0
- package/src/vro-el-select/types.ts +18 -0
- package/src/vro-el-select/vro-el-select.vue +33 -0
- package/src/vro-el-skeleton/README.md +128 -0
- package/src/vro-el-skeleton/index.ts +16 -0
- package/src/vro-el-skeleton/style/css.ts +3 -0
- package/src/vro-el-skeleton/style/deps.ts +3 -0
- package/src/vro-el-skeleton/style/index.scss +24 -0
- package/src/vro-el-skeleton/style/index.ts +2 -0
- package/src/vro-el-skeleton/types.ts +86 -0
- package/src/vro-el-skeleton/vro-el-skeleton.vue +73 -0
- package/src/vro-el-with-config/README.md +75 -0
- package/src/vro-el-with-config/index.ts +16 -0
- package/src/vro-el-with-config/style/css.ts +3 -0
- package/src/vro-el-with-config/style/deps.ts +2 -0
- package/src/vro-el-with-config/style/index.scss +0 -0
- package/src/vro-el-with-config/style/index.ts +2 -0
- package/src/vro-el-with-config/types.ts +18 -0
- package/src/vro-el-with-config/vro-el-with-config.vue +48 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# VroElWithConfig
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
|
|
5
|
+
用于给局部内容或动态组件同时包裹 `ElConfigProvider` 和 `VroElConfigProvider`。传入 `is` 时会渲染对应动态组件,并将 `attrs`、插槽透传给内部组件;未传入 `is` 时直接渲染默认插槽。
|
|
6
|
+
|
|
7
|
+
## 代码演示
|
|
8
|
+
|
|
9
|
+
### 基础用法
|
|
10
|
+
|
|
11
|
+
```html
|
|
12
|
+
<vro-el-with-config :el-config-props="{ size: 'large' }">
|
|
13
|
+
<el-button>按钮</el-button>
|
|
14
|
+
</vro-el-with-config>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Vro 文案配置
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<vro-el-with-config :vro-config-props="{ locale }">
|
|
21
|
+
<app />
|
|
22
|
+
</vro-el-with-config>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 动态组件
|
|
26
|
+
|
|
27
|
+
```html
|
|
28
|
+
<vro-el-with-config :is="ElButton" :el-config-props="{ size: 'small' }" type="primary">
|
|
29
|
+
动态按钮
|
|
30
|
+
</vro-el-with-config>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## API
|
|
34
|
+
|
|
35
|
+
### 属性 Props
|
|
36
|
+
|
|
37
|
+
<table>
|
|
38
|
+
<tbody>
|
|
39
|
+
<tr>
|
|
40
|
+
<td>名称</td>
|
|
41
|
+
<td>类型</td>
|
|
42
|
+
<td>默认值</td>
|
|
43
|
+
</tr>
|
|
44
|
+
<tr v-for="(item, key) in vroElWithConfigProps" :key="key">
|
|
45
|
+
<td>{{ key }}</td>
|
|
46
|
+
<td>{{ parseType(item.type || item) }}</td>
|
|
47
|
+
<td>{{ reserve(item.default, '-') }}</td>
|
|
48
|
+
</tr>
|
|
49
|
+
</tbody>
|
|
50
|
+
</table>
|
|
51
|
+
|
|
52
|
+
### 插槽 Slots
|
|
53
|
+
|
|
54
|
+
<table>
|
|
55
|
+
<tbody>
|
|
56
|
+
<tr>
|
|
57
|
+
<td>名称</td>
|
|
58
|
+
<td>说明</td>
|
|
59
|
+
</tr>
|
|
60
|
+
<tr>
|
|
61
|
+
<td>default</td>
|
|
62
|
+
<td>默认内容;传入 is 时会透传给动态组件</td>
|
|
63
|
+
</tr>
|
|
64
|
+
</tbody>
|
|
65
|
+
</table>
|
|
66
|
+
|
|
67
|
+
### 实例代理
|
|
68
|
+
|
|
69
|
+
传入 `is` 时,组件实例会代理内部动态组件暴露的方法和属性。
|
|
70
|
+
|
|
71
|
+
<script setup lang="ts">
|
|
72
|
+
import { reserve } from '@daysnap/utils'
|
|
73
|
+
import { VroElWithConfig, vroElWithConfigProps } from '.'
|
|
74
|
+
import { parseType } from '../utils'
|
|
75
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { withInstall } from '@vrojs/base'
|
|
2
|
+
|
|
3
|
+
import Component from './vro-el-with-config.vue'
|
|
4
|
+
|
|
5
|
+
export * from './types'
|
|
6
|
+
|
|
7
|
+
export const VroElWithConfig = withInstall<typeof Component>(Component)
|
|
8
|
+
export default VroElWithConfig
|
|
9
|
+
|
|
10
|
+
export type VroElWithConfigInstance = InstanceType<typeof VroElWithConfig>
|
|
11
|
+
|
|
12
|
+
declare module 'vue' {
|
|
13
|
+
export interface GlobalComponents {
|
|
14
|
+
VroElWithConfig: typeof VroElWithConfig
|
|
15
|
+
}
|
|
16
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ConfigProviderProps } from 'element-plus'
|
|
2
|
+
import type { Component, ExtractPropTypes, PropType } from 'vue'
|
|
3
|
+
|
|
4
|
+
import type { VroElConfigProviderProps } from '../vro-el-config-provider'
|
|
5
|
+
|
|
6
|
+
export const vroElWithConfigProps = {
|
|
7
|
+
elConfigProps: {
|
|
8
|
+
type: Object as PropType<Partial<ConfigProviderProps>>,
|
|
9
|
+
default: () => ({}),
|
|
10
|
+
},
|
|
11
|
+
vroConfigProps: {
|
|
12
|
+
type: Object as PropType<Partial<VroElConfigProviderProps>>,
|
|
13
|
+
default: () => ({}),
|
|
14
|
+
},
|
|
15
|
+
is: [String, Object] as PropType<string | Component>,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type VroElWithConfigProps = ExtractPropTypes<typeof vroElWithConfigProps>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ElConfigProvider } from 'element-plus'
|
|
3
|
+
import { h, ref, useAttrs, useSlots } from 'vue'
|
|
4
|
+
|
|
5
|
+
import { VroElConfigProvider } from '../vro-el-config-provider'
|
|
6
|
+
import { vroElWithConfigProps } from './types'
|
|
7
|
+
|
|
8
|
+
defineOptions({ name: 'VroElWithConfig' })
|
|
9
|
+
|
|
10
|
+
const props = defineProps(vroElWithConfigProps)
|
|
11
|
+
const attrs = useAttrs()
|
|
12
|
+
const slots = useSlots()
|
|
13
|
+
|
|
14
|
+
const refComponent = ref<any>()
|
|
15
|
+
|
|
16
|
+
defineExpose(
|
|
17
|
+
new Proxy(
|
|
18
|
+
{},
|
|
19
|
+
{
|
|
20
|
+
get(_target, prop) {
|
|
21
|
+
return refComponent.value?.[prop]
|
|
22
|
+
},
|
|
23
|
+
has(_target, prop) {
|
|
24
|
+
return refComponent.value ? prop in refComponent.value : false
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
),
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
const renderContent = () => {
|
|
31
|
+
if (props.is) {
|
|
32
|
+
return h(props.is, { ...attrs, ref: refComponent }, slots)
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return slots.default?.()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const renderVroConfigProvider = () =>
|
|
39
|
+
h(VroElConfigProvider, props.vroConfigProps, {
|
|
40
|
+
default: renderContent,
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const Render = () => h(ElConfigProvider, props.elConfigProps, renderVroConfigProvider)
|
|
44
|
+
</script>
|
|
45
|
+
|
|
46
|
+
<template>
|
|
47
|
+
<Render />
|
|
48
|
+
</template>
|