huibo-ui 0.5.0 → 0.6.0

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.
Files changed (69) hide show
  1. package/dist/cjs/hb-form-item.cjs.entry.js +59 -9
  2. package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
  3. package/dist/cjs/hb-form.cjs.entry.js +105 -2
  4. package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
  5. package/dist/cjs/hb-select.cjs.entry.js +82 -10
  6. package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
  7. package/dist/cjs/hb-steps.cjs.entry.js +1 -1
  8. package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
  9. package/dist/cjs/hb-table.cjs.entry.js +195 -27
  10. package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
  11. package/dist/cjs/huibo-ui.cjs.js +1 -1
  12. package/dist/cjs/loader.cjs.js +1 -1
  13. package/dist/collection/components/Form/Form.js +205 -2
  14. package/dist/collection/components/Form/Form.js.map +1 -1
  15. package/dist/collection/components/Form/FormItem.js +117 -10
  16. package/dist/collection/components/Form/FormItem.js.map +1 -1
  17. package/dist/collection/components/Select/Select.js +105 -10
  18. package/dist/collection/components/Select/Select.js.map +1 -1
  19. package/dist/collection/components/Table/Table.js +273 -27
  20. package/dist/collection/components/Table/Table.js.map +1 -1
  21. package/dist/collection/utils/virtual-scroll.js +39 -0
  22. package/dist/collection/utils/virtual-scroll.js.map +1 -0
  23. package/dist/components/hb-form-item.js +62 -9
  24. package/dist/components/hb-form-item.js.map +1 -1
  25. package/dist/components/hb-form.js +110 -2
  26. package/dist/components/hb-form.js.map +1 -1
  27. package/dist/components/hb-select.js +87 -11
  28. package/dist/components/hb-select.js.map +1 -1
  29. package/dist/components/hb-steps.js +1 -1
  30. package/dist/components/hb-steps.js.map +1 -1
  31. package/dist/components/hb-table.js +203 -29
  32. package/dist/components/hb-table.js.map +1 -1
  33. package/dist/esm/hb-form-item.entry.js +59 -9
  34. package/dist/esm/hb-form-item.entry.js.map +1 -1
  35. package/dist/esm/hb-form.entry.js +105 -2
  36. package/dist/esm/hb-form.entry.js.map +1 -1
  37. package/dist/esm/hb-select.entry.js +82 -10
  38. package/dist/esm/hb-select.entry.js.map +1 -1
  39. package/dist/esm/hb-steps.entry.js +1 -1
  40. package/dist/esm/hb-steps.entry.js.map +1 -1
  41. package/dist/esm/hb-table.entry.js +195 -27
  42. package/dist/esm/hb-table.entry.js.map +1 -1
  43. package/dist/esm/huibo-ui.js +1 -1
  44. package/dist/esm/loader.js +1 -1
  45. package/dist/huibo-ui/huibo-ui.esm.js +1 -1
  46. package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
  47. package/dist/huibo-ui/{p-79b24b83.entry.js → p-2cf5bf20.entry.js} +2 -2
  48. package/dist/huibo-ui/{p-79b24b83.entry.js.map → p-2cf5bf20.entry.js.map} +1 -1
  49. package/dist/huibo-ui/p-4148d875.entry.js +2 -0
  50. package/dist/huibo-ui/p-4148d875.entry.js.map +1 -0
  51. package/dist/huibo-ui/{p-54a28052.entry.js → p-6bfe1954.entry.js} +2 -2
  52. package/dist/huibo-ui/p-6bfe1954.entry.js.map +1 -0
  53. package/dist/huibo-ui/{p-ac18c68b.entry.js → p-e8824b2c.entry.js} +2 -2
  54. package/dist/huibo-ui/p-e8824b2c.entry.js.map +1 -0
  55. package/dist/huibo-ui/p-f69599fa.entry.js +2 -0
  56. package/dist/huibo-ui/p-f69599fa.entry.js.map +1 -0
  57. package/dist/types/components/Form/Form.d.ts +57 -0
  58. package/dist/types/components/Form/FormItem.d.ts +23 -0
  59. package/dist/types/components/Select/Select.d.ts +19 -0
  60. package/dist/types/components/Table/Table.d.ts +103 -8
  61. package/dist/types/components.d.ts +148 -2
  62. package/dist/types/utils/virtual-scroll.d.ts +38 -0
  63. package/package.json +1 -1
  64. package/dist/huibo-ui/p-29092b85.entry.js +0 -2
  65. package/dist/huibo-ui/p-29092b85.entry.js.map +0 -1
  66. package/dist/huibo-ui/p-2bc30b1b.entry.js +0 -2
  67. package/dist/huibo-ui/p-2bc30b1b.entry.js.map +0 -1
  68. package/dist/huibo-ui/p-54a28052.entry.js.map +0 -1
  69. package/dist/huibo-ui/p-ac18c68b.entry.js.map +0 -1
