@canvas-components/react-list-table 0.3.73 → 0.3.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -9,6 +9,8 @@ var chart = require('@canvas-components/chart');
9
9
  var date = require('@canvas-components/utils/date');
10
10
  var number = require('@canvas-components/utils/number');
11
11
  var listTablePrint = require('@canvas-components/print-design-plugin/list-table-print');
12
+ var utils = require('@canvas-components/utils');
13
+ var numberUnit = require('@canvas-components/utils/number-unit');
12
14
 
13
15
  // #style-inject:#style-inject
14
16
  function styleInject(css, { insertAt } = {}) {
@@ -37,6 +39,29 @@ styleInject(".react-list-table-host {\n touch-action: none;\n min-width: 0;\n
37
39
 
38
40
  // ../print-design-plugin/dist/react.css
39
41
  styleInject('.cc-print-design-flow-item {\n border: 1px solid var(--pd-border);\n border-radius: 6px;\n padding: 8px;\n}\n.cc-print-design-flow-reverse,\n.cc-print-design-flow-reverse .canvas-react-button {\n width: 100%;\n}\n.cc-print-design-flow-item-heading {\n display: flex;\n align-items: center;\n gap: 4px;\n margin-bottom: 8px;\n}\n.cc-print-design-flow-item-heading strong {\n flex: 1;\n}\n.cc-print-design-flow-item-heading .canvas-react-button {\n padding: 4px;\n}\n.cc-print-design-chart-series {\n border: 1px solid var(--pd-border);\n border-radius: 6px;\n padding: 8px;\n margin: 8px 0;\n}\n.cc-print-design-column-actions > .canvas-react-button {\n box-sizing: border-box;\n width: 32px;\n height: 32px;\n flex: 0 0 32px;\n padding: 4px;\n}\n.cc-print-design-editor .cc-print-design-table-data label {\n font-size: var(--pd-label-font-size, 12px);\n color: var(--pd-muted);\n}\n.cc-print-design-packed-form,\n.cc-print-design-packed-section,\n.cc-print-design-packed-card {\n display: flex;\n flex-direction: column;\n gap: 9px;\n min-width: 0;\n}\n.cc-print-design-packed-form {\n --canvas-react-control-height: 32px;\n gap: 16px;\n padding-top: 9px;\n}\n.cc-print-design-packed-form .canvas-react-select,\n.cc-print-design-packed-form .canvas-react-input-number,\n.cc-print-design-packed-form .canvas-react-input-affix-wrapper {\n height: 32px;\n}\n.cc-print-design-table-data .cc-print-design-packed-form label.cc-print-design-field {\n align-items: stretch;\n margin: 0;\n gap: 5px;\n}\n.cc-print-design-packed-section {\n padding-top: 12px;\n border-top: 1px solid var(--pd-border);\n}\n.cc-print-design-packed-mode {\n display: flex;\n gap: 6px;\n}\n.cc-print-design-packed-mode > button {\n flex: 1;\n}\n.cc-print-design-packed-hint {\n color: var(--pd-muted);\n font-size: 12px;\n line-height: 1.5;\n}\n.cc-print-design-packed-summary-field {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n.cc-print-design-packed-summary-field > button {\n width: 100%;\n}\n.cc-print-design-packed-card {\n padding: 9px;\n border: 1px solid var(--pd-border);\n border-radius: 5px;\n}\n.cc-print-design-packed-row {\n display: flex;\n align-items: end;\n gap: 6px;\n min-width: 0;\n}\n.cc-print-design-packed-add {\n width: 100%;\n margin-top: 9px;\n padding: 0;\n border-style: dashed;\n}\n.cc-print-design-packed-row > .cc-print-design-field {\n flex: 1;\n}\n.cc-print-design-packed-row > .cc-print-design-packed-delete {\n flex: none;\n align-self: end;\n width: 32px;\n height: 32px;\n padding: 0;\n}\n.cc-print-design-packed-checks {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 6px;\n}\n.cc-print-design-table-data {\n padding: 12px;\n border-bottom: 1px solid var(--pd-border);\n --canvas-react-control-height: 32px;\n}\n.cc-print-design-table-data h4 {\n font-size: var(--pd-primary-font-size, 13px);\n margin: 12px 0;\n}\n.cc-print-design-table-data label:not(.canvas-react-checkbox) {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 10px 0;\n}\n.cc-print-design-diagonal-style {\n grid-column: 1 / -1;\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n padding-top: 8px;\n border-top: 1px solid var(--pd-border);\n}\n.cc-print-design-diagonal-style > strong {\n grid-column: 1 / -1;\n}\n.cc-print-design-cell-merge-actions {\n grid-column: 1 / -1;\n display: flex;\n gap: 8px;\n}\n.cc-print-design-cell-merge-actions > .canvas-react-button {\n flex: 1;\n min-width: 0;\n}\n.cc-print-design-cell-content-format {\n grid-column: 1 / -1;\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n}\n.cc-print-design-cell-content-format > .cc-print-design-cell-content-format-type {\n grid-column: 1 / -1;\n}\n.cc-print-design-diagonal-controls {\n grid-column: 1 / -1;\n display: grid;\n gap: 4px;\n}\n.cc-print-design-compact-grid:not([hidden]) {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n}\n.cc-print-design-compact-grid > .canvas-react-checkbox,\n.cc-print-design-compact-grid > .cc-print-design-property-toggle {\n grid-column: 1 / -1;\n}\n.cc-print-design-table-data.cc-print-design-compact-grid label:not(.canvas-react-checkbox) {\n min-width: 0;\n gap: 4px;\n margin: 0;\n}\n.cc-print-design-compact-grid .canvas-react-input-number,\n.cc-print-design-compact-grid .canvas-react-color-picker {\n width: 100%;\n min-width: 0;\n}\n.cc-print-design-row-height-controls {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.cc-print-design-cell-print-mode,\n.cc-print-design-row-height-field {\n align-self: end;\n}\n.cc-print-design-row-height-controls > .canvas-react-input-number {\n flex: 1 1 auto;\n}\n.cc-print-design-row-height-controls > .cc-print-design-row-height-reset {\n box-sizing: border-box;\n width: 32px;\n height: 32px;\n flex: 0 0 32px;\n padding: 4px;\n}\n.cc-print-design-column-conditions,\n.cc-print-design-column-condition {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n.cc-print-design-column-conditions {\n padding-top: 10px;\n border-top: 1px solid var(--pd-border);\n}\n.cc-print-design-column-condition {\n padding: 8px;\n border: 1px solid var(--pd-border);\n border-radius: 5px;\n}\n.cc-print-design-column-condition-head,\n.cc-print-design-column-condition-colors {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.cc-print-design-column-condition-head {\n justify-content: space-between;\n}\n.cc-print-design-column-condition-colors > label {\n flex: 1;\n min-width: 0;\n}\n.cc-print-design-column-heading {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 8px;\n min-width: 0;\n}\n.cc-print-design-column-heading > span {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-design-column-heading small {\n flex-shrink: 0;\n color: var(--pd-muted);\n font-size: var(--pd-secondary-font-size, 11px);\n font-weight: normal;\n}\n.cc-print-design-column-grid:not([hidden]) {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n padding: 8px;\n}\n.cc-print-design-column-grid > * {\n grid-column: 1 / -1;\n min-width: 0;\n}\n.cc-print-design-column-grid > .cc-print-design-column-half {\n grid-column: span 1;\n}\n.cc-print-design-column-field-row {\n display: flex;\n align-items: end;\n gap: 8px;\n min-width: 0;\n}\n.cc-print-design-column-field-row > .cc-print-design-field {\n flex: 1;\n min-width: 0;\n margin: 0;\n}\n.cc-print-design-column-field-row .cc-print-design-column-actions {\n flex: none;\n gap: 4px;\n}\n.cc-print-design-table-data .cc-print-design-column-grid label:not(.canvas-react-checkbox),\n.cc-print-design-column-grid > .cc-print-design-field {\n gap: 4px;\n margin: 0;\n}\n.cc-print-design-column-grid .canvas-react-input-number {\n min-width: 0;\n width: 100%;\n}\n.cc-print-design-cell-appearance .canvas-react-color-picker {\n min-width: 0;\n width: 100%;\n}\n.cc-print-design-table-appearance-colors {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n}\n.cc-print-design-table-appearance-colors > label {\n min-width: 0;\n}\n.cc-print-design-column-actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 8px;\n}\n.cc-print-design-column-toolbar {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 6px;\n margin-top: 8px;\n}\n.cc-print-design-column-toolbar > * {\n min-width: 0;\n width: 100%;\n}\n.cc-print-design-data-merge,\n.cc-print-design-merge-form {\n display: grid;\n gap: 12px;\n}\n.cc-print-design-merge-fields {\n display: flex;\n flex-direction: column;\n gap: 8px;\n margin: 0;\n}\n.cc-print-design-merge-fields > strong {\n font-size: var(--pd-primary-font-size, 13px);\n}\n.cc-print-design-merge-field {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n.cc-print-design-merge-field > .cc-print-design-field {\n flex: 1;\n min-width: 0;\n}\n.cc-print-design-packed-toggle {\n width: 100%;\n}\n.cc-print-design-summary-toggle {\n width: 100%;\n}\n.cc-print-design-table-row {\n border: 1px solid var(--pd-border);\n border-radius: 6px;\n padding: 8px;\n margin: 8px 0;\n}\n.cc-print-design-table-data pre {\n max-height: 200px;\n overflow: auto;\n font-size: var(--pd-primary-font-size, 13px);\n overscroll-behavior: contain;\n}\n.cc-print-design-row-settings:not([hidden]) {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n}\n.cc-print-design-row-settings > * {\n grid-column: 1 / -1;\n min-width: 0;\n}\n.cc-print-design-row-settings-header-toggle {\n width: 100%;\n}\n.cc-print-design-row-settings > .cc-print-design-column-half {\n grid-column: span 1;\n margin: 0;\n gap: 4px;\n}\n.cc-print-design-row-count {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n align-items: end;\n}\n.cc-print-design-table-data .cc-print-design-row-count > label {\n min-width: 0;\n margin: 0;\n gap: 4px;\n}\n.cc-print-design-row-count > .canvas-react-button {\n box-sizing: border-box;\n min-width: 0;\n width: 100%;\n height: var(--canvas-react-control-height, 32px);\n padding: 0 4px;\n white-space: nowrap;\n}\n.cc-print-design-row-settings .canvas-react-input-number {\n min-width: 0;\n width: 100%;\n}\n.cc-print-design-row-settings .cc-print-design-hint {\n margin: 0;\n}\n.cc-print-design-data-compact {\n padding: 8px;\n}\n.cc-print-design-table-data-panel:not([hidden]) {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n.cc-print-design-static-data-actions {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n}\n.cc-print-design-static-data-actions > .canvas-react-button {\n min-width: 0;\n width: 100%;\n}\n.cc-print-design-data-compact .cc-print-design-hint {\n margin: 6px 0;\n}\n.cc-print-design-data-compact .cc-print-design-json-field {\n margin: 6px 0;\n}\n.cc-print-design-data-compact .cc-print-design-table-row {\n padding: 0;\n margin: 6px 0;\n overflow: hidden;\n}\n.cc-print-design-static-row-grid:not([hidden]) {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n padding: 8px;\n}\n.cc-print-design-static-row-grid > * {\n min-width: 0;\n}\n.cc-print-design-table-data .cc-print-design-static-row-grid label:not(.canvas-react-checkbox) {\n margin: 0;\n gap: 4px;\n overflow-wrap: anywhere;\n}\n.cc-print-design-static-row-grid .canvas-react-input-number {\n width: 100%;\n min-width: 0;\n}\n.cc-print-design-static-row-grid > .cc-print-design-json-field,\n.cc-print-design-static-row-grid > .cc-print-design-static-row-actions {\n grid-column: 1 / -1;\n}\n.cc-print-design-static-row-grid > .cc-print-design-static-row-actions-inline {\n grid-column: span 1;\n align-self: end;\n}\n.cc-print-design-border-side-controls {\n display: grid;\n grid-template-columns: repeat(3, 32px);\n grid-template-rows: repeat(3, 32px);\n gap: 2px;\n justify-content: center;\n}\n.cc-print-design-border-editor {\n grid-column: 1 / -1;\n width: 100%;\n min-width: 0;\n padding: 0;\n margin: 0;\n border: 0;\n}\n.cc-print-design-border-editor .cc-print-design-border-side-controls {\n width: 100%;\n}\n.cc-print-design-border-editor > .cc-print-design-border-line-style,\n.cc-print-design-border-editor > .cc-print-design-border-print-mode {\n grid-column: span 1;\n min-width: 0;\n}\n.cc-print-design-border-side-controls .canvas-react-button {\n min-width: 0;\n width: 32px;\n height: 32px;\n padding: 0;\n}\n.cc-print-design-border-side-top {\n grid-area: 1 / 2;\n}\n.cc-print-design-border-side-right {\n grid-area: 2 / 3;\n}\n.cc-print-design-border-side-bottom {\n grid-area: 3 / 2;\n}\n.cc-print-design-border-side-left {\n grid-area: 2 / 1;\n}\n.cc-print-design-border-side-inner {\n grid-area: 2 / 2;\n}\n.cc-print-design-table-data.cc-print-design-pivot-field-config {\n padding: 0;\n border: 0;\n}\n.cc-print-design-pivot-field-config__panel {\n height: 430px;\n min-height: 280px;\n margin-top: 10px;\n}\n.cc-print-pivot-fields {\n display: flex;\n flex-direction: column;\n height: 100%;\n min-width: 0;\n overflow: hidden;\n background: var(--pd-surface);\n color: var(--pd-text);\n font-size: var(--pd-primary-font-size, 13px);\n}\n.cc-print-pivot-fields section {\n min-height: 0;\n box-sizing: border-box;\n}\n.cc-print-pivot-fields__catalog {\n display: flex;\n flex: 0 0 39%;\n flex-direction: column;\n}\n.cc-print-pivot-fields__zones {\n display: flex;\n flex: 1 1 0;\n flex-direction: column;\n padding-top: 12px;\n}\n.cc-print-pivot-fields p {\n margin: 4px 0 8px;\n color: var(--pd-muted);\n font-size: var(--pd-label-font-size, 12px);\n}\n.cc-print-pivot-fields__catalog-list {\n min-height: 0;\n margin-top: 7px;\n overflow: auto;\n}\n.cc-print-pivot-fields__field,\n.cc-print-pivot-fields__area-field {\n display: grid;\n height: 28px;\n align-items: center;\n column-gap: 6px;\n box-sizing: border-box;\n}\n.cc-print-pivot-fields__field:hover,\n.cc-print-pivot-fields__area-field:hover {\n background: var(--pd-hover);\n}\n.cc-print-pivot-fields__field {\n grid-template-columns: 10px 16px minmax(0, 1fr);\n padding: 0 8px 0 6px;\n cursor: grab;\n}\n.cc-print-pivot-fields__field[data-dragging] {\n opacity: 0.45;\n}\n.cc-print-pivot-fields__field > span:last-child,\n.cc-print-pivot-fields__area-field > span:nth-child(2) {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-pivot-fields__grip {\n width: 8px;\n height: 12px;\n background-image:\n radial-gradient(\n circle at 2px 2px,\n var(--pd-muted) 1px,\n transparent 1.2px);\n background-size: 4px 4px;\n cursor: grab;\n}\n.cc-print-pivot-fields__grid {\n display: grid;\n min-height: 0;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n grid-template-rows: repeat(2, minmax(0, 1fr));\n gap: 8px;\n flex: 1;\n}\n.cc-print-pivot-fields__zone {\n display: flex;\n min-height: 0;\n min-width: 0;\n flex-direction: column;\n}\n.cc-print-pivot-fields__zone > strong {\n margin-bottom: 4px;\n font-size: 12px;\n}\n.cc-print-pivot-fields__drop {\n min-height: 0;\n flex: 1;\n overflow: auto;\n border: 1px solid var(--pd-border);\n border-radius: 3px;\n background: var(--pd-surface);\n}\n.cc-print-pivot-fields__drop[data-drag-over] {\n border-color: var(--pd-primary);\n background: var(--pd-selected);\n}\n.cc-print-pivot-fields__area-field {\n grid-template-columns: 9px minmax(0, 1fr) 18px;\n padding: 0 7px 0 5px;\n}\n.cc-print-pivot-fields__menu-trigger {\n display: grid;\n width: 18px;\n height: 22px;\n padding: 0;\n place-items: center;\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n.cc-print-pivot-fields__menu-trigger > span {\n width: 0;\n height: 0;\n border-top: 5px solid currentColor;\n border-right: 4px solid transparent;\n border-left: 4px solid transparent;\n}\n.cc-print-pivot-fields__empty {\n display: block;\n padding: 10px 3px;\n color: var(--pd-muted);\n font-size: var(--pd-label-font-size, 12px);\n}\n.cc-print-pivot-fields__menu,\n.cc-print-pivot-fields__settings {\n color: var(--pd-text, #263244);\n font-family:\n "Segoe UI",\n "Microsoft YaHei",\n sans-serif;\n font-size: var(--pd-primary-font-size, 13px);\n}\n.cc-print-pivot-fields__menu button,\n.cc-print-pivot-fields__settings button,\n.cc-print-pivot-fields__settings input {\n font: inherit;\n}\n.cc-print-pivot-fields__menu {\n min-width: 176px;\n padding: 5px 0;\n}\n.cc-print-pivot-fields__menu button {\n display: block;\n width: 100%;\n height: 30px;\n padding: 0 12px;\n border: 0;\n background: transparent;\n text-align: left;\n cursor: pointer;\n}\n.cc-print-pivot-fields__menu button:hover:not(:disabled) {\n background: var(--pd-selected);\n}\n.cc-print-pivot-fields__menu button:disabled {\n color: #a7abb2;\n cursor: default;\n}\n.cc-print-pivot-fields__separator {\n height: 1px;\n margin: 4px 0;\n background: var(--pd-divider);\n}\n.cc-print-pivot-fields__settings {\n display: grid;\n min-width: 260px;\n gap: 12px;\n padding: 14px;\n}\n.cc-print-pivot-fields__settings label:not(.canvas-react-checkbox) {\n display: grid;\n gap: 5px;\n}\n.cc-print-pivot-fields__settings-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n.cc-print-design-nested-repeat > strong {\n display: block;\n margin: 8px 0 4px;\n}\n.cc-print-design-task-title {\n padding: 8px;\n font-weight: 600;\n}\n.cc-print-design-task-dependency-row {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 8px;\n padding: 8px 0;\n border-top: 1px solid #e7edf5;\n}\n.cc-print-design-task-dependency-row > * {\n min-width: 0;\n}\n.cc-print-design-ai-panel {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n min-width: 0;\n min-height: 0;\n background: var(--pd-surface, #fff);\n color: var(--pd-text, #263244);\n border-left: 1px solid var(--pd-border, #e4e8ef);\n}\n.cc-print-design-ai-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n box-sizing: border-box;\n height: var(--pd-panel-header-height, 36px);\n flex: 0 0 var(--pd-panel-header-height, 36px);\n padding: 0 12px;\n border-bottom: 1px solid var(--pd-border, #e4e8ef);\n}\n.cc-print-design-ai-header > div {\n display: flex;\n align-items: center;\n gap: 8px;\n}\n.cc-print-design-ai-panel button {\n cursor: pointer;\n font: inherit;\n}\n.cc-print-design-ai-header button,\n.cc-print-design-ai-composer-more {\n border: 0;\n background: transparent;\n color: inherit;\n}\n.cc-print-design-ai-messages {\n flex: 1;\n min-height: 0;\n overflow: auto;\n overscroll-behavior: contain;\n}\n.cc-print-design-ai-message {\n box-sizing: border-box;\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n padding: 9px 12px;\n}\n.cc-print-design-ai-message-user {\n align-items: flex-end;\n}\n.cc-print-design-ai-message > span {\n display: block;\n max-width: 85%;\n margin-bottom: 4px;\n color: var(--pd-muted, #8993a2);\n font-size: 11px;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-design-ai-message p {\n margin: 0;\n max-width: min(85%, 680px);\n padding: 10px;\n border-radius: 10px;\n background: var(--pd-hover, #f5f7fa);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n line-height: 1.5;\n}\n.cc-print-design-ai-message-user p {\n background: var(--pd-selected, #edf4ff);\n}\n.cc-print-design-ai-artifact {\n display: flex;\n flex-direction: column;\n gap: 3px;\n max-width: min(85%, 680px);\n margin-top: 7px;\n padding: 10px 12px;\n border: 1px solid var(--pd-border, #e4e8ef);\n border-radius: 10px;\n color: inherit;\n text-decoration: none;\n background: var(--pd-hover, #f5f7fa);\n cursor: pointer;\n text-align: left;\n font: inherit;\n}\n.cc-print-design-ai-artifact:hover {\n border-color: #5b8def;\n}\n.cc-print-design-ai-artifact small {\n color: var(--pd-muted, #64748b);\n line-height: 1.4;\n}\n.cc-print-design-ai-artifact span:last-child {\n color: #2563eb;\n}\n.cc-print-design-ai-reasoning {\n box-sizing: border-box;\n width: min(85%, 680px);\n max-width: 100%;\n margin-bottom: 6px;\n border: 1px solid var(--pd-border, #e4e8ef);\n border-radius: 8px;\n background: var(--pd-hover, #f5f7fa);\n}\n.cc-print-design-ai-reasoning-trigger {\n display: flex;\n align-items: center;\n gap: 6px;\n width: 100%;\n padding: 7px 10px;\n border: 0;\n background: transparent;\n color: var(--pd-muted, #8993a2);\n text-align: left;\n cursor: pointer;\n}\n.cc-print-design-ai-reasoning-trigger > svg {\n flex: 0 0 auto;\n transition: transform 180ms ease;\n}\n.cc-print-design-ai-reasoning-trigger[aria-expanded=true] > svg {\n transform: rotate(90deg);\n}\n.cc-print-design-ai-reasoning-trigger:focus-visible {\n outline: 2px solid var(--pd-primary, #1677ff);\n outline-offset: -2px;\n}\n.cc-print-design-ai-reasoning-content {\n max-height: 180px;\n overflow: auto;\n padding: 0 10px 10px;\n font-size: 12px;\n line-height: 1.5;\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n@media (prefers-reduced-motion: reduce) {\n .cc-print-design-ai-reasoning-trigger > svg {\n transition: none;\n }\n}\n.cc-print-design-ai-message-thinking .cc-print-design-ai-thinking-indicator {\n display: inline-flex;\n align-items: center;\n gap: 8px;\n color: var(--pd-muted, #8993a2);\n}\n.cc-print-design-ai-thinking-dots {\n display: inline-flex;\n align-items: center;\n gap: 3px;\n}\n.cc-print-design-ai-thinking-dots i {\n width: 5px;\n height: 5px;\n border-radius: 50%;\n background: currentColor;\n animation: cc-print-design-ai-thinking 1s ease-in-out infinite;\n}\n.cc-print-design-ai-thinking-dots i:nth-child(2) {\n animation-delay: 0.16s;\n}\n.cc-print-design-ai-thinking-dots i:nth-child(3) {\n animation-delay: 0.32s;\n}\n.cc-print-design-ai-message-thinking.is-paused .cc-print-design-ai-thinking-dots i {\n animation-play-state: paused;\n}\n@keyframes cc-print-design-ai-thinking {\n 0%, 60%, 100% {\n opacity: 0.35;\n transform: translateY(0);\n }\n 30% {\n opacity: 1;\n transform: translateY(-3px);\n }\n}\n@media (prefers-reduced-motion: reduce) {\n .cc-print-design-ai-thinking-dots i {\n animation: none;\n }\n}\n.cc-print-design-ai-settings {\n display: grid;\n gap: 8px;\n padding: 12px;\n border-top: 1px solid var(--pd-border, #e4e8ef);\n max-height: 48%;\n overflow: auto;\n}\n.cc-print-design-ai-settings label {\n display: grid;\n gap: 4px;\n}\n.cc-print-design-ai-composer textarea {\n box-sizing: border-box;\n width: 100%;\n padding: 8px;\n border: 1px solid var(--pd-border, #e4e8ef);\n border-radius: 6px;\n background: var(--pd-surface, #fff);\n color: inherit;\n font: inherit;\n}\n.cc-print-design-ai-settings-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n}\n.cc-print-design-ai-key-row {\n display: flex;\n align-items: end;\n gap: 8px;\n}\n.cc-print-design-ai-key-row label {\n flex: 1;\n min-width: 0;\n}\n.cc-print-design-ai-key-row button {\n flex: 0 0 auto;\n white-space: nowrap;\n}\n.cc-print-design-ai-width-fields {\n display: grid;\n grid-template-columns: repeat(3, minmax(0, 1fr));\n gap: 6px;\n}\n.cc-print-design-ai-profile-picker {\n display: flex;\n align-items: end;\n gap: 8px;\n}\n.cc-print-design-ai-profile-picker label {\n flex: 1;\n min-width: 0;\n}\n.cc-print-design-ai-profile-picker button {\n height: 34px;\n}\n.cc-print-design-ai-dialog-layout {\n display: flex;\n height: 100%;\n min-height: 0;\n}\n.cc-print-design-ai-dialog-nav {\n display: flex;\n width: 150px;\n flex: 0 0 150px;\n flex-direction: column;\n gap: 4px;\n padding: 14px 8px;\n border-right: 1px solid var(--pd-border, #e4e8ef);\n background: var(--pd-hover, #f5f7fa);\n}\n.cc-print-design-ai-dialog-nav button {\n padding: 10px 12px;\n border: 0;\n border-radius: 6px;\n background: transparent;\n text-align: left;\n cursor: pointer;\n}\n.cc-print-design-ai-dialog-nav button[aria-current=page] {\n background: var(--pd-selected, #edf4ff);\n color: var(--pd-primary, #1677ff);\n}\n.cc-print-design-ai-dialog-content {\n flex: 1;\n min-width: 0;\n min-height: 0;\n overflow: auto;\n}\n.cc-print-design-ai-dialog .cc-print-design-ai-settings {\n max-height: none;\n border-top: 0;\n}\n.cc-print-design-ai-history {\n min-height: 140px;\n max-height: none;\n overflow: auto;\n padding: 8px 0;\n}\n.cc-print-design-ai-history > p {\n color: var(--pd-muted, #8993a2);\n text-align: center;\n}\n.cc-print-design-ai-history-item {\n display: flex;\n align-items: center;\n gap: 8px;\n border-bottom: 1px solid var(--pd-border, #e4e8ef);\n}\n.cc-print-design-ai-history-item > button:first-child {\n display: flex;\n flex: 1;\n min-width: 0;\n flex-direction: column;\n align-items: flex-start;\n gap: 4px;\n padding: 9px 10px;\n border: 0;\n background: transparent;\n text-align: left;\n cursor: pointer;\n}\n.cc-print-design-ai-history-item > button:first-child.active {\n color: var(--pd-primary, #1677ff);\n}\n.cc-print-design-ai-history-item span {\n overflow: hidden;\n max-width: 100%;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-design-ai-history-item small {\n color: var(--pd-muted, #8993a2);\n}\n.cc-print-design-ai-history-delete {\n border: 0;\n background: transparent;\n color: var(--pd-danger, #dc2626);\n cursor: pointer;\n}\n.cc-print-design-ai-composer {\n padding: 10px;\n border-top: 1px solid var(--pd-border, #e4e8ef);\n}\n.cc-print-design-ai-attachments,\n.cc-print-design-ai-message-attachments {\n display: flex;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n.cc-print-design-ai-attachments {\n max-height: 116px;\n margin-bottom: 8px;\n overflow: auto;\n}\n.cc-print-design-ai-attachment {\n display: flex;\n align-items: center;\n gap: 5px;\n max-width: 100%;\n padding: 4px 6px;\n border: 1px solid var(--pd-border, #e4e8ef);\n border-radius: 6px;\n font-size: 11px;\n}\n.cc-print-design-ai-attachment .cc-print-design-ai-image-trigger img {\n width: 28px;\n height: 28px;\n object-fit: cover;\n}\n.cc-print-design-ai-panel .cc-print-design-ai-image-trigger {\n display: block;\n padding: 0;\n border: 0;\n border-radius: 5px;\n background: transparent;\n cursor: zoom-in;\n}\n.cc-print-design-ai-image-trigger:focus-visible {\n outline: 2px solid var(--pd-primary, #1677ff);\n outline-offset: 2px;\n}\n.cc-print-design-ai-attachment > span:nth-last-child(2) {\n overflow: hidden;\n max-width: 145px;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-design-ai-attachment > button {\n border: 0;\n background: transparent;\n cursor: pointer;\n}\n.cc-print-design-ai-message-attachments {\n margin-top: 7px;\n}\n.cc-print-design-ai-message-user .cc-print-design-ai-message-attachments {\n align-self: flex-end;\n justify-content: flex-end;\n max-width: min(85%, 680px);\n margin-left: auto;\n}\n.cc-print-design-ai-message-attachments figure {\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n max-width: 100%;\n margin: 0;\n}\n.cc-print-design-ai-message-attachments .cc-print-design-ai-image-trigger {\n max-width: min(100%, 240px);\n}\n.cc-print-design-ai-message-attachments img {\n display: block;\n max-width: min(100%, 240px);\n max-height: 180px;\n border-radius: 5px;\n object-fit: contain;\n}\n.cc-print-design-ai-message-attachments figcaption,\n.cc-print-design-ai-message-attachments > span {\n overflow: hidden;\n max-width: 100%;\n color: var(--pd-muted, #8993a2);\n font-size: 11px;\n text-overflow: ellipsis;\n text-align: right;\n white-space: nowrap;\n}\n.cc-print-design-ai-composer-attach {\n display: grid;\n flex: 0 0 30px;\n width: 30px;\n height: 30px;\n place-items: center;\n border: 0;\n border-radius: 5px;\n background: transparent;\n color: inherit;\n cursor: pointer;\n}\n.cc-print-design-ai-composer-attach:hover {\n background: var(--pd-hover, #f5f7fa);\n}\n.cc-print-design-ai-selection {\n min-width: 0;\n margin-bottom: 8px;\n color: var(--pd-muted, #8993a2);\n font-size: 11px;\n}\n.cc-print-design-ai-selection-items {\n display: flex;\n flex-wrap: wrap;\n gap: 5px;\n max-height: 80px;\n margin-top: 5px;\n overflow: auto;\n}\n.cc-print-design-ai-selection-item {\n max-width: 100%;\n}\n.cc-print-design-ai-selection-item strong,\n.cc-print-design-ai-selection-item small {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.cc-print-design-ai-selection-item strong {\n flex: 0 0 auto;\n max-width: 115px;\n}\n.cc-print-design-ai-selection-item small {\n flex: 1 1 auto;\n min-width: 0;\n color: var(--pd-muted, #8993a2);\n}\n.cc-print-design-ai-composer textarea {\n resize: vertical;\n min-height: 70px;\n}\n.cc-print-design-ai-composer-tools {\n display: flex;\n align-items: center;\n gap: 8px;\n margin-top: 6px;\n}\n.cc-print-design-ai-composer-options {\n display: flex;\n flex: 1 1 auto;\n align-items: center;\n gap: 8px;\n min-width: 0;\n}\n.cc-print-design-ai-composer-options .canvas-react-select-wrap:first-child {\n flex: 1 1 auto;\n min-width: 0;\n}\n.cc-print-design-ai-composer-options .canvas-react-select-wrap:last-child {\n flex: 0 0 94px;\n min-width: 0;\n}\n.cc-print-design-ai-composer-actions {\n display: flex;\n flex: 0 0 auto;\n align-items: center;\n gap: 4px;\n margin-left: auto;\n}\n');
42
+ function useStorageKeyState(storageKey, createInitial) {
43
+ const initial = react.useMemo(createInitial, [storageKey]);
44
+ const [state, setState] = react.useState(() => ({ storageKey, value: initial }));
45
+ const activeKey = react.useRef(storageKey);
46
+ react.useLayoutEffect(() => {
47
+ activeKey.current = storageKey;
48
+ }, [storageKey]);
49
+ const setValue = react.useCallback(
50
+ (update) => {
51
+ if (activeKey.current !== storageKey) return;
52
+ setState((current) => {
53
+ if (activeKey.current !== storageKey) return current;
54
+ const value = current.storageKey === storageKey ? current.value : initial;
55
+ return {
56
+ storageKey,
57
+ value: typeof update === "function" ? update(value) : update
58
+ };
59
+ });
60
+ },
61
+ [storageKey, initial]
62
+ );
63
+ return [state.storageKey === storageKey ? state.value : initial, setValue];
64
+ }
40
65
  var conditionalOperators = {
41
66
  eq: "\u7B49\u4E8E",
42
67
  neq: "\u4E0D\u7B49\u4E8E",
@@ -1383,7 +1408,27 @@ function ReactTableContextMenuView(props) {
1383
1408
  onChange: request.onChangeDensity
1384
1409
  }
1385
1410
  ),
1411
+ request.onOpenPaginationConfig ? /* @__PURE__ */ jsxRuntime.jsx(
1412
+ MenuAction,
1413
+ {
1414
+ label: "\u5206\u9875\u914D\u7F6E",
1415
+ onClick: () => {
1416
+ request.onClose();
1417
+ request.onOpenPaginationConfig?.();
1418
+ }
1419
+ }
1420
+ ) : null,
1386
1421
  /* @__PURE__ */ jsxRuntime.jsx(ZoomMenu, { value: request.zoom ?? 1, onChange: request.onChangeZoom }),
1422
+ request.onToggleDebug ? /* @__PURE__ */ jsxRuntime.jsx(
1423
+ MenuAction,
1424
+ {
1425
+ label: request.debugEnabled ? "\u5173\u95ED\u8C03\u8BD5" : "\u5F00\u542F\u8C03\u8BD5",
1426
+ onClick: () => {
1427
+ request.onClose();
1428
+ request.onToggleDebug?.();
1429
+ }
1430
+ }
1431
+ ) : null,
1387
1432
  request.columnSettingsCacheAvailable === true ? /* @__PURE__ */ jsxRuntime.jsx(
1388
1433
  MenuSubmenu,
1389
1434
  {
@@ -4234,6 +4279,147 @@ function ReactListTablePrintProvider(props) {
4234
4279
  function useReactListTablePrintIntegration() {
4235
4280
  return react.useContext(PrintIntegrationContext);
4236
4281
  }
4282
+ function cancelRequest(session) {
4283
+ session.version++;
4284
+ if (session.timer !== void 0) clearTimeout(session.timer);
4285
+ session.timer = void 0;
4286
+ session.controller?.abort();
4287
+ session.controller = void 0;
4288
+ }
4289
+ function mergeOptions(records, getValue) {
4290
+ const values = /* @__PURE__ */ new Map();
4291
+ records.forEach((record) => values.set(getValue(record), record));
4292
+ return [...values.values()];
4293
+ }
4294
+ function useTableSelectOptions(options) {
4295
+ const { editorKey, config, active } = options;
4296
+ const request = config?.request;
4297
+ const pageSize = typeof config?.pageSize === "number" && Number.isFinite(config.pageSize) && config.pageSize >= 1 ? Math.floor(config.pageSize) : 30;
4298
+ const debounce = typeof config?.debounce === "number" && Number.isFinite(config.debounce) && config.debounce >= 0 ? config.debounce : 300;
4299
+ const sessionRef = react.useRef();
4300
+ const [, refresh] = react.useState(0);
4301
+ const previous = sessionRef.current;
4302
+ if (!previous || previous.editorKey !== editorKey || previous.active !== active || previous.request !== request || previous.getOptionValue !== config?.getOptionValue || previous.pageSize !== pageSize || previous.debounce !== debounce) {
4303
+ const sameEditor = previous?.editorKey === editorKey && previous.active && active;
4304
+ if (previous) {
4305
+ previous.alive = false;
4306
+ cancelRequest(previous);
4307
+ }
4308
+ sessionRef.current = {
4309
+ editorKey,
4310
+ active,
4311
+ request,
4312
+ getOptionValue: config?.getOptionValue,
4313
+ pageSize,
4314
+ debounce,
4315
+ alive: true,
4316
+ version: 0,
4317
+ keyword: sameEditor ? previous.keyword : options.initialKeyword ?? "",
4318
+ page: 0,
4319
+ dataSource: config?.dataSource ?? [],
4320
+ loading: active && !!request,
4321
+ hasMore: false
4322
+ };
4323
+ }
4324
+ const session = sessionRef.current;
4325
+ const isCurrent = react.useCallback(
4326
+ () => session.alive && session.active && sessionRef.current === session,
4327
+ [session]
4328
+ );
4329
+ const notify = react.useCallback(() => {
4330
+ if (isCurrent()) refresh((value) => value + 1);
4331
+ }, [isCurrent]);
4332
+ const load = react.useCallback(
4333
+ (page, wait) => {
4334
+ if (!isCurrent() || !session.request || !session.getOptionValue) return;
4335
+ cancelRequest(session);
4336
+ const version = session.version;
4337
+ session.loading = true;
4338
+ session.error = void 0;
4339
+ session.failedPage = void 0;
4340
+ notify();
4341
+ const run = async () => {
4342
+ session.timer = void 0;
4343
+ if (!isCurrent() || session.version !== version) return;
4344
+ const controller = new AbortController();
4345
+ session.controller = controller;
4346
+ try {
4347
+ const result = await session.request({
4348
+ keyword: session.keyword,
4349
+ page,
4350
+ pageSize: session.pageSize,
4351
+ signal: controller.signal
4352
+ });
4353
+ if (!isCurrent() || session.version !== version || controller.signal.aborted)
4354
+ return;
4355
+ if (!result || !Array.isArray(result.data) || typeof result.hasMore !== "boolean")
4356
+ throw new Error("\u5019\u9009\u67E5\u8BE2\u7ED3\u679C\u683C\u5F0F\u65E0\u6548");
4357
+ session.dataSource = mergeOptions(
4358
+ page === 1 ? result.data : [...session.dataSource, ...result.data],
4359
+ session.getOptionValue
4360
+ );
4361
+ session.page = page;
4362
+ session.hasMore = result.hasMore;
4363
+ } catch (error) {
4364
+ if (!isCurrent() || session.version !== version || controller.signal.aborted)
4365
+ return;
4366
+ session.error = error instanceof Error ? error : new Error(
4367
+ typeof error === "string" ? error : "\u5019\u9009\u67E5\u8BE2\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5"
4368
+ );
4369
+ session.failedPage = page;
4370
+ } finally {
4371
+ if (isCurrent() && session.version === version) {
4372
+ session.controller = void 0;
4373
+ session.loading = false;
4374
+ notify();
4375
+ }
4376
+ }
4377
+ };
4378
+ if (wait && session.debounce > 0)
4379
+ session.timer = setTimeout(() => {
4380
+ void run();
4381
+ }, session.debounce);
4382
+ else void run();
4383
+ },
4384
+ [session, isCurrent, notify]
4385
+ );
4386
+ react.useEffect(() => {
4387
+ session.alive = true;
4388
+ if (session.active && session.request) load(1, false);
4389
+ return () => {
4390
+ session.alive = false;
4391
+ cancelRequest(session);
4392
+ };
4393
+ }, [session, load]);
4394
+ const onSearch = react.useCallback(
4395
+ (keyword) => {
4396
+ if (!isCurrent() || !session.request || session.keyword === keyword)
4397
+ return;
4398
+ session.keyword = keyword;
4399
+ load(1, true);
4400
+ },
4401
+ [session, isCurrent, load]
4402
+ );
4403
+ const onLoadMore = react.useCallback(() => {
4404
+ if (!isCurrent() || !session.request || session.loading || session.error || !session.hasMore)
4405
+ return;
4406
+ load(session.page + 1, false);
4407
+ }, [session, isCurrent, load]);
4408
+ const retry = react.useCallback(() => {
4409
+ if (!isCurrent() || !session.request || session.loading || !session.error)
4410
+ return;
4411
+ load(session.failedPage ?? 1, false);
4412
+ }, [session, isCurrent, load]);
4413
+ return {
4414
+ dataSource: request && active ? session.dataSource : config?.dataSource ?? [],
4415
+ loading: active && !!request && session.loading,
4416
+ error: active && request ? session.error : void 0,
4417
+ hasMore: active && !!request && session.hasMore,
4418
+ onSearch,
4419
+ onLoadMore,
4420
+ retry
4421
+ };
4422
+ }
4237
4423
 
4238
4424
  // src/features/editor/utils.ts
4239
4425
  function toNumberValue(value) {
@@ -4277,6 +4463,7 @@ function getEditorInputStyle(request) {
4277
4463
  color: request.theme.cellColor ?? request.theme.textColor,
4278
4464
  textAlign: request.theme.textAlign,
4279
4465
  fontFamily: request.theme.fontFamily,
4466
+ fontWeight: request.theme.fontWeight ?? "normal",
4280
4467
  fontSize,
4281
4468
  // 用像素 token,确保 select/time/color 触发器与内部 Input 同步缩放。
4282
4469
  ["--canvas-react-control-height"]: `${height}px`,
@@ -4306,6 +4493,8 @@ function resolveEditorOverlayStyle(params) {
4306
4493
  minHeight: height,
4307
4494
  zIndex: 1200,
4308
4495
  boxSizing: "border-box",
4496
+ fontFamily: params.fontFamily,
4497
+ fontWeight: params.fontWeight ?? "normal",
4309
4498
  // 覆盖表单组件 token,使输入框高度/字号/内边距跟随表格缩放。
4310
4499
  ["--canvas-react-control-height"]: `${height}px`,
4311
4500
  ["--canvas-react-control-padding-inline"]: `${Math.max(resolvedPaddingInline - 1, 0)}px`,
@@ -4319,160 +4508,1087 @@ function resolveEditorOverlayStyle(params) {
4319
4508
  } : null
4320
4509
  };
4321
4510
  }
4322
- function ReactTableEditorOverlay(props) {
4323
- const { request } = props;
4324
- const editorHostRef = react.useRef(null);
4325
- const wheelCommittedRef = react.useRef(false);
4326
- const editorRequest = {
4327
- ...request,
4328
- onCommit: (options) => {
4329
- if (!wheelCommittedRef.current) request.onCommit(options);
4511
+ function CompositeItemEditor(props) {
4512
+ const { item, value, onValueChange, initialText } = props;
4513
+ const base = {
4514
+ disabled: item.disabled,
4515
+ readOnly: item.readOnly,
4516
+ "aria-label": item.label ?? item.key,
4517
+ "aria-invalid": props.feedback?.length ? true : void 0,
4518
+ style: {
4519
+ width: "100%",
4520
+ height: "100%",
4521
+ minHeight: 0,
4522
+ border: 0,
4523
+ borderRadius: 0,
4524
+ boxShadow: "none",
4525
+ ...props.style
4330
4526
  }
4331
4527
  };
4332
- react.useEffect(() => {
4333
- wheelCommittedRef.current = false;
4334
- }, [request.editorKey]);
4335
- const style = resolveEditorOverlayStyle({
4336
- rect: request.rect,
4337
- hostRect: request.hostRect,
4338
- fontSize: request.theme.fontSize,
4339
- paddingInline: request.theme.paddingInline,
4340
- paddingBlock: request.theme.paddingBlock,
4341
- contentZoom: request.theme.contentZoom
4342
- });
4343
- const contentZoom = typeof request.theme.contentZoom === "number" && Number.isFinite(request.theme.contentZoom) && request.theme.contentZoom > 0 ? request.theme.contentZoom : 1;
4344
- react.useLayoutEffect(() => {
4345
- const input = editorHostRef.current?.querySelector("input");
4346
- if (!input) {
4347
- return;
4348
- }
4349
- focusAndSelectEditorInput(input, request.selectOnFocus);
4350
- }, [request]);
4351
- react.useEffect(() => {
4352
- const host = editorHostRef.current;
4353
- if (!host) return;
4354
- const valueType = request.config.valueType ?? "text";
4355
- if (valueType !== "text" && valueType !== "number" && valueType !== "input-range") {
4356
- return;
4357
- }
4358
- const handleWheel = (event) => {
4359
- event.preventDefault();
4360
- event.stopPropagation();
4361
- if (!wheelCommittedRef.current) {
4362
- wheelCommittedRef.current = true;
4363
- request.onCommit();
4364
- }
4365
- request.onWheel?.(event);
4366
- };
4367
- host.addEventListener("wheel", handleWheel, { passive: false });
4368
- return () => host.removeEventListener("wheel", handleWheel);
4369
- }, [request]);
4370
- return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactContentScaleProvider, { scale: contentZoom, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: editorHostRef, children: renderEditorByType(editorRequest, style) }, request.editorKey) });
4371
- }
4372
- function renderEditorByType(request, style) {
4373
- switch (request.config.valueType ?? "text") {
4374
- case "tree-select":
4375
- return /* @__PURE__ */ jsxRuntime.jsx(TreeSelectEditor, { request, style });
4376
- case "cascader":
4377
- return /* @__PURE__ */ jsxRuntime.jsx(CascaderEditor, { request, style });
4528
+ const numeric = {
4529
+ min: toNumericProp(item.min),
4530
+ max: toNumericProp(item.max),
4531
+ step: toNumericProp(item.step),
4532
+ precision: item.precision
4533
+ };
4534
+ const scalar = typeof value === "number" || typeof value === "string" ? value : void 0;
4535
+ const text = value == null ? "" : String(value);
4536
+ const stringRange = Array.isArray(value) ? [String(value[0] ?? ""), String(value[1] ?? "")] : ["", ""];
4537
+ const numberRange = Array.isArray(value) ? [toNumberValue(value[0]), toNumberValue(value[1])] : [null, null];
4538
+ const date = {
4539
+ ...base,
4540
+ value: text,
4541
+ allowClear: item.allowClear ?? false,
4542
+ showArrow: false,
4543
+ onChange: (next) => onValueChange(next, { trigger: "change" })
4544
+ };
4545
+ const range = {
4546
+ ...base,
4547
+ value: stringRange,
4548
+ allowClear: item.allowClear ?? false,
4549
+ rangeSeparator: item.rangeSeparator,
4550
+ onChange: (next) => onValueChange(next, { trigger: "change" })
4551
+ };
4552
+ switch (item.valueType ?? "text") {
4378
4553
  case "number":
4379
- return /* @__PURE__ */ jsxRuntime.jsx(NumberEditor, { request, style });
4380
- case "input-range":
4381
- return /* @__PURE__ */ jsxRuntime.jsx(InputRangeEditor, { request, style });
4554
+ return /* @__PURE__ */ jsxRuntime.jsx(
4555
+ reactComponents.ReactInputNumber,
4556
+ {
4557
+ ...base,
4558
+ ...numeric,
4559
+ initialText: initialText ?? (typeof value === "string" ? value : void 0),
4560
+ placeholder: item.placeholder,
4561
+ value: toNumberValue(value),
4562
+ onChange: (next) => onValueChange(next, { trigger: "input" })
4563
+ }
4564
+ );
4565
+ case "select":
4566
+ return /* @__PURE__ */ jsxRuntime.jsx(
4567
+ reactComponents.ReactSelect,
4568
+ {
4569
+ ...base,
4570
+ value: scalar,
4571
+ options: item.options ?? [],
4572
+ allowClear: item.allowClear,
4573
+ showSearch: item.showSearch ?? initialText !== void 0,
4574
+ filterOption: item.filterOption,
4575
+ initialSearchValue: initialText,
4576
+ placeholder: item.placeholder,
4577
+ onChange: (next, meta) => {
4578
+ const option = item.options?.find(
4579
+ (option2) => String(option2.value) === String(next)
4580
+ );
4581
+ onValueChange(option?.value ?? next, { ...meta, option });
4582
+ }
4583
+ }
4584
+ );
4585
+ case "auto-complete":
4586
+ return /* @__PURE__ */ jsxRuntime.jsx(CompositeAutoComplete, { ...props, style: base.style });
4587
+ case "table-select":
4588
+ return /* @__PURE__ */ jsxRuntime.jsx(CompositeTableSelect, { ...props });
4382
4589
  case "year":
4383
- return /* @__PURE__ */ jsxRuntime.jsx(YearEditor, { request, style });
4590
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactYearPicker, { ...date });
4384
4591
  case "quarter":
4385
- return /* @__PURE__ */ jsxRuntime.jsx(QuarterEditor, { request, style });
4592
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactQuarterPicker, { ...date });
4386
4593
  case "month":
4387
- return /* @__PURE__ */ jsxRuntime.jsx(MonthEditor, { request, style });
4594
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactMonthPicker, { ...date });
4388
4595
  case "date":
4389
- return /* @__PURE__ */ jsxRuntime.jsx(DateEditor, { request, style });
4390
- case "date-range":
4391
- return /* @__PURE__ */ jsxRuntime.jsx(DateRangeEditor, { request, style });
4596
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactDatePicker, { ...date });
4392
4597
  case "time":
4393
- return /* @__PURE__ */ jsxRuntime.jsx(TimeEditor, { request, style });
4598
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactTimePicker, { ...date });
4394
4599
  case "datetime":
4395
- return /* @__PURE__ */ jsxRuntime.jsx(DateTimeEditor, { request, style });
4396
- case "datetime-range":
4397
- return /* @__PURE__ */ jsxRuntime.jsx(DateTimeRangeEditor, { request, style });
4600
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactDateTimePicker, { ...date });
4601
+ case "date-range":
4602
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactDateRangePicker, { ...range });
4398
4603
  case "timerange":
4399
- return /* @__PURE__ */ jsxRuntime.jsx(TimeRangeEditor, { request, style });
4400
- case "color":
4401
- return /* @__PURE__ */ jsxRuntime.jsx(ColorEditor, { request, style });
4402
- case "select":
4403
- return /* @__PURE__ */ jsxRuntime.jsx(SelectEditor, { request, style });
4404
- case "auto-complete":
4405
- return /* @__PURE__ */ jsxRuntime.jsx(AutoCompleteEditor, { request, style });
4604
+ return /* @__PURE__ */ jsxRuntime.jsx(
4605
+ reactComponents.ReactTimeRangePicker,
4606
+ {
4607
+ ...base,
4608
+ value: stringRange,
4609
+ rangeSeparator: item.rangeSeparator,
4610
+ onChange: range.onChange
4611
+ }
4612
+ );
4613
+ case "datetime-range":
4614
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactDateTimeRangePicker, { ...range });
4615
+ case "input-range":
4616
+ return /* @__PURE__ */ jsxRuntime.jsx(
4617
+ reactComponents.ReactInputRange,
4618
+ {
4619
+ initialText,
4620
+ ...base,
4621
+ ...numeric,
4622
+ value: numberRange,
4623
+ rangeSeparator: item.rangeSeparator,
4624
+ onChange: (next) => onValueChange(next, { trigger: "input" })
4625
+ }
4626
+ );
4627
+ case "math-interval":
4628
+ return /* @__PURE__ */ jsxRuntime.jsx(
4629
+ reactComponents.ReactMathInterval,
4630
+ {
4631
+ ...base,
4632
+ ...numeric,
4633
+ value: utils.normalizeMathInterval(value),
4634
+ initialText,
4635
+ onChange: (next) => onValueChange(next, { trigger: "input" })
4636
+ }
4637
+ );
4638
+ case "number-unit":
4639
+ return /* @__PURE__ */ jsxRuntime.jsx(
4640
+ reactComponents.ReactInputNumberUnit,
4641
+ {
4642
+ ...base,
4643
+ ...numeric,
4644
+ value: utils.normalizeNumberUnit(value, item.numberUnit?.unit),
4645
+ initialText,
4646
+ placeholder: item.placeholder,
4647
+ unit: item.numberUnit?.unit,
4648
+ unitOptions: item.numberUnit?.options,
4649
+ unitWidth: item.numberUnit?.unitWidth,
4650
+ unitRequired: item.numberUnit?.unitRequired,
4651
+ unitPlaceholder: item.numberUnit?.unitPlaceholder,
4652
+ onChange: onValueChange
4653
+ }
4654
+ );
4406
4655
  default:
4407
- return /* @__PURE__ */ jsxRuntime.jsx(TextEditor, { request, style });
4656
+ return /* @__PURE__ */ jsxRuntime.jsx(
4657
+ reactComponents.ReactInput,
4658
+ {
4659
+ ...base,
4660
+ value: text,
4661
+ placeholder: item.placeholder,
4662
+ allowClear: item.allowClear,
4663
+ onChange: (event) => onValueChange(event.target.value, { trigger: "input" })
4664
+ }
4665
+ );
4408
4666
  }
