@aspire-ui/element-component-pro 1.0.1 → 1.0.2
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/README.md +141 -7
- package/dist/ProTable/ProTable.vue.d.ts +421 -0
- package/dist/ProTable/TableAction.vue.d.ts +43 -0
- package/dist/ProTable/index.d.ts +8 -0
- package/dist/ProTable/types/index.d.ts +252 -0
- package/dist/ProTable/useProTable.d.ts +12 -0
- package/dist/element-component-pro.es.js +741 -296
- package/dist/element-component-pro.es.js.map +1 -1
- package/dist/element-component-pro.umd.js +2 -2
- package/dist/element-component-pro.umd.js.map +1 -1
- package/dist/index.d.ts +1325 -0
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +0 -49
- package/dist/useComponentSetting.d.ts +12 -0
- package/package.json +7 -5
- package/src/ProForm/ProForm.vue +3 -1
- package/src/ProForm/useForm.ts +0 -1
- package/src/ProTable/ProTable.vue +773 -0
- package/src/ProTable/TableAction.vue +193 -0
- package/src/ProTable/index.ts +20 -0
- package/src/ProTable/types/index.ts +236 -0
- package/src/ProTable/useProTable.ts +79 -0
- package/src/index.ts +13 -10
- package/src/types/index.ts +0 -44
- package/src/useComponentSetting.ts +35 -0
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ecp-pro-form-item__help-icon[data-v-cfc968c5]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-cfc968c5]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-cfc968c5]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-cfc968c5]:last-child{margin-bottom:0}.ecp-form-actions[data-v-489c88d2]{text-align:right}.ecp-form-actions__advance[data-v-489c88d2]{margin-right:8px}.el-icon-d-arrow-left.up[data-v-489c88d2]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-489c88d2]{transform:rotate(-90deg)}.ecp-pro-form[data-v-
|
|
1
|
+
.ecp-pro-table[data-v-c5638c20]{padding:16px;background:#fff;width:100%;box-sizing:border-box}.ecp-pro-table[data-v-c5638c20] .el-table{width:100%!important}.ecp-pro-table__header[data-v-c5638c20]{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.ecp-pro-table__title-wrapper[data-v-c5638c20]{display:flex;align-items:center;gap:4px}.ecp-pro-table__title[data-v-c5638c20]{font-size:16px;font-weight:600}.ecp-pro-table__help[data-v-c5638c20]{color:#909399;cursor:help}.ecp-pro-table__toolbar[data-v-c5638c20]{display:flex;align-items:center;gap:8px}.ecp-pro-table__body[data-v-c5638c20]{width:100%}.ecp-pro-table__pagination[data-v-c5638c20]{margin-top:16px;display:flex;justify-content:flex-end}.ecp-pro-table__col-help[data-v-c5638c20]{margin-left:4px;color:#909399;cursor:help}.ecp-table-action[data-v-1b2d6c42],.ecp-table-action__item[data-v-1b2d6c42]{display:inline-flex;align-items:center;gap:4px}.ecp-table-action__icon[data-v-1b2d6c42]{margin-right:4px}.ecp-table-action__more[data-v-1b2d6c42]{display:inline-flex;align-items:center}.ecp-table-action__dropdown-item[data-v-1b2d6c42]{display:inline-flex;align-items:center;gap:4px}.ecp-pro-form-item__help-icon[data-v-cfc968c5]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-cfc968c5]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-cfc968c5]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-cfc968c5]:last-child{margin-bottom:0}.ecp-form-actions[data-v-489c88d2]{text-align:right}.ecp-form-actions__advance[data-v-489c88d2]{margin-right:8px}.el-icon-d-arrow-left.up[data-v-489c88d2]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-489c88d2]{transform:rotate(-90deg)}.ecp-pro-form[data-v-140fc052]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-140fc052]{margin-bottom:16px}.ecp-pro-form_col[data-v-140fc052]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-140fc052]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-140fc052]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-140fc052]{position:absolute;bottom:0;left:50%;transform:translate(-50%,-50%)}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,54 +1,5 @@
|
|
|
1
1
|
import { VNode } from 'vue';
|
|
2
2
|
|
|
3
|
-
/** ProTable 列配置 */
|
|
4
|
-
export interface ProColumn {
|
|
5
|
-
/** 列标题 */
|
|
6
|
-
title: string;
|
|
7
|
-
/** 数据字段名 */
|
|
8
|
-
dataIndex: string;
|
|
9
|
-
/** 列宽度 */
|
|
10
|
-
width?: number | string;
|
|
11
|
-
/** 最小宽度 */
|
|
12
|
-
minWidth?: number | string;
|
|
13
|
-
/** 固定列 */
|
|
14
|
-
fixed?: 'left' | 'right';
|
|
15
|
-
/** 是否可排序 */
|
|
16
|
-
sortable?: boolean;
|
|
17
|
-
/** 对齐方式 */
|
|
18
|
-
align?: 'left' | 'center' | 'right';
|
|
19
|
-
/** 是否可调整宽度 */
|
|
20
|
-
resizable?: boolean;
|
|
21
|
-
/** 是否隐藏 */
|
|
22
|
-
hideInTable?: boolean;
|
|
23
|
-
/** 值类型 */
|
|
24
|
-
valueType?: 'text' | 'date' | 'dateTime' | 'option' | 'select' | 'index';
|
|
25
|
-
/** 枚举值映射 */
|
|
26
|
-
valueEnum?: Record<string | number, {
|
|
27
|
-
text: string;
|
|
28
|
-
status?: string;
|
|
29
|
-
}>;
|
|
30
|
-
/** 自定义渲染 */
|
|
31
|
-
customRender?: (params: {
|
|
32
|
-
text: unknown;
|
|
33
|
-
record: Record<string, unknown>;
|
|
34
|
-
index: number;
|
|
35
|
-
}) => VNode | string;
|
|
36
|
-
/** 表单项配置(用于搜索) */
|
|
37
|
-
fieldProps?: Record<string, unknown>;
|
|
38
|
-
/** 表单项占位符 */
|
|
39
|
-
placeholder?: string;
|
|
40
|
-
}
|
|
41
|
-
/** ProTable 工具栏配置 */
|
|
42
|
-
export interface ProTableToolBarConfig {
|
|
43
|
-
/** 是否显示刷新按钮 */
|
|
44
|
-
reload?: boolean;
|
|
45
|
-
/** 是否显示密度切换 */
|
|
46
|
-
density?: boolean;
|
|
47
|
-
/** 是否显示列设置 */
|
|
48
|
-
columnSetting?: boolean;
|
|
49
|
-
/** 是否显示全屏 */
|
|
50
|
-
fullScreen?: boolean;
|
|
51
|
-
}
|
|
52
3
|
/** 栅格配置 */
|
|
53
4
|
export interface ColEx {
|
|
54
5
|
span?: number;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface UseComponentSettingReturn {
|
|
2
|
+
/** 获取组件默认配置;不传参时返回全部组件的配置 */
|
|
3
|
+
getSetting: (componentName?: string) => Record<string, unknown>;
|
|
4
|
+
/** 设置组件默认配置(与已有配置浅合并) */
|
|
5
|
+
setSetting: (componentName: string, config: Record<string, unknown>) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* 组件默认配置:供所有组件统一获取/设置默认配置
|
|
9
|
+
* - getSetting:获取组件默认配置,用于初始化或合并 props
|
|
10
|
+
* - setSetting:设置组件默认配置,可在应用入口或按需调用
|
|
11
|
+
*/
|
|
12
|
+
export declare function useComponentSetting(): UseComponentSettingReturn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aspire-ui/element-component-pro",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.02",
|
|
4
4
|
"description": "Element UI 二次封装组件库,基于 Vue 2.7 + TypeScript + setup 语法糖,实现 VbenAdmin 风格的 Pro 组件",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/element-component-pro.umd.js",
|
|
@@ -21,20 +21,22 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"dev": "vite",
|
|
23
23
|
"build": "vite build",
|
|
24
|
-
"preview": "vite preview"
|
|
24
|
+
"preview": "vite preview",
|
|
25
|
+
"test:loading": "node scripts/test-loading.cjs"
|
|
25
26
|
},
|
|
26
27
|
"peerDependencies": {
|
|
27
|
-
"
|
|
28
|
-
"
|
|
28
|
+
"element-ui": "^2.15.0",
|
|
29
|
+
"vue": "^2.7.0"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
32
|
"@vitejs/plugin-vue2": "^2.3.1",
|
|
32
|
-
"vue-router": "^3.6.5",
|
|
33
33
|
"element-ui": "^2.15.14",
|
|
34
|
+
"playwright": "^1.40.0",
|
|
34
35
|
"typescript": "^5.3.0",
|
|
35
36
|
"vite": "^4.5.0",
|
|
36
37
|
"vite-plugin-dts": "^3.7.0",
|
|
37
38
|
"vue": "^2.7.16",
|
|
39
|
+
"vue-router": "^3.6.5",
|
|
38
40
|
"vue-tsc": "^1.8.27"
|
|
39
41
|
},
|
|
40
42
|
"keywords": [
|
package/src/ProForm/ProForm.vue
CHANGED
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
|
|
57
57
|
<script setup lang="ts">
|
|
58
58
|
import { ref, computed, watch, useSlots, onMounted, onUnmounted } from 'vue'
|
|
59
|
+
import { useComponentSetting } from '../useComponentSetting'
|
|
59
60
|
import ProFormItem from './ProFormItem.vue'
|
|
60
61
|
import FormActions from './FormActions.vue'
|
|
61
62
|
import type { ProFormSchema, ProFormProps, FormActionType, ColEx, ScrollToFieldOptions, FormListeners } from '../types'
|
|
@@ -142,7 +143,8 @@ const getEffectiveSpan = (colProps?: ColEx | null, baseColProps?: ColEx | null,
|
|
|
142
143
|
return col.xs ?? base.xs ?? col.span ?? fallback
|
|
143
144
|
}
|
|
144
145
|
|
|
145
|
-
const
|
|
146
|
+
const { getSetting: getComponentSetting } = useComponentSetting()
|
|
147
|
+
const effectiveProps = computed(() => ({ ...getComponentSetting('ProForm'), ...props, ...innerProps.value }))
|
|
146
148
|
const effectiveActionColOptions = computed(() => effectiveProps.value.actionColOptions ?? { span: 24 })
|
|
147
149
|
|
|
148
150
|
/** 当前视口宽度,用于响应式计算 span */
|
package/src/ProForm/useForm.ts
CHANGED
|
@@ -35,7 +35,6 @@ export function useForm(props?: UseFormPropsReactive): [UseFormReturn['register'
|
|
|
35
35
|
const register = (action: FormActionType) => {
|
|
36
36
|
formAction.value = action
|
|
37
37
|
const formProps = getFormProps()
|
|
38
|
-
debugger
|
|
39
38
|
if (formProps && Object.keys(formProps).length > 0) {
|
|
40
39
|
action.setProps(formProps)
|
|
41
40
|
}
|