@aspire-ui/element-component-pro 1.0.13 → 1.0.14
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 +1 -0
- package/dist/ProTable/ProTable.vue.d.ts +7 -1
- package/dist/ProTable/types/index.d.ts +1 -0
- package/dist/ProTableForm/ProTableForm.vue.d.ts +164 -0
- package/dist/ProTableForm/index.d.ts +5 -0
- package/dist/ProTableForm/types.d.ts +69 -0
- package/dist/element-component-pro.es.js +1201 -911
- 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 +782 -243
- package/dist/style.css +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/useComponentSetting.d.ts +9 -4
- package/package.json +1 -1
- package/src/ProDescriptions/ProDescriptions.vue +2 -2
- package/src/ProTable/ProTable.vue +36 -5
- package/src/ProTable/types/index.ts +1 -0
- package/src/ProTableForm/ProTableForm.vue +555 -0
- package/src/ProTableForm/index.ts +9 -0
- package/src/ProTableForm/types.ts +72 -0
- package/src/index.ts +10 -0
- package/src/types/index.ts +1 -0
- package/src/useComponentSetting.ts +63 -8
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.ecp-pro-table[data-v-
|
|
1
|
+
.ecp-pro-table[data-v-f3d27813]{padding:16px;background:#fff;width:100%;box-sizing:border-box}.ecp-pro-table[data-v-f3d27813] .el-table{width:100%!important}.ecp-pro-table__header[data-v-f3d27813]{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.ecp-pro-table__title-wrapper[data-v-f3d27813]{display:flex;align-items:center;gap:4px}.ecp-pro-table__title[data-v-f3d27813]{font-size:16px;font-weight:600}.ecp-pro-table__help[data-v-f3d27813]{color:#909399;cursor:help}.ecp-pro-table__toolbar[data-v-f3d27813]{display:flex;align-items:center;gap:8px}.ecp-pro-table__body[data-v-f3d27813]{width:100%}.ecp-pro-table__pagination[data-v-f3d27813]{margin-top:16px;display:flex;justify-content:flex-end}.ecp-pro-table__col-help[data-v-f3d27813]{margin-left:4px;color:#909399;cursor:help}.ecp-table-action[data-v-45a58e7c],.ecp-table-action__item[data-v-45a58e7c]{display:inline-flex;align-items:center;gap:4px}.ecp-table-action__icon[data-v-45a58e7c]{margin-right:4px}.ecp-table-action__more[data-v-45a58e7c]{display:inline-flex;align-items:center}.ecp-table-action__dropdown-item[data-v-45a58e7c]{display:inline-flex;align-items:center;gap:4px}.ecp-tree-select[data-v-f30bba11]{position:relative;width:100%}.ecp-tree-select__filter-inner[data-v-f30bba11]{margin-bottom:8px}.ecp-tree-select__dropdown[data-v-f30bba11]{position:absolute;top:100%;left:0;right:0;max-height:280px;overflow:auto;background:#fff;border:1px solid #dcdfe6;border-radius:4px;margin-top:4px;z-index:1000;padding:8px}.ecp-tree-select__loading[data-v-f30bba11]{padding:24px;text-align:center;color:#909399;font-size:14px}.ecp-pro-form-item__colon[data-v-d3466c67]{margin-right:2px}.ecp-pro-form-item__help-icon[data-v-d3466c67]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-d3466c67]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-d3466c67]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-d3466c67]: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-bf70afca]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-bf70afca]{margin-bottom:16px}.ecp-pro-form_col[data-v-bf70afca]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-bf70afca]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-bf70afca]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-bf70afca]{position:absolute;bottom:0;left:50%;transform:translate(-50%,-50%)}.ecp-pro-descriptions[data-v-656036f6]{width:100%;box-sizing:border-box}.ecp-pro-descriptions__header[data-v-656036f6]{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px;gap:12px}.ecp-pro-descriptions__title-wrap[data-v-656036f6]{display:flex;align-items:center;gap:6px}.ecp-pro-descriptions__title[data-v-656036f6]{font-size:16px;font-weight:600;color:#303133}.ecp-pro-descriptions__help[data-v-656036f6],.ecp-pro-descriptions__toggle[data-v-656036f6]{color:#909399}.ecp-pro-descriptions__toggle .el-icon-arrow-down[data-v-656036f6]{margin-left:4px;transition:transform .2s ease}.ecp-pro-descriptions__toggle .el-icon-arrow-down.is-expanded[data-v-656036f6]{transform:rotate(180deg)}.ecp-pro-descriptions__body[data-v-656036f6]{display:grid;border-top:1px solid #ebeef5;border-left:1px solid #ebeef5;overflow:hidden}.ecp-pro-descriptions__body.is-collapsed[data-v-656036f6]{overflow:hidden}.ecp-pro-descriptions__body[data-v-656036f6]:not(.is-bordered){border-top:0;border-left:0;gap:12px 16px}.ecp-pro-descriptions__item[data-v-656036f6]{display:flex;min-width:0;border-right:1px solid #ebeef5;border-bottom:1px solid #ebeef5}.ecp-pro-descriptions__body:not(.is-bordered) .ecp-pro-descriptions__item[data-v-656036f6]{border-right:0;border-bottom:0}.ecp-pro-descriptions__label[data-v-656036f6],.ecp-pro-descriptions__content[data-v-656036f6]{min-width:0;box-sizing:border-box;word-break:break-word}.ecp-pro-descriptions__label[data-v-656036f6]{flex:0 0 120px;padding:12px 16px;color:#606266;background:#fafafa}.ecp-pro-descriptions__content[data-v-656036f6]{flex:1;padding:12px 16px;color:#303133;background:#fff}.ecp-pro-descriptions__body:not(.is-bordered) .ecp-pro-descriptions__label[data-v-656036f6]{flex-basis:auto;padding:0;margin-right:8px;background:transparent;font-weight:500}.ecp-pro-descriptions__body:not(.is-bordered) .ecp-pro-descriptions__content[data-v-656036f6]{padding:0;background:transparent}.ecp-pro-descriptions__body.is-small .ecp-pro-descriptions__label[data-v-656036f6],.ecp-pro-descriptions__body.is-small .ecp-pro-descriptions__content[data-v-656036f6]{padding-top:8px;padding-bottom:8px;font-size:13px}@media (max-width: 767px){.ecp-pro-descriptions__item[data-v-656036f6]{flex-direction:column}.ecp-pro-descriptions__label[data-v-656036f6]{flex-basis:auto}}.ecp-pro-table-form__form[data-v-44aa7592] .el-form-item{margin-bottom:0}.ecp-pro-table-form__cell-item[data-v-44aa7592]{width:100%}.ecp-pro-table-form__cell-item[data-v-44aa7592] .el-form-item__content{margin-left:0!important;line-height:normal}.ecp-pro-table-form__fixed-label[data-v-44aa7592]{color:#303133;font-size:14px}.ecp-pro-table-form__req[data-v-44aa7592]{color:#f56c6c;margin-right:2px}.ecp-pro-table-form__th-text[data-v-44aa7592]{font-weight:500;color:#606266}.ecp-pro-table-form__action-title[data-v-44aa7592]{margin-right:8px;font-size:13px;color:#606266}.ecp-pro-table-form__add-btn[data-v-44aa7592]{padding:0;font-size:14px}.ecp-pro-table-form__del-btn[data-v-44aa7592]{padding:0;color:#909399}.ecp-pro-table-form__del-btn[data-v-44aa7592]:not(:disabled){color:#409eff}.ecp-pro-table-form .ecp-pro-table-form__header-cell{background:#f5f7fa!important}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
export interface UseComponentSettingReturn {
|
|
2
2
|
/** 获取组件默认配置;不传参时返回全部组件的配置 */
|
|
3
|
-
getSetting:
|
|
4
|
-
/**
|
|
3
|
+
getSetting: <T extends Record<string, unknown> = Record<string, unknown>>(componentName?: string) => T;
|
|
4
|
+
/** 设置组件默认配置(与已有配置深度合并) */
|
|
5
5
|
setSetting: (componentName: string, config: Record<string, unknown>) => void;
|
|
6
|
+
/** 合并组件配置:全局配置与组件 props 合并,返回合并后的结果 */
|
|
7
|
+
mergeSettings: <T extends Record<string, unknown> = Record<string, unknown>>(componentName: string, props: Record<string, unknown>) => T;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
8
10
|
* 组件默认配置:供所有组件统一获取/设置默认配置
|
|
9
|
-
* - getSetting
|
|
10
|
-
* - setSetting
|
|
11
|
+
* - getSetting:获取组件默认配置
|
|
12
|
+
* - setSetting:设置组件默认配置(深度合并),可在应用入口或按需调用
|
|
13
|
+
* - mergeSettings:合并全局配置与组件 props,props 优先级更高
|
|
14
|
+
*
|
|
15
|
+
* 合并优先级:组件默认值 < 全局配置 < 组件 props
|
|
11
16
|
*/
|
|
12
17
|
export declare function useComponentSetting(): UseComponentSettingReturn;
|
package/package.json
CHANGED
|
@@ -181,8 +181,8 @@ const normalizeTooltip = (schema: DescriptionSchema, value: unknown, record: Rec
|
|
|
181
181
|
return normalizeTooltipConfig(resolved, value)
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
-
const {
|
|
185
|
-
const effectiveProps = computed(() => (
|
|
184
|
+
const { mergeSettings } = useComponentSetting()
|
|
185
|
+
const effectiveProps = computed(() => mergeSettings<DescriptionProps>('ProDescriptions', { ...props, ...innerProps.value }))
|
|
186
186
|
|
|
187
187
|
const breakpoints = { xxl: 1920, xl: 1200, lg: 992, md: 768, sm: 576 }
|
|
188
188
|
|
|
@@ -208,6 +208,8 @@
|
|
|
208
208
|
:page-sizes="pagination.pageSizes"
|
|
209
209
|
:page-size="pagination.pageSize"
|
|
210
210
|
:total="pagination.total"
|
|
211
|
+
:small="paginationSmall"
|
|
212
|
+
:background="paginationBackground"
|
|
211
213
|
:layout="(effectiveProps.pagination && typeof effectiveProps.pagination === 'object' ? effectiveProps.pagination.layout : null) || 'total, sizes, prev, pager, next, jumper'"
|
|
212
214
|
v-bind="(effectiveProps.pagination && typeof effectiveProps.pagination === 'object' && effectiveProps.pagination.props) || {}"
|
|
213
215
|
@size-change="handleSizeChange"
|
|
@@ -301,7 +303,7 @@ const props = withDefaults(
|
|
|
301
303
|
actionColumn?: Partial<ProColumn>
|
|
302
304
|
rowSelection?: { type?: 'checkbox' | 'radio'; width?: number; fixed?: 'left' | 'right'; getCheckboxProps?: (r: Record<string, unknown>) => { disabled?: boolean }; getRadioProps?: (r: Record<string, unknown>) => { disabled?: boolean } }
|
|
303
305
|
clearSelectOnPageChange?: boolean
|
|
304
|
-
pagination?: false | { pageSize?: number; pageSizes?: number[]; layout?: string; props?: Record<string, unknown> } | Record<string, unknown>
|
|
306
|
+
pagination?: false | { pageSize?: number; pageSizes?: number[]; layout?: string; small?: boolean; background?: boolean; props?: Record<string, unknown> } | Record<string, unknown>
|
|
305
307
|
tableSetting?: { redo?: boolean; size?: boolean; setting?: boolean; fullScreen?: boolean }
|
|
306
308
|
fetchSetting?: FetchSetting
|
|
307
309
|
beforeFetch?: (params: Record<string, unknown>) => Record<string, unknown>
|
|
@@ -362,21 +364,50 @@ const innerProps = ref<Partial<ProTableProps>>({})
|
|
|
362
364
|
const selectedRows = ref<Record<string, unknown>[]>([])
|
|
363
365
|
const showPaginationRef = ref<boolean | null>(null)
|
|
364
366
|
|
|
367
|
+
const { mergeSettings } = useComponentSetting()
|
|
368
|
+
const effectiveProps = computed(() => mergeSettings<ProTableProps>('ProTable', { ...props, ...innerProps.value }))
|
|
369
|
+
|
|
370
|
+
/** 从 effectiveProps.pagination 读取分页默认值(已通过深度合并) */
|
|
371
|
+
const defaultPagination = computed(() => {
|
|
372
|
+
const paginationConfig = effectiveProps.value.pagination
|
|
373
|
+
if (paginationConfig && typeof paginationConfig === 'object') {
|
|
374
|
+
return {
|
|
375
|
+
pageSize: (paginationConfig as Record<string, unknown>).pageSize ?? 10,
|
|
376
|
+
pageSizes: ((paginationConfig as Record<string, unknown>).pageSizes as number[]) ?? [10, 20, 50, 100],
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
return { pageSize: 10, pageSizes: [10, 20, 50, 100] as number[] }
|
|
380
|
+
})
|
|
381
|
+
|
|
365
382
|
const pagination = ref({
|
|
366
383
|
page: 1,
|
|
367
|
-
pageSize:
|
|
368
|
-
pageSizes:
|
|
384
|
+
pageSize: defaultPagination.value.pageSize,
|
|
385
|
+
pageSizes: defaultPagination.value.pageSizes,
|
|
369
386
|
total: 0,
|
|
370
387
|
})
|
|
371
388
|
|
|
372
|
-
const { getSetting: getComponentSetting } = useComponentSetting()
|
|
373
|
-
const effectiveProps = computed(() => ({ ...getComponentSetting('ProTable'), ...props, ...innerProps.value }))
|
|
374
389
|
const showTitleBar = computed(() => !!effectiveProps.value.title || !!slots.tableTitle || !!slots.toolbar)
|
|
375
390
|
const showPagination = computed(() => {
|
|
376
391
|
if (showPaginationRef.value !== null) return showPaginationRef.value
|
|
377
392
|
return !!props.pagination && typeof props.pagination === 'object'
|
|
378
393
|
})
|
|
379
394
|
|
|
395
|
+
/** 分页 small 属性:从 pagination 配置或全局设置中读取 */
|
|
396
|
+
const paginationSmall = computed(() => {
|
|
397
|
+
if (effectiveProps.value.pagination && typeof effectiveProps.value.pagination === 'object') {
|
|
398
|
+
return !!(effectiveProps.value.pagination as Record<string, unknown>).small
|
|
399
|
+
}
|
|
400
|
+
return false
|
|
401
|
+
})
|
|
402
|
+
|
|
403
|
+
/** 分页 background 属性:从 pagination 配置或全局设置中读取 */
|
|
404
|
+
const paginationBackground = computed(() => {
|
|
405
|
+
if (effectiveProps.value.pagination && typeof effectiveProps.value.pagination === 'object') {
|
|
406
|
+
return !!(effectiveProps.value.pagination as Record<string, unknown>).background
|
|
407
|
+
}
|
|
408
|
+
return false
|
|
409
|
+
})
|
|
410
|
+
|
|
380
411
|
const rowKeyField = computed(() => effectiveProps.value.rowKey || 'id')
|
|
381
412
|
|
|
382
413
|
/** 选中行 key 集合(用于快速判断) */
|