4409
4667
  }
4410
- function TextEditor(props) {
4411
- const { request, style } = props;
4412
- const [value, setValue] = react.useState(String(request.value ?? ""));
4413
- const hostRef = react.useRef(null);
4414
- const skipBlurCommitRef = react.useRef(false);
4415
- react.useLayoutEffect(() => {
4416
- const input = hostRef.current?.querySelector("input");
4417
- focusAndSelectEditorInput(input, request.selectOnFocus);
4418
- }, [request]);
4668
+ function CompositeTableSelect(props) {
4669
+ const config = props.item.tableSelect;
4670
+ const options = useTableSelectOptions({
4671
+ editorKey: JSON.stringify([props.editorKey, props.item.key]),
4672
+ config,
4673
+ active: !props.item.disabled,
4674
+ initialKeyword: props.initialText
4675
+ });
4676
+ const generation = react.useRef(0);
4419
4677
  react.useEffect(() => {
4420
- setValue(String(request.value ?? ""));
4421
- }, [request.value]);
4422
- return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: hostRef, style, children: /* @__PURE__ */ jsxRuntime.jsx(
4423
- reactComponents.ReactInput,
4678
+ generation.current++;
4679
+ return () => {
4680
+ generation.current++;
4681
+ };
4682
+ }, [props.editorKey, props.item.key, config?.onCreate]);
4683
+ if (!config) return /* @__PURE__ */ jsxRuntime.jsx("span", { role: "alert", children: "\u591A\u5217\u9009\u62E9\u7F3A\u5C11\u5019\u9009\u914D\u7F6E" });
4684
+ const {
4685
+ request,
4686
+ debounce,
4687
+ pageSize,
4688
+ dataSource,
4689
+ columns,
4690
+ onCreate,
4691
+ ...component
4692
+ } = config;
4693
+ const mapped = columns.map(
4694
+ ({ format, ...column }) => ({
4695
+ ...column,
4696
+ render: format ? (value, record, index) => {
4697
+ const result = format(value, record, index);
4698
+ return typeof result === "boolean" ? String(result) : result;
4699
+ } : void 0
4700
+ })
4701
+ );
4702
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4703
+ /* @__PURE__ */ jsxRuntime.jsx(
4704
+ reactComponents.ReactTableSelect,
4705
+ {
4706
+ ...component,
4707
+ columns: mapped,
4708
+ dataSource: options.dataSource,
4709
+ value: typeof props.value === "string" || typeof props.value === "number" ? props.value : void 0,
4710
+ disabled: props.item.disabled,
4711
+ readOnly: props.item.readOnly,
4712
+ "aria-label": props.item.label ?? props.item.key,
4713
+ "aria-invalid": !!props.feedback?.length || void 0,
4714
+ placeholder: props.item.placeholder,
4715
+ allowClear: props.item.allowClear,
4716
+ showSearch: props.item.showSearch,
4717
+ initialSearchValue: props.initialText,
4718
+ filterOption: request ? false : config.filterOption,
4719
+ loading: options.loading,
4720
+ hasMore: options.hasMore,
4721
+ onLoadMore: options.onLoadMore,
4722
+ onSearch: options.onSearch,
4723
+ allowCreate: !!config.allowCreate && !options.loading && !options.error,
4724
+ onCreate: onCreate ? async (keyword) => {
4725
+ const epoch = generation.current;
4726
+ const next = await onCreate(keyword);
4727
+ return epoch === generation.current ? next : void 0;
4728
+ } : void 0,
4729
+ onChange: (next, option, info) => props.onValueChange(next, {
4730
+ trigger: info.trigger,
4731
+ ...info.trigger === "clear" ? {} : { option }
4732
+ }),
4733
+ style: { width: "100%", height: "100%", border: 0, ...props.style }
4734
+ }
4735
+ ),
4736
+ options.error && /* @__PURE__ */ jsxRuntime.jsxs("div", { role: "alert", children: [
4737
+ options.error.message,
4738
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: options.retry, children: "\u91CD\u8BD5\u67E5\u8BE2" })
4739
+ ] })
4740
+ ] });
4741
+ }
4742
+ function CompositeAutoComplete(props) {
4743
+ const { item } = props;
4744
+ const options = react.useRef(item.options ?? []), epoch = react.useRef(0), alive = react.useRef(true);
4745
+ react.useEffect(() => {
4746
+ options.current = item.options ?? [];
4747
+ }, [item.options]);
4748
+ react.useEffect(() => {
4749
+ alive.current = true;
4750
+ epoch.current++;
4751
+ return () => {
4752
+ alive.current = false;
4753
+ epoch.current++;
4754
+ };
4755
+ }, [props.editorKey, item.key]);
4756
+ return /* @__PURE__ */ jsxRuntime.jsx(
4757
+ reactComponents.ReactAutoComplete,
4424
4758
  {
4425
- value,
4426
- placeholder: request.config.placeholder ?? "",
4427
- onChange: (event) => {
4428
- const nextValue = event.target.value;
4429
- setValue(nextValue);
4430
- request.onChange(nextValue);
4431
- },
4432
- onPressEnter: () => {
4433
- request.onCommit({ restoreTableFocus: true });
4434
- },
4435
- onBlur: (event) => {
4436
- handleEditorBlur(event, skipBlurCommitRef, request);
4437
- },
4438
- onKeyDown: (event) => {
4439
- if (handleEditorNavigationKey(event, request, skipBlurCommitRef)) {
4440
- return;
4441
- }
4442
- handleEditorEscapeKey(event, request);
4759
+ value: typeof props.value === "number" || typeof props.value === "string" ? props.value : void 0,
4760
+ options: item.options ?? [],
4761
+ filterOption: item.filterOption,
4762
+ initialSearchValue: props.initialText,
4763
+ disabled: item.disabled,
4764
+ readOnly: item.readOnly,
4765
+ "aria-label": item.label ?? item.key,
4766
+ "aria-invalid": !!props.feedback?.length || void 0,
4767
+ style: props.style,
4768
+ allowClear: item.allowClear,
4769
+ placeholder: item.placeholder,
4770
+ onChange: (next, meta) => {
4771
+ if (alive.current)
4772
+ props.onValueChange(next, {
4773
+ ...meta,
4774
+ option: options.current.find(
4775
+ (option) => String(option.value) === String(next)
4776
+ )
4777
+ });
4443
4778
  },
4444
- style: getEditorInputStyle(request)
4779
+ onPressEnter: async (input) => {
4780
+ const current = epoch.current;
4781
+ const next = await item.onPressEnter?.(input);
4782
+ if (!alive.current || current !== epoch.current) return;
4783
+ if (next) options.current = next;
4784
+ return next;
4785
+ }
4445
4786
  }
4446
- ) });
4447
- }
4448
- function NumberEditor(props) {
4449
- const { request, style } = props;
4450
- const [value, setValue] = react.useState(
4451
- toNumberValue(request.value)
4452
4787
  );
4788
+ }
4789
+ function CompositeEditor({
4790
+ request,
4791
+ style
4792
+ }) {
4793
+ const items = request.config.items ?? [];
4453
4794
  const hostRef = react.useRef(null);
4454
- const skipBlurCommitRef = react.useRef(false);
4795
+ const seeded = react.useRef();
4796
+ const [, refresh] = react.useState(0), local = react.useRef({});
4797
+ const source = react.useRef(request.value);
4798
+ if (source.current !== request.value) {
4799
+ source.current = request.value;
4800
+ local.current = {};
4801
+ }
4802
+ const leaving = react.useRef(false), version = react.useRef(0), current = react.useRef(request);
4803
+ current.current = request;
4804
+ const publish = (key, value, meta) => {
4805
+ local.current = { ...local.current, [key]: value };
4806
+ version.current++;
4807
+ leaving.current = false;
4808
+ refresh((next) => next + 1);
4809
+ request.onChange(value, {
4810
+ ...meta,
4811
+ trigger: meta?.trigger ?? "change",
4812
+ itemKey: key
4813
+ });
4814
+ };
4815
+ const leave = (direction) => {
4816
+ if (leaving.current || current.current.feedback?.pending) return;
4817
+ leaving.current = true;
4818
+ const epoch = version.current;
4819
+ const result = direction ? current.current.onNavigate?.(direction) : current.current.onCommit({ restoreTableFocus: true });
4820
+ if (result && typeof result.then === "function")
4821
+ void result.then(
4822
+ (accepted) => {
4823
+ if (accepted === false && version.current === epoch)
4824
+ leaving.current = false;
4825
+ },
4826
+ () => {
4827
+ if (version.current === epoch) leaving.current = false;
4828
+ }
4829
+ );
4830
+ };
4831
+ const zoom = request.theme.contentZoom ?? 1;
4832
+ const widths = listTable.resolveListTableEditorItemWidths(
4833
+ items,
4834
+ Math.max(0, ((request.hostRect ?? request.rect).width - 2) / zoom)
4835
+ );
4836
+ const scaledWidths = widths.map((width) => width * zoom);
4837
+ const values = request.value && typeof request.value === "object" ? request.value : {};
4838
+ const entry = items.find(
4839
+ (item) => item.key === request.initialItemKey && !item.disabled && !item.readOnly
4840
+ ) ?? items.find((item) => !item.disabled && !item.readOnly);
4455
4841
  react.useLayoutEffect(() => {
4456
- const input = hostRef.current?.querySelector("input");
4457
- focusAndSelectEditorInput(input, request.selectOnFocus);
4458
- }, [request]);
4459
- react.useEffect(() => {
4460
- setValue(toNumberValue(request.value));
4461
- }, [request.value]);
4842
+ const seedKey = JSON.stringify([request.editorKey, entry?.key]);
4843
+ if (seeded.current !== seedKey && request.initialText !== void 0 && entry && ["text", "auto-complete"].includes(entry.valueType ?? "text")) {
4844
+ seeded.current = seedKey;
4845
+ publish(entry.key, request.initialText, { trigger: "input" });
4846
+ }
4847
+ if (request.initialText === void 0 || entry?.valueType !== "math-interval")
4848
+ return;
4849
+ const slot = Array.from(
4850
+ hostRef.current?.querySelectorAll(
4851
+ "[data-input-group-item]"
4852
+ ) ?? []
4853
+ ).find((element) => element.dataset.inputGroupItem === entry.key);
4854
+ const input = slot?.querySelector(
4855
+ "[data-math-interval-control]"
4856
+ );
4857
+ input?.focus();
4858
+ if (input) {
4859
+ if (request.selectOnFocus === false)
4860
+ input.setSelectionRange(input.value.length, input.value.length);
4861
+ else input.select();
4862
+ }
4863
+ }, [request.editorKey]);
4462
4864
  return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: hostRef, style, children: /* @__PURE__ */ jsxRuntime.jsx(
4463
- reactComponents.ReactInputNumber,
4865
+ reactComponents.ReactInputGroup,
4464
4866
  {
4465
- value,
4466
- initialText: typeof request.value === "string" ? request.value : void 0,
4467
- min: toNumericProp(request.config.min),
4468
- max: toNumericProp(request.config.max),
4469
- step: toNumericProp(request.config.step),
4470
- onChange: (nextValue) => {
4471
- setValue(nextValue);
4472
- request.onChange(nextValue);
4867
+ initialItemKey: entry?.key,
4868
+ selectOnFocus: request.selectOnFocus,
4869
+ onLeave: () => leave(),
4870
+ onBoundaryTab: (direction) => leave(direction),
4871
+ onPressEnter: () => leave(),
4872
+ onCancel: () => {
4873
+ if (leaving.current) return;
4874
+ leaving.current = true;
4875
+ request.onCancel();
4473
4876
  },
4474
- onPressEnter: () => {
4475
- request.onCommit({ restoreTableFocus: true });
4877
+ items: items.map((item, index) => {
4878
+ const errors = request.feedback?.itemErrors?.[item.key];
4879
+ const errorStyle = errors?.length ? {
4880
+ backgroundColor: "#ff4d4f",
4881
+ color: "#fff",
4882
+ ["--canvas-react-color-bg"]: "#ff4d4f",
4883
+ ["--canvas-react-color-text"]: "#fff",
4884
+ ["--canvas-react-color-text-muted"]: "#fff",
4885
+ ["--canvas-react-color-text-secondary"]: "#fff"
4886
+ } : {};
4887
+ return {
4888
+ key: item.key,
4889
+ width: scaledWidths[index],
4890
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4891
+ "div",
4892
+ {
4893
+ "data-input-group-readonly": item.readOnly || void 0,
4894
+ onFocusCapture: (event) => {
4895
+ if (item.readOnly) event.stopPropagation();
4896
+ },
4897
+ onClickCapture: (event) => {
4898
+ if (item.readOnly) event.stopPropagation();
4899
+ },
4900
+ onKeyDownCapture: (event) => {
4901
+ if (item.readOnly && !["Tab", "Escape"].includes(event.key) && !event.ctrlKey && !event.metaKey) {
4902
+ event.preventDefault();
4903
+ event.stopPropagation();
4904
+ }
4905
+ },
4906
+ style: { height: "100%", ...errorStyle },
4907
+ "aria-invalid": !!errors?.length || void 0,
4908
+ children: /* @__PURE__ */ jsxRuntime.jsx(
4909
+ CompositeItemEditor,
4910
+ {
4911
+ item,
4912
+ value: Object.prototype.hasOwnProperty.call(
4913
+ local.current,
4914
+ item.key
4915
+ ) ? local.current[item.key] : values[item.key],
4916
+ editorKey: request.editorKey,
4917
+ initialText: entry?.key === item.key ? request.initialText : void 0,
4918
+ feedback: errors,
4919
+ style: {
4920
+ fontSize: request.theme.fontSize,
4921
+ fontFamily: request.theme.fontFamily,
4922
+ fontWeight: request.theme.fontWeight ?? "normal",
4923
+ color: request.theme.textColor,
4924
+ ...errorStyle
4925
+ },
4926
+ onValueChange: (value, meta) => {
4927
+ if (!item.disabled && !item.readOnly)
4928
+ publish(item.key, value, meta);
4929
+ }
4930
+ }
4931
+ )
4932
+ }
4933
+ )
4934
+ };
4935
+ })
4936
+ }
4937
+ ) });
4938
+ }
4939
+
4940
+ // src/features/editor/editor-change.ts
4941
+ function publishEditorChange(request, value, meta = { trigger: "change" }) {
4942
+ if (!request.config.hasChangeHandler && request.config.valueType !== "table-select") {
4943
+ request.onChange(value);
4944
+ return;
4945
+ }
4946
+ const normalized = meta.trigger === "clear" ? { trigger: "clear" } : {
4947
+ trigger: meta.trigger ?? "change",
4948
+ ...meta.option !== void 0 ? { option: meta.option } : {},
4949
+ ...meta.options !== void 0 ? { options: meta.options } : {}
4950
+ };
4951
+ request.onChange(value, normalized);
4952
+ }
4953
+ function containsEditorInteraction(host, target, popupClassName) {
4954
+ if (!(target instanceof Node)) return false;
4955
+ if (host?.contains(target)) return true;
4956
+ if (!(target instanceof Element)) return false;
4957
+ const popup = target.closest(".canvas-react-popup");
4958
+ return !!popup && (!popupClassName || !!popup.querySelector(`.${popupClassName}`));
4959
+ }
4960
+
4961
+ // src/features/editor/use-composite-editor-session.ts
4962
+ function useCompositeEditorSession(request) {
4963
+ const hostRef = react.useRef(null), inputRef = react.useRef(null);
4964
+ const current = react.useRef(request);
4965
+ current.current = request;
4966
+ const leaving = react.useRef(false), version = react.useRef(0);
4967
+ react.useLayoutEffect(() => {
4968
+ const input = inputRef.current;
4969
+ if (!input) return;
4970
+ input.focus();
4971
+ if (request.selectOnFocus === false)
4972
+ input.setSelectionRange(input.value.length, input.value.length);
4973
+ else input.select();
4974
+ return () => {
4975
+ version.current++;
4976
+ };
4977
+ }, [request.editorKey]);
4978
+ const settle = (result, epoch) => {
4979
+ if (result && typeof result.then === "function")
4980
+ void result.then(
4981
+ (accepted) => {
4982
+ if (accepted === false && epoch === version.current)
4983
+ leaving.current = false;
4984
+ },
4985
+ () => {
4986
+ if (epoch === version.current) leaving.current = false;
4987
+ }
4988
+ );
4989
+ };
4990
+ const commit = () => {
4991
+ if (leaving.current) return;
4992
+ leaving.current = true;
4993
+ settle(
4994
+ current.current.onCommit({ restoreTableFocus: true }),
4995
+ version.current
4996
+ );
4997
+ };
4998
+ return {
4999
+ hostRef,
5000
+ inputRef,
5001
+ notifyChange(value, meta = { trigger: "input" }) {
5002
+ version.current++;
5003
+ leaving.current = false;
5004
+ publishEditorChange(current.current, value, meta);
5005
+ },
5006
+ onMouseDown(event) {
5007
+ if (event.target === event.currentTarget) event.preventDefault();
5008
+ },
5009
+ onBlur() {
5010
+ if (!leaving.current && !current.current.feedback?.pending) commit();
5011
+ },
5012
+ onKeyDown(event) {
5013
+ if (event.nativeEvent.isComposing) return;
5014
+ if (event.key === "Escape") {
5015
+ event.preventDefault();
5016
+ event.stopPropagation();
5017
+ version.current++;
5018
+ leaving.current = true;
5019
+ current.current.onCancel();
5020
+ return;
5021
+ }
5022
+ if (event.key === "Tab") {
5023
+ const controls = Array.from(
5024
+ hostRef.current?.querySelectorAll(
5025
+ "input:not(:disabled),select:not(:disabled)"
5026
+ ) ?? []
5027
+ );
5028
+ const index = controls.indexOf(event.target);
5029
+ const target = controls[index + (event.shiftKey ? -1 : 1)];
5030
+ event.preventDefault();
5031
+ event.stopPropagation();
5032
+ if (target) {
5033
+ target.focus();
5034
+ if (target instanceof HTMLInputElement) target.select();
5035
+ } else if (!current.current.feedback?.pending) {
5036
+ leaving.current = true;
5037
+ settle(
5038
+ current.current.onNavigate?.(event.shiftKey ? "prev" : "next"),
5039
+ version.current
5040
+ );
5041
+ }
5042
+ return;
5043
+ }
5044
+ if ([
5045
+ "ArrowUp",
5046
+ "ArrowDown",
5047
+ "ArrowLeft",
5048
+ "ArrowRight",
5049
+ "Home",
5050
+ "End"
5051
+ ].includes(event.key))
5052
+ event.stopPropagation();
5053
+ },
5054
+ onPressEnter(event) {
5055
+ event.preventDefault();
5056
+ event.stopPropagation();
5057
+ commit();
5058
+ }
5059
+ };
5060
+ }
5061
+ function NumberUnitEditor({
5062
+ request,
5063
+ style
5064
+ }) {
5065
+ const config = request.config.numberUnit;
5066
+ const [value, setValue] = react.useState(
5067
+ () => numberUnit.normalizeNumberUnit(request.value, config?.unit)
5068
+ );
5069
+ const session = useCompositeEditorSession(request);
5070
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: session.hostRef, style, onMouseDown: session.onMouseDown, children: /* @__PURE__ */ jsxRuntime.jsx(
5071
+ reactComponents.ReactInputNumberUnit,
5072
+ {
5073
+ ref: session.inputRef,
5074
+ value,
5075
+ initialText: request.initialText,
5076
+ unit: config?.unit,
5077
+ unitOptions: config?.options,
5078
+ unitWidth: config?.unitWidth,
5079
+ unitRequired: config?.unitRequired,
5080
+ unitPlaceholder: config?.unitPlaceholder,
5081
+ placeholder: request.config.placeholder,
5082
+ min: toNumericProp(request.config.min),
5083
+ max: toNumericProp(request.config.max),
5084
+ step: toNumericProp(request.config.step),
5085
+ precision: request.config.precision,
5086
+ style: getEditorInputStyle(request),
5087
+ onChange: (next, info) => {
5088
+ setValue(next);
5089
+ session.notifyChange(next, info);
5090
+ },
5091
+ onBlur: session.onBlur,
5092
+ onKeyDown: session.onKeyDown,
5093
+ onPressEnter: session.onPressEnter
5094
+ }
5095
+ ) });
5096
+ }
5097
+ function MathIntervalEditor({
5098
+ request,
5099
+ style
5100
+ }) {
5101
+ const [value, setValue] = react.useState(
5102
+ () => utils.normalizeMathInterval(request.value)
5103
+ );
5104
+ const session = useCompositeEditorSession(request);
5105
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: session.hostRef, style, onMouseDown: session.onMouseDown, children: /* @__PURE__ */ jsxRuntime.jsx(
5106
+ reactComponents.ReactMathInterval,
5107
+ {
5108
+ ref: session.inputRef,
5109
+ value,
5110
+ initialText: request.initialText,
5111
+ min: toNumericProp(request.config.min),
5112
+ max: toNumericProp(request.config.max),
5113
+ step: toNumericProp(request.config.step),
5114
+ precision: request.config.precision,
5115
+ style: getEditorInputStyle(request),
5116
+ onChange: (next) => {
5117
+ setValue(next);
5118
+ session.notifyChange(next);
5119
+ },
5120
+ onBlur: session.onBlur,
5121
+ onKeyDown: session.onKeyDown,
5122
+ onPressEnter: session.onPressEnter
5123
+ }
5124
+ ) });
5125
+ }
5126
+ function TableSelectEditor({
5127
+ request,
5128
+ style
5129
+ }) {
5130
+ const config = request.config.tableSelect;
5131
+ const [value, setValue] = react.useState(
5132
+ toValue(request.value)
5133
+ );
5134
+ const [cancelled, setCancelled] = react.useState(false);
5135
+ const hostRef = react.useRef(null);
5136
+ const current = react.useRef(request);
5137
+ current.current = request;
5138
+ const mounted = react.useRef(true), creating = react.useRef(false), submitting = react.useRef(false), skipBlur = react.useRef(false), version = react.useRef(0);
5139
+ const popupClass = react.useRef(
5140
+ `react-list-table-table-select-${nextEditorIdentity++}`
5141
+ ).current;
5142
+ const options = useTableSelectOptions({
5143
+ editorKey: request.editorKey ?? popupClass,
5144
+ config,
5145
+ initialKeyword: request.selectOnFocus === false ? String(request.value ?? "") : void 0,
5146
+ active: !cancelled
5147
+ });
5148
+ react.useEffect(() => {
5149
+ mounted.current = true;
5150
+ return () => {
5151
+ mounted.current = false;
5152
+ version.current++;
5153
+ };
5154
+ }, []);
5155
+ react.useEffect(() => {
5156
+ setValue(toValue(request.value));
5157
+ }, [request.value]);
5158
+ const submit = (restoreTableFocus = false, afterChange = false) => {
5159
+ const active = current.current;
5160
+ if (cancelled || !mounted.current || submitting.current || active.feedback?.pending && !afterChange)
5161
+ return;
5162
+ const epoch = version.current;
5163
+ submitting.current = true;
5164
+ const result = active.onCommit(
5165
+ restoreTableFocus ? { restoreTableFocus: true } : void 0
5166
+ );
5167
+ if (result && typeof result.then === "function")
5168
+ void result.then(
5169
+ () => {
5170
+ if (mounted.current && version.current === epoch) {
5171
+ submitting.current = false;
5172
+ skipBlur.current = false;
5173
+ }
5174
+ },
5175
+ () => {
5176
+ if (mounted.current && version.current === epoch) {
5177
+ submitting.current = false;
5178
+ skipBlur.current = false;
5179
+ }
5180
+ }
5181
+ );
5182
+ else submitting.current = false;
5183
+ return result;
5184
+ };
5185
+ const submitRef = react.useRef(submit);
5186
+ submitRef.current = submit;
5187
+ react.useEffect(() => {
5188
+ const outside = (event) => {
5189
+ if (creating.current || cancelled || containsEditorInteraction(hostRef.current, event.target, popupClass))
5190
+ return;
5191
+ submitRef.current();
5192
+ };
5193
+ document.addEventListener("mousedown", outside, true);
5194
+ return () => document.removeEventListener("mousedown", outside, true);
5195
+ }, [popupClass, cancelled]);
5196
+ const navigate = (event) => {
5197
+ if (event.key !== "Tab" || !current.current.onNavigate) return;
5198
+ event.preventDefault();
5199
+ event.stopPropagation();
5200
+ if (current.current.feedback?.pending || submitting.current) return;
5201
+ skipBlur.current = true;
5202
+ submitting.current = true;
5203
+ const epoch = version.current;
5204
+ const result = current.current.onNavigate(event.shiftKey ? "prev" : "next");
5205
+ if (result && typeof result.then === "function")
5206
+ void result.then(
5207
+ () => {
5208
+ if (mounted.current && version.current === epoch) {
5209
+ submitting.current = false;
5210
+ skipBlur.current = false;
5211
+ }
5212
+ },
5213
+ () => {
5214
+ if (mounted.current && version.current === epoch) {
5215
+ submitting.current = false;
5216
+ skipBlur.current = false;
5217
+ }
5218
+ }
5219
+ );
5220
+ else submitting.current = false;
5221
+ };
5222
+ if (!config)
5223
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { style, role: "alert", children: "\u591A\u5217\u9009\u62E9\u7F3A\u5C11\u5019\u9009\u914D\u7F6E" });
5224
+ const {
5225
+ request: remoteRequest,
5226
+ debounce,
5227
+ pageSize,
5228
+ dataSource,
5229
+ columns: sourceColumns,
5230
+ onCreate,
5231
+ ...componentConfig
5232
+ } = config;
5233
+ const columns = sourceColumns.map(
5234
+ ({ format, ...column }) => ({
5235
+ ...column,
5236
+ render: format ? (cell, record, index) => {
5237
+ const result = format(cell, record, index);
5238
+ return typeof result === "boolean" ? String(result) : result;
5239
+ } : void 0
5240
+ })
5241
+ );
5242
+ return /* @__PURE__ */ jsxRuntime.jsxs(
5243
+ "div",
5244
+ {
5245
+ ref: hostRef,
5246
+ style,
5247
+ onBlur: (event) => {
5248
+ if (creating.current || containsEditorInteraction(
5249
+ hostRef.current,
5250
+ event.relatedTarget,
5251
+ popupClass
5252
+ ) || current.current.feedback?.pending || submitting.current)
5253
+ return;
5254
+ if (skipBlur.current) {
5255
+ skipBlur.current = false;
5256
+ return;
5257
+ }
5258
+ submit();
5259
+ },
5260
+ onKeyDownCapture: (event) => {
5261
+ if (event.key === "Escape") {
5262
+ event.preventDefault();
5263
+ event.stopPropagation();
5264
+ version.current++;
5265
+ setCancelled(true);
5266
+ current.current.onCancel();
5267
+ }
5268
+ },
5269
+ onKeyDown: (event) => {
5270
+ if (event.target !== hostRef.current?.querySelector("input"))
5271
+ navigate(event);
5272
+ },
5273
+ children: [
5274
+ /* @__PURE__ */ jsxRuntime.jsx(
5275
+ reactComponents.ReactTableSelect,
5276
+ {
5277
+ ...componentConfig,
5278
+ dataSource: options.dataSource,
5279
+ columns,
5280
+ value,
5281
+ autoFocus: true,
5282
+ selectOnFocus: request.selectOnFocus,
5283
+ initialSearchValue: request.selectOnFocus === false ? String(request.value ?? "") : void 0,
5284
+ placeholder: request.config.placeholder,
5285
+ allowClear: request.config.allowClear,
5286
+ showSearch: request.config.showSearch,
5287
+ filterOption: remoteRequest ? false : config.filterOption,
5288
+ loading: options.loading,
5289
+ hasMore: options.hasMore,
5290
+ onLoadMore: options.onLoadMore,
5291
+ onSearch: options.onSearch,
5292
+ allowCreate: !!config.allowCreate && !options.loading && !options.error,
5293
+ popupClassName: popupClass,
5294
+ onCreate: onCreate ? async (keyword) => {
5295
+ const epoch = version.current;
5296
+ creating.current = true;
5297
+ try {
5298
+ const record = await onCreate(keyword);
5299
+ return mounted.current && !cancelled && version.current === epoch ? record : void 0;
5300
+ } finally {
5301
+ creating.current = false;
5302
+ }
5303
+ } : void 0,
5304
+ onChange: (next, option, info) => {
5305
+ if (cancelled || !mounted.current) return;
5306
+ version.current++;
5307
+ submitting.current = false;
5308
+ skipBlur.current = false;
5309
+ setValue(next);
5310
+ publishEditorChange(
5311
+ current.current,
5312
+ next,
5313
+ info.trigger === "clear" ? { trigger: "clear" } : { trigger: info.trigger, option }
5314
+ );
5315
+ if (info.trigger !== "clear") {
5316
+ skipBlur.current = true;
5317
+ submit(true, true);
5318
+ }
5319
+ },
5320
+ onKeyDown: (event) => {
5321
+ if (event.key === "Tab") navigate(event);
5322
+ else if ([
5323
+ "ArrowUp",
5324
+ "ArrowDown",
5325
+ "ArrowLeft",
5326
+ "ArrowRight",
5327
+ "Home",
5328
+ "End",
5329
+ "F6"
5330
+ ].includes(event.key))
5331
+ event.stopPropagation();
5332
+ },
5333
+ style: getEditorInputStyle(request)
5334
+ }
5335
+ ),
5336
+ options.error && /* @__PURE__ */ jsxRuntime.jsxs(
5337
+ "div",
5338
+ {
5339
+ role: "alert",
5340
+ style: { background: "#fff", color: "#cf1322", padding: 4 },
5341
+ children: [
5342
+ options.error.message,
5343
+ /* @__PURE__ */ jsxRuntime.jsx("button", { type: "button", onClick: options.retry, children: "\u91CD\u8BD5\u67E5\u8BE2" })
5344
+ ]
5345
+ }
5346
+ )
5347
+ ]
5348
+ }
5349
+ );
5350
+ }
5351
+ var nextEditorIdentity = 0;
5352
+ function toValue(value) {
5353
+ return typeof value === "string" || typeof value === "number" ? value : void 0;
5354
+ }
5355
+ function ReactTableEditorOverlay(props) {
5356
+ const { request } = props;
5357
+ const editorHostRef = react.useRef(null);
5358
+ const wheelCommittedRef = react.useRef(false);
5359
+ const changedSinceCommitRef = react.useRef(false);
5360
+ const editorRequest = {
5361
+ ...request,
5362
+ onChange: (value, meta) => {
5363
+ wheelCommittedRef.current = false;
5364
+ changedSinceCommitRef.current = true;
5365
+ if (meta === void 0) request.onChange(value);
5366
+ else request.onChange(value, meta);
5367
+ },
5368
+ onCommit: (options) => {
5369
+ if (!wheelCommittedRef.current && (!request.feedback?.pending || changedSinceCommitRef.current)) {
5370
+ changedSinceCommitRef.current = false;
5371
+ return request.onCommit(options);
5372
+ }
5373
+ }
5374
+ };
5375
+ react.useEffect(() => {
5376
+ wheelCommittedRef.current = false;
5377
+ changedSinceCommitRef.current = false;
5378
+ }, [request.editorKey]);
5379
+ const style = resolveEditorOverlayStyle({
5380
+ rect: request.rect,
5381
+ hostRect: request.hostRect,
5382
+ fontSize: request.theme.fontSize,
5383
+ fontFamily: request.theme.fontFamily,
5384
+ fontWeight: request.theme.fontWeight,
5385
+ paddingInline: request.theme.paddingInline,
5386
+ paddingBlock: request.theme.paddingBlock,
5387
+ contentZoom: request.theme.contentZoom
5388
+ });
5389
+ const contentZoom = typeof request.theme.contentZoom === "number" && Number.isFinite(request.theme.contentZoom) && request.theme.contentZoom > 0 ? request.theme.contentZoom : 1;
5390
+ react.useLayoutEffect(() => {
5391
+ if (request.config.valueType === "composite" || request.config.valueType === "math-interval" || request.config.valueType === "number-unit")
5392
+ return;
5393
+ const input = editorHostRef.current?.querySelector("input");
5394
+ if (!input) {
5395
+ return;
5396
+ }
5397
+ focusAndSelectEditorInput(input, request.selectOnFocus);
5398
+ }, [request.editorKey]);
5399
+ react.useEffect(() => {
5400
+ const host = editorHostRef.current;
5401
+ if (!host) return;
5402
+ const valueType = request.config.valueType ?? "text";
5403
+ if (valueType !== "composite" && valueType !== "text" && valueType !== "number" && valueType !== "input-range") {
5404
+ return;
5405
+ }
5406
+ const handleWheel = (event) => {
5407
+ event.preventDefault();
5408
+ event.stopPropagation();
5409
+ if (wheelCommittedRef.current || request.feedback?.pending) return;
5410
+ wheelCommittedRef.current = true;
5411
+ const result = request.onCommit();
5412
+ if (result && typeof result.then === "function")
5413
+ void result.then(
5414
+ (success) => {
5415
+ if (!success) wheelCommittedRef.current = false;
5416
+ else request.onWheel?.(event);
5417
+ },
5418
+ () => {
5419
+ wheelCommittedRef.current = false;
5420
+ }
5421
+ );
5422
+ else request.onWheel?.(event);
5423
+ };
5424
+ host.addEventListener("wheel", handleWheel, { passive: false });
5425
+ return () => host.removeEventListener("wheel", handleWheel);
5426
+ }, [request]);
5427
+ const itemErrorOwnsFeedback = request.config.valueType === "composite" && Object.values(request.feedback?.itemErrors ?? {}).some(
5428
+ (errors) => errors.includes(request.feedback?.error ?? "")
5429
+ );
5430
+ return /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactContentScaleProvider, { scale: contentZoom, children: /* @__PURE__ */ jsxRuntime.jsxs(
5431
+ "div",
5432
+ {
5433
+ ref: editorHostRef,
5434
+ "aria-busy": request.feedback?.pending || void 0,
5435
+ children: [
5436
+ renderEditorByType(editorRequest, style),
5437
+ request.feedback?.error && !itemErrorOwnsFeedback && /* @__PURE__ */ jsxRuntime.jsx(
5438
+ "div",
5439
+ {
5440
+ role: "alert",
5441
+ style: {
5442
+ ...style,
5443
+ top: Number(style.top) + Number(style.height),
5444
+ height: "auto",
5445
+ minHeight: 0,
5446
+ padding: 4,
5447
+ background: "#fff",
5448
+ color: "#cf1322",
5449
+ border: "1px solid #ffccc7"
5450
+ },
5451
+ children: request.feedback.error
5452
+ }
5453
+ )
5454
+ ]
5455
+ },
5456
+ request.editorKey
5457
+ ) });
5458
+ }
5459
+ function renderEditorByType(request, style) {
5460
+ switch (request.config.valueType ?? "text") {
5461
+ case "composite":
5462
+ return /* @__PURE__ */ jsxRuntime.jsx(
5463
+ CompositeEditor,
5464
+ {
5465
+ request,
5466
+ style
5467
+ },
5468
+ request.editorKey
5469
+ );
5470
+ case "number-unit":
5471
+ return /* @__PURE__ */ jsxRuntime.jsx(
5472
+ NumberUnitEditor,
5473
+ {
5474
+ request,
5475
+ style
5476
+ },
5477
+ request.editorKey
5478
+ );
5479
+ case "math-interval":
5480
+ return /* @__PURE__ */ jsxRuntime.jsx(
5481
+ MathIntervalEditor,
5482
+ {
5483
+ request,
5484
+ style
5485
+ },
5486
+ request.editorKey
5487
+ );
5488
+ case "table-select":
5489
+ return /* @__PURE__ */ jsxRuntime.jsx(TableSelectEditor, { request, style });
5490
+ case "tree-select":
5491
+ return /* @__PURE__ */ jsxRuntime.jsx(TreeSelectEditor, { request, style });
5492
+ case "cascader":
5493
+ return /* @__PURE__ */ jsxRuntime.jsx(CascaderEditor, { request, style });
5494
+ case "number":
5495
+ return /* @__PURE__ */ jsxRuntime.jsx(NumberEditor, { request, style });
5496
+ case "input-range":
5497
+ return /* @__PURE__ */ jsxRuntime.jsx(InputRangeEditor, { request, style });
5498
+ case "year":
5499
+ return /* @__PURE__ */ jsxRuntime.jsx(YearEditor, { request, style });
5500
+ case "quarter":
5501
+ return /* @__PURE__ */ jsxRuntime.jsx(QuarterEditor, { request, style });
5502
+ case "month":
5503
+ return /* @__PURE__ */ jsxRuntime.jsx(MonthEditor, { request, style });
5504
+ case "date":
5505
+ return /* @__PURE__ */ jsxRuntime.jsx(DateEditor, { request, style });
5506
+ case "date-range":
5507
+ return /* @__PURE__ */ jsxRuntime.jsx(DateRangeEditor, { request, style });
5508
+ case "time":
5509
+ return /* @__PURE__ */ jsxRuntime.jsx(TimeEditor, { request, style });
5510
+ case "datetime":
5511
+ return /* @__PURE__ */ jsxRuntime.jsx(DateTimeEditor, { request, style });
5512
+ case "datetime-range":
5513
+ return /* @__PURE__ */ jsxRuntime.jsx(DateTimeRangeEditor, { request, style });
5514
+ case "timerange":
5515
+ return /* @__PURE__ */ jsxRuntime.jsx(TimeRangeEditor, { request, style });
5516
+ case "color":
5517
+ return /* @__PURE__ */ jsxRuntime.jsx(ColorEditor, { request, style });
5518
+ case "select":
5519
+ return /* @__PURE__ */ jsxRuntime.jsx(SelectEditor, { request, style });
5520
+ case "auto-complete":
5521
+ return /* @__PURE__ */ jsxRuntime.jsx(AutoCompleteEditor, { request, style });
5522
+ default:
5523
+ return /* @__PURE__ */ jsxRuntime.jsx(TextEditor, { request, style });
5524
+ }
5525
+ }
5526
+ function TextEditor(props) {
5527
+ const { request, style } = props;
5528
+ const [value, setValue] = react.useState(String(request.value ?? ""));
5529
+ const hostRef = react.useRef(null);
5530
+ const skipBlurCommitRef = react.useRef(false);
5531
+ react.useLayoutEffect(() => {
5532
+ const input = hostRef.current?.querySelector("input");
5533
+ focusAndSelectEditorInput(input, request.selectOnFocus);
5534
+ }, [request.editorKey]);
5535
+ react.useEffect(() => {
5536
+ setValue(String(request.value ?? ""));
5537
+ }, [request.value]);
5538
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: hostRef, style, children: /* @__PURE__ */ jsxRuntime.jsx(
5539
+ reactComponents.ReactInput,
5540
+ {
5541
+ value,
5542
+ placeholder: request.config.placeholder ?? "",
5543
+ onChange: (event) => {
5544
+ const nextValue = event.target.value;
5545
+ setValue(nextValue);
5546
+ publishEditorChange(request, nextValue, { trigger: "input" });
5547
+ },
5548
+ onPressEnter: () => {
5549
+ request.onCommit({ restoreTableFocus: true });
5550
+ },
5551
+ onBlur: (event) => {
5552
+ handleEditorBlur(event, skipBlurCommitRef, request);
5553
+ },
5554
+ onKeyDown: (event) => {
5555
+ if (handleEditorNavigationKey(event, request, skipBlurCommitRef)) {
5556
+ return;
5557
+ }
5558
+ handleEditorEscapeKey(event, request);
5559
+ },
5560
+ style: getEditorInputStyle(request)
5561
+ }
5562
+ ) });
5563
+ }
5564
+ function NumberEditor(props) {
5565
+ const { request, style } = props;
5566
+ const [value, setValue] = react.useState(
5567
+ toNumberValue(request.value)
5568
+ );
5569
+ const hostRef = react.useRef(null);
5570
+ const skipBlurCommitRef = react.useRef(false);
5571
+ react.useLayoutEffect(() => {
5572
+ const input = hostRef.current?.querySelector("input");
5573
+ focusAndSelectEditorInput(input, request.selectOnFocus);
5574
+ }, [request.editorKey]);
5575
+ react.useEffect(() => {
5576
+ setValue(toNumberValue(request.value));
5577
+ }, [request.value]);
5578
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { ref: hostRef, style, children: /* @__PURE__ */ jsxRuntime.jsx(
5579
+ reactComponents.ReactInputNumber,
5580
+ {
5581
+ value,
5582
+ initialText: typeof request.value === "string" ? request.value : void 0,
5583
+ min: toNumericProp(request.config.min),
5584
+ max: toNumericProp(request.config.max),
5585
+ step: toNumericProp(request.config.step),
5586
+ onChange: (nextValue) => {
5587
+ setValue(nextValue);
5588
+ publishEditorChange(request, nextValue, { trigger: "input" });
5589
+ },
5590
+ onPressEnter: () => {
5591
+ request.onCommit({ restoreTableFocus: true });
4476
5592
  },
4477
5593
  onBlur: (event) => {
4478
5594
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -4507,7 +5623,7 @@ function InputRangeEditor(props) {
4507
5623
  rangeSeparator: request.config.rangeSeparator,
4508
5624
  onChange: (nextValue) => {
4509
5625
  setValue(nextValue);
4510
- request.onChange(nextValue);
5626
+ publishEditorChange(request, nextValue, { trigger: "input" });
4511
5627
  },
4512
5628
  onPressEnter: () => {
4513
5629
  request.onCommit({ restoreTableFocus: true });
@@ -4546,7 +5662,7 @@ function YearEditor(props) {
4546
5662
  showArrow: false,
4547
5663
  onChange: (nextValue) => {
4548
5664
  setValue(nextValue);
4549
- request.onChange(nextValue);
5665
+ publishEditorChange(request, nextValue, { trigger: "change" });
4550
5666
  request.onCommit();
4551
5667
  },
4552
5668
  onBlur: (event) => {
@@ -4580,7 +5696,7 @@ function QuarterEditor(props) {
4580
5696
  showArrow: false,
4581
5697
  onChange: (nextValue) => {
4582
5698
  setValue(nextValue);
4583
- request.onChange(nextValue);
5699
+ publishEditorChange(request, nextValue, { trigger: "change" });
4584
5700
  request.onCommit();
4585
5701
  },
4586
5702
  onBlur: (event) => {
@@ -4614,7 +5730,7 @@ function MonthEditor(props) {
4614
5730
  showArrow: false,
4615
5731
  onChange: (nextValue) => {
4616
5732
  setValue(nextValue);
4617
- request.onChange(nextValue);
5733
+ publishEditorChange(request, nextValue, { trigger: "change" });
4618
5734
  request.onCommit();
4619
5735
  },
4620
5736
  onBlur: (event) => {
@@ -4648,7 +5764,7 @@ function DateEditor(props) {
4648
5764
  showArrow: false,
4649
5765
  onChange: (nextValue) => {
4650
5766
  setValue(nextValue);
4651
- request.onChange(nextValue);
5767
+ publishEditorChange(request, nextValue, { trigger: "change" });
4652
5768
  request.onCommit();
4653
5769
  },
4654
5770
  onBlur: (event) => {
@@ -4690,7 +5806,10 @@ function TreeSelectEditor({
4690
5806
  style: getEditorInputStyle(request),
4691
5807
  onChange: (next, _nodes, info) => {
4692
5808
  setValue(next);
4693
- request.onChange(next);
5809
+ publishEditorChange(request, next, {
5810
+ trigger: info.trigger,
5811
+ options: _nodes
5812
+ });
4694
5813
  if (info.complete && info.trigger !== "clear") {
4695
5814
  skipBlurCommitRef.current = true;
4696
5815
  request.onCommit();
@@ -4734,7 +5853,10 @@ function CascaderEditor({
4734
5853
  style: getEditorInputStyle(request),
4735
5854
  onChange: (next, _options, info) => {
4736
5855
  setValue(next);
4737
- request.onChange(next);
5856
+ publishEditorChange(request, next, {
5857
+ trigger: info.trigger,
5858
+ options: _options
5859
+ });
4738
5860
  if (info.complete && info.trigger !== "clear") {
4739
5861
  skipBlurCommitRef.current = true;
4740
5862
  request.onCommit();
@@ -4774,9 +5896,13 @@ function SelectEditor(props) {
4774
5896
  onChange: (nextValue, info) => {
4775
5897
  const resolvedValue = String(nextValue);
4776
5898
  setValue(resolvedValue);
4777
- request.onChange(
4778
- options.find((option) => String(option.value) === resolvedValue)?.value ?? resolvedValue
5899
+ const option = options.find(
5900
+ (option2) => String(option2.value) === resolvedValue
4779
5901
  );
5902
+ publishEditorChange(request, option?.value ?? resolvedValue, {
5903
+ trigger: info.trigger,
5904
+ option
5905
+ });
4780
5906
  if (info.trigger === "mouse" || info.trigger === "keyboard") {
4781
5907
  skipBlurCommitRef.current = true;
4782
5908
  request.onCommit({ restoreTableFocus: true });
@@ -4805,6 +5931,18 @@ function AutoCompleteEditor(props) {
4805
5931
  request.value == null ? "" : String(request.value)
4806
5932
  );
4807
5933
  const [options, setOptions] = react.useState(request.config.options ?? []);
5934
+ const optionsRef = react.useRef(options);
5935
+ const aliveRef = react.useRef(true);
5936
+ react.useEffect(() => {
5937
+ aliveRef.current = true;
5938
+ return () => {
5939
+ aliveRef.current = false;
5940
+ };
5941
+ }, []);
5942
+ react.useEffect(() => {
5943
+ optionsRef.current = request.config.options ?? [];
5944
+ setOptions(optionsRef.current);
5945
+ }, [request.config.options]);
4808
5946
  const skipBlurCommitRef = react.useRef(false);
4809
5947
  react.useEffect(() => {
4810
5948
  setValue(request.value == null ? "" : String(request.value));
@@ -4818,8 +5956,14 @@ function AutoCompleteEditor(props) {
4818
5956
  options,
4819
5957
  placeholder: request.config.placeholder ?? "",
4820
5958
  onChange: (nextValue, info) => {
5959
+ if (!aliveRef.current) return;
4821
5960
  setValue(nextValue);
4822
- request.onChange(nextValue);
5961
+ publishEditorChange(request, nextValue, {
5962
+ trigger: info.trigger,
5963
+ option: optionsRef.current.find(
5964
+ (option) => String(option.value) === String(nextValue)
5965
+ )
5966
+ });
4823
5967
  if (info.trigger === "mouse" || info.trigger === "keyboard") {
4824
5968
  skipBlurCommitRef.current = true;
4825
5969
  request.onCommit({ restoreTableFocus: true });
@@ -4827,7 +5971,9 @@ function AutoCompleteEditor(props) {
4827
5971
  },
4828
5972
  onPressEnter: async (input) => {
4829
5973
  const nextOptions = await request.config.onPressEnter?.(input);
5974
+ if (!aliveRef.current) return;
4830
5975
  if (nextOptions) {
5976
+ optionsRef.current = nextOptions;
4831
5977
  setOptions(nextOptions);
4832
5978
  }
4833
5979
  return nextOptions;
@@ -4867,7 +6013,7 @@ function ColorEditor(props) {
4867
6013
  showArrow: false,
4868
6014
  onChange: (nextValue) => {
4869
6015
  setValue(nextValue);
4870
- request.onChange(nextValue);
6016
+ publishEditorChange(request, nextValue, { trigger: "change" });
4871
6017
  },
4872
6018
  onBlur: (event) => {
4873
6019
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -4902,7 +6048,7 @@ function DateRangeEditor(props) {
4902
6048
  rangeSeparator: separator,
4903
6049
  onChange: (nextValue) => {
4904
6050
  setValue(nextValue);
4905
- request.onChange(nextValue);
6051
+ publishEditorChange(request, nextValue, { trigger: "change" });
4906
6052
  },
4907
6053
  onBlur: (event) => {
4908
6054
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -4938,7 +6084,7 @@ function TimeEditor(props) {
4938
6084
  showArrow: false,
4939
6085
  onChange: (nextValue) => {
4940
6086
  setValue(nextValue);
4941
- request.onChange(nextValue);
6087
+ publishEditorChange(request, nextValue, { trigger: "change" });
4942
6088
  },
4943
6089
  onBlur: (event) => {
4944
6090
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -4971,7 +6117,7 @@ function DateTimeEditor(props) {
4971
6117
  showArrow: false,
4972
6118
  onChange: (nextValue) => {
4973
6119
  setValue(nextValue);
4974
- request.onChange(nextValue);
6120
+ publishEditorChange(request, nextValue, { trigger: "change" });
4975
6121
  request.onCommit();
4976
6122
  },
4977
6123
  onBlur: (event) => {
@@ -5007,7 +6153,7 @@ function DateTimeRangeEditor(props) {
5007
6153
  rangeSeparator: separator,
5008
6154
  onChange: (nextValue) => {
5009
6155
  setValue(nextValue);
5010
- request.onChange(nextValue);
6156
+ publishEditorChange(request, nextValue, { trigger: "change" });
5011
6157
  },
5012
6158
  onBlur: (event) => {
5013
6159
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -5044,7 +6190,7 @@ function TimeRangeEditor(props) {
5044
6190
  rangeSeparator: separator,
5045
6191
  onChange: (nextValue) => {
5046
6192
  setValue(nextValue);
5047
- request.onChange(nextValue);
6193
+ publishEditorChange(request, nextValue, { trigger: "change" });
5048
6194
  },
5049
6195
  onBlur: (event) => {
5050
6196
  handleEditorBlur(event, skipBlurCommitRef, request);
@@ -5068,8 +6214,18 @@ function handleEditorNavigationKey(event, request, skipBlurCommitRef) {
5068
6214
  return false;
5069
6215
  }
5070
6216
  event.preventDefault();
6217
+ if (request.feedback?.pending) return true;
5071
6218
  skipBlurCommitRef.current = true;
5072
- request.onNavigate(direction);
6219
+ const result = request.onNavigate(direction);
6220
+ if (result && typeof result.then === "function")
6221
+ void result.then(
6222
+ (success) => {
6223
+ if (!success) skipBlurCommitRef.current = false;
6224
+ },
6225
+ () => {
6226
+ skipBlurCommitRef.current = false;
6227
+ }
6228
+ );
5073
6229
  return true;
5074
6230
  }
5075
6231
  function handleRangeInputTab(event) {
@@ -5122,7 +6278,12 @@ function toNumberRangeTuple(value) {
5122
6278
  }
5123
6279
  return [toNumberValue(value[0]), toNumberValue(value[1])];
5124
6280
  }
5125
- function handleEditorBlur(_event, skipBlurCommitRef, request) {
6281
+ function handleEditorBlur(event, skipBlurCommitRef, request) {
6282
+ if (containsEditorInteraction(
6283
+ event.currentTarget.closest("[data-list-table-range-editor]"),
6284
+ event.relatedTarget
6285
+ ) || request.feedback?.pending)
6286
+ return;
5126
6287
  if (skipBlurCommitRef.current) {
5127
6288
  skipBlurCommitRef.current = false;
5128
6289
  return;
@@ -5227,7 +6388,12 @@ function ReactTableFilterPanelView(props) {
5227
6388
  }
5228
6389
 
5229
6390
  // src/components/react-list-table-layout.ts
5230
- function resolveReactListTablePaginationLayout(density) {
6391
+ function resolveReactListTablePaginationLayout(density, size) {
6392
+ if (size && size !== "auto") {
6393
+ return resolveReactListTablePaginationLayout(
6394
+ size === "small" ? 26 : size === "large" ? 48 : 32
6395
+ );
6396
+ }
5231
6397
  if (typeof density === "number" && density <= 26) {
5232
6398
  return { size: "small", height: 32, paddingTop: 8 };
5233
6399
  }
@@ -5252,7 +6418,7 @@ function ReactTablePaginationView(props) {
5252
6418
  if (!config) {
5253
6419
  return null;
5254
6420
  }
5255
- const layout = resolveReactListTablePaginationLayout(density);
6421
+ const layout = resolveReactListTablePaginationLayout(density, config.size);
5256
6422
  return /* @__PURE__ */ jsxRuntime.jsx(
5257
6423
  "div",
5258
6424
  {
@@ -5271,6 +6437,7 @@ function ReactTablePaginationView(props) {
5271
6437
  {
5272
6438
  styles: config.styles,
5273
6439
  size: layout.size,
6440
+ pageInfoText: config.pageInfoText,
5274
6441
  current: config.current,
5275
6442
  total: config.total,
5276
6443
  pageSize: config.pageSize,
@@ -5295,6 +6462,402 @@ function ReactTablePaginationView(props) {
5295
6462
  }
5296
6463
  );
5297
6464
  }
6465
+ var pageInfoFormats = [
6466
+ { value: "", label: "\u4E0D\u989D\u5916\u663E\u793A" },
6467
+ {
6468
+ value: "\u7B2C {current} \u9875 / \u5171 {totalPages} \u9875",
6469
+ label: "\u7B2C 1 \u9875 / \u5171 10 \u9875"
6470
+ },
6471
+ { value: "{current} / {totalPages}", label: "1 / 10" },
6472
+ { value: "custom", label: "\u81EA\u5B9A\u4E49\u683C\u5F0F" }
6473
+ ];
6474
+ var totalFormats = [
6475
+ { value: "inherit", label: "\u6CBF\u7528\u4F20\u5165\u683C\u5F0F" },
6476
+ { value: "\u5171 {total} \u6761", label: "\u5171 200 \u6761" },
6477
+ {
6478
+ value: "\u7B2C {start}\u2013{end} \u6761\uFF0C\u5171 {total} \u6761",
6479
+ label: "\u7B2C 1\u201320 \u6761\uFF0C\u5171 200 \u6761"
6480
+ },
6481
+ { value: "hide", label: "\u9690\u85CF" },
6482
+ { value: "custom", label: "\u81EA\u5B9A\u4E49\u683C\u5F0F" }
6483
+ ];
6484
+ function createPaginationDraft(snapshot, incoming = false) {
6485
+ const source = incoming ? snapshot.incoming : snapshot.value;
6486
+ const config = listTable.withPaginationDefaults(
6487
+ source || (incoming ? {} : snapshot.retained)
6488
+ );
6489
+ const pageTemplate = config.pageInfoFormat ?? "";
6490
+ const totalTemplate = typeof config.totalFormat === "string" ? config.totalFormat : "";
6491
+ return {
6492
+ cacheEnabled: snapshot.cache?.enabled ?? false,
6493
+ cacheScope: snapshot.cache?.scope ?? "all",
6494
+ enabled: !!source,
6495
+ config,
6496
+ current: String(config.current),
6497
+ pageSize: String(config.pageSize),
6498
+ minPageSize: String(config.minPageSize ?? 1),
6499
+ maxPageSize: config.maxPageSize == null ? "" : String(config.maxPageSize),
6500
+ candidates: config.pageSizeOptions.join(", "),
6501
+ pageChoice: pageInfoFormats.some((o) => o.value === pageTemplate) ? pageTemplate : "custom",
6502
+ totalChoice: config.totalFormat === false ? "hide" : config.totalFormat === void 0 ? "inherit" : totalFormats.some((o) => o.value === totalTemplate) ? totalTemplate : "custom",
6503
+ pageTemplate,
6504
+ totalTemplate
6505
+ };
6506
+ }
6507
+ function paginationDraftValue(draft) {
6508
+ if (!draft.enabled) return false;
6509
+ return {
6510
+ ...draft.config,
6511
+ current: Number(draft.current),
6512
+ pageSize: Number(draft.pageSize),
6513
+ minPageSize: Number(draft.minPageSize),
6514
+ maxPageSize: draft.maxPageSize.trim() ? Number(draft.maxPageSize) : void 0,
6515
+ pageSizeOptions: [
6516
+ ...new Set(draft.candidates.split(/[,,]/).map((n) => Number(n.trim())))
6517
+ ].sort((a, b) => a - b),
6518
+ pageInfoFormat: draft.pageChoice === "custom" ? draft.pageTemplate : draft.pageChoice || void 0,
6519
+ totalFormat: draft.totalChoice === "inherit" ? void 0 : draft.totalChoice === "hide" ? false : draft.totalChoice === "custom" ? draft.totalTemplate : draft.totalChoice
6520
+ };
6521
+ }
6522
+
6523
+ // src/features/pagination/pagination-config-dialog.css
6524
+ styleInject(".react-list-table-pagination-config {\n display: grid;\n gap: 18px;\n color: var(--canvas-react-color-text, #253247);\n}\n.react-list-table-pagination-config-enable {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 16px;\n}\n.react-list-table-pagination-config-cache {\n flex-wrap: wrap;\n}\n.react-list-table-pagination-config-cache > label {\n flex-shrink: 0;\n white-space: nowrap;\n}\n.react-list-table-pagination-config-cache-scope {\n flex: 0 1 180px;\n min-width: 120px;\n}\n.react-list-table-pagination-config-help {\n color: var(--canvas-react-color-text-muted, #64748b);\n font-size: 12px;\n margin-top: 6px;\n}\n.react-list-table-pagination-config fieldset {\n border: 0;\n padding: 0;\n margin: 0;\n min-width: 0;\n}\n.react-list-table-pagination-config fieldset:disabled {\n opacity: 0.5;\n}\n.react-list-table-pagination-config h3 {\n font-size: 13px;\n margin: 18px 0 12px;\n}\n.react-list-table-pagination-config h3:first-child {\n margin-top: 0;\n}\n.react-list-table-pagination-config-grid {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 14px 20px;\n margin-top: 12px;\n}\n.react-list-table-pagination-config-field {\n display: grid;\n align-content: start;\n gap: 6px;\n min-width: 0;\n font-size: 13px;\n}\n.react-list-table-pagination-config-check {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: 13px;\n}\n.react-list-table-pagination-config-check input {\n accent-color: var(--canvas-react-color-primary, #2563eb);\n}\n.react-list-table-pagination-config details {\n margin-top: 18px;\n border-top: 1px solid var(--canvas-react-color-border, #e2e8f0);\n padding-top: 14px;\n}\n.react-list-table-pagination-config summary {\n cursor: pointer;\n font-size: 13px;\n font-weight: 600;\n}\n.react-list-table-pagination-config-preview {\n border-top: 1px solid var(--canvas-react-color-border, #e2e8f0);\n padding-top: 10px;\n min-width: 0;\n}\n.react-list-table-pagination-config-pager {\n display: flex;\n justify-content: flex-end;\n margin-top: 12px;\n}\n.react-list-table-pagination-config-pager > div {\n flex-wrap: wrap;\n justify-content: flex-end;\n}\n.react-list-table-pagination-config-off {\n text-align: center;\n padding: 16px 0;\n color: var(--canvas-react-color-text-muted, #64748b);\n}\n.react-list-table-pagination-config-error {\n color: var(--canvas-react-color-danger, #dc2626);\n font-size: 12px;\n}\n.react-list-table-pagination-config-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n gap: 12px;\n flex-wrap: wrap;\n width: 100%;\n}\n.react-list-table-pagination-config-footer > div {\n display: flex;\n gap: 10px;\n margin-left: auto;\n}\n@media (max-width: 460px) {\n .react-list-table-pagination-config-grid {\n grid-template-columns: minmax(0, 1fr);\n }\n}\n");
6525
+ function ReactListTablePaginationConfigDialog(props) {
6526
+ const [initial] = react.useState(() => createPaginationDraft(props.snapshot));
6527
+ const [draft, setDraft] = react.useState(initial);
6528
+ const [currentEdited, setCurrentEdited] = react.useState(false);
6529
+ const [errors, setErrors] = react.useState({});
6530
+ const patch = (next) => setDraft((current2) => ({ ...current2, ...next }));
6531
+ const patchConfig = (next) => setDraft((current2) => ({
6532
+ ...current2,
6533
+ config: { ...current2.config, ...next }
6534
+ }));
6535
+ const value = paginationDraftValue(draft);
6536
+ const scroll = draft.config.mode === "scroll";
6537
+ const pageSize = Math.max(
6538
+ 1,
6539
+ Number.isSafeInteger(Number(draft.pageSize)) ? Number(draft.pageSize) : 10
6540
+ );
6541
+ const totalPages = Math.max(1, Math.ceil(props.snapshot.total / pageSize));
6542
+ const current = Math.min(totalPages, Math.max(1, Number(draft.current) || 1));
6543
+ const field = (label, key, control) => /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-field", children: [
6544
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
6545
+ control,
6546
+ errors[key] ? /* @__PURE__ */ jsxRuntime.jsx("span", { role: "alert", className: "react-list-table-pagination-config-error", children: errors[key] }) : null
6547
+ ] });
6548
+ const input = (label, key) => field(
6549
+ label,
6550
+ key === "candidates" ? "pageSizeOptions" : key,
6551
+ /* @__PURE__ */ jsxRuntime.jsx(
6552
+ reactComponents.ReactInput,
6553
+ {
6554
+ "aria-label": label,
6555
+ value: draft[key],
6556
+ inputMode: key === "candidates" ? "text" : "numeric",
6557
+ allowClear: false,
6558
+ placeholder: key === "maxPageSize" ? "\u4E0D\u9650\u5236" : void 0,
6559
+ onChange: (event) => {
6560
+ if (key === "current") setCurrentEdited(true);
6561
+ patch({
6562
+ [key]: event.target.value,
6563
+ ...key === "pageSize" && !currentEdited ? { current: "1" } : {}
6564
+ });
6565
+ }
6566
+ }
6567
+ )
6568
+ );
6569
+ const check = (label, key, disabled = false) => /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "react-list-table-pagination-config-check", children: [
6570
+ /* @__PURE__ */ jsxRuntime.jsx(
6571
+ "input",
6572
+ {
6573
+ type: "checkbox",
6574
+ checked: key === "allowPageSizeInput" ? draft.config.allowPageSizeInput ?? !!draft.config.showSizeChanger : !!draft.config[key],
6575
+ disabled,
6576
+ onChange: (event) => patchConfig({ [key]: event.target.checked })
6577
+ }
6578
+ ),
6579
+ label
6580
+ ] });
6581
+ const confirm = () => {
6582
+ if (JSON.stringify(draft) === JSON.stringify(initial)) {
6583
+ props.onClose();
6584
+ return;
6585
+ }
6586
+ const nextErrors = {
6587
+ ...listTable.validatePaginationConfig(value, props.snapshot.total)
6588
+ };
6589
+ if (draft.enabled && draft.pageChoice === "custom" && !draft.pageTemplate.trim())
6590
+ nextErrors.pageInfoFormat = "\u8BF7\u8F93\u5165\u9875\u7801\u4FE1\u606F\u683C\u5F0F";
6591
+ setErrors(nextErrors);
6592
+ if (Object.keys(nextErrors).length) return;
6593
+ const result = props.onConfirm(value, {
6594
+ enabled: draft.cacheEnabled,
6595
+ scope: draft.cacheScope
6596
+ });
6597
+ if (result.ok) props.onClose();
6598
+ else setErrors(result.errors);
6599
+ };
6600
+ const totalFormat = value && value.totalFormat;
6601
+ const pageFormat = value && value.pageInfoFormat;
6602
+ return /* @__PURE__ */ jsxRuntime.jsx(
6603
+ reactComponents.ReactModal,
6604
+ {
6605
+ open: true,
6606
+ title: "\u5206\u9875\u914D\u7F6E",
6607
+ width: 640,
6608
+ fullscreenable: false,
6609
+ onCancel: props.onClose,
6610
+ footer: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-footer", children: [
6611
+ /* @__PURE__ */ jsxRuntime.jsx(
6612
+ reactComponents.ReactButton,
6613
+ {
6614
+ type: "text",
6615
+ onClick: () => {
6616
+ setDraft(createPaginationDraft(props.snapshot, true));
6617
+ setCurrentEdited(false);
6618
+ setErrors({});
6619
+ },
6620
+ children: "\u6062\u590D\u4F20\u5165\u914D\u7F6E"
6621
+ }
6622
+ ),
6623
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6624
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactButton, { onClick: props.onClose, children: "\u53D6\u6D88" }),
6625
+ /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactButton, { type: "primary", onClick: confirm, children: "\u786E\u5B9A" })
6626
+ ] })
6627
+ ] }),
6628
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config", children: [
6629
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-enable", children: [
6630
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6631
+ /* @__PURE__ */ jsxRuntime.jsx("strong", { children: "\u542F\u7528\u5206\u9875" }),
6632
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-help", children: "\u5173\u95ED\u540E\u5C55\u793A\u5168\u90E8\u5DF2\u52A0\u8F7D\u6570\u636E\uFF0C\u4E0D\u663E\u793A\u5206\u9875\u63A7\u4EF6" })
6633
+ ] }),
6634
+ /* @__PURE__ */ jsxRuntime.jsx(
6635
+ reactComponents.ReactSwitch,
6636
+ {
6637
+ "aria-label": "\u542F\u7528\u5206\u9875",
6638
+ checked: draft.enabled,
6639
+ onChange: (enabled) => {
6640
+ setCurrentEdited(false);
6641
+ patch({ enabled, ...enabled ? { current: "1" } : {} });
6642
+ }
6643
+ }
6644
+ )
6645
+ ] }),
6646
+ /* @__PURE__ */ jsxRuntime.jsxs("fieldset", { disabled: !draft.enabled, children: [
6647
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: scroll ? "\u6EDA\u52A8\u52A0\u8F7D" : "\u57FA\u672C\u8BBE\u7F6E" }),
6648
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6649
+ scroll ? /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6650
+ "\u5F53\u524D\u5DF2\u52A0\u8F7D ",
6651
+ draft.current,
6652
+ " \u9875"
6653
+ ] }) : input("\u5F53\u524D\u9875", "current"),
6654
+ input(scroll ? "\u6BCF\u6279\u6761\u6570" : "\u6BCF\u9875\u6761\u6570", "pageSize")
6655
+ ] }),
6656
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6657
+ "\u5171 ",
6658
+ props.snapshot.total,
6659
+ " \u6761\u6570\u636E \xB7 ",
6660
+ totalPages,
6661
+ " \u9875"
6662
+ ] }),
6663
+ !scroll ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6664
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "\u663E\u793A\u8BBE\u7F6E" }),
6665
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-grid", children: field(
6666
+ "\u5206\u9875\u5C3A\u5BF8",
6667
+ "size",
6668
+ /* @__PURE__ */ jsxRuntime.jsx(
6669
+ reactComponents.ReactSelect,
6670
+ {
6671
+ "aria-label": "\u5206\u9875\u5C3A\u5BF8",
6672
+ value: draft.config.size ?? "auto",
6673
+ options: [
6674
+ { value: "auto", label: "\u8DDF\u968F\u8868\u683C" },
6675
+ { value: "small", label: "\u5C0F" },
6676
+ { value: "middle", label: "\u4E2D" },
6677
+ { value: "large", label: "\u5927" }
6678
+ ],
6679
+ onChange: (size) => patchConfig({
6680
+ size
6681
+ })
6682
+ }
6683
+ )
6684
+ ) }),
6685
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6686
+ check("\u7B80\u6D01\u6A21\u5F0F", "simple"),
6687
+ check("\u7D27\u51D1\u9875\u7801", "showLessItems", !!draft.config.simple),
6688
+ check("\u663E\u793A\u6BCF\u9875\u6761\u6570\u9009\u62E9\u5668", "showSizeChanger"),
6689
+ check("\u663E\u793A\u5FEB\u901F\u8DF3\u9875", "showQuickJumper")
6690
+ ] }),
6691
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { children: "\u6587\u6848\u8BBE\u7F6E" }),
6692
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6693
+ field(
6694
+ "\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6695
+ "pageInfoFormat",
6696
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6697
+ /* @__PURE__ */ jsxRuntime.jsx(
6698
+ reactComponents.ReactSelect,
6699
+ {
6700
+ "aria-label": "\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6701
+ value: draft.pageChoice,
6702
+ options: pageInfoFormats,
6703
+ onChange: (pageChoice) => patch({ pageChoice })
6704
+ }
6705
+ ),
6706
+ draft.pageChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsx(
6707
+ reactComponents.ReactInput,
6708
+ {
6709
+ "aria-label": "\u81EA\u5B9A\u4E49\u9875\u7801\u4FE1\u606F\u683C\u5F0F",
6710
+ maxLength: 500,
6711
+ placeholder: "\u7B2C {current} \u9875 / \u5171 {totalPages} \u9875",
6712
+ value: draft.pageTemplate,
6713
+ onChange: (event) => patch({ pageTemplate: event.target.value })
6714
+ }
6715
+ ) : null
6716
+ ] })
6717
+ ),
6718
+ field(
6719
+ "\u603B\u6761\u6570\u683C\u5F0F",
6720
+ "totalFormat",
6721
+ /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
6722
+ /* @__PURE__ */ jsxRuntime.jsx(
6723
+ reactComponents.ReactSelect,
6724
+ {
6725
+ "aria-label": "\u603B\u6761\u6570\u683C\u5F0F",
6726
+ value: draft.totalChoice,
6727
+ options: totalFormats,
6728
+ onChange: (totalChoice) => patch({ totalChoice })
6729
+ }
6730
+ ),
6731
+ draft.totalChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsx(
6732
+ reactComponents.ReactInput,
6733
+ {
6734
+ "aria-label": "\u81EA\u5B9A\u4E49\u603B\u6761\u6570\u683C\u5F0F",
6735
+ maxLength: 500,
6736
+ placeholder: "\u7B2C {start}\u2013{end} \u6761\uFF0C\u5171 {total} \u6761",
6737
+ value: draft.totalTemplate,
6738
+ onChange: (event) => patch({ totalTemplate: event.target.value })
6739
+ }
6740
+ ) : null
6741
+ ] })
6742
+ )
6743
+ ] }),
6744
+ draft.pageChoice === "custom" || draft.totalChoice === "custom" ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6745
+ "\u9875\u7801\uFF1A",
6746
+ "{current}\u3001{totalPages}",
6747
+ "\uFF1B\u603B\u6761\u6570\uFF1A",
6748
+ "{total}\u3001{start}\u3001{end}"
6749
+ ] }) : null,
6750
+ /* @__PURE__ */ jsxRuntime.jsxs("details", { children: [
6751
+ /* @__PURE__ */ jsxRuntime.jsx("summary", { children: "\u9AD8\u7EA7\u8BBE\u7F6E" }),
6752
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6753
+ input("\u6BCF\u9875\u6761\u6570\u5019\u9009", "candidates"),
6754
+ input("\u6700\u5C0F\u6BCF\u9875\u6761\u6570", "minPageSize"),
6755
+ input("\u6700\u5927\u6BCF\u9875\u6761\u6570", "maxPageSize")
6756
+ ] }),
6757
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-grid", children: [
6758
+ check(
6759
+ "\u5141\u8BB8\u624B\u8F93\u6BCF\u9875\u6761\u6570",
6760
+ "allowPageSizeInput",
6761
+ !draft.config.showSizeChanger
6762
+ ),
6763
+ check("\u7981\u7528\u5206\u9875\u64CD\u4F5C", "disabled")
6764
+ ] })
6765
+ ] })
6766
+ ] }) : null
6767
+ ] }),
6768
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
6769
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-enable react-list-table-pagination-config-cache", children: [
6770
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "react-list-table-pagination-config-check", children: [
6771
+ /* @__PURE__ */ jsxRuntime.jsx(
6772
+ "input",
6773
+ {
6774
+ type: "checkbox",
6775
+ "aria-label": "\u7F13\u5B58\u5230\u672C\u5730",
6776
+ checked: draft.cacheEnabled,
6777
+ onChange: (event) => patch({ cacheEnabled: event.target.checked })
6778
+ }
6779
+ ),
6780
+ "\u7F13\u5B58\u5230\u672C\u5730"
6781
+ ] }),
6782
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-cache-scope", children: /* @__PURE__ */ jsxRuntime.jsx(
6783
+ reactComponents.ReactSelect,
6784
+ {
6785
+ "aria-label": "\u7F13\u5B58\u8303\u56F4",
6786
+ disabled: !draft.cacheEnabled,
6787
+ value: draft.cacheScope,
6788
+ options: [
6789
+ {
6790
+ value: "table",
6791
+ label: "\u5F53\u524D\u8868\u683C",
6792
+ disabled: !props.snapshot.cache?.currentTableAvailable
6793
+ },
6794
+ { value: "all", label: "\u6240\u6709\u8868\u683C" }
6795
+ ],
6796
+ onChange: (scope) => patch({ cacheScope: scope })
6797
+ }
6798
+ ) })
6799
+ ] }),
6800
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-help", children: [
6801
+ draft.cacheScope === "all" ? "\u4F5C\u4E3A\u6240\u6709\u8868\u683C\u7684\u5171\u4EAB\u9ED8\u8BA4\u914D\u7F6E\uFF1B\u660E\u786E\u8BBE\u7F6E pagination=false \u7684\u8868\u683C\u4E0D\u4F7F\u7528\u5171\u4EAB\u7F13\u5B58\u3002\u5355\u8868\u7F13\u5B58\u4F18\u5148\u3002" : "\u4EC5\u4FDD\u5B58\u5230\u5F53\u524D\u8868\u683C\uFF1B\u9700\u8981\u7A33\u5B9A\u7684 storageKey\u3002",
6802
+ " ",
6803
+ "\u5F53\u524D\u9875\u4E0D\u7F13\u5B58\u3002"
6804
+ ] }),
6805
+ errors.cache ? /* @__PURE__ */ jsxRuntime.jsx(
6806
+ "div",
6807
+ {
6808
+ role: "alert",
6809
+ className: "react-list-table-pagination-config-error",
6810
+ children: errors.cache
6811
+ }
6812
+ ) : null
6813
+ ] }),
6814
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "react-list-table-pagination-config-preview", children: [
6815
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-help", children: "\u5206\u9875\u9884\u89C8" }),
6816
+ !draft.enabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-off", children: "\u5206\u9875\u5DF2\u5173\u95ED" }) : scroll ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-off", children: "\u6EDA\u52A8\u5230\u5E95\u90E8\u52A0\u8F7D\u4E0B\u4E00\u6279\uFF0C\u4E0D\u663E\u793A\u5206\u9875\u63A7\u4EF6" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "react-list-table-pagination-config-pager", children: /* @__PURE__ */ jsxRuntime.jsx(
6817
+ reactComponents.ReactPagination,
6818
+ {
6819
+ ...draft.config,
6820
+ allowPageSizeInput: draft.config.allowPageSizeInput ?? draft.config.showSizeChanger,
6821
+ size: resolveReactListTablePaginationLayout(
6822
+ void 0,
6823
+ draft.config.size
6824
+ ).size,
6825
+ current,
6826
+ pageSize,
6827
+ total: props.snapshot.total,
6828
+ pageSizeOptions: value ? value.pageSizeOptions : void 0,
6829
+ pageInfoText: pageFormat ? listTable.formatPaginationText(pageFormat, { current, totalPages }) : void 0,
6830
+ showTotal: typeof totalFormat === "string" ? (total, [start, end]) => listTable.formatPaginationText(totalFormat, {
6831
+ total,
6832
+ start: total ? start : 0,
6833
+ end: total ? end : 0
6834
+ }) : totalFormat === false ? void 0 : props.showTotal,
6835
+ onChange: (page) => {
6836
+ setCurrentEdited(true);
6837
+ patch({ current: String(page) });
6838
+ },
6839
+ onPageSizeChange: (_page, size) => patch({
6840
+ pageSize: String(size),
6841
+ ...!currentEdited ? { current: "1" } : {}
6842
+ })
6843
+ }
6844
+ ) })
6845
+ ] }),
6846
+ errors.table ? /* @__PURE__ */ jsxRuntime.jsx("div", { role: "alert", children: errors.table }) : null
6847
+ ] })
6848
+ }
6849
+ );
6850
+ }
6851
+ function usePaginationConfigDialog(request, latest, onClose) {
6852
+ const stale = !!request && !!latest && request.revision !== latest.revision;
6853
+ react.useEffect(() => {
6854
+ if (stale) {
6855
+ onClose();
6856
+ reactComponents.reactMessage.info("\u5206\u9875\u72B6\u6001\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u6253\u5F00\u914D\u7F6E");
6857
+ }
6858
+ }, [stale, onClose]);
6859
+ return request && !stale ? request : null;
6860
+ }
5298
6861
  function ReactTableDangerConfirmView(props) {
5299
6862
  const { request, onClose } = props;
5300
6863
  const confirmingRef = react.useRef(false);
@@ -5680,7 +7243,7 @@ function ToolButton(props) {
5680
7243
  }
5681
7244
  );
