bw-pro-table 0.0.4 → 0.0.5

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 CHANGED
@@ -7,7 +7,7 @@
7
7
  ### 已集成功能
8
8
 
9
9
  - 🚀 **双模式数据加载**:`request` 异步请求模式 与 `dataSource` 静态数据模式互斥,支持自动竞态保护与页码越界校验
10
- - 🎨 **12 种内置渲染器**:`text`、`number`、`date`、`tag`、`image`、`link`、`progress`、`avatar`、`action`、`index`、`currency`、`boolean`(含 `enum` 别名),支持 `defineColumnType` 注册自定义类型
10
+ - 🎨 **13 种内置渲染器**:`text`、`number`、`date`、`dateTime`、`tag`、`image`、`link`、`progress`、`avatar`、`action`、`index`、`currency`、`boolean`(含 `enum` 别名),支持 `defineColumnType` 注册自定义类型
11
11
  - 🔍 **三管道筛选系统**:搜索栏 + 表头筛选(ant-design-vue 原生)+ 列头搜索(Popover),独立运行并合并为 `mergedSearchParams`
12
12
  - 📊 **客户端筛选与排序**:DataSource 模式下自动应用 `applyClientFilters`(三管道合并)与 `applyClientSort`(支持自定义 sorter 函数)
13
13
  - ✏️ **行内编辑**:单元格级 / 行级双模式编辑,草稿数据管理,字段校验(required/type/min/max/pattern/validator),撤销/重做(Command Pattern),批量编辑
@@ -256,6 +256,7 @@ interface ProColumnType<RecordType = any> extends Omit<TableColumnType<RecordTyp
256
256
  valueType?: ValueType; // 内置渲染器类型
257
257
  valueEnum?: ValueEnumMap; // 枚举值映射(tag/enum 渲染 + 搜索栏 select)
258
258
  dateFormat?: string; // 日期格式(valueType='date',默认 'YYYY-MM-DD')
259
+ dateTimeFormat?: string; // 日期时间格式(valueType='dateTime',默认 'YYYY-MM-DD HH:mm:ss')
259
260
  precision?: number; // 小数精度(valueType='number'/'currency')
260
261
  currencyPrefix?: string; // 货币前缀(默认 '¥')
261
262
  currencySuffix?: string; // 货币后缀(默认 '')
