@aspire-ui/element-component-pro 1.0.19 → 1.0.20

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/dist/index.d.ts CHANGED
@@ -1214,113 +1214,10 @@ declare const _default: {
1214
1214
  };
1215
1215
  };
1216
1216
  } & (new () => {
1217
- $scopedSlots: Partial<Record<`header-${string}`, (_: {
1218
- column: {
1219
- key?: string | undefined;
1220
- title: string;
1221
- dataIndex: string;
1222
- width?: number | string | undefined;
1223
- minWidth?: number | string | undefined;
1224
- maxWidth?: number | string | undefined;
1225
- fixed?: "left" | "right" | undefined;
1226
- sortable?: boolean | undefined;
1227
- align?: "left" | "center" | "right" | undefined;
1228
- resizable?: boolean | undefined;
1229
- ellipsis?: boolean | undefined;
1230
- hideInTable?: boolean | undefined;
1231
- defaultHidden?: boolean | undefined;
1232
- helpMessage?: string | string[] | undefined;
1233
- valueType?: "text" | "date" | "dateTime" | "option" | "select" | "index" | undefined;
1234
- valueEnum?: Record<string | number, {
1235
- text: string;
1236
- status?: string;
1237
- }> | undefined;
1238
- customRender?: ((params: {
1239
- text: unknown;
1240
- record: Record<string, unknown>;
1241
- index: number;
1242
- }) => import('vue').VNode | string) | undefined;
1243
- formatter?: ((row: Record<string, unknown>, column: unknown, cellValue: unknown) => string) | undefined;
1244
- ifShow?: boolean | ((params: {
1245
- column: import('./ProTable').ProColumn;
1246
- }) => boolean) | undefined;
1247
- fieldProps?: Record<string, unknown> | undefined;
1248
- placeholder?: string | undefined;
1249
- };
1250
- }) => any>> & Partial<Record<string, (_: {
1251
- row: any;
1252
- column: {
1253
- key?: string | undefined;
1254
- title: string;
1255
- dataIndex: string;
1256
- width?: number | string | undefined;
1257
- minWidth?: number | string | undefined;
1258
- maxWidth?: number | string | undefined;
1259
- fixed?: "left" | "right" | undefined;
1260
- sortable?: boolean | undefined;
1261
- align?: "left" | "center" | "right" | undefined;
1262
- resizable?: boolean | undefined;
1263
- ellipsis?: boolean | undefined;
1264
- hideInTable?: boolean | undefined;
1265
- defaultHidden?: boolean | undefined;
1266
- helpMessage?: string | string[] | undefined;
1267
- valueType?: "text" | "date" | "dateTime" | "option" | "select" | "index" | undefined;
1268
- valueEnum?: Record<string | number, {
1269
- text: string;
1270
- status?: string;
1271
- }> | undefined;
1272
- customRender?: ((params: {
1273
- text: unknown;
1274
- record: Record<string, unknown>;
1275
- index: number;
1276
- }) => import('vue').VNode | string) | undefined;
1277
- formatter?: ((row: Record<string, unknown>, column: unknown, cellValue: unknown) => string) | undefined;
1278
- ifShow?: boolean | ((params: {
1279
- column: import('./ProTable').ProColumn;
1280
- }) => boolean) | undefined;
1281
- fieldProps?: Record<string, unknown> | undefined;
1282
- placeholder?: string | undefined;
1283
- };
1284
- index: any;
1285
- value: any;
1286
- }) => any>> & {
1217
+ $scopedSlots: {
1287
1218
  tableTitle?(_: {}): any;
1288
1219
  toolbar?(_: {}): any;
1289
1220
  "toolbar-right"?(_: {}): any;
1290
- headerCell?(_: {
1291
- column: {
1292
- key?: string | undefined;
1293
- title: string;
1294
- dataIndex: string;
1295
- width?: number | string | undefined;
1296
- minWidth?: number | string | undefined;
1297
- maxWidth?: number | string | undefined;
1298
- fixed?: "left" | "right" | undefined;
1299
- sortable?: boolean | undefined;
1300
- align?: "left" | "center" | "right" | undefined;
1301
- resizable?: boolean | undefined;
1302
- ellipsis?: boolean | undefined;
1303
- hideInTable?: boolean | undefined;
1304
- defaultHidden?: boolean | undefined;
1305
- helpMessage?: string | string[] | undefined;
1306
- valueType?: "text" | "date" | "dateTime" | "option" | "select" | "index" | undefined;
1307
- valueEnum?: Record<string | number, {
1308
- text: string;
1309
- status?: string;
1310
- }> | undefined;
1311
- customRender?: ((params: {
1312
- text: unknown;
1313
- record: Record<string, unknown>;
1314
- index: number;
1315
- }) => import('vue').VNode | string) | undefined;
1316
- formatter?: ((row: Record<string, unknown>, column: unknown, cellValue: unknown) => string) | undefined;
1317
- ifShow?: boolean | ((params: {
1318
- column: import('./ProTable').ProColumn;
1319
- }) => boolean) | undefined;
1320
- fieldProps?: Record<string, unknown> | undefined;
1321
- placeholder?: string | undefined;
1322
- };
1323
- }): any;
1324
1221
  action?(_: {
1325
1222
  record: any;
1326
1223
  column: Partial<import('./ProTable').ProColumn>;
package/dist/style.css CHANGED
@@ -1 +1 @@
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-48d7960b]{margin-right:2px}.ecp-pro-form-item__help-icon[data-v-48d7960b]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-48d7960b]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-48d7960b]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-48d7960b]: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-cf7b3b35]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-cf7b3b35]{margin-bottom:16px}.ecp-pro-form .ecp-pro-form_col[data-v-cf7b3b35]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-cf7b3b35]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-cf7b3b35]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-cf7b3b35]{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-collapse-container[data-v-087dba3a]{background:#fff;border-radius:14px;border:1px solid #e8eef8;box-shadow:0 10px 24px #0f2d5e0f;overflow:hidden}.ecp-collapse-container.is-ghost[data-v-087dba3a]{border-color:transparent;box-shadow:none;background:transparent}.ecp-collapse-container__header[data-v-087dba3a]{min-height:56px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid #eef3fb}.ecp-collapse-container.is-ghost .ecp-collapse-container__header[data-v-087dba3a]{padding-left:0;padding-right:0}.ecp-collapse-container__header-main[data-v-087dba3a]{min-width:0;flex:1;display:flex;align-items:center}.ecp-collapse-container__title-wrap[data-v-087dba3a]{min-width:0;display:inline-flex;align-items:center;gap:8px}.ecp-collapse-container__title[data-v-087dba3a]{color:#1f2d3d;font-size:16px;font-weight:600;line-height:1.4}.ecp-collapse-container__help[data-v-087dba3a]{color:#91a3b7;font-size:14px}.ecp-collapse-container__header-extra[data-v-087dba3a]{display:inline-flex;align-items:center;justify-content:flex-end;gap:12px;flex-shrink:0}.ecp-collapse-container__toggle[data-v-087dba3a]{padding:0;color:#2f6fd3}.ecp-collapse-container__toggle i[data-v-087dba3a]{margin-left:6px;transition:transform .2s ease}.ecp-collapse-container__toggle i.is-expanded[data-v-087dba3a]{transform:rotate(180deg)}.ecp-collapse-container__body[data-v-087dba3a]{padding:20px;box-sizing:border-box}.ecp-collapse-container.is-ghost .ecp-collapse-container__body[data-v-087dba3a]{padding-left:0;padding-right:0}.ecp-collapse-container.is-header-clickable .ecp-collapse-container__header-main[data-v-087dba3a]{cursor:pointer}@media (max-width: 768px){.ecp-collapse-container__header[data-v-087dba3a]{padding:14px 16px;align-items:flex-start;flex-direction:column}.ecp-collapse-container__header-extra[data-v-087dba3a]{width:100%;justify-content:space-between}.ecp-collapse-container__body[data-v-087dba3a]{padding:16px}}.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}
1
+ .ecp-pro-table[data-v-ce606251]{padding:16px;background:#fff;width:100%;box-sizing:border-box}.ecp-pro-table[data-v-ce606251] .el-table{width:100%!important}.ecp-pro-table__header[data-v-ce606251]{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.ecp-pro-table__title-wrapper[data-v-ce606251]{display:flex;align-items:center;gap:4px}.ecp-pro-table__title[data-v-ce606251]{font-size:16px;font-weight:600}.ecp-pro-table__help[data-v-ce606251]{color:#909399;cursor:help}.ecp-pro-table__toolbar[data-v-ce606251]{display:flex;align-items:center;gap:8px}.ecp-pro-table__body[data-v-ce606251]{width:100%}.ecp-pro-table__pagination[data-v-ce606251]{margin-top:16px;display:flex;justify-content:flex-end}.ecp-pro-table__col-help[data-v-ce606251]{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-48d7960b]{margin-right:2px}.ecp-pro-form-item__help-icon[data-v-48d7960b]{margin-left:4px;color:#909399;cursor:help;font-size:14px}.ecp-pro-form-item__help-icon[data-v-48d7960b]:hover{color:#409eff}.ecp-pro-form-item__help-item[data-v-48d7960b]{margin-bottom:4px}.ecp-pro-form-item__help-item[data-v-48d7960b]: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-cf7b3b35]{padding:16px;position:relative}.ecp-pro-form__advance[data-v-cf7b3b35]{margin-bottom:16px}.ecp-pro-form .ecp-pro-form_col[data-v-cf7b3b35]{position:relative;float:right}.el-icon-d-arrow-left.up[data-v-cf7b3b35]{transform:rotate(90deg)}.el-icon-d-arrow-left.down[data-v-cf7b3b35]{transform:rotate(-90deg)}.ecp-form-actions__advance[data-v-cf7b3b35]{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-collapse-container[data-v-087dba3a]{background:#fff;border-radius:14px;border:1px solid #e8eef8;box-shadow:0 10px 24px #0f2d5e0f;overflow:hidden}.ecp-collapse-container.is-ghost[data-v-087dba3a]{border-color:transparent;box-shadow:none;background:transparent}.ecp-collapse-container__header[data-v-087dba3a]{min-height:56px;padding:0 20px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid #eef3fb}.ecp-collapse-container.is-ghost .ecp-collapse-container__header[data-v-087dba3a]{padding-left:0;padding-right:0}.ecp-collapse-container__header-main[data-v-087dba3a]{min-width:0;flex:1;display:flex;align-items:center}.ecp-collapse-container__title-wrap[data-v-087dba3a]{min-width:0;display:inline-flex;align-items:center;gap:8px}.ecp-collapse-container__title[data-v-087dba3a]{color:#1f2d3d;font-size:16px;font-weight:600;line-height:1.4}.ecp-collapse-container__help[data-v-087dba3a]{color:#91a3b7;font-size:14px}.ecp-collapse-container__header-extra[data-v-087dba3a]{display:inline-flex;align-items:center;justify-content:flex-end;gap:12px;flex-shrink:0}.ecp-collapse-container__toggle[data-v-087dba3a]{padding:0;color:#2f6fd3}.ecp-collapse-container__toggle i[data-v-087dba3a]{margin-left:6px;transition:transform .2s ease}.ecp-collapse-container__toggle i.is-expanded[data-v-087dba3a]{transform:rotate(180deg)}.ecp-collapse-container__body[data-v-087dba3a]{padding:20px;box-sizing:border-box}.ecp-collapse-container.is-ghost .ecp-collapse-container__body[data-v-087dba3a]{padding-left:0;padding-right:0}.ecp-collapse-container.is-header-clickable .ecp-collapse-container__header-main[data-v-087dba3a]{cursor:pointer}@media (max-width: 768px){.ecp-collapse-container__header[data-v-087dba3a]{padding:14px 16px;align-items:flex-start;flex-direction:column}.ecp-collapse-container__header-extra[data-v-087dba3a]{width:100%;justify-content:space-between}.ecp-collapse-container__body[data-v-087dba3a]{padding:16px}}.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspire-ui/element-component-pro",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
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",
@@ -43,7 +43,7 @@
43
43
  :max-height="effectiveProps.maxHeight"
44
44
  :height="effectiveProps.height"
45
45
  :default-sort="effectiveProps.defaultSort"
46
- :span-method="effectiveProps.spanMethod"
46
+ :span-method="spanMethodAdapter"
47
47
  :tree-props="effectiveProps.treeProps"
48
48
  :default-expand-all="effectiveProps.defaultExpandAll"
49
49
  :expand-row-keys="effectiveProps.expandRowKeys || []"
@@ -105,70 +105,15 @@
105
105
  :fixed="effectiveProps.indexColumnProps?.fixed"
106
106
  :align="effectiveProps.indexColumnProps?.align || 'center'"
107
107
  />
108
- <!-- 数据列 -->
108
+ <!-- 数据列(支持多级表头) -->
109
109
  <template v-for="col in displayColumns">
110
- <el-table-column
110
+ <TableColumnGroup
111
111
  v-if="shouldShowColumn(col)"
112
- :key="col.dataIndex || col.key || col.title"
113
- :prop="col.dataIndex"
114
- :label="col.title"
115
- :width="getColumnWidth(col)"
116
- :min-width="isRatioWidth(col.width) ? undefined : col.minWidth"
117
- :fixed="col.fixed"
118
- :align="col.align || 'left'"
119
- :sortable="col.sortable"
120
- :formatter="col.formatter"
121
- :show-overflow-tooltip="col.ellipsis !== false && effectiveProps.ellipsis !== false"
122
- >
123
- <template slot="header" slot-scope="_">
124
- <!-- 1. 列级自定义表头:header-[dataIndex],例如 #header-age -->
125
- <slot
126
- v-if="col.dataIndex && $scopedSlots[`header-${col.dataIndex}`]"
127
- :name="`header-${col.dataIndex}`"
128
- :column="col"
129
- />
130
- <!-- 2. 全局表头渲染:headerCell,类似 Vben 的 headerCell 用法 -->
131
- <slot
132
- v-else-if="$scopedSlots['headerCell']"
133
- name="headerCell"
134
- :column="col"
135
- />
136
- <!-- 3. 默认表头渲染:标题 + helpMessage 提示 -->
137
- <template v-else>
138
- <span>{{ col.title }}</span>
139
- <el-tooltip v-if="col.helpMessage" class="ecp-pro-table__col-help" placement="top" effect="dark">
140
- <template slot="content">
141
- <span v-if="Array.isArray(col.helpMessage)">
142
- <div v-for="(msg, i) in col.helpMessage" :key="i">{{ msg }}</div>
143
- </span>
144
- <span v-else>{{ col.helpMessage }}</span>
145
- </template>
146
- <i class="el-icon-question" />
147
- </el-tooltip>
148
- </template>
149
- </template>
150
- <template slot-scope="scope">
151
- <slot
152
- v-if="col.dataIndex && $scopedSlots[col.dataIndex]"
153
- :name="col.dataIndex"
154
- :row="scope.row"
155
- :column="col"
156
- :index="scope.$index"
157
- :value="scope.row[col.dataIndex]"
158
- />
159
- <BodyCellRenderer
160
- v-else-if="$scopedSlots['bodyCell']"
161
- :slot-render="$scopedSlots['bodyCell']"
162
- :column="col"
163
- :record="scope.row"
164
- :index="scope.$index"
165
- :value="scope.row[col.dataIndex]"
166
- :custom-render="col.customRender"
167
- :value-enum="col.valueEnum"
168
- />
169
- <DefaultCellRenderer v-else :column="col" :record="scope.row" :index="scope.$index" :value="scope.row[col.dataIndex]" />
170
- </template>
171
- </el-table-column>
112
+ :key="col.key || col.dataIndex || col.title"
113
+ :column="col"
114
+ :effective-props="effectiveProps"
115
+ :get-column-width="getColumnWidth"
116
+ />
172
117
  </template>
173
118
  <!-- 操作列 -->
174
119
  <el-table-column
@@ -221,67 +166,11 @@
221
166
 
222
167
  <script setup lang="ts">
223
168
  // @ts-nocheck - Vue 2 el-table-column slot-scope 类型推断存在已知限制,暂用此方式消除模板内 scope 相关告警
224
- import { ref, computed, watch, onMounted, onUnmounted, useSlots, nextTick, defineComponent, h } from 'vue'
169
+ import { ref, computed, watch, onMounted, onUnmounted, useSlots, nextTick } from 'vue'
225
170
  import { useComponentSetting } from '../useComponentSetting'
226
171
  import type { ProColumn, ProTableProps, TableActionType, FetchSetting, FetchParams } from './types'
227
-
228
- const DefaultCellRenderer = defineComponent({
229
- name: 'EcpProTableDefaultCellRenderer',
230
- props: {
231
- column: { type: Object, required: true },
232
- record: { type: Object, required: true },
233
- index: { type: Number, required: true },
234
- value: { required: false },
235
- },
236
- setup(p) {
237
- return () => {
238
- const col = p.column as any
239
- if (col?.customRender) {
240
- const r = col.customRender({ text: p.value, record: p.record, index: p.index })
241
- if (typeof r === 'string' || typeof r === 'number') return h('span', String(r))
242
- return r as any
243
- }
244
- if (col?.valueEnum) {
245
- const text = col.valueEnum?.[p.value]?.text ?? p.value
246
- return h('span', text == null ? '' : String(text))
247
- }
248
- return h('span', p.value == null ? '' : String(p.value))
249
- }
250
- },
251
- })
252
-
253
- const BodyCellRenderer = defineComponent({
254
- name: 'EcpProTableBodyCellRenderer',
255
- props: {
256
- slotRender: { type: Function, required: true },
257
- column: { type: Object, required: true },
258
- record: { type: Object, required: true },
259
- index: { type: Number, required: true },
260
- value: { required: false },
261
- customRender: { type: Function, required: false },
262
- valueEnum: { type: Object, required: false },
263
- },
264
- setup(p) {
265
- return () => {
266
- const slot = p.slotRender as any
267
- const nodes = slot?.({ column: p.column, record: p.record, index: p.index, value: p.value })
268
-
269
- const normalize = (n: any) => {
270
- if (n == null) return []
271
- if (Array.isArray(n)) return n.filter((x) => x != null && x !== false && !x.isComment)
272
- return [n]
273
- }
274
- const normalized = normalize(nodes)
275
- if (normalized.length > 0) return nodes
276
-
277
- // slot 未返回内容时,回退到默认渲染(对齐 vbenAdmin bodyCell 用法)
278
- const col = { ...(p.column as any) }
279
- if (p.customRender) col.customRender = p.customRender
280
- if (p.valueEnum) col.valueEnum = p.valueEnum
281
- return h(DefaultCellRenderer as any, { props: { column: col, record: p.record, index: p.index, value: p.value } })
282
- }
283
- },
284
- })
172
+ import TableColumnGroup from './components/TableColumnGroup.vue'
173
+ import { DefaultCellRenderer, BodyCellRenderer } from './components/CellRenderers'
285
174
 
286
175
  const props = withDefaults(
287
176
  defineProps<{
@@ -418,6 +307,25 @@ const displayColumns = computed(() =>
418
307
  innerColumns.value.filter((c) => !c.hideInTable && !c.defaultHidden)
419
308
  )
420
309
 
310
+ /** 扁平列映射:columnId -> 原始 ProColumn(供 spanMethod 使用) */
311
+ const flatColumnsMap = computed(() => {
312
+ const map = new Map<string, ProColumn>()
313
+ const flatten = (cols: ProColumn[]) => {
314
+ for (const col of cols) {
315
+ if (col.children && col.children.length > 0) {
316
+ flatten(col.children)
317
+ } else {
318
+ if (col.id) map.set(col.id, col)
319
+ }
320
+ }
321
+ }
322
+ flatten(displayColumns.value)
323
+ return map
324
+ })
325
+
326
+ /** 所有可见叶子列(支持多级表头) */
327
+ const allFlatColumns = computed(() => Array.from(flatColumnsMap.value.values()))
328
+
421
329
  /** 固定列总宽度 */
422
330
  const fixedColumnsWidth = computed(() => {
423
331
  let w = 0
@@ -429,18 +337,30 @@ const fixedColumnsWidth = computed(() => {
429
337
 
430
338
  const isRatioWidth = (w: number | string | undefined) => typeof w === 'number' && w > 0
431
339
  const totalRatio = computed(() => {
432
- const cols = displayColumns.value.filter((c) => shouldShowColumn(c) && isRatioWidth(c.width))
340
+ const cols = allFlatColumns.value.filter((c) => shouldShowColumn(c) && isRatioWidth(c.width))
433
341
  return cols.reduce((sum, c) => sum + (typeof c.width === 'number' ? c.width : 0), 0)
434
342
  })
435
343
 
436
344
  const fixedDataColumnsWidth = computed(() => {
437
- const cols = displayColumns.value.filter((c) => shouldShowColumn(c) && typeof c.width === 'string')
345
+ const cols = allFlatColumns.value.filter((c) => shouldShowColumn(c) && typeof c.width === 'string')
438
346
  return cols.reduce((sum, c) => sum + (Number(getColumnWidth(c)) || 80), 0)
439
347
  })
440
348
 
441
349
  const parseWidthPx = (v: number | string | undefined): number | null =>
442
350
  v == null ? null : typeof v === 'number' ? v : parseInt(String(v).replace(/px$/i, ''), 10) || null
443
351
 
352
+ /** spanMethod 适配器:给用户回调注入原始 ProColumn */
353
+ const spanMethodAdapter: TableProps<any>['spanMethod'] = (
354
+ param: { row: any; column: any; rowIndex: number; columnIndex: number }
355
+ ) => {
356
+ if (!effectiveProps.value.spanMethod) return [1, 1]
357
+ const original = flatColumnsMap.value.get(param.column.id)
358
+ return effectiveProps.value.spanMethod({
359
+ ...param,
360
+ column: {...original, dataIndex: param.column.property, title: param.column.label } || { ...param.column, dataIndex: param.column.property, title: param.column.label },
361
+ })
362
+ }
363
+
444
364
  const getColumnWidth = (col: ProColumn): number | string | undefined => {
445
365
  const w = col.width
446
366
  if (isRatioWidth(w) && totalRatio.value > 0 && containerWidth.value > 0 && typeof w === 'number') {
@@ -461,7 +381,7 @@ const getColumnWidth = (col: ProColumn): number | string | undefined => {
461
381
  if (maxPx != null) result = Math.min(maxPx, result)
462
382
  return result
463
383
  }
464
- return col.width
384
+ return col.minWidth
465
385
  }
466
386
 
467
387
  const shouldShowColumn = (col: ProColumn) => {
@@ -702,7 +622,18 @@ const tableAction: TableActionType = {
702
622
 
703
623
  defineExpose(tableAction)
704
624
 
705
- const syncColumns = () => { innerColumns.value = [...(props.columns ?? [])] }
625
+ const syncColumns = () => {
626
+ const assignIds = (cols: ProColumn[], parentKey = ''): ProColumn[] =>
627
+ cols.map((c, i) => {
628
+ const key = `${parentKey}-${i}`
629
+ return {
630
+ ...c,
631
+ id: c.id || key,
632
+ children: c.children ? assignIds(c.children, key) : undefined,
633
+ }
634
+ })
635
+ innerColumns.value = assignIds(props.columns ?? [])
636
+ }
706
637
 
707
638
  const loadData = () => {
708
639
  if (props.api && effectiveProps.value.immediate !== false) {
@@ -0,0 +1,59 @@
1
+ import { defineComponent, h } from 'vue'
2
+ import type { ProColumn } from '../types'
3
+
4
+ export const DefaultCellRenderer = defineComponent({
5
+ name: 'EcpProTableDefaultCellRenderer',
6
+ props: {
7
+ column: { type: Object as () => ProColumn, required: true },
8
+ record: { type: Object as () => Record<string, unknown>, required: true },
9
+ index: { type: Number, required: true },
10
+ value: { required: false },
11
+ },
12
+ setup(p) {
13
+ return () => {
14
+ const col = p.column as any
15
+ if (col?.customRender) {
16
+ const r = col.customRender({ text: p.value, record: p.record, index: p.index })
17
+ if (typeof r === 'string' || typeof r === 'number') return h('span', String(r))
18
+ return r as any
19
+ }
20
+ if (col?.valueEnum) {
21
+ const text = col.valueEnum?.[p.value]?.text ?? p.value
22
+ return h('span', text == null ? '' : String(text))
23
+ }
24
+ return h('span', p.value == null ? '' : String(p.value))
25
+ }
26
+ },
27
+ })
28
+
29
+ export const BodyCellRenderer = defineComponent({
30
+ name: 'EcpProTableBodyCellRenderer',
31
+ props: {
32
+ slotRender: { type: Function, required: true },
33
+ column: { type: Object as () => ProColumn, required: true },
34
+ record: { type: Object as () => Record<string, unknown>, required: true },
35
+ index: { type: Number, required: true },
36
+ value: { required: false },
37
+ customRender: { type: Function, required: false },
38
+ valueEnum: { type: Object, required: false },
39
+ },
40
+ setup(p) {
41
+ return () => {
42
+ const slot = p.slotRender as any
43
+ const nodes = slot?.({ column: p.column, record: p.record, index: p.index, value: p.value })
44
+
45
+ const normalize = (n: any) => {
46
+ if (n == null) return []
47
+ if (Array.isArray(n)) return n.filter((x) => x != null && x !== false && !x.isComment)
48
+ return [n]
49
+ }
50
+ const normalized = normalize(nodes)
51
+ if (normalized.length > 0) return nodes
52
+
53
+ const col = { ...(p.column as any) }
54
+ if (p.customRender) col.customRender = p.customRender
55
+ if (p.valueEnum) col.valueEnum = p.valueEnum
56
+ return h(DefaultCellRenderer as any, { props: { column: col, record: p.record, index: p.index, value: p.value } })
57
+ }
58
+ },
59
+ })
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <el-table-column
3
+ v-if="column.children && column.children.length > 0"
4
+ :label="column.title"
5
+ :align="column.align || 'left'"
6
+ :fixed="column.fixed"
7
+ >
8
+ <template v-for="child in column.children">
9
+ <TableColumnGroup
10
+ v-if="shouldShowColumn(child)"
11
+ :key="child.key || child.dataIndex || child.title"
12
+ :column="child"
13
+ :effective-props="effectiveProps"
14
+ :get-column-width="getColumnWidth"
15
+ />
16
+ </template>
17
+ </el-table-column>
18
+ <el-table-column
19
+ v-else
20
+ :prop="column.dataIndex"
21
+ :label="column.title"
22
+ :min-width="getColumnWidth(column)"
23
+ :fixed="column.fixed"
24
+ :align="column.align || 'left'"
25
+ :sortable="column.sortable"
26
+ :formatter="column.formatter"
27
+ :show-overflow-tooltip="column.ellipsis !== false && effectiveProps.ellipsis !== false"
28
+ >
29
+ <template #default="slotProps">
30
+ <slot
31
+ v-if="column.dataIndex && $scopedSlots[column.dataIndex]"
32
+ :name="column.dataIndex"
33
+ :row="slotProps.row"
34
+ :column="column"
35
+ :index="slotProps.$index"
36
+ :value="slotProps.row[column.dataIndex]"
37
+ />
38
+ <BodyCellRenderer
39
+ v-else-if="$scopedSlots['bodyCell']"
40
+ :slot-render="$scopedSlots['bodyCell']"
41
+ :column="column"
42
+ :record="slotProps.row"
43
+ :index="slotProps.$index"
44
+ :value="slotProps.row[column.dataIndex]"
45
+ :custom-render="column.customRender"
46
+ :value-enum="column.valueEnum"
47
+ />
48
+ <DefaultCellRenderer
49
+ v-else
50
+ :column="column"
51
+ :record="slotProps.row"
52
+ :index="slotProps.$index"
53
+ :value="slotProps.row[column.dataIndex]"
54
+ />
55
+ </template>
56
+ <template #header>
57
+ <slot
58
+ v-if="column.dataIndex && $scopedSlots[`header-${column.dataIndex}`]"
59
+ :name="`header-${column.dataIndex}`"
60
+ :column="column"
61
+ />
62
+ <slot
63
+ v-else-if="$scopedSlots['headerCell']"
64
+ name="headerCell"
65
+ :column="column"
66
+ />
67
+ <template v-else>
68
+ <span>{{ column.title }}</span>
69
+ <el-tooltip v-if="column.helpMessage" class="ecp-pro-table__col-help" placement="top" effect="dark">
70
+ <template #content>
71
+ <span v-if="Array.isArray(column.helpMessage)">
72
+ <div v-for="(msg, i) in column.helpMessage" :key="i">{{ msg }}</div>
73
+ </span>
74
+ <span v-else>{{ column.helpMessage }}</span>
75
+ </template>
76
+ <i class="el-icon-question" />
77
+ </el-tooltip>
78
+ </template>
79
+ </template>
80
+ </el-table-column>
81
+ </template>
82
+
83
+ <script setup lang="ts">
84
+ import { useSlots } from 'vue'
85
+ import type { ProColumn, ProTableProps } from '../types'
86
+ import { DefaultCellRenderer, BodyCellRenderer } from './CellRenderers'
87
+
88
+ const props = defineProps<{
89
+ column: ProColumn
90
+ effectiveProps: ProTableProps
91
+ getColumnWidth: (col: ProColumn) => number | string | undefined
92
+ }>()
93
+
94
+ const $scopedSlots = useSlots()
95
+
96
+ const shouldShowColumn = (col: ProColumn) => {
97
+ if (col.ifShow === false) return false
98
+ if (typeof col.ifShow === 'function') return col.ifShow({ column: col })
99
+ return true
100
+ }
101
+ </script>
@@ -8,6 +8,8 @@ export interface ProColumn {
8
8
  title: string
9
9
  /** 数据字段名 */
10
10
  dataIndex: string
11
+ /** 子列配置(用于多级表头) */
12
+ children?: ProColumn[]
11
13
  /** 列宽度:number 为比例(如 1、2、3 表示 1:2:3),string 为 px */
12
14
  width?: number | string
13
15
  /** 最小宽度(参考 VbenAdmin,比例列和固定列均生效) */