5682
7245
  }
5683
- function flattenColumns(columns, parentKey = "root", level = 0) {
7246
+ function flattenColumns(columns, parentKey = "root", level = 0, parentHidden = false) {
5684
7247
  return columns.flatMap((column) => {
5685
7248
  if (column.hideInSetting || listTable.isListTableColumnHiddenBySource(column)) {
5686
7249
  return [];
@@ -5690,7 +7253,7 @@ function flattenColumns(columns, parentKey = "root", level = 0) {
5690
7253
  const current = {
5691
7254
  key,
5692
7255
  label,
5693
- hidden: column.hidden === true,
7256
+ hidden: parentHidden || listTable.isListTableColumnHidden(column),
5694
7257
  parentKey,
5695
7258
  width: Number(column.width) || 160,
5696
7259
  minWidth: typeof column.minWidth === "number" ? column.minWidth : void 0,
@@ -5701,12 +7264,23 @@ function flattenColumns(columns, parentKey = "root", level = 0) {
5701
7264
  disableHide: column.disableHide === true,
5702
7265
  sortable: column.allowSort !== false && column.sorter !== false
5703
7266
  };
5704
- return column.children?.length ? [current, ...flattenColumns(column.children, key, level + 1)] : [current];
7267
+ return column.children?.length ? [
7268
+ current,
7269
+ ...flattenColumns(column.children, key, level + 1, current.hidden)
7270
+ ] : [current];
5705
7271
  });
5706
7272
  }
5707
7273
  function useReactListTableState(options) {
5708
7274
  const containerRef = react.useRef(null);
5709
7275
  const tableRef = react.useRef(null);
7276
+ const [paginationSnapshot, setPaginationSnapshot] = react.useState(null);
7277
+ const [paginationConfigRequest, setPaginationConfigRequest] = react.useState(null);
7278
+ const hadPaginationConfigRequest = react.useRef(false);
7279
+ react.useEffect(() => {
7280
+ if (hadPaginationConfigRequest.current && !paginationConfigRequest)
7281
+ containerRef.current?.querySelector("canvas")?.focus();
7282
+ hadPaginationConfigRequest.current = !!paginationConfigRequest;
7283
+ }, [paginationConfigRequest]);
5710
7284
  const [editorRequest, setEditorRequest] = react.useState(null);
5711
7285
  const [paginationConfig, setPaginationConfig] = react.useState(null);
5712
7286
  const [tooltipRequest, setTooltipRequest] = react.useState(null);
@@ -5721,6 +7295,15 @@ function useReactListTableState(options) {
5721
7295
  const uiOptions = react.useMemo(
5722
7296
  () => ({
5723
7297
  ...options.ui,
7298
+ onOpenPaginationConfig: () => {
7299
+ const snapshot = tableRef.current?.getPaginationConfig();
7300
+ if (snapshot) setPaginationConfigRequest(snapshot);
7301
+ options.ui?.onOpenPaginationConfig?.();
7302
+ },
7303
+ onPaginationConfigRender: (snapshot) => {
7304
+ setPaginationSnapshot(snapshot);
7305
+ options.ui?.onPaginationConfigRender?.(snapshot);
7306
+ },
5724
7307
  onExportNameRequest: (request) => {
5725
7308
  setExportNameRequest(request);
5726
7309
  options.ui?.onExportNameRequest?.(request);
@@ -5787,6 +7370,8 @@ function useReactListTableState(options) {
5787
7370
  appliedOptionsRef.current = null;
5788
7371
  setEditorRequest(null);
5789
7372
  setPaginationConfig(null);
7373
+ setPaginationSnapshot(null);
7374
+ setPaginationConfigRequest(null);
5790
7375
  setTooltipRequest(null);
5791
7376
  setLoadingRequest(null);
5792
7377
  setFilterPanelRequest(null);
@@ -5811,6 +7396,9 @@ function useReactListTableState(options) {
5811
7396
  return {
5812
7397
  containerRef,
5813
7398
  tableRef,
7399
+ paginationSnapshot,
7400
+ paginationConfigRequest,
7401
+ closePaginationConfigRequest: () => setPaginationConfigRequest(null),
5814
7402
  editorRequest,
5815
7403
  paginationConfig,
5816
7404
  tooltipRequest,
@@ -5892,7 +7480,7 @@ function useStableTableProps(props) {
5892
7480
  }
5893
7481
  return handler;
5894
7482
  };
5895
- for (const key of ["onChange"]) {
7483
+ for (const key of ["onChange", "onPaginationConfigChange"]) {
5896
7484
  if (typeof props[key] === "function") next[key] = event(void 0, key);
5897
7485
  }
5898
7486
  for (const key of CONFIG_KEYS) {
@@ -5983,7 +7571,7 @@ function applyColumnManagerState(columns, visibility, orders, config, parentKey
5983
7571
  const managedConfig = config.get(key);
5984
7572
  return {
5985
7573
  ...column,
5986
- hidden: listTable.isListTableColumnHiddenBySource(column) ? true : visibility.has(key) ? visibility.get(key) === false : column.hidden ?? column.initialHide,
7574
+ visible: visibility.has(key) ? visibility.get(key) !== false : column.visible !== false,
5987
7575
  width: managedConfig?.width ?? column.width,
5988
7576
  minWidth: column.minWidth,
5989
7577
  maxWidth: column.maxWidth,
@@ -5998,6 +7586,44 @@ function applyColumnManagerState(columns, visibility, orders, config, parentKey
5998
7586
  };
5999
7587
  });
6000
7588
  }
7589
+ function updateColumnManagerVisibility(columns, current, columnKey, visible) {
7590
+ const next = new Map(current);
7591
+ const setSubtree = (column) => {
7592
+ if (column.hidden === true || !visible && column.disableHide) return;
7593
+ next.set(resolveColumnKey(column), visible);
7594
+ column.children?.forEach(setSubtree);
7595
+ };
7596
+ const visit = (items, ancestors) => {
7597
+ for (const column of items) {
7598
+ if (column.hidden === true) continue;
7599
+ if (resolveColumnKey(column) === columnKey) {
7600
+ if (!visible && column.disableHide) return false;
7601
+ if (visible)
7602
+ ancestors.forEach(
7603
+ (parent) => next.set(resolveColumnKey(parent), true)
7604
+ );
7605
+ setSubtree(column);
7606
+ return true;
7607
+ }
7608
+ if (column.children && visit(column.children, [...ancestors, column]))
7609
+ return true;
7610
+ }
7611
+ return false;
7612
+ };
7613
+ visit(columns, []);
7614
+ return next;
7615
+ }
7616
+ function getColumnManagerVisibility(columns) {
7617
+ const result = /* @__PURE__ */ new Map();
7618
+ const visit = (items) => {
7619
+ for (const column of items) {
7620
+ result.set(resolveColumnKey(column), column.visible !== false);
7621
+ if (column.children) visit(column.children);
7622
+ }
7623
+ };
7624
+ visit(columns);
7625
+ return result;
7626
+ }
6001
7627
  function normalizeUniqueColumnKeys(columns) {
6002
7628
  const usedKeys = /* @__PURE__ */ new Set();
6003
7629
  const reservedKeys = /* @__PURE__ */ new Set();
@@ -6064,6 +7690,7 @@ function getColumnSettingsSignature(columns) {
6064
7690
  dataIndex: column.dataIndex,
6065
7691
  userDefined: column.userDefined,
6066
7692
  hidden: column.hidden,
7693
+ visible: column.visible,
6067
7694
  width: column.width,
6068
7695
  minWidth: column.minWidth,
6069
7696
  maxWidth: column.maxWidth,
@@ -6095,6 +7722,7 @@ function ReactListTableInner(props, ref) {
6095
7722
  rowKey,
6096
7723
  columns,
6097
7724
  showCollapsedColumnIcon,
7725
+ showHeaderActions,
6098
7726
  dataSource,
6099
7727
  loading,
6100
7728
  onRow,
@@ -6115,6 +7743,7 @@ function ReactListTableInner(props, ref) {
6115
7743
  rowSelection,
6116
7744
  expandable,
6117
7745
  pagination,
7746
+ onPaginationConfigChange,
6118
7747
  scrollbar,
6119
7748
  stickToBottom,
6120
7749
  carouselScroll,
@@ -6140,9 +7769,17 @@ function ReactListTableInner(props, ref) {
6140
7769
  () => resolveReactListTableDebugOptions(debug, inheritedDebugEnabled),
6141
7770
  [debug, inheritedDebugEnabled]
6142
7771
  );
7772
+ const activeStorageKey = react.useRef(storageKey);
7773
+ react.useLayoutEffect(() => {
7774
+ activeStorageKey.current = storageKey;
7775
+ }, [storageKey]);
6143
7776
  const shellRef = react.useRef(null);
6144
7777
  const [isFullscreen, setIsFullscreen] = react.useState(false);
6145
- const [scrollbarOverride, setScrollbarOverride] = react.useState(null);
7778
+ const [paginationHeight, setPaginationHeight] = react.useState(0);
7779
+ const [scrollbarOverride, setScrollbarOverride] = useStorageKeyState(
7780
+ storageKey,
7781
+ () => null
7782
+ );
6146
7783
  const [sharedScrollbar, setSharedScrollbar] = react.useState(
6147
7784
  reactComponents.getSharedScrollbarSettings
6148
7785
  );
@@ -6153,12 +7790,10 @@ function ReactListTableInner(props, ref) {
6153
7790
  []
6154
7791
  );
6155
7792
  const effectiveScrollbar = sharedScrollbar.shared ? sharedScrollbar.value : scrollbarOverride ?? scrollbar;
6156
- const [densityOverride, setDensityOverride] = react.useState(null);
6157
- const [columnVisibility, setColumnVisibility] = react.useState(() => /* @__PURE__ */ new Map());
6158
- const [columnOrders, setColumnOrders] = react.useState(
6159
- () => /* @__PURE__ */ new Map()
6160
- );
6161
- const [columnConfig, setColumnConfig] = react.useState(() => /* @__PURE__ */ new Map());
7793
+ const [densityOverride, setDensityOverride] = useStorageKeyState(storageKey, () => null);
7794
+ const [columnVisibility, setColumnVisibility] = react.useState(() => ({ storageKey, values: /* @__PURE__ */ new Map() }));
7795
+ const [columnOrders, setColumnOrders] = useStorageKeyState(storageKey, () => /* @__PURE__ */ new Map());
7796
+ const [columnConfig, setColumnConfig] = useStorageKeyState(storageKey, () => /* @__PURE__ */ new Map());
6162
7797
  const restoredColumnTreeRef = react.useRef(null);
6163
7798
  const [restoredColumnTree, setRestoredColumnTree] = react.useState(
6164
7799
  restoredColumnTreeRef.current
@@ -6175,7 +7810,7 @@ function ReactListTableInner(props, ref) {
6175
7810
  const resolvedColumns = react.useMemo(
6176
7811
  () => applyColumnManagerState(
6177
7812
  restoredColumnTree?.sourceColumns === sourceColumns && restoredColumnTree.storageKey === storageKey ? restoredColumnTree.columns : sourceColumns,
6178
- columnVisibility,
7813
+ columnVisibility.storageKey === storageKey ? columnVisibility.values : /* @__PURE__ */ new Map(),
6179
7814
  columnOrders,
6180
7815
  columnConfig
6181
7816
  ),
@@ -6197,11 +7832,13 @@ function ReactListTableInner(props, ref) {
6197
7832
  const queryRef = react.useRef(query);
6198
7833
  queryRef.current = retainEqualQueryOption(queryRef.current, query);
6199
7834
  const stableQuery = queryRef.current;
7835
+ const autoContentHeight = height == null && style?.height == null && scroll?.y == null ? (resolvedHeaderRowHeight ?? 40) + dataSource.length * (typeof resolvedRowHeight === "number" ? resolvedRowHeight : 40) + paginationHeight : void 0;
7836
+ const resolvedTableHeight = autoContentHeight ?? height;
6200
7837
  const options = react.useMemo(() => {
6201
7838
  const nextOptions = buildListTableOptions({
6202
7839
  exportOptions,
6203
7840
  width,
6204
- height,
7841
+ height: resolvedTableHeight,
6205
7842
  emptyText,
6206
7843
  scroll,
6207
7844
  locale,
@@ -6209,6 +7846,7 @@ function ReactListTableInner(props, ref) {
6209
7846
  rowKey,
6210
7847
  columns: resolvedColumns,
6211
7848
  showCollapsedColumnIcon,
7849
+ showHeaderActions,
6212
7850
  dataSource,
6213
7851
  loading,
6214
7852
  onRow,
@@ -6229,6 +7867,7 @@ function ReactListTableInner(props, ref) {
6229
7867
  rowSelection,
6230
7868
  expandable,
6231
7869
  pagination,
7870
+ onPaginationConfigChange,
6232
7871
  scrollbar: effectiveScrollbar,
6233
7872
  stickToBottom,
6234
7873
  carouselScroll,
@@ -6257,6 +7896,7 @@ function ReactListTableInner(props, ref) {
6257
7896
  onDensityChange: setDensityOverride,
6258
7897
  onScrollbarChange: setScrollbarOverride,
6259
7898
  onColumnSettingsChange: (restoredColumns, source) => {
7899
+ if (activeStorageKey.current !== storageKey) return;
6260
7900
  const signature = getColumnSettingsSignature(restoredColumns);
6261
7901
  const current = restoredColumnTreeRef.current;
6262
7902
  if (current?.sourceColumns === sourceColumns && current.storageKey === storageKey && current.signature === signature)
@@ -6269,24 +7909,33 @@ function ReactListTableInner(props, ref) {
6269
7909
  };
6270
7910
  restoredColumnTreeRef.current = next;
6271
7911
  setRestoredColumnTree(next);
7912
+ setColumnVisibility({
7913
+ storageKey,
7914
+ values: getColumnManagerVisibility(restoredColumns)
7915
+ });
6272
7916
  setColumnOrders(getColumnManagerOrders(restoredColumns));
6273
7917
  if (source === "restore") {
6274
- setColumnVisibility(/* @__PURE__ */ new Map());
6275
7918
  setColumnConfig(/* @__PURE__ */ new Map());
6276
7919
  }
6277
7920
  },
6278
- onColumnSettingsCacheChange: (value) => setColumnSettingsCacheOverride(
6279
- (current) => current?.storageKey === storageKey && current?.value === value ? current : { storageKey, value }
6280
- ),
6281
- onCachePreferencesChange: (next) => setCachePreferencesOverride(
6282
- (current) => current?.storageKey === storageKey && JSON.stringify(current?.value ?? {}) === JSON.stringify(next) ? current : { storageKey, value: next }
6283
- )
7921
+ onColumnSettingsCacheChange: (value) => {
7922
+ if (activeStorageKey.current !== storageKey) return;
7923
+ setColumnSettingsCacheOverride(
7924
+ (current) => current?.storageKey === storageKey && current?.value === value ? current : { storageKey, value }
7925
+ );
7926
+ },
7927
+ onCachePreferencesChange: (next) => {
7928
+ if (activeStorageKey.current !== storageKey) return;
7929
+ setCachePreferencesOverride(
7930
+ (current) => current?.storageKey === storageKey && JSON.stringify(current?.value ?? {}) === JSON.stringify(next) ? current : { storageKey, value: next }
7931
+ );
7932
+ }
6284
7933
  }
6285
7934
  };
6286
7935
  }, [
6287
7936
  exportOptions,
6288
7937
  width,
6289
- height,
7938
+ resolvedTableHeight,
6290
7939
  emptyText,
6291
7940
  scroll,
6292
7941
  locale,
@@ -6294,6 +7943,7 @@ function ReactListTableInner(props, ref) {
6294
7943
  rowKey,
6295
7944
  resolvedColumns,
6296
7945
  showCollapsedColumnIcon,
7946
+ showHeaderActions,
6297
7947
  dataSource,
6298
7948
  loading,
6299
7949
  onRow,
@@ -6314,6 +7964,7 @@ function ReactListTableInner(props, ref) {
6314
7964
  rowSelection,
6315
7965
  expandable,
6316
7966
  pagination,
7967
+ onPaginationConfigChange,
6317
7968
  effectiveScrollbar,
6318
7969
  stickToBottom,
6319
7970
  carouselScroll,
@@ -6333,6 +7984,9 @@ function ReactListTableInner(props, ref) {
6333
7984
  const {
6334
7985
  containerRef,
6335
7986
  tableRef,
7987
+ paginationSnapshot,
7988
+ paginationConfigRequest,
7989
+ closePaginationConfigRequest,
6336
7990
  editorRequest,
6337
7991
  paginationConfig,
6338
7992
  tooltipRequest,
@@ -6349,7 +8003,18 @@ function ReactListTableInner(props, ref) {
6349
8003
  } = useReactListTableState(options);
6350
8004
  const hasPagination = paginationConfig != null;
6351
8005
  const [cacheConfigOpen, setCacheConfigOpen] = react.useState(false);
6352
- const paginationLayout = resolveReactListTablePaginationLayout(resolvedRowHeight);
8006
+ const paginationLayout = resolveReactListTablePaginationLayout(
8007
+ resolvedRowHeight,
8008
+ paginationConfig?.size
8009
+ );
8010
+ react.useLayoutEffect(() => {
8011
+ setPaginationHeight(hasPagination ? paginationLayout.height : 0);
8012
+ }, [hasPagination, paginationLayout.height]);
8013
+ const paginationDialogSnapshot = usePaginationConfigDialog(
8014
+ paginationConfigRequest,
8015
+ paginationSnapshot,
8016
+ closePaginationConfigRequest
8017
+ );
6353
8018
  const portalContainer = resolveFullscreenPortalContainer(shellRef.current);
6354
8019
  const PrintHost = printIntegration?.Host;
6355
8020
  const contextMenuRequest = headerContextMenuRequest ? {
@@ -6382,6 +8047,11 @@ function ReactListTableInner(props, ref) {
6382
8047
  react.useImperativeHandle(
6383
8048
  ref,
6384
8049
  () => ({
8050
+ getPaginationConfig: () => tableRef.current?.getPaginationConfig() ?? null,
8051
+ setPaginationConfig: (value, cache) => tableRef.current?.setPaginationConfig(value, cache) ?? {
8052
+ ok: false,
8053
+ errors: { table: "\u8868\u683C\u5C1A\u672A\u6302\u8F7D" }
8054
+ },
6385
8055
  getDataSource: () => tableRef.current?.getDataSource() ?? [],
6386
8056
  getFilteredData: () => tableRef.current?.getFilteredData() ?? [],
6387
8057
  validate: () => tableRef.current?.validate() ?? Promise.resolve([]),
@@ -6397,6 +8067,19 @@ function ReactListTableInner(props, ref) {
6397
8067
  scrollTo: (options2) => {
6398
8068
  tableRef.current?.scrollTo(options2);
6399
8069
  },
8070
+ freezeRow: (targets) => {
8071
+ tableRef.current?.freezeRow(targets);
8072
+ },
8073
+ freezeRows: (targets) => {
8074
+ tableRef.current?.freezeRows(targets);
8075
+ },
8076
+ unfreezeRow: (targets) => {
8077
+ tableRef.current?.unfreezeRow(targets);
8078
+ },
8079
+ unfreezeRows: (targets) => {
8080
+ tableRef.current?.unfreezeRows(targets);
8081
+ },
8082
+ getFrozenRows: () => tableRef.current?.getFrozenRows() ?? [],
6400
8083
  getDebugSnapshot: () => tableRef.current?.getDebugSnapshot() ?? null,
6401
8084
  resetSorter: () => {
6402
8085
  tableRef.current?.resetSorter();
@@ -6458,11 +8141,15 @@ function ReactListTableInner(props, ref) {
6458
8141
  }
6459
8142
  },
6460
8143
  onColumnVisibilityChange: (columnKey, visible) => {
6461
- setColumnVisibility((current) => {
6462
- const next = new Map(current);
6463
- next.set(columnKey, visible);
6464
- return next;
6465
- });
8144
+ setColumnVisibility((current) => ({
8145
+ storageKey,
8146
+ values: updateColumnManagerVisibility(
8147
+ resolvedColumns,
8148
+ current.storageKey === storageKey ? current.values : /* @__PURE__ */ new Map(),
8149
+ columnKey,
8150
+ visible
8151
+ )
8152
+ }));
6466
8153
  setColumnConfigRevision((current) => current + 1);
6467
8154
  },
6468
8155
  onColumnOrderChange: (parentKey, orderedKeys) => {
@@ -6506,7 +8193,8 @@ function ReactListTableInner(props, ref) {
6506
8193
  storageKey,
6507
8194
  columns: initialColumns
6508
8195
  }).finally(() => {
6509
- setColumnVisibility(/* @__PURE__ */ new Map());
8196
+ if (activeStorageKey.current !== storageKey) return;
8197
+ setColumnVisibility({ storageKey, values: /* @__PURE__ */ new Map() });
6510
8198
  setColumnOrders(/* @__PURE__ */ new Map());
6511
8199
  setColumnConfig(/* @__PURE__ */ new Map());
6512
8200
  restoredColumnTreeRef.current = null;
@@ -6556,6 +8244,18 @@ function ReactListTableInner(props, ref) {
6556
8244
  ]
6557
8245
  }
6558
8246
  ),
8247
+ paginationDialogSnapshot ? /* @__PURE__ */ jsxRuntime.jsx(
8248
+ ReactListTablePaginationConfigDialog,
8249
+ {
8250
+ snapshot: paginationDialogSnapshot,
8251
+ showTotal: pagination ? pagination.showTotal : void 0,
8252
+ onConfirm: (value, cache) => tableRef.current?.setPaginationConfig(value, cache) ?? {
8253
+ ok: false,
8254
+ errors: { table: "\u8868\u683C\u5C1A\u672A\u6302\u8F7D" }
8255
+ },
8256
+ onClose: closePaginationConfigRequest
8257
+ }
8258
+ ) : null,
6559
8259
  tooltipRequest ? reactDom.createPortal(
6560
8260
  /* @__PURE__ */ jsxRuntime.jsx(reactComponents.ReactTooltip, { request: tooltipRequest }),
6561
8261
  portalContainer