@@ -1 +1 @@
1
- {"file":"hb-steps.entry.js","mappings":"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","names":[],"sources":["src/components/Steps/steps.css?tag=hb-steps&encapsulation=shadow","src/components/Steps/Steps.tsx"],"sourcesContent":[":host { display: block; }\n.hb-steps { display: flex; }\n.hb-steps--vertical { flex-direction: column; }\n.hb-steps__item { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }\n.hb-steps--vertical .hb-steps__item { flex-direction: row; align-items: flex-start; gap: var(--hb-spacing-sm); padding-bottom: var(--hb-spacing-md); }\n.hb-steps__head { display: flex; align-items: center; width: 100%; }\n.hb-steps__icon {\n width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;\n font-size: var(--hb-font-size-sm); font-weight: 600; flex-shrink: 0;\n background: var(--hb-color-fill); color: var(--hb-color-text-secondary); transition: all 0.3s;\n}\n.hb-steps__item--process .hb-steps__icon { background: var(--hb-color-primary); color: #fff; }\n.hb-steps__item--finish .hb-steps__icon { background: var(--hb-color-primary); color: #fff; }\n.hb-steps__item--error .hb-steps__icon { background: var(--hb-color-danger); color: #fff; }\n.hb-steps__line { flex: 1; height: 2px; background: var(--hb-color-border-secondary); margin: 0 var(--hb-spacing-xs); }\n.hb-steps__item--finish .hb-steps__line { background: var(--hb-color-primary); }\n.hb-steps__main { text-align: center; margin-top: var(--hb-spacing-xs); }\n.hb-steps--vertical .hb-steps__main { text-align: left; }\n\n/* 对齐方式(alignCenter prop):默认 false 时图标与文字左对齐,true 时居中 */\n.hb-steps:not(.hb-steps--align-center) .hb-steps__item { align-items: flex-start; }\n.hb-steps:not(.hb-steps--align-center) .hb-steps__main { text-align: left; }\n.hb-steps__title { font-size: var(--hb-font-size-sm); font-weight: 600; }\n.hb-steps__item--process .hb-steps__title { color: var(--hb-color-primary); }\n.hb-steps__description { font-size: var(--hb-font-size-xs); color: var(--hb-color-text-secondary); margin-top: 2px; }\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\nexport type StepStatus = 'wait' | 'process' | 'finish' | 'error';\n\ninterface StepMeta {\n title: string;\n description?: string;\n /** 自定义图标名/标记('hb-icon' name 或文本)。undefined 表示用默认序号/状态图标 */\n icon?: string;\n /** 子项显式状态覆盖(不指定则按 active 自动推导) */\n status?: StepStatus;\n}\n\n@Component({ tag: 'hb-steps', styleUrl: 'steps.css', shadow: true })\nexport class Steps {\n @Element() el: HTMLElement;\n @Prop() active: number = 0;\n @Prop() processStatus: StepStatus = 'process';\n @Prop() alignCenter: boolean = false;\n @Prop() direction: 'horizontal' | 'vertical' = 'horizontal';\n\n @State() steps: StepMeta[] = [];\n\n componentDidLoad() {\n const items = this.el.querySelectorAll('hb-step');\n this.steps = Array.from(items).map(item => {\n const node = item as HTMLElement;\n // 仅用 getAttribute:hb-step 的 @Prop() status 默认值为 'wait',\n // 若读 (node as any).status 会拿到默认值,从而错误地覆盖 active 推导。\n // 用户显式在 HTML 上写 status=\"xxx\" 时 getAttribute 才有值。\n return {\n title: node.getAttribute('title') || '',\n description: node.getAttribute('description') || undefined,\n icon: node.getAttribute('icon') || undefined,\n status: (node.getAttribute('status') || undefined) as StepStatus | undefined,\n };\n });\n }\n\n private getStatus(index: number): StepStatus {\n const meta = this.steps[index];\n // 子项显式 status 优先(仅当用户在 HTML 上写了 status 属性)\n if (meta && meta.status) return meta.status;\n if (index < this.active) return 'finish';\n if (index === this.active) return this.processStatus;\n return 'wait';\n }\n\n /** 渲染图标:子项自定义 icon 优先;否则按状态(finish=✓、error=✕、其余=序号) */\n private renderIcon(index: number): any {\n const meta = this.steps[index];\n if (meta && meta.icon) {\n // 自定义图标名:若与 hb-icon 内置图标同名则渲染 hb-icon,否则按文本渲染\n return <hb-icon name={meta.icon} size={16} aria-hidden=\"true\" />;\n }\n const status = this.getStatus(index);\n if (status === 'finish') return '✓';\n if (status === 'error') return '✕';\n return String(index + 1);\n }\n\n render() {\n return (\n <ol class={{ 'hb-steps': true, [`hb-steps--${this.direction}`]: true, 'hb-steps--align-center': this.alignCenter }} role=\"list\">\n {this.steps.map((step, i) => {\n const status = this.getStatus(i);\n return (\n <li\n class={{ 'hb-steps__item': true, [`hb-steps__item--${status}`]: true }}\n role=\"listitem\"\n aria-current={status === 'process' ? 'step' : undefined}\n aria-disabled={step.status === 'wait' && i > this.active ? 'true' : undefined}\n >\n <div class=\"hb-steps__head\">\n <span class=\"hb-steps__icon\" aria-hidden=\"true\">\n {this.renderIcon(i)}\n </span>\n {i < this.steps.length - 1 && <div class=\"hb-steps__line\"></div>}\n </div>\n <div class=\"hb-steps__main\">\n <div class=\"hb-steps__title\">{step.title}</div>\n {step.description && <div class=\"hb-steps__description\">{step.description}</div>}\n </div>\n </li>\n );\n })}\n </ol>\n );\n }\n}\n"],"version":3}
1
+ {"file":"hb-steps.entry.js","mappings":"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","names":[],"sources":["src/components/Steps/steps.css?tag=hb-steps&encapsulation=shadow","src/components/Steps/Steps.tsx"],"sourcesContent":[":host { display: block; }\n.hb-steps { display: flex; }\n.hb-steps--vertical { flex-direction: column; }\n.hb-steps__item { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }\n.hb-steps--vertical .hb-steps__item { flex-direction: row; align-items: flex-start; gap: var(--hb-spacing-sm); padding-bottom: var(--hb-spacing-md); }\n.hb-steps__head { display: flex; align-items: center; width: 100%; }\n.hb-steps__icon {\n width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;\n font-size: var(--hb-font-size-sm); font-weight: 600; flex-shrink: 0;\n background: var(--hb-color-fill); color: var(--hb-color-text-secondary); transition: all 0.3s;\n}\n.hb-steps__item--process .hb-steps__icon { background: var(--hb-color-primary); color: #fff; }\n.hb-steps__item--finish .hb-steps__icon { background: var(--hb-color-primary); color: #fff; }\n.hb-steps__item--error .hb-steps__icon { background: var(--hb-color-danger); color: #fff; }\n.hb-steps__line { flex: 1; height: 2px; background: var(--hb-color-border-secondary); margin: 0 var(--hb-spacing-xs); }\n.hb-steps__item--finish .hb-steps__line { background: var(--hb-color-primary); }\n.hb-steps__main { text-align: center; margin-top: var(--hb-spacing-xs); }\n.hb-steps--vertical .hb-steps__main { text-align: left; }\n\n/* 对齐方式(alignCenter prop):默认 false 时图标与文字左对齐,true 时居中 */\n.hb-steps:not(.hb-steps--align-center) .hb-steps__item { align-items: flex-start; }\n.hb-steps:not(.hb-steps--align-center) .hb-steps__main { text-align: left; }\n.hb-steps__title { font-size: var(--hb-font-size-sm); font-weight: 600; }\n.hb-steps__item--process .hb-steps__title { color: var(--hb-color-primary); }\n.hb-steps__description { font-size: var(--hb-font-size-xs); color: var(--hb-color-text-secondary); margin-top: 2px; }\n","import { Component, h, Prop, State, Element } from '@stencil/core';\n\nexport type StepStatus = 'wait' | 'process' | 'finish' | 'error';\n\ninterface StepMeta {\n title: string;\n description?: string;\n /** 自定义图标名/标记('hb-icon' name 或文本)。undefined 表示用默认序号/状态图标 */\n icon?: string;\n /** 子项显式状态覆盖(不指定则按 active 自动推导) */\n status?: StepStatus;\n}\n\n@Component({ tag: 'hb-steps', styleUrl: 'steps.css', shadow: true })\nexport class Steps {\n @Element() el: HTMLElement;\n @Prop() active: number = 0;\n @Prop() processStatus: StepStatus = 'process';\n @Prop() alignCenter: boolean = false;\n @Prop() direction: 'horizontal' | 'vertical' = 'horizontal';\n\n @State() steps: StepMeta[] = [];\n\n componentDidLoad() {\n const items = this.el.querySelectorAll('hb-step');\n this.steps = Array.from(items).map(item => {\n const node = item as HTMLElement;\n // 仅用 getAttribute:hb-step 的 @Prop() status 默认值为 'wait',\n // 若读 (node as any).status 会拿到默认值,从而错误地覆盖 active 推导。\n // 用户显式在 HTML 上写 status=\"xxx\" 时 getAttribute 才有值。\n return {\n title: node.getAttribute('title') || '',\n description: node.getAttribute('description') || undefined,\n icon: node.getAttribute('icon') || undefined,\n status: (node.getAttribute('status') || undefined) as StepStatus | undefined,\n };\n });\n }\n\n private getStatus(index: number): StepStatus {\n const meta = this.steps[index];\n // 子项显式 status 优先(仅当用户在 HTML 上写了 status 属性)\n if (meta && meta.status) return meta.status;\n if (index < this.active) return 'finish';\n if (index === this.active) return this.processStatus;\n return 'wait';\n }\n\n /** 渲染图标:子项自定义 icon 优先;否则按状态(finish=✓、error=✕、其余=序号) */\n private renderIcon(index: number): any {\n const meta = this.steps[index];\n if (meta && meta.icon) {\n // 自定义图标名:若与 hb-icon 内置图标同名则渲染 hb-icon,否则按文本渲染\n return <hb-icon name={meta.icon} size={16} aria-hidden=\"true\" />;\n }\n const status = this.getStatus(index);\n if (status === 'finish') return '✓';\n if (status === 'error') return '✕';\n return String(index + 1);\n }\n\n render() {\n return (\n <ol class={{ 'hb-steps': true, [`hb-steps--${this.direction}`]: true, 'hb-steps--align-center': this.alignCenter }} role=\"list\">\n {this.steps.map((step, i) => {\n const status = this.getStatus(i);\n return (\n <li\n class={{ 'hb-steps__item': true, [`hb-steps__item--${status}`]: true }}\n role=\"listitem\"\n aria-current={status === 'process' ? 'step' : undefined}\n aria-disabled={step.status === 'wait' && i > this.active ? 'true' : undefined}\n >\n <div class=\"hb-steps__head\">\n <span class=\"hb-steps__icon\" aria-hidden=\"true\">\n {this.renderIcon(i)}\n </span>\n {i < this.steps.length - 1 && <div class=\"hb-steps__line\"></div>}\n </div>\n <div class=\"hb-steps__main\">\n <div class=\"hb-steps__title\">{step.title}</div>\n {step.description && <div class=\"hb-steps__description\">{step.description}</div>}\n </div>\n </li>\n );\n })}\n </ol>\n );\n }\n}\n"],"version":3}
@@ -12,6 +12,8 @@ const Table = class {
12
12
  this.hbAction = createEvent(this, "hbAction", 7);
13
13
  this.hbExpandChange = createEvent(this, "hbExpandChange", 7);
14
14
  this.hbCellChange = createEvent(this, "hbCellChange", 7);
15
+ this.hbPageChange = createEvent(this, "hbPageChange", 7);
16
+ this.hbFilterChange = createEvent(this, "hbFilterChange", 7);
15
17
  }
16
18
  /** 数据源 */
17
19
  data = [];
@@ -51,6 +53,13 @@ const Table = class {
51
53
  treeProps;
52
54
  /** 是否开启行内编辑模式(默认关闭)。需列配置 column.editable=true 才对该列生效 */
53
55
  editable = false;
56
+ /**
57
+ * 内置分页配置(T1)。传入后 Table 自动对 data 切片并在底部渲染 <hb-pagination>。
58
+ * 不传则不分页(向后兼容)。
59
+ */
60
+ pagination;
61
+ /** 行 className(函数,按行返回附加 class,T8) */
62
+ rowClassName;
54
63
  sortProp = '';
55
64
  sortDirection = null;
56
65
  currentRow = -1;
@@ -61,6 +70,12 @@ const Table = class {
61
70
  expandedRowKeys = [];
62
71
  /** 行内编辑:当前正在编辑的单元格 { key, prop },null 表示无 */
63
72
  editingCell = null;
73
+ /** T1 分页:内部当前页(非受控时用) */
74
+ internalPage = 1;
75
+ /** T1 分页:内部每页条数(非受控时用) */
76
+ internalPageSize = 10;
77
+ /** T3 筛选:内部筛选状态 { prop: 选中的 value 列表 }(非受控时用) */
78
+ internalFilters = {};
64
79
  /** 排序变化事件 */
65
80
  hbSortChange;
66
81
  /** 行点击事件 */
@@ -73,10 +88,21 @@ const Table = class {
73
88
  hbExpandChange;
74
89
  /** 行内编辑提交事件 */
75
90
  hbCellChange;
91
+ /** T1 分页变化事件 { current, pageSize } */
92
+ hbPageChange;
93
+ /** T3 筛选变化事件 { prop, values } */
94
+ hbFilterChange;
76
95
  handleDataChange() {
77
96
  this.selectedRows = new Set();
78
97
  this.emitSelection();
79
98
  }
99
+ handlePaginationChange() {
100
+ // 受控分页:从 pagination.current/pageSize 初始化内部状态
101
+ if (this.pagination) {
102
+ this.internalPage = this.pagination.current ?? this.pagination.defaultCurrent ?? 1;
103
+ this.internalPageSize = this.pagination.pageSize ?? this.pagination.defaultPageSize ?? 10;
104
+ }
105
+ }
80
106
  /** 树形模式是否启用(显式传入 treeProps 即启用) */
81
107
  get isTreeMode() {
82
108
  return !!this.treeProps;
@@ -87,9 +113,6 @@ const Table = class {
87
113
  }
88
114
  /**
89
115
  * 把树拍平成可见行列表:仅保留「祖先链路全部已展开」的后代。
90
- * @param list 当前层级的数组
91
- * @param level 当前层级(根 = 0)
92
- * @param parentKeyPath 父级 key 路径,用于构造深层稳定 key(避免不同分支同 index 撞 key)
93
116
  */
94
117
  flattenTree(list, level = 0, parentKeyPath = '') {
95
118
  const field = this.childrenField;
@@ -100,7 +123,6 @@ const Table = class {
100
123
  const kids = row[field];
101
124
  const hasKids = Array.isArray(kids) && kids.length > 0;
102
125
  result.push({ row, level, key, hasChildren: hasKids, index: i });
103
- // 仅当该行已展开时,递归拍入其 children
104
126
  if (hasKids && this.expandedRowKeys.indexOf(key) !== -1) {
105
127
  result.push(...this.flattenTree(kids, level + 1, keyPath));
106
128
  }
@@ -125,7 +147,6 @@ const Table = class {
125
147
  commitEdit = (e, row, prop) => {
126
148
  const input = e.target;
127
149
  const value = input.value;
128
- // 就地更新(简单可用版):修改 row[prop] 后强制重渲染
129
150
  row[prop] = value;
130
151
  this.editingCell = null;
131
152
  this.hbCellChange.emit({ row, prop, value });
@@ -143,7 +164,6 @@ const Table = class {
143
164
  };
144
165
  allCheckboxRef;
145
166
  componentDidRender() {
146
- // indeterminate 不是可反射的 HTML 属性,必须通过 DOM 属性设置
147
167
  if (this.allCheckboxRef) {
148
168
  this.allCheckboxRef.indeterminate = this.isIndeterminate;
149
169
  }
@@ -174,7 +194,24 @@ const Table = class {
174
194
  get virtualTotalHeight() {
175
195
  return this.data.length * (this.itemHeight > 0 ? this.itemHeight : 1);
176
196
  }
177
- handleSort = (prop) => {
197
+ /**
198
+ * T2:解析某列的有效排序方向。
199
+ * 受控(col.sortOrder 设置)→ 用该值;否则用内部 state(sortProp/sortDirection)。
200
+ */
201
+ effectiveSortOrder(col) {
202
+ if (col.sortOrder !== undefined)
203
+ return col.sortOrder;
204
+ if (this.sortProp === col.prop)
205
+ return this.sortDirection;
206
+ return null;
207
+ }
208
+ handleSort = (col) => {
209
+ const prop = col.prop;
210
+ // T2:受控排序(col.sortOrder 已定义)→ 不内部切换,仅 emit 交外部决策
211
+ if (col.sortOrder !== undefined) {
212
+ this.hbSortChange.emit({ prop, order: col.sortOrder });
213
+ return;
214
+ }
178
215
  if (this.sortProp === prop) {
179
216
  this.sortDirection = this.sortDirection === 'ascending' ? 'descending' : this.sortDirection === 'descending' ? null : 'ascending';
180
217
  }
@@ -184,13 +221,38 @@ const Table = class {
184
221
  }
185
222
  this.hbSortChange.emit({ prop, order: this.sortDirection });
186
223
  };
224
+ /**
225
+ * T2 增强的排序数据:支持 col.sorter 自定义排序函数 + 受控 sortOrder。
226
+ * 多列排序不支持(与 antd 行为一致,取首个有效排序列)。
227
+ */
187
228
  get sortedData() {
188
- if (!this.sortProp || !this.sortDirection)
229
+ // 找到当前生效的排序列
230
+ let activeCol;
231
+ let activeOrder = null;
232
+ for (const col of this.columns) {
233
+ if (col.sortable || col.sorter) {
234
+ const order = this.effectiveSortOrder(col);
235
+ if (order) {
236
+ activeCol = col;
237
+ activeOrder = order;
238
+ break;
239
+ }
240
+ }
241
+ }
242
+ // 兼容旧逻辑:若没有列级 sortOrder,回退到内部 sortProp/sortDirection
243
+ if (!activeCol && this.sortProp && this.sortDirection) {
244
+ activeOrder = this.sortDirection;
245
+ }
246
+ if (!activeOrder)
189
247
  return this.data;
190
- const direction = this.sortDirection === 'ascending' ? 1 : -1;
248
+ const direction = activeOrder === 'ascending' ? 1 : -1;
249
+ const sortProp = activeCol ? activeCol.prop : this.sortProp;
250
+ const sorterFn = activeCol && activeCol.sorter;
191
251
  return [...this.data].sort((a, b) => {
192
- const va = a[this.sortProp];
193
- const vb = b[this.sortProp];
252
+ if (sorterFn)
253
+ return sorterFn(a, b) * direction;
254
+ const va = a[sortProp];
255
+ const vb = b[sortProp];
194
256
  if (va < vb)
195
257
  return -1 * direction;
196
258
  if (va > vb)
@@ -198,6 +260,72 @@ const Table = class {
198
260
  return 0;
199
261
  });
200
262
  }
263
+ /**
264
+ * T3 筛选:应用所有列的 onFilter。
265
+ * 受控(col.filteredValue 已定义)→ 用该值;否则用内部 internalFilters[prop]。
266
+ */
267
+ get filteredData() {
268
+ let result = this.sortedData;
269
+ for (const col of this.columns) {
270
+ if (!col.onFilter || !col.filters)
271
+ continue;
272
+ const values = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop];
273
+ if (!values || values.length === 0)
274
+ continue;
275
+ result = result.filter(row => values.some(v => col.onFilter(row, v)));
276
+ }
277
+ return result;
278
+ }
279
+ /**
280
+ * T1 分页:取当前页数据切片(仅当 pagination 配置时)。
281
+ * 在 sorted+filtered 之后切片。
282
+ */
283
+ get pagedData() {
284
+ const filtered = this.filteredData;
285
+ if (!this.pagination)
286
+ return filtered;
287
+ const page = this.currentPage;
288
+ const size = this.currentPageSize;
289
+ const start = (page - 1) * size;
290
+ return filtered.slice(start, start + size);
291
+ }
292
+ /** T1:当前页(受控优先) */
293
+ get currentPage() {
294
+ return this.pagination?.current ?? this.internalPage;
295
+ }
296
+ /** T1:当前每页条数(受控优先) */
297
+ get currentPageSize() {
298
+ return this.pagination?.pageSize ?? this.internalPageSize;
299
+ }
300
+ /** T1:分页切换 */
301
+ handlePageChange = (page) => {
302
+ this.internalPage = page;
303
+ this.hbPageChange.emit({ current: page, pageSize: this.currentPageSize });
304
+ };
305
+ /** T1:每页条数切换 */
306
+ handlePageSizeChange = (size) => {
307
+ this.internalPageSize = size;
308
+ // 切条数后回到第一页避免越界
309
+ this.internalPage = 1;
310
+ this.hbPageChange.emit({ current: 1, pageSize: size });
311
+ };
312
+ /** T3:筛选下拉切换某项 */
313
+ handleFilterToggle = (col, value) => {
314
+ const current = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop] || [];
315
+ const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];
316
+ // 仅内部状态时更新;受控(filteredValue 已定义)则只 emit 交外部
317
+ if (col.filteredValue === undefined) {
318
+ this.internalFilters = { ...this.internalFilters, [col.prop]: next };
319
+ }
320
+ this.hbFilterChange.emit({ prop: col.prop, values: next });
321
+ };
322
+ /** T3:清空某列筛选 */
323
+ handleFilterReset = (col) => {
324
+ if (col.filteredValue === undefined) {
325
+ this.internalFilters = { ...this.internalFilters, [col.prop]: [] };
326
+ }
327
+ this.hbFilterChange.emit({ prop: col.prop, values: [] });
328
+ };
201
329
  get isAllSelected() {
202
330
  return this.data.length > 0 && this.selectedRows.size === this.data.length;
203
331
  }
@@ -242,10 +370,14 @@ const Table = class {
242
370
  get hasActions() {
243
371
  return !!this.actions && this.actions.length > 0;
244
372
  }
373
+ /** T3:某列是否有激活筛选 */
374
+ isColumnFiltered(col) {
375
+ const values = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop];
376
+ return !!values && values.length > 0;
377
+ }
245
378
  /**
246
379
  * 计算固定列的 sticky 偏移(左侧/右侧累计宽度)。
247
380
  * P1 优化:缓存结果,仅当 columns 引用变化时重算。
248
- * 修复前是 getter,被每个 <td>/<th> 反复调用,复杂度 O(rows×cols²)。
249
381
  */
250
382
  _fixedOffsetsCache = null;
251
383
  _fixedOffsetsColumnsRef = null;
@@ -289,11 +421,18 @@ const Table = class {
289
421
  }
290
422
  return style;
291
423
  }
424
+ /**
425
+ * 渲染单元格内容(T7:优先 col.render,其次 formatter,最后原值)。
426
+ */
427
+ renderCell(col, row, rowIndex) {
428
+ if (col.render)
429
+ return col.render(row, rowIndex);
430
+ if (col.formatter)
431
+ return col.formatter(row, rowIndex);
432
+ return row[col.prop] ?? '';
433
+ }
292
434
  /**
293
435
  * 渲染单行(普通 + 虚拟滚动 + 树形 共用)。
294
- * - 普通模式:rowIndex 为在 sortedData 中的全局索引。
295
- * - 树形模式:fr.level 决定缩进,第一列渲染展开箭头,key 取 fr.key。
296
- * fr 为可选;未传时按普通模式渲染。
297
436
  */
298
437
  renderRow(row, rowIndex, fr) {
299
438
  const tree = !!fr;
@@ -301,15 +440,17 @@ const Table = class {
301
440
  const rowKeyVal = fr ? fr.key : this.rowKey ? row[this.rowKey] : rowIndex;
302
441
  const indent = level * 16;
303
442
  const isEditing = (prop) => !!this.editingCell && this.editingCell.rowKey === rowKeyVal && this.editingCell.prop === prop;
443
+ // T8:行 className
444
+ const extraRowClass = this.rowClassName ? this.rowClassName(row, rowIndex) : '';
304
445
  return (h("tr", { key: rowKeyVal, class: {
305
446
  'hb-table__row': true,
306
447
  'hb-table__row--striped': this.stripe && rowIndex % 2 === 1,
307
448
  'hb-table__row--current': this.highlightCurrentRow && rowIndex === this.currentRow,
308
449
  'hb-table__row--selected': this.selectedRows.has(rowIndex),
309
450
  'hb-table__row--tree': tree,
451
+ [extraRowClass]: !!extraRowClass,
310
452
  }, onClick: () => this.handleRowClick(row, rowIndex) }, this.selectable && (h("td", { class: "hb-table__selection", onClick: e => e.stopPropagation() }, h("input", { type: "checkbox", class: "hb-table__checkbox", checked: this.selectedRows.has(rowIndex), onChange: e => this.toggleRow(rowIndex, e) }))), this.columns.map((col, colIdx) => {
311
453
  const off = this.getFixedOffsets()[col.prop];
312
- // 树形模式:第一列加缩进 + 展开箭头
313
454
  const isFirstCol = colIdx === 0;
314
455
  const showExpand = tree && isFirstCol && fr.hasChildren;
315
456
  const expanded = showExpand && this.expandedRowKeys.indexOf(rowKeyVal) !== -1;
@@ -320,52 +461,79 @@ const Table = class {
320
461
  'hb-table__cell--fixed-left': off?.side === 'left',
321
462
  'hb-table__cell--fixed-right': off?.side === 'right',
322
463
  'hb-table__cell--editable': editableActive,
464
+ 'hb-table__cell--ellipsis': !!col.ellipsis,
323
465
  }, onClick: editableActive ? e => this.startEdit(e, rowKeyVal, col.prop) : undefined }, tree && isFirstCol && h("span", { class: "hb-table__indent", style: { display: 'inline-block', width: `${indent}px` }, "aria-hidden": "true" }), showExpand && (h("button", { type: "button", class: { 'hb-table__expand': true, 'hb-table__expand--expanded': expanded }, "aria-label": expanded ? '收起' : '展开', onClick: e => {
324
466
  e.stopPropagation();
325
467
  this.toggleExpand(row, rowKeyVal);
326
- } }, expanded ? '▼' : '▶')), showExpand === false && tree && isFirstCol && h("span", { class: "hb-table__expand-placeholder", style: { display: 'inline-block', width: '16px' }, "aria-hidden": "true" }), editing ? (h("input", { class: "hb-table__edit-input", type: "text", value: row[col.prop] ?? '', onBlur: e => this.commitEdit(e, row, col.prop), onKeyDown: e => this.onEditKeydown(e, row, col.prop) })) : (h("slot", { name: `cell-${col.prop}` }, col.formatter ? col.formatter(row, rowIndex) : (row[col.prop] ?? '')))));
468
+ } }, expanded ? '▼' : '▶')), showExpand === false && tree && isFirstCol && h("span", { class: "hb-table__expand-placeholder", style: { display: 'inline-block', width: '16px' }, "aria-hidden": "true" }), editing ? (h("input", { class: "hb-table__edit-input", type: "text", value: row[col.prop] ?? '', onBlur: e => this.commitEdit(e, row, col.prop), onKeyDown: e => this.onEditKeydown(e, row, col.prop) })) : (
469
+ // T7:col.render 优先(支持返回 JSX);否则 formatter;否则原值
470
+ h("slot", { name: `cell-${col.prop}` }, this.renderCell(col, row, rowIndex)))));
327
471
  }), this.hasActions && (h("td", { class: "hb-table__td--actions", style: { textAlign: 'right', whiteSpace: 'nowrap' }, onClick: e => e.stopPropagation() }, this.actions.map(act => (h("button", { type: "button", class: {
328
472
  'hb-table__action': true,
329
473
  'hb-table__action--primary': act.type === 'primary',
330
474
  'hb-table__action--danger': act.type === 'danger',
331
475
  }, disabled: act.disabled ? act.disabled(row, rowIndex) : false, onClick: () => this.handleAction(row, rowIndex, act.key) }, act.label)))))));
332
476
  }