@@ -334,6 +335,7 @@ interface FormRule {
334
335
  | `text` | 文本 + Tooltip(`ellipsis !== false` 时) | `emptyText`、`ellipsis` |
335
336
  | `number` | 千分位格式化数字 | `precision`、`emptyText` |
336
337
  | `date` | dayjs 格式化日期 | `dateFormat`(默认 `'YYYY-MM-DD'`)、`emptyText` |
338
+ | `dateTime` | dayjs 格式化日期时间 | `dateTimeFormat`(默认 `'YYYY-MM-DD HH:mm:ss'`)、`dateFormat`(回退)、`emptyText` |
337
339
  | `currency` | 货币符号 + 千分位 | `precision`、`currencyPrefix`(默认 `'¥'`)、`currencySuffix`、`emptyText` |
338
340
  | `tag` / `enum` | `a-tag` + 颜色 | `valueEnum`、`emptyText` |
339
341
  | `image` | `a-image` 缩略图(含预览) | `imageWidth`(默认 32)、`imageHeight`(默认 32)、`emptyText` |
@@ -434,7 +436,7 @@ const dataSource = ref<User[]>([...]);
434
436
  按以下顺序对数据应用三管道筛选:
435
437
 
436
438
  1. **searchFormParams**(搜索栏):
437
- - `tag`/`boolean`/`number`/`currency`/`date` 类型 → 精确匹配(`===`)
439
+ - `tag`/`boolean`/`number`/`currency`/`date`/`dateTime` 类型 → 精确匹配(`===`)
438
440
  - `text`/其他类型 → 子串匹配(大小写不敏感)
439
441
  2. **headerSearchParams**(列头搜索):子串匹配(大小写不敏感)
440
442
  3. **tableFilterParams**(表头筛选):数组 `includes` 或精确匹配
@@ -474,6 +476,7 @@ const dataSource = ref<User[]>([...]);
474
476
  | `boolean` | `a-select`(是/否选项) |
475
477
  | `number` / `currency` | `a-input-number` |
476
478
  | `date` | `a-date-picker` |
479
+ | `dateTime` | `a-date-picker` |
477
480
  | `image` / `avatar` / `progress` / `action` / `index` | 不可搜索(自动排除) |
478
481
  | 其他 | `a-input`(兜底) |
479
482
 
@@ -550,6 +553,7 @@ interface EditConfig<RecordType = any> {
550
553
  |-----------|----------|
551
554
  | `number` / `currency` | `a-input-number` |
552
555
  | `date` | `a-date-picker`(格式使用 `dateFormat` 或默认 `'YYYY-MM-DD'`) |
556
+ | `dateTime` | `a-date-picker`(格式使用 `dateTimeFormat`,回退 `dateFormat`,默认 `'YYYY-MM-DD HH:mm:ss'`) |
553
557
  | `tag` / `enum` | `a-select`(选项来自 `valueEnum`) |
554
558
  | `boolean` | `a-switch` |
555
559
  | 其他(`text` 等) | `a-input` |
@@ -923,6 +927,11 @@ import { zhCN } from 'bw-pro-table';
923
927
  | `useBwRowSelection` | 行选择管理 |
924
928
  | `useQueryParams` | 查询参数管理 |
925
929
  | `useColumnHeaderSearch` | 列头搜索状态管理 |
930
+ | `useContextMenu` | 右键菜单状态管理(未集成) |
931
+ | `useDragSort` | 拖拽排序(未集成) |
932
+ | `useBwKeyboard` | 键盘导航(未集成) |
933
+ | `useTableView` | 视图管理(未集成) |
934
+ | `useBwPermission` | 权限过滤(未集成) |
926
935
  | `useLocale` / `mergeLocale` | 国际化工具 |
927
936
 
928
937
  示例:
@@ -1,2 +1,2 @@
1
- .bw-pro-table-column-search[data-v-06f12966]{min-width:200px;padding:8px}.bw-pro-table-column-search .bw-pro-table-column-search-input[data-v-06f12966]{margin-bottom:8px}.bw-pro-table-column-search .bw-pro-table-column-search-actions[data-v-06f12966]{justify-content:flex-end;display:flex}.bw-pro-table-core[data-v-406475b2] .ant-result{padding:48px 0}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-overflow-wrap{white-space:normal;word-break:break-all;-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.bw-pro-table-core .bw-pro-table-header-cell[data-v-406475b2]{justify-content:space-between;align-items:center;width:100%;display:flex}.bw-pro-table-core .bw-pro-table-header-left[data-v-406475b2]{text-overflow:ellipsis;align-items:center;gap:4px;min-width:0;display:inline-flex;overflow:hidden}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-description-icon{color:var(--ant-color-text-secondary,#00000073);cursor:help;font-size:14px}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-row-selected{background-color:var(--ant-primary-1,#e6f4ff)!important}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-input,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-input-number,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-select-selector,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-picker{border-color:var(--ant-color-error,#ff4d4f)!important}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error-msg{color:var(--ant-color-error,#ff4d4f);margin-top:4px;font-size:12px;line-height:1.5}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-drag-source{opacity:.45}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-drag-target{box-shadow:inset 2px 0 0 0 var(--ant-primary-color,#1890ff)}.bw-pro-table-core .bw-pro-table-header-drag-icon[data-v-406475b2]{color:var(--ant-color-text-quaternary,#bfbfbf);cursor:grab;flex-shrink:0;font-size:16px;transition:color .2s}.bw-pro-table-core .bw-pro-table-header-drag-icon[data-v-406475b2]:hover{color:var(--ant-primary-color,#1890ff)}.bw-pro-table-core .bw-pro-table-header-drag-icon--active[data-v-406475b2]{color:var(--ant-primary-color,#1890ff);cursor:grabbing}.bw-pro-table-search[data-v-8bc76b31]{background:var(--ant-color-bg-container,#fff);border-radius:8px;padding:24px 24px 0}.bw-pro-table-search .bw-search-form[data-v-8bc76b31] .ant-form-inline{row-gap:16px}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex-wrap:nowrap!important;flex:0 0 100%!important;margin-bottom:0!important;margin-right:0!important}@media (width>=576px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(50% - 12px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(2n){margin-right:0!important}}@media (width>=768px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(33.333% - 16px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(2n){margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(3n){margin-right:0!important}}@media (width>=992px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(25% - 18px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(3n){margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(4n){margin-right:0!important}}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-label{white-space:nowrap;align-items:center;overflow:hidden;flex:0 0 var(--bw-search-label-width,80px)!important;display:flex!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-label>label{text-overflow:ellipsis;white-space:nowrap;width:100%;overflow:hidden}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control{flex-direction:column;min-width:0;flex:1!important;display:flex!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input,.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input-content{width:100%}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input-content>*{box-sizing:border-box;width:100%!important}.bw-pro-table-search .bw-pro-table-search-actions{justify-content:flex-end;padding:16px;display:flex}.bw-pro-table-column-setting-panel[data-v-7e735b2d]{width:280px}.bw-pro-table-column-setting-header[data-v-7e735b2d]{border-bottom:1px solid #f0f0f0;justify-content:space-between;align-items:center;padding:12px 12px 8px;font-weight:600;display:flex}.bw-pro-table-column-setting-body[data-v-7e735b2d]{max-height:50vh;padding:4px 0;overflow-y:auto}.bw-pro-table-column-setting-item[data-v-7e735b2d]{cursor:default;align-items:center;gap:8px;padding:8px 12px;transition:background .15s;display:flex}.bw-pro-table-column-setting-item[data-v-7e735b2d]:hover{background:#fafafa}.bw-pro-table-column-setting-item--dragging[data-v-7e735b2d]{opacity:.45;background:#f0f0f0}.bw-pro-table-column-setting-item--drag-over[data-v-7e735b2d]{box-shadow:inset 0 2px 0 0 var(--ant-primary-color,#1890ff);background:#e6f7ff}.bw-pro-table-column-setting-item .bw-pro-table-column-drag-icon[data-v-7e735b2d]{color:#999;cursor:grab;flex-shrink:0;font-size:16px}.bw-pro-table-column-setting-item .bw-pro-table-column-drag-icon--active[data-v-7e735b2d]{color:var(--ant-primary-color,#1890ff);cursor:grabbing}.bw-pro-table-toolbar[data-v-db6f1492]{overflow:auto hidden}.bw-pro-table-toolbar .bw-pro-table-toolbar-container[data-v-db6f1492]{justify-content:space-between;align-items:center;height:64px;padding:0 24px;line-height:64px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-left[data-v-db6f1492]{align-items:center;gap:16px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-right[data-v-db6f1492]{align-items:center;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-title[data-v-db6f1492]{color:var(--ant-color-text,#000000d9);font-family:PingFangSC-Medium;font-size:16px}.bw-pro-table-toolbar .bw-pro-table-toolbar-selection-alert[data-v-db6f1492]{background:var(--ant-primary-1,#e6f4ff);border-bottom:1px solid var(--ant-primary-3,#91caff);justify-content:space-between;align-items:center;padding:8px 24px;font-size:14px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-selection-alert .bw-pro-table-toolbar-selection-count[data-v-db6f1492]{color:var(--ant-color-text,#000000d9)}.bw-pro-table[data-v-ce85e68e]{background:var(--ant-color-bg-container,#fff);border-radius:8px}.bw-pro-table[data-v-ce85e68e] .bw-pro-table-row-striped{background:var(--ant-color-bg-layout,#f5f5f5)}.bw-pro-table[data-v-ce85e68e] .bw-pro-table-row-selected{background-color:var(--ant-primary-1,#e6f4ff)!important}
1
+ .bw-pro-table-column-search[data-v-06f12966]{min-width:200px;padding:8px}.bw-pro-table-column-search .bw-pro-table-column-search-input[data-v-06f12966]{margin-bottom:8px}.bw-pro-table-column-search .bw-pro-table-column-search-actions[data-v-06f12966]{justify-content:flex-end;display:flex}.bw-pro-table-core[data-v-406475b2] .ant-result{padding:48px 0}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-overflow-ellipsis{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-overflow-wrap{white-space:normal;word-break:break-all;-webkit-line-clamp:3;-webkit-box-orient:vertical;display:-webkit-box;overflow:hidden}.bw-pro-table-core .bw-pro-table-header-cell[data-v-406475b2]{justify-content:space-between;align-items:center;width:100%;display:flex}.bw-pro-table-core .bw-pro-table-header-left[data-v-406475b2]{text-overflow:ellipsis;align-items:center;gap:4px;min-width:0;display:inline-flex;overflow:hidden}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-description-icon{color:var(--ant-color-text-secondary,#00000073);cursor:help;font-size:14px}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-row-selected{background-color:var(--ant-primary-1,#e6f4ff)!important}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-input,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-input-number,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-select-selector,.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error .ant-picker{border-color:var(--ant-color-error,#ff4d4f)!important}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-cell-error-msg{color:var(--ant-color-error,#ff4d4f);margin-top:4px;font-size:12px;line-height:1.5}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-drag-source{opacity:.45}.bw-pro-table-core[data-v-406475b2] .bw-pro-table-header-drag-target{box-shadow:inset 2px 0 0 0 var(--ant-primary-color,#1890ff)}.bw-pro-table-core .bw-pro-table-header-drag-icon[data-v-406475b2]{color:var(--ant-color-text-quaternary,#bfbfbf);cursor:grab;flex-shrink:0;font-size:16px;transition:color .2s}.bw-pro-table-core .bw-pro-table-header-drag-icon[data-v-406475b2]:hover{color:var(--ant-primary-color,#1890ff)}.bw-pro-table-core .bw-pro-table-header-drag-icon--active[data-v-406475b2]{color:var(--ant-primary-color,#1890ff);cursor:grabbing}.bw-pro-table-search[data-v-fa05fbb4]{background:var(--ant-color-bg-container,#fff);border-radius:8px;padding:24px 24px 0}.bw-pro-table-search .bw-search-form[data-v-fa05fbb4] .ant-form-inline{row-gap:16px}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex-wrap:nowrap!important;flex:0 0 100%!important;margin-bottom:0!important;margin-right:0!important}@media (width>=576px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(50% - 12px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(2n){margin-right:0!important}}@media (width>=768px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(33.333% - 16px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(2n){margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(3n){margin-right:0!important}}@media (width>=992px){.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item{flex:0 0 calc(25% - 18px)!important;margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(3n){margin-right:24px!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item:nth-child(4n){margin-right:0!important}}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-label{white-space:nowrap;align-items:center;overflow:hidden;flex:0 0 var(--bw-search-label-width,80px)!important;display:flex!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-label>label{text-overflow:ellipsis;white-space:nowrap;width:100%;overflow:hidden}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control{flex-direction:column;min-width:0;flex:1!important;display:flex!important}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input,.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input-content{width:100%}.bw-pro-table-search [data-bw-search] .ant-form-inline .ant-form-item.bw-search-form-item .ant-form-item-control-input-content>*{box-sizing:border-box;width:100%!important}.bw-pro-table-search .bw-pro-table-search-actions{justify-content:flex-end;padding:16px;display:flex}.bw-pro-table-column-setting-panel[data-v-7e735b2d]{width:280px}.bw-pro-table-column-setting-header[data-v-7e735b2d]{border-bottom:1px solid #f0f0f0;justify-content:space-between;align-items:center;padding:12px 12px 8px;font-weight:600;display:flex}.bw-pro-table-column-setting-body[data-v-7e735b2d]{max-height:50vh;padding:4px 0;overflow-y:auto}.bw-pro-table-column-setting-item[data-v-7e735b2d]{cursor:default;align-items:center;gap:8px;padding:8px 12px;transition:background .15s;display:flex}.bw-pro-table-column-setting-item[data-v-7e735b2d]:hover{background:#fafafa}.bw-pro-table-column-setting-item--dragging[data-v-7e735b2d]{opacity:.45;background:#f0f0f0}.bw-pro-table-column-setting-item--drag-over[data-v-7e735b2d]{box-shadow:inset 0 2px 0 0 var(--ant-primary-color,#1890ff);background:#e6f7ff}.bw-pro-table-column-setting-item .bw-pro-table-column-drag-icon[data-v-7e735b2d]{color:#999;cursor:grab;flex-shrink:0;font-size:16px}.bw-pro-table-column-setting-item .bw-pro-table-column-drag-icon--active[data-v-7e735b2d]{color:var(--ant-primary-color,#1890ff);cursor:grabbing}.bw-pro-table-toolbar[data-v-6eb60d31]{overflow:auto hidden}.bw-pro-table-toolbar .bw-pro-table-toolbar-container[data-v-6eb60d31]{justify-content:space-between;align-items:center;height:64px;padding:0 24px;line-height:64px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-left[data-v-6eb60d31]{align-items:center;gap:16px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-right[data-v-6eb60d31]{align-items:center;gap:8px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-title[data-v-6eb60d31]{color:var(--ant-color-text,#000000d9);font-family:PingFangSC-Medium;font-size:16px}.bw-pro-table-toolbar .bw-pro-table-toolbar-selection-alert[data-v-6eb60d31]{background:var(--ant-primary-1,#e6f4ff);border-bottom:1px solid var(--ant-primary-3,#91caff);justify-content:space-between;align-items:center;padding:8px 24px;font-size:14px;display:flex}.bw-pro-table-toolbar .bw-pro-table-toolbar-selection-alert .bw-pro-table-toolbar-selection-count[data-v-6eb60d31]{color:var(--ant-color-text,#000000d9)}.bw-pro-table[data-v-ce85e68e]{background:var(--ant-color-bg-container,#fff);border-radius:8px}.bw-pro-table[data-v-ce85e68e] .bw-pro-table-row-striped{background:var(--ant-color-bg-layout,#f5f5f5)}.bw-pro-table[data-v-ce85e68e] .bw-pro-table-row-selected{background-color:var(--ant-primary-1,#e6f4ff)!important}
2
2
  /*$vite$:1*/