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.
- package/dist/cjs/hb-form-item.cjs.entry.js +59 -9
- package/dist/cjs/hb-form-item.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-form.cjs.entry.js +105 -2
- package/dist/cjs/hb-form.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-select.cjs.entry.js +82 -10
- package/dist/cjs/hb-select.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-steps.cjs.entry.js +1 -1
- package/dist/cjs/hb-steps.cjs.entry.js.map +1 -1
- package/dist/cjs/hb-table.cjs.entry.js +195 -27
- package/dist/cjs/hb-table.cjs.entry.js.map +1 -1
- package/dist/cjs/huibo-ui.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/Form/Form.js +205 -2
- package/dist/collection/components/Form/Form.js.map +1 -1
- package/dist/collection/components/Form/FormItem.js +117 -10
- package/dist/collection/components/Form/FormItem.js.map +1 -1
- package/dist/collection/components/Select/Select.js +105 -10
- package/dist/collection/components/Select/Select.js.map +1 -1
- package/dist/collection/components/Table/Table.js +273 -27
- package/dist/collection/components/Table/Table.js.map +1 -1
- package/dist/collection/utils/virtual-scroll.js +39 -0
- package/dist/collection/utils/virtual-scroll.js.map +1 -0
- package/dist/components/hb-form-item.js +62 -9
- package/dist/components/hb-form-item.js.map +1 -1
- package/dist/components/hb-form.js +110 -2
- package/dist/components/hb-form.js.map +1 -1
- package/dist/components/hb-select.js +87 -11
- package/dist/components/hb-select.js.map +1 -1
- package/dist/components/hb-steps.js +1 -1
- package/dist/components/hb-steps.js.map +1 -1
- package/dist/components/hb-table.js +203 -29
- package/dist/components/hb-table.js.map +1 -1
- package/dist/esm/hb-form-item.entry.js +59 -9
- package/dist/esm/hb-form-item.entry.js.map +1 -1
- package/dist/esm/hb-form.entry.js +105 -2
- package/dist/esm/hb-form.entry.js.map +1 -1
- package/dist/esm/hb-select.entry.js +82 -10
- package/dist/esm/hb-select.entry.js.map +1 -1
- package/dist/esm/hb-steps.entry.js +1 -1
- package/dist/esm/hb-steps.entry.js.map +1 -1
- package/dist/esm/hb-table.entry.js +195 -27
- package/dist/esm/hb-table.entry.js.map +1 -1
- package/dist/esm/huibo-ui.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/huibo-ui/huibo-ui.esm.js +1 -1
- package/dist/huibo-ui/huibo-ui.esm.js.map +1 -1
- package/dist/huibo-ui/{p-79b24b83.entry.js → p-2cf5bf20.entry.js} +2 -2
- package/dist/huibo-ui/{p-79b24b83.entry.js.map → p-2cf5bf20.entry.js.map} +1 -1
- package/dist/huibo-ui/p-4148d875.entry.js +2 -0
- package/dist/huibo-ui/p-4148d875.entry.js.map +1 -0
- package/dist/huibo-ui/{p-54a28052.entry.js → p-6bfe1954.entry.js} +2 -2
- package/dist/huibo-ui/p-6bfe1954.entry.js.map +1 -0
- package/dist/huibo-ui/{p-ac18c68b.entry.js → p-e8824b2c.entry.js} +2 -2
- package/dist/huibo-ui/p-e8824b2c.entry.js.map +1 -0
- package/dist/huibo-ui/p-f69599fa.entry.js +2 -0
- package/dist/huibo-ui/p-f69599fa.entry.js.map +1 -0
- package/dist/types/components/Form/Form.d.ts +57 -0
- package/dist/types/components/Form/FormItem.d.ts +23 -0
- package/dist/types/components/Select/Select.d.ts +19 -0
- package/dist/types/components/Table/Table.d.ts +103 -8
- package/dist/types/components.d.ts +148 -2
- package/dist/types/utils/virtual-scroll.d.ts +38 -0
- package/package.json +1 -1
- package/dist/huibo-ui/p-29092b85.entry.js +0 -2
- package/dist/huibo-ui/p-29092b85.entry.js.map +0 -1
- package/dist/huibo-ui/p-2bc30b1b.entry.js +0 -2
- package/dist/huibo-ui/p-2bc30b1b.entry.js.map +0 -1
- package/dist/huibo-ui/p-54a28052.entry.js.map +0 -1
- package/dist/huibo-ui/p-ac18c68b.entry.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { p as proxyCustomElement, H, h } from './p-1407a5e8.js';
|
|
2
2
|
import { d as defineCustomElement$2 } from './p-86d92faf.js';
|
|
3
3
|
|
|
4
|
-
const stepsCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components
|
|
4
|
+
const stepsCss = "/*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,::backdrop,:after,:before{--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000}}}@layer theme{:host,:root{--font-sans:ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\";--font-mono:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace;--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,::backdrop,:after,:before{border:0 solid;box-sizing:border-box;margin:0;padding:0}::file-selector-button{appearance:button;background-color:#0000;border:0 solid;border-radius:0;box-sizing:border-box;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;margin:0;margin-inline-end:4px;opacity:1;padding:0}:host,html{-webkit-text-size-adjust:100%;font-family:var(--default-font-family,ui-sans-serif,system-ui,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\",\"Noto Color Emoji\");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);line-height:1.5;tab-size:4;-webkit-tap-highlight-color:transparent}hr{border-top-width:1px;color:inherit;height:0}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:var(--default-mono-font-family,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,\"Liberation Mono\",\"Courier New\",monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-size:1em;font-variation-settings:var(--default-mono-font-variation-settings,normal)}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{border-collapse:collapse;border-color:inherit;text-indent:0}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}menu,ol,ul{list-style:none}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{height:auto;max-width:100%}button,input,optgroup,select,textarea{background-color:#0000;border-radius:0;color:inherit;font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;opacity:1}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex;padding-block:0}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit-month-field,::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-day-field,::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field,::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-meridiem-field,::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a),0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}} /*! tailwindcss v4.1.16 | MIT License | https://tailwindcss.com */@layer properties{}@layer base{}@layer components;:host{display:block}.hb-steps{display:flex}.hb-steps--vertical,.hb-steps__item{flex-direction:column}.hb-steps__item{align-items:center;display:flex;flex:1;position:relative}.hb-steps--vertical .hb-steps__item{align-items:flex-start;flex-direction:row;gap:var(--hb-spacing-sm);padding-bottom:var(--hb-spacing-md)}.hb-steps__head{align-items:center;display:flex;width:100%}.hb-steps__icon{align-items:center;background:var(--hb-color-fill);border-radius:50%;color:var(--hb-color-text-secondary);display:flex;flex-shrink:0;font-size:var(--hb-font-size-sm);font-weight:600;height:28px;justify-content:center;transition:all .3s;width:28px}.hb-steps__item--finish .hb-steps__icon,.hb-steps__item--process .hb-steps__icon{background:var(--hb-color-primary);color:#fff}.hb-steps__item--error .hb-steps__icon{background:var(--hb-color-danger);color:#fff}.hb-steps__line{background:var(--hb-color-border-secondary);flex:1;height:2px;margin:0 var(--hb-spacing-xs)}.hb-steps__item--finish .hb-steps__line{background:var(--hb-color-primary)}.hb-steps__main{margin-top:var(--hb-spacing-xs);text-align:center}.hb-steps--vertical .hb-steps__main{text-align:left}.hb-steps:not(.hb-steps--align-center) .hb-steps__item{align-items:flex-start}.hb-steps:not(.hb-steps--align-center) .hb-steps__main{text-align:left}.hb-steps__title{font-size:var(--hb-font-size-sm);font-weight:600}.hb-steps__item--process .hb-steps__title{color:var(--hb-color-primary)}.hb-steps__description{color:var(--hb-color-text-secondary);font-size:var(--hb-font-size-xs);margin-top:2px}@property --tw-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:\"*\";inherits:false}@property --tw-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:\"*\";inherits:false}@property --tw-inset-shadow-alpha{syntax:\"<percentage>\";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:\"*\";inherits:false}@property --tw-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:\"*\";inherits:false}@property --tw-inset-ring-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:\"*\";inherits:false}@property --tw-ring-offset-width{syntax:\"<length>\";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:\"*\";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:\"*\";inherits:false;initial-value:0 0 #0000}";
|
|
5
5
|
const HbStepsStyle0 = stepsCss;
|
|
6
6
|
|
|
7
7
|
const Steps = /*@__PURE__*/ proxyCustomElement(class Steps extends H {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"hb-steps.js","mappings":";;;AAAA,MAAM,QAAQ,GAAG,
|
|
1
|
+
{"file":"hb-steps.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}
|
|
@@ -14,6 +14,8 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
14
14
|
this.hbAction = createEvent(this, "hbAction", 7);
|
|
15
15
|
this.hbExpandChange = createEvent(this, "hbExpandChange", 7);
|
|
16
16
|
this.hbCellChange = createEvent(this, "hbCellChange", 7);
|
|
17
|
+
this.hbPageChange = createEvent(this, "hbPageChange", 7);
|
|
18
|
+
this.hbFilterChange = createEvent(this, "hbFilterChange", 7);
|
|
17
19
|
}
|
|
18
20
|
/** 数据源 */
|
|
19
21
|
data = [];
|
|
@@ -53,6 +55,13 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
53
55
|
treeProps;
|
|
54
56
|
/** 是否开启行内编辑模式(默认关闭)。需列配置 column.editable=true 才对该列生效 */
|
|
55
57
|
editable = false;
|
|
58
|
+
/**
|
|
59
|
+
* 内置分页配置(T1)。传入后 Table 自动对 data 切片并在底部渲染 <hb-pagination>。
|
|
60
|
+
* 不传则不分页(向后兼容)。
|
|
61
|
+
*/
|
|
62
|
+
pagination;
|
|
63
|
+
/** 行 className(函数,按行返回附加 class,T8) */
|
|
64
|
+
rowClassName;
|
|
56
65
|
sortProp = '';
|
|
57
66
|
sortDirection = null;
|
|
58
67
|
currentRow = -1;
|
|
@@ -63,6 +72,12 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
63
72
|
expandedRowKeys = [];
|
|
64
73
|
/** 行内编辑:当前正在编辑的单元格 { key, prop },null 表示无 */
|
|
65
74
|
editingCell = null;
|
|
75
|
+
/** T1 分页:内部当前页(非受控时用) */
|
|
76
|
+
internalPage = 1;
|
|
77
|
+
/** T1 分页:内部每页条数(非受控时用) */
|
|
78
|
+
internalPageSize = 10;
|
|
79
|
+
/** T3 筛选:内部筛选状态 { prop: 选中的 value 列表 }(非受控时用) */
|
|
80
|
+
internalFilters = {};
|
|
66
81
|
/** 排序变化事件 */
|
|
67
82
|
hbSortChange;
|
|
68
83
|
/** 行点击事件 */
|
|
@@ -75,10 +90,21 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
75
90
|
hbExpandChange;
|
|
76
91
|
/** 行内编辑提交事件 */
|
|
77
92
|
hbCellChange;
|
|
93
|
+
/** T1 分页变化事件 { current, pageSize } */
|
|
94
|
+
hbPageChange;
|
|
95
|
+
/** T3 筛选变化事件 { prop, values } */
|
|
96
|
+
hbFilterChange;
|
|
78
97
|
handleDataChange() {
|
|
79
98
|
this.selectedRows = new Set();
|
|
80
99
|
this.emitSelection();
|
|
81
100
|
}
|
|
101
|
+
handlePaginationChange() {
|
|
102
|
+
// 受控分页:从 pagination.current/pageSize 初始化内部状态
|
|
103
|
+
if (this.pagination) {
|
|
104
|
+
this.internalPage = this.pagination.current ?? this.pagination.defaultCurrent ?? 1;
|
|
105
|
+
this.internalPageSize = this.pagination.pageSize ?? this.pagination.defaultPageSize ?? 10;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
82
108
|
/** 树形模式是否启用(显式传入 treeProps 即启用) */
|
|
83
109
|
get isTreeMode() {
|
|
84
110
|
return !!this.treeProps;
|
|
@@ -89,9 +115,6 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
89
115
|
}
|
|
90
116
|
/**
|
|
91
117
|
* 把树拍平成可见行列表:仅保留「祖先链路全部已展开」的后代。
|
|
92
|
-
* @param list 当前层级的数组
|
|
93
|
-
* @param level 当前层级(根 = 0)
|
|
94
|
-
* @param parentKeyPath 父级 key 路径,用于构造深层稳定 key(避免不同分支同 index 撞 key)
|
|
95
118
|
*/
|
|
96
119
|
flattenTree(list, level = 0, parentKeyPath = '') {
|
|
97
120
|
const field = this.childrenField;
|
|
@@ -102,7 +125,6 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
102
125
|
const kids = row[field];
|
|
103
126
|
const hasKids = Array.isArray(kids) && kids.length > 0;
|
|
104
127
|
result.push({ row, level, key, hasChildren: hasKids, index: i });
|
|
105
|
-
// 仅当该行已展开时,递归拍入其 children
|
|
106
128
|
if (hasKids && this.expandedRowKeys.indexOf(key) !== -1) {
|
|
107
129
|
result.push(...this.flattenTree(kids, level + 1, keyPath));
|
|
108
130
|
}
|
|
@@ -127,7 +149,6 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
127
149
|
commitEdit = (e, row, prop) => {
|
|
128
150
|
const input = e.target;
|
|
129
151
|
const value = input.value;
|
|
130
|
-
// 就地更新(简单可用版):修改 row[prop] 后强制重渲染
|
|
131
152
|
row[prop] = value;
|
|
132
153
|
this.editingCell = null;
|
|
133
154
|
this.hbCellChange.emit({ row, prop, value });
|
|
@@ -145,7 +166,6 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
145
166
|
};
|
|
146
167
|
allCheckboxRef;
|
|
147
168
|
componentDidRender() {
|
|
148
|
-
// indeterminate 不是可反射的 HTML 属性,必须通过 DOM 属性设置
|
|
149
169
|
if (this.allCheckboxRef) {
|
|
150
170
|
this.allCheckboxRef.indeterminate = this.isIndeterminate;
|
|
151
171
|
}
|
|
@@ -176,7 +196,24 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
176
196
|
get virtualTotalHeight() {
|
|
177
197
|
return this.data.length * (this.itemHeight > 0 ? this.itemHeight : 1);
|
|
178
198
|
}
|
|
179
|
-
|
|
199
|
+
/**
|
|
200
|
+
* T2:解析某列的有效排序方向。
|
|
201
|
+
* 受控(col.sortOrder 设置)→ 用该值;否则用内部 state(sortProp/sortDirection)。
|
|
202
|
+
*/
|
|
203
|
+
effectiveSortOrder(col) {
|
|
204
|
+
if (col.sortOrder !== undefined)
|
|
205
|
+
return col.sortOrder;
|
|
206
|
+
if (this.sortProp === col.prop)
|
|
207
|
+
return this.sortDirection;
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
handleSort = (col) => {
|
|
211
|
+
const prop = col.prop;
|
|
212
|
+
// T2:受控排序(col.sortOrder 已定义)→ 不内部切换,仅 emit 交外部决策
|
|
213
|
+
if (col.sortOrder !== undefined) {
|
|
214
|
+
this.hbSortChange.emit({ prop, order: col.sortOrder });
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
180
217
|
if (this.sortProp === prop) {
|
|
181
218
|
this.sortDirection = this.sortDirection === 'ascending' ? 'descending' : this.sortDirection === 'descending' ? null : 'ascending';
|
|
182
219
|
}
|
|
@@ -186,13 +223,38 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
186
223
|
}
|
|
187
224
|
this.hbSortChange.emit({ prop, order: this.sortDirection });
|
|
188
225
|
};
|
|
226
|
+
/**
|
|
227
|
+
* T2 增强的排序数据:支持 col.sorter 自定义排序函数 + 受控 sortOrder。
|
|
228
|
+
* 多列排序不支持(与 antd 行为一致,取首个有效排序列)。
|
|
229
|
+
*/
|
|
189
230
|
get sortedData() {
|
|
190
|
-
|
|
231
|
+
// 找到当前生效的排序列
|
|
232
|
+
let activeCol;
|
|
233
|
+
let activeOrder = null;
|
|
234
|
+
for (const col of this.columns) {
|
|
235
|
+
if (col.sortable || col.sorter) {
|
|
236
|
+
const order = this.effectiveSortOrder(col);
|
|
237
|
+
if (order) {
|
|
238
|
+
activeCol = col;
|
|
239
|
+
activeOrder = order;
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// 兼容旧逻辑:若没有列级 sortOrder,回退到内部 sortProp/sortDirection
|
|
245
|
+
if (!activeCol && this.sortProp && this.sortDirection) {
|
|
246
|
+
activeOrder = this.sortDirection;
|
|
247
|
+
}
|
|
248
|
+
if (!activeOrder)
|
|
191
249
|
return this.data;
|
|
192
|
-
const direction =
|
|
250
|
+
const direction = activeOrder === 'ascending' ? 1 : -1;
|
|
251
|
+
const sortProp = activeCol ? activeCol.prop : this.sortProp;
|
|
252
|
+
const sorterFn = activeCol && activeCol.sorter;
|
|
193
253
|
return [...this.data].sort((a, b) => {
|
|
194
|
-
|
|
195
|
-
|
|
254
|
+
if (sorterFn)
|
|
255
|
+
return sorterFn(a, b) * direction;
|
|
256
|
+
const va = a[sortProp];
|
|
257
|
+
const vb = b[sortProp];
|
|
196
258
|
if (va < vb)
|
|
197
259
|
return -1 * direction;
|
|
198
260
|
if (va > vb)
|
|
@@ -200,6 +262,72 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
200
262
|
return 0;
|
|
201
263
|
});
|
|
202
264
|
}
|
|
265
|
+
/**
|
|
266
|
+
* T3 筛选:应用所有列的 onFilter。
|
|
267
|
+
* 受控(col.filteredValue 已定义)→ 用该值;否则用内部 internalFilters[prop]。
|
|
268
|
+
*/
|
|
269
|
+
get filteredData() {
|
|
270
|
+
let result = this.sortedData;
|
|
271
|
+
for (const col of this.columns) {
|
|
272
|
+
if (!col.onFilter || !col.filters)
|
|
273
|
+
continue;
|
|
274
|
+
const values = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop];
|
|
275
|
+
if (!values || values.length === 0)
|
|
276
|
+
continue;
|
|
277
|
+
result = result.filter(row => values.some(v => col.onFilter(row, v)));
|
|
278
|
+
}
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* T1 分页:取当前页数据切片(仅当 pagination 配置时)。
|
|
283
|
+
* 在 sorted+filtered 之后切片。
|
|
284
|
+
*/
|
|
285
|
+
get pagedData() {
|
|
286
|
+
const filtered = this.filteredData;
|
|
287
|
+
if (!this.pagination)
|
|
288
|
+
return filtered;
|
|
289
|
+
const page = this.currentPage;
|
|
290
|
+
const size = this.currentPageSize;
|
|
291
|
+
const start = (page - 1) * size;
|
|
292
|
+
return filtered.slice(start, start + size);
|
|
293
|
+
}
|
|
294
|
+
/** T1:当前页(受控优先) */
|
|
295
|
+
get currentPage() {
|
|
296
|
+
return this.pagination?.current ?? this.internalPage;
|
|
297
|
+
}
|
|
298
|
+
/** T1:当前每页条数(受控优先) */
|
|
299
|
+
get currentPageSize() {
|
|
300
|
+
return this.pagination?.pageSize ?? this.internalPageSize;
|
|
301
|
+
}
|
|
302
|
+
/** T1:分页切换 */
|
|
303
|
+
handlePageChange = (page) => {
|
|
304
|
+
this.internalPage = page;
|
|
305
|
+
this.hbPageChange.emit({ current: page, pageSize: this.currentPageSize });
|
|
306
|
+
};
|
|
307
|
+
/** T1:每页条数切换 */
|
|
308
|
+
handlePageSizeChange = (size) => {
|
|
309
|
+
this.internalPageSize = size;
|
|
310
|
+
// 切条数后回到第一页避免越界
|
|
311
|
+
this.internalPage = 1;
|
|
312
|
+
this.hbPageChange.emit({ current: 1, pageSize: size });
|
|
313
|
+
};
|
|
314
|
+
/** T3:筛选下拉切换某项 */
|
|
315
|
+
handleFilterToggle = (col, value) => {
|
|
316
|
+
const current = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop] || [];
|
|
317
|
+
const next = current.includes(value) ? current.filter(v => v !== value) : [...current, value];
|
|
318
|
+
// 仅内部状态时更新;受控(filteredValue 已定义)则只 emit 交外部
|
|
319
|
+
if (col.filteredValue === undefined) {
|
|
320
|
+
this.internalFilters = { ...this.internalFilters, [col.prop]: next };
|
|
321
|
+
}
|
|
322
|
+
this.hbFilterChange.emit({ prop: col.prop, values: next });
|
|
323
|
+
};
|
|
324
|
+
/** T3:清空某列筛选 */
|
|
325
|
+
handleFilterReset = (col) => {
|
|
326
|
+
if (col.filteredValue === undefined) {
|
|
327
|
+
this.internalFilters = { ...this.internalFilters, [col.prop]: [] };
|
|
328
|
+
}
|
|
329
|
+
this.hbFilterChange.emit({ prop: col.prop, values: [] });
|
|
330
|
+
};
|
|
203
331
|
get isAllSelected() {
|
|
204
332
|
return this.data.length > 0 && this.selectedRows.size === this.data.length;
|
|
205
333
|
}
|
|
@@ -244,10 +372,14 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
244
372
|
get hasActions() {
|
|
245
373
|
return !!this.actions && this.actions.length > 0;
|
|
246
374
|
}
|
|
375
|
+
/** T3:某列是否有激活筛选 */
|
|
376
|
+
isColumnFiltered(col) {
|
|
377
|
+
const values = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop];
|
|
378
|
+
return !!values && values.length > 0;
|
|
379
|
+
}
|
|
247
380
|
/**
|
|
248
381
|
* 计算固定列的 sticky 偏移(左侧/右侧累计宽度)。
|
|
249
382
|
* P1 优化:缓存结果,仅当 columns 引用变化时重算。
|
|
250
|
-
* 修复前是 getter,被每个 <td>/<th> 反复调用,复杂度 O(rows×cols²)。
|
|
251
383
|
*/
|
|
252
384
|
_fixedOffsetsCache = null;
|
|
253
385
|
_fixedOffsetsColumnsRef = null;
|
|
@@ -291,11 +423,18 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
291
423
|
}
|
|
292
424
|
return style;
|
|
293
425
|
}
|
|
426
|
+
/**
|
|
427
|
+
* 渲染单元格内容(T7:优先 col.render,其次 formatter,最后原值)。
|
|
428
|
+
*/
|
|
429
|
+
renderCell(col, row, rowIndex) {
|
|
430
|
+
if (col.render)
|
|
431
|
+
return col.render(row, rowIndex);
|
|
432
|
+
if (col.formatter)
|
|
433
|
+
return col.formatter(row, rowIndex);
|
|
434
|
+
return row[col.prop] ?? '';
|
|
435
|
+
}
|
|
294
436
|
/**
|
|
295
437
|
* 渲染单行(普通 + 虚拟滚动 + 树形 共用)。
|
|
296
|
-
* - 普通模式:rowIndex 为在 sortedData 中的全局索引。
|
|
297
|
-
* - 树形模式:fr.level 决定缩进,第一列渲染展开箭头,key 取 fr.key。
|
|
298
|
-
* fr 为可选;未传时按普通模式渲染。
|
|
299
438
|
*/
|
|
300
439
|
renderRow(row, rowIndex, fr) {
|
|
301
440
|
const tree = !!fr;
|
|
@@ -303,15 +442,17 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
303
442
|
const rowKeyVal = fr ? fr.key : this.rowKey ? row[this.rowKey] : rowIndex;
|
|
304
443
|
const indent = level * 16;
|
|
305
444
|
const isEditing = (prop) => !!this.editingCell && this.editingCell.rowKey === rowKeyVal && this.editingCell.prop === prop;
|
|
445
|
+
// T8:行 className
|
|
446
|
+
const extraRowClass = this.rowClassName ? this.rowClassName(row, rowIndex) : '';
|
|
306
447
|
return (h("tr", { key: rowKeyVal, class: {
|
|
307
448
|
'hb-table__row': true,
|
|
308
449
|
'hb-table__row--striped': this.stripe && rowIndex % 2 === 1,
|
|
309
450
|
'hb-table__row--current': this.highlightCurrentRow && rowIndex === this.currentRow,
|
|
310
451
|
'hb-table__row--selected': this.selectedRows.has(rowIndex),
|
|
311
452
|
'hb-table__row--tree': tree,
|
|
453
|
+
[extraRowClass]: !!extraRowClass,
|
|
312
454
|
}, 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) => {
|
|
313
455
|
const off = this.getFixedOffsets()[col.prop];
|
|
314
|
-
// 树形模式:第一列加缩进 + 展开箭头
|
|
315
456
|
const isFirstCol = colIdx === 0;
|
|
316
457
|
const showExpand = tree && isFirstCol && fr.hasChildren;
|
|
317
458
|
const expanded = showExpand && this.expandedRowKeys.indexOf(rowKeyVal) !== -1;
|
|
@@ -322,52 +463,79 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
322
463
|
'hb-table__cell--fixed-left': off?.side === 'left',
|
|
323
464
|
'hb-table__cell--fixed-right': off?.side === 'right',
|
|
324
465
|
'hb-table__cell--editable': editableActive,
|
|
466
|
+
'hb-table__cell--ellipsis': !!col.ellipsis,
|
|
325
467
|
}, 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 => {
|
|
326
468
|
e.stopPropagation();
|
|
327
469
|
this.toggleExpand(row, rowKeyVal);
|
|
328
|
-
} }, 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) })) : (
|
|
470
|
+
} }, 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) })) : (
|
|
471
|
+
// T7:col.render 优先(支持返回 JSX);否则 formatter;否则原值
|
|
472
|
+
h("slot", { name: `cell-${col.prop}` }, this.renderCell(col, row, rowIndex)))));
|
|
329
473
|
}), 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: {
|
|
330
474
|
'hb-table__action': true,
|
|
331
475
|
'hb-table__action--primary': act.type === 'primary',
|
|
332
476
|
'hb-table__action--danger': act.type === 'danger',
|
|
333
477
|
}, disabled: act.disabled ? act.disabled(row, rowIndex) : false, onClick: () => this.handleAction(row, rowIndex, act.key) }, act.label)))))));
|
|
334
478
|
}
|
|
479
|
+
/**
|
|
480
|
+
* T3:渲染表头某列的筛选下拉。
|
|
481
|
+
*/
|
|
482
|
+
renderColumnFilter = (col) => {
|
|
483
|
+
if (!col.filters || col.filters.length === 0 || !col.onFilter)
|
|
484
|
+
return null;
|
|
485
|
+
const activeValues = col.filteredValue !== undefined ? col.filteredValue : this.internalFilters[col.prop] || [];
|
|
486
|
+
const filtered = this.isColumnFiltered(col);
|
|
487
|
+
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 => {
|
|
488
|
+
const checked = activeValues.includes(f.value);
|
|
489
|
+
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))));
|
|
490
|
+
})), h("div", { class: "hb-table__filter-actions" }, h("button", { type: "button", class: "hb-table__filter-reset", onClick: () => this.handleFilterReset(col) }, "\u91CD\u7F6E"))))));
|
|
491
|
+
};
|
|
335
492
|
/** 渲染表头(普通 + 虚拟滚动共用,表头始终固定不随滚) */
|
|
336
493
|
renderHeader() {
|
|
337
494
|
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 => {
|
|
338
495
|
this.allCheckboxRef = el;
|
|
339
496
|
}, onChange: this.toggleAll }))), this.columns.map(col => {
|
|
340
497
|
const off = this.getFixedOffsets()[col.prop];
|
|
498
|
+
// T2:列可排序的条件(sortable 或 sorter)
|
|
499
|
+
const canSort = !!col.sortable || !!col.sorter;
|
|
500
|
+
const order = this.effectiveSortOrder(col);
|
|
341
501
|
return (h("th", { key: col.prop, style: this.cellStyle(col.prop, {
|
|
342
502
|
width: col.width,
|
|
343
503
|
minWidth: col.minWidth,
|
|
344
504
|
textAlign: col.align || 'left',
|
|
345
505
|
}), class: {
|
|
346
|
-
'hb-table__th--sortable':
|
|
506
|
+
'hb-table__th--sortable': canSort,
|
|
347
507
|
'hb-table__cell--fixed-left': off?.side === 'left',
|
|
348
508
|
'hb-table__cell--fixed-right': off?.side === 'right',
|
|
349
|
-
}, onClick:
|
|
509
|
+
}, 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))));
|
|
350
510
|
}), this.hasActions && (h("th", { class: "hb-table__th--actions", style: { textAlign: 'right', whiteSpace: 'nowrap' } }, "\u64CD\u4F5C")))));
|
|
351
511
|
}
|
|
512
|
+
/** T1:渲染内置分页底部栏 */
|
|
513
|
+
renderPagination() {
|
|
514
|
+
if (!this.pagination)
|
|
515
|
+
return null;
|
|
516
|
+
const total = this.filteredData.length;
|
|
517
|
+
const page = this.currentPage;
|
|
518
|
+
const size = this.currentPageSize;
|
|
519
|
+
const totalPages = Math.max(1, Math.ceil(total / size));
|
|
520
|
+
const showTotal = this.pagination.showTotal;
|
|
521
|
+
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")))))));
|
|
522
|
+
}
|
|
352
523
|
render() {
|
|
353
|
-
|
|
524
|
+
// T1+T2+T3:排序 → 筛选 → 分页 依次应用
|
|
525
|
+
const displayData = this.pagedData;
|
|
354
526
|
const isEmpty = displayData.length === 0;
|
|
355
|
-
// 树形模式:把可见树拍平成带 level 的行列表(仅含已展开链路上的后代)
|
|
356
527
|
const flatRows = this.isTreeMode ? this.flattenTree(displayData) : [];
|
|
357
|
-
// 虚拟滚动:固定高度滚动视口 + 撑高容器 + 仅渲染可见窗口行(绝对定位 offset)
|
|
358
|
-
// 注意:树形 + 虚拟滚动组合较复杂,此处虚拟滚动沿用普通行渲染(不展开树),
|
|
359
|
-
// 保留树形仅在普通模式下生效以降低风险。
|
|
360
528
|
const renderVirtualBody = () => {
|
|
361
529
|
const { startIndex, endIndex } = this.visibleRange;
|
|
362
530
|
const offsetTop = startIndex * (this.itemHeight > 0 ? this.itemHeight : 1);
|
|
363
531
|
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)))))));
|
|
364
532
|
};
|
|
365
|
-
// 普通模式:树形启用时按拍平列表渲染(带 level 缩进 + 展开箭头),否则原样按行渲染
|
|
366
533
|
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)))));
|
|
367
|
-
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())))));
|
|
534
|
+
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()));
|
|
368
535
|
}
|
|
369
536
|
static get watchers() { return {
|
|
370
|
-
"data": ["handleDataChange"]
|
|
537
|
+
"data": ["handleDataChange"],
|
|
538
|
+
"pagination": ["handlePaginationChange"]
|
|
371
539
|
}; }
|
|
372
540
|
static get style() { return HbTableStyle0; }
|
|
373
541
|
}, [1, "hb-table", {
|
|
@@ -388,15 +556,21 @@ const Table = /*@__PURE__*/ proxyCustomElement(class Table extends H {
|
|
|
388
556
|
"virtualScrollHeight": [2, "virtual-scroll-height"],
|
|
389
557
|
"treeProps": [16],
|
|
390
558
|
"editable": [4],
|
|
559
|
+
"pagination": [16],
|
|
560
|
+
"rowClassName": [16],
|
|
391
561
|
"sortProp": [32],
|
|
392
562
|
"sortDirection": [32],
|
|
393
563
|
"currentRow": [32],
|
|
394
564
|
"selectedRows": [32],
|
|
395
565
|
"scrollTop": [32],
|
|
396
566
|
"expandedRowKeys": [32],
|
|
397
|
-
"editingCell": [32]
|
|
567
|
+
"editingCell": [32],
|
|
568
|
+
"internalPage": [32],
|
|
569
|
+
"internalPageSize": [32],
|
|
570
|
+
"internalFilters": [32]
|
|
398
571
|
}, undefined, {
|
|
399
|
-
"data": ["handleDataChange"]
|
|
572
|
+
"data": ["handleDataChange"],
|
|
573
|
+
"pagination": ["handlePaginationChange"]
|
|
400
574
|
}]);
|
|
401
575
|
function defineCustomElement$1() {
|
|
402
576
|
if (typeof customElements === "undefined") {
|