477
+ /**
478
+ * T3:渲染表头某列的筛选下拉。
479
+ */
480
+ renderColumnFilter = (col) => {
481
+ if (!col.filters || col.filters.length === 0 || !col.onFilter)
482
+ return null;
483
+ const activeValues = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop] || [];
484
+ const filtered = this.isColumnFiltered(col);
485
+ return (h("span", { class: "hb-table__filter", onClick: e => e.stopPropagation() }, h("details", { class: "hb-table__filter-dropdown" }, h("summary", { class: { 'hb-table__filter-trigger': true, 'hb-table__filter-trigger--active': filtered }, "aria-label": "\u7B5B\u9009" }, h("svg", { viewBox: "0 0 24 24", width: "14", height: "14", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round" }, h("path", { d: "M22 3H2l8 9.46V19l4 2v-8.54L22 3z" }))), h("div", { class: "hb-table__filter-menu", role: "menu" }, h("ul", { class: "hb-table__filter-list" }, col.filters.map(f => {
486
+ const checked = activeValues.includes(f.value);
487
+ return (h("li", { class: "hb-table__filter-item", role: "menuitemcheckbox", "aria-checked": checked ? 'true' : 'false' }, h("label", { class: "hb-table__filter-label" }, h("input", { type: "checkbox", class: "hb-table__filter-checkbox", checked: checked, onChange: () => this.handleFilterToggle(col, f.value) }), h("span", null, f.label))));
488
+ })), h("div", { class: "hb-table__filter-actions" }, h("button", { type: "button", class: "hb-table__filter-reset", onClick: () => this.handleFilterReset(col) }, "\u91CD\u7F6E"))))));
489
+ };
333
490
  /** 渲染表头(普通 + 虚拟滚动共用,表头始终固定不随滚) */
334
491
  renderHeader() {
335
492
  return (h("thead", null, h("tr", null, this.selectable && (h("th", { class: "hb-table__selection" }, h("input", { type: "checkbox", class: "hb-table__checkbox", checked: this.isAllSelected, ref: el => {
336
493
  this.allCheckboxRef = el;
337
494
  }, onChange: this.toggleAll }))), this.columns.map(col => {
338
495
  const off = this.getFixedOffsets()[col.prop];
496
+ // T2:列可排序的条件(sortable 或 sorter)
497
+ const canSort = !!col.sortable || !!col.sorter;
498
+ const order = this.effectiveSortOrder(col);
339
499
  return (h("th", { key: col.prop, style: this.cellStyle(col.prop, {
340
500
  width: col.width,
341
501
  minWidth: col.minWidth,
342
502
  textAlign: col.align || 'left',
343
503
  }), class: {
344
- 'hb-table__th--sortable': col.sortable,
504
+ 'hb-table__th--sortable': canSort,
345
505
  'hb-table__cell--fixed-left': off?.side === 'left',
346
506
  'hb-table__cell--fixed-right': off?.side === 'right',
347
- }, onClick: col.sortable ? () => this.handleSort(col.prop) : undefined }, h("div", { class: "hb-table__th-content" }, h("span", null, col.label), col.sortable && (h("span", { class: "hb-table__sort" }, h("span", { class: { 'hb-table__sort-icon': true, 'hb-table__sort-icon--active': this.sortProp === col.prop && this.sortDirection === 'ascending' } }, "\u25B2"), h("span", { class: { 'hb-table__sort-icon': true, 'hb-table__sort-icon--active': this.sortProp === col.prop && this.sortDirection === 'descending' } }, "\u25BC"))))));
507
+ }, onClick: canSort ? () => this.handleSort(col) : undefined }, h("div", { class: "hb-table__th-content" }, h("span", null, col.label), canSort && (h("span", { class: "hb-table__sort" }, h("span", { class: { 'hb-table__sort-icon': true, 'hb-table__sort-icon--active': order === 'ascending' } }, "\u25B2"), h("span", { class: { 'hb-table__sort-icon': true, 'hb-table__sort-icon--active': order === 'descending' } }, "\u25BC"))), this.renderColumnFilter(col))));
348
508
  }), this.hasActions && (h("th", { class: "hb-table__th--actions", style: { textAlign: 'right', whiteSpace: 'nowrap' } }, "\u64CD\u4F5C")))));
349
509
  }
510
+ /** T1:渲染内置分页底部栏 */
511
+ renderPagination() {
512
+ if (!this.pagination)
513
+ return null;
514
+ const total = this.filteredData.length;
515
+ const page = this.currentPage;
516
+ const size = this.currentPageSize;
517
+ const totalPages = Math.max(1, Math.ceil(total / size));
518
+ const showTotal = this.pagination.showTotal;
519
+ return (h("div", { class: "hb-table__pagination" }, showTotal && h("span", { class: "hb-table__pagination-total" }, "\u5171 ", total, " \u6761"), h("span", { class: "hb-table__pagination-pages" }, h("button", { type: "button", class: "hb-table__pagination-btn", disabled: page <= 1, onClick: () => this.handlePageChange(page - 1), "aria-label": "\u4E0A\u4E00\u9875" }, "\u2039"), h("span", { class: "hb-table__pagination-current" }, page, " / ", totalPages), h("button", { type: "button", class: "hb-table__pagination-btn", disabled: page >= totalPages, onClick: () => this.handlePageChange(page + 1), "aria-label": "\u4E0B\u4E00\u9875" }, "\u203A")), this.pagination.pageSizes && (h("select", { class: "hb-table__pagination-size", onChange: e => this.handlePageSizeChange(parseInt(e.target.value, 10)) }, this.pagination.pageSizes.map(s => (h("option", { value: String(s), selected: s === size }, s, " \u6761/\u9875")))))));
520
+ }
350
521
  render() {
351
- const displayData = this.sortedData;
522
+ // T1+T2+T3:排序 筛选 → 分页 依次应用
523
+ const displayData = this.pagedData;
352
524
  const isEmpty = displayData.length === 0;
353
- // 树形模式:把可见树拍平成带 level 的行列表(仅含已展开链路上的后代)
354
525
  const flatRows = this.isTreeMode ? this.flattenTree(displayData) : [];
355
- // 虚拟滚动:固定高度滚动视口 + 撑高容器 + 仅渲染可见窗口行(绝对定位 offset)
356
- // 注意:树形 + 虚拟滚动组合较复杂,此处虚拟滚动沿用普通行渲染(不展开树),
357
- // 保留树形仅在普通模式下生效以降低风险。
358
526
  const renderVirtualBody = () => {
359
527
  const { startIndex, endIndex } = this.visibleRange;
360
528
  const offsetTop = startIndex * (this.itemHeight > 0 ? this.itemHeight : 1);
361
529
  return (h("div", { class: "hb-table__virtual-viewport", style: { height: `${this.virtualScrollHeight}px`, overflowY: 'auto' }, onScroll: this.handleVirtualScroll }, h("div", { class: "hb-table__virtual-spacer", style: { height: `${this.virtualTotalHeight}px`, position: 'relative' } }, h("table", { class: "hb-table__table hb-table__table--virtual" }, h("tbody", null, isEmpty ? (h("tr", null, h("td", { colSpan: this.columns.length + (this.selectable ? 1 : 0) + (this.hasActions ? 1 : 0), class: "hb-table__empty" }, this.emptyText))) : (h("tr", { style: { height: `${offsetTop}px` }, "aria-hidden": "true" })), displayData.slice(startIndex, endIndex).map((row, i) => this.renderRow(row, startIndex + i)))))));
362
530
  };
363
- // 普通模式:树形启用时按拍平列表渲染(带 level 缩进 + 展开箭头),否则原样按行渲染
364
531
  const renderNormalBody = () => (h("tbody", null, isEmpty ? (h("tr", null, h("td", { colSpan: this.columns.length + (this.selectable ? 1 : 0) + (this.hasActions ? 1 : 0), class: "hb-table__empty" }, this.emptyText))) : this.isTreeMode ? (flatRows.map((fr, i) => this.renderRow(fr.row, i, fr))) : (displayData.map((row, rowIndex) => this.renderRow(row, rowIndex)))));
365
- return (h("div", { class: { 'hb-table': true, [`hb-table--${this.size}`]: true, 'hb-table--border': this.border, 'hb-table--virtual': this.virtualScroll } }, this.loading && (h("div", { class: "hb-table__loading" }, h("div", { class: "hb-table__loading-spinner" }))), this.virtualScroll ? (h("div", { class: "hb-table__virtual-wrapper" }, h("table", { class: "hb-table__table" }, this.renderHeader()), renderVirtualBody())) : (h("div", { class: "hb-table__wrapper", style: this.maxHeight ? { maxHeight: this.maxHeight, overflow: 'auto' } : undefined }, h("table", { class: "hb-table__table" }, this.renderHeader(), renderNormalBody())))));
532
+ return (h("div", { class: { 'hb-table': true, [`hb-table--${this.size}`]: true, 'hb-table--border': this.border, 'hb-table--virtual': this.virtualScroll, 'hb-table--has-pagination': !!this.pagination } }, this.loading && (h("div", { class: "hb-table__loading" }, h("div", { class: "hb-table__loading-spinner" }))), this.virtualScroll ? (h("div", { class: "hb-table__virtual-wrapper" }, h("table", { class: "hb-table__table" }, this.renderHeader()), renderVirtualBody())) : (h("div", { class: "hb-table__wrapper", style: this.maxHeight ? { maxHeight: this.maxHeight, overflow: 'auto' } : undefined }, h("table", { class: "hb-table__table" }, this.renderHeader(), renderNormalBody()))), this.renderPagination()));
366
533
  }
367
534
  static get watchers() { return {
368
- "data": ["handleDataChange"]
535
+ "data": ["handleDataChange"],
536
+ "pagination": ["handlePaginationChange"]
369
537
  }; }
370
538
  };
371
539
  Table.style = HbTableStyle0;