@canvas-components/react-list-table 0.3.82 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +198 -15
- package/dist/index.cjs +365 -60
- package/dist/index.d.cts +42 -4
- package/dist/index.d.ts +42 -4
- package/dist/index.js +366 -62
- package/package.json +10 -8
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var react = require('react');
|
|
4
|
+
var listTable = require('@canvas-components/list-table');
|
|
5
|
+
var utils = require('@canvas-components/utils');
|
|
6
|
+
var host = require('@canvas-components/canvas-ui/host');
|
|
7
|
+
var host$1 = require('@canvas-components/react-canvas-ui/host');
|
|
4
8
|
var reactDom = require('react-dom');
|
|
5
9
|
var reactComponents = require('@canvas-components/react-components');
|
|
6
|
-
var listTable = require('@canvas-components/list-table');
|
|
7
10
|
var jsxRuntime = require('react/jsx-runtime');
|
|
8
11
|
var chart = require('@canvas-components/chart');
|
|
9
12
|
var date = require('@canvas-components/utils/date');
|
|
10
13
|
var number = require('@canvas-components/utils/number');
|
|
11
14
|
var listTablePrint = require('@canvas-components/print-design-plugin/list-table-print');
|
|
12
|
-
var utils = require('@canvas-components/utils');
|
|
13
15
|
var numberUnit = require('@canvas-components/utils/number-unit');
|
|
14
16
|
|
|
15
17
|
// #style-inject:#style-inject
|
|
@@ -39,6 +41,269 @@ styleInject(".react-list-table-host {\n touch-action: none;\n min-width: 0;\n
|
|
|
39
41
|
|
|
40
42
|
// ../print-design-plugin/dist/react.css
|
|
41
43
|
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');
|
|
44
|
+
|
|
45
|
+
// src/cell/cell-layout-bindings.ts
|
|
46
|
+
var instanceSequence = 0;
|
|
47
|
+
function dispatchCellLayoutAction(action, bindings) {
|
|
48
|
+
const binding = bindings.get(action.actionId);
|
|
49
|
+
if (!binding || binding.context.record !== action.record || binding.context.rowIndex !== action.rowIndex || binding.context.rowKey !== action.rowKey || binding.context.columnKey !== action.columnKey)
|
|
50
|
+
return;
|
|
51
|
+
binding.handler(action.event, binding.context.record);
|
|
52
|
+
}
|
|
53
|
+
function createCellLayoutBindings() {
|
|
54
|
+
const instance = ++instanceSequence;
|
|
55
|
+
const headers = /* @__PURE__ */ new WeakMap();
|
|
56
|
+
let sequence = 0;
|
|
57
|
+
let pending;
|
|
58
|
+
let current = /* @__PURE__ */ new Map();
|
|
59
|
+
let currentReleases = [];
|
|
60
|
+
const temporaryReleases = [];
|
|
61
|
+
let temporary = 0;
|
|
62
|
+
let captured;
|
|
63
|
+
const runtime = {
|
|
64
|
+
registerHeader(result) {
|
|
65
|
+
headers.set(result.document, result);
|
|
66
|
+
},
|
|
67
|
+
prepareHeader(document2, rowIndex, columnKey) {
|
|
68
|
+
if (document2.type !== "canvas-ui") return;
|
|
69
|
+
const compiled = headers.get(document2);
|
|
70
|
+
if (!compiled || !pending || temporary) return;
|
|
71
|
+
const context = {
|
|
72
|
+
record: void 0,
|
|
73
|
+
rowIndex,
|
|
74
|
+
columnKey,
|
|
75
|
+
rowKey: `@header:${columnKey}`
|
|
76
|
+
};
|
|
77
|
+
for (const [id, handler] of compiled.handlers)
|
|
78
|
+
pending.bindings.set(id, { handler, context });
|
|
79
|
+
},
|
|
80
|
+
beginFrame(id) {
|
|
81
|
+
pending?.releases.forEach((release) => release());
|
|
82
|
+
pending = { id, bindings: /* @__PURE__ */ new Map(), releases: [] };
|
|
83
|
+
},
|
|
84
|
+
publishFrame(id) {
|
|
85
|
+
if (pending?.id === id) {
|
|
86
|
+
currentReleases.forEach((release) => release());
|
|
87
|
+
currentReleases = pending.releases;
|
|
88
|
+
current = pending.bindings;
|
|
89
|
+
pending = void 0;
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
discardFrame(id) {
|
|
93
|
+
if (pending?.id === id) {
|
|
94
|
+
pending.releases.forEach((release) => release());
|
|
95
|
+
pending = void 0;
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
captureActions(actionIds) {
|
|
99
|
+
captured?.clear();
|
|
100
|
+
const bindings = /* @__PURE__ */ new Map();
|
|
101
|
+
for (const id of actionIds) {
|
|
102
|
+
const binding = current.get(id);
|
|
103
|
+
if (binding) bindings.set(id, binding);
|
|
104
|
+
}
|
|
105
|
+
captured = bindings;
|
|
106
|
+
return {
|
|
107
|
+
dispatch: (action) => dispatchCellLayoutAction(action, bindings),
|
|
108
|
+
release() {
|
|
109
|
+
bindings.clear();
|
|
110
|
+
if (captured === bindings) captured = void 0;
|
|
111
|
+
}
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
destroy() {
|
|
115
|
+
captured?.clear();
|
|
116
|
+
captured = void 0;
|
|
117
|
+
current.clear();
|
|
118
|
+
currentReleases.forEach((release) => release());
|
|
119
|
+
currentReleases = [];
|
|
120
|
+
pending?.releases.forEach((release) => release());
|
|
121
|
+
pending = void 0;
|
|
122
|
+
},
|
|
123
|
+
withTemporaryContext(work) {
|
|
124
|
+
temporary++;
|
|
125
|
+
temporaryReleases.push([]);
|
|
126
|
+
try {
|
|
127
|
+
return work();
|
|
128
|
+
} finally {
|
|
129
|
+
temporaryReleases.pop().forEach((release) => release());
|
|
130
|
+
temporary--;
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
token(context) {
|
|
134
|
+
return encodeURIComponent(
|
|
135
|
+
JSON.stringify([
|
|
136
|
+
instance,
|
|
137
|
+
temporary ? "temporary" : pending?.id ?? "temporary",
|
|
138
|
+
context.rowKey,
|
|
139
|
+
context.rowIndex,
|
|
140
|
+
context.columnKey,
|
|
141
|
+
++sequence
|
|
142
|
+
])
|
|
143
|
+
);
|
|
144
|
+
},
|
|
145
|
+
register(result, context) {
|
|
146
|
+
if (result.releaseRuntimeBindings) {
|
|
147
|
+
if (temporary)
|
|
148
|
+
temporaryReleases[temporaryReleases.length - 1].push(
|
|
149
|
+
result.releaseRuntimeBindings
|
|
150
|
+
);
|
|
151
|
+
else if (pending) pending.releases.push(result.releaseRuntimeBindings);
|
|
152
|
+
}
|
|
153
|
+
if (pending && !temporary)
|
|
154
|
+
for (const [id, handler] of result.handlers)
|
|
155
|
+
pending.bindings.set(id, { handler, context });
|
|
156
|
+
},
|
|
157
|
+
dispatch(action) {
|
|
158
|
+
dispatchCellLayoutAction(action, current);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
return runtime;
|
|
162
|
+
}
|
|
163
|
+
function useCellLayoutRuntime(options) {
|
|
164
|
+
const bindings = react.useMemo(() => createCellLayoutBindings(), []);
|
|
165
|
+
const committed = react.useRef(options);
|
|
166
|
+
const active = react.useRef(true);
|
|
167
|
+
const [error, setError] = react.useState(null);
|
|
168
|
+
react.useLayoutEffect(() => {
|
|
169
|
+
committed.current = options;
|
|
170
|
+
});
|
|
171
|
+
react.useLayoutEffect(() => {
|
|
172
|
+
active.current = true;
|
|
173
|
+
return () => {
|
|
174
|
+
active.current = false;
|
|
175
|
+
bindings.destroy();
|
|
176
|
+
};
|
|
177
|
+
}, []);
|
|
178
|
+
const runtime = react.useMemo(
|
|
179
|
+
() => ({
|
|
180
|
+
bindings,
|
|
181
|
+
register: bindings.register,
|
|
182
|
+
registerHeader: bindings.registerHeader,
|
|
183
|
+
context: (record, rowIndex, columnKey) => {
|
|
184
|
+
const context = {
|
|
185
|
+
record,
|
|
186
|
+
rowIndex,
|
|
187
|
+
columnKey,
|
|
188
|
+
rowKey: listTable.getRowKey(
|
|
189
|
+
committed.current,
|
|
190
|
+
record,
|
|
191
|
+
rowIndex
|
|
192
|
+
)
|
|
193
|
+
};
|
|
194
|
+
return {
|
|
195
|
+
...context,
|
|
196
|
+
get token() {
|
|
197
|
+
return bindings.token(context);
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
onError: (next) => {
|
|
202
|
+
if (active.current) setError(next);
|
|
203
|
+
}
|
|
204
|
+
}),
|
|
205
|
+
[]
|
|
206
|
+
);
|
|
207
|
+
if (error) throw error;
|
|
208
|
+
return runtime;
|
|
209
|
+
}
|
|
210
|
+
function compileTableUIJSX(input, context) {
|
|
211
|
+
const compiled = host$1.compileUIJSXForHost(input, context, {
|
|
212
|
+
resolveToken: () => context.token,
|
|
213
|
+
actionPrefix: "@cell",
|
|
214
|
+
unsupported(value, nodePath) {
|
|
215
|
+
const receivedType = typeof value === "function" ? Object.getOwnPropertyDescriptor(value, "name")?.value || "function" : typeof value === "string" ? value : typeof value;
|
|
216
|
+
throw new host.UIJSXTypeError(
|
|
217
|
+
`\u8BF7\u4F7F\u7528 Canvas UI \u7684 JSX \u7EC4\u4EF6\uFF0C\u6536\u5230 ${receivedType}\uFF08\u884C ${context.rowKey}\uFF0C\u5217 ${context.columnKey}\uFF0C\u8DEF\u5F84 ${nodePath}\uFF09`,
|
|
218
|
+
{ ...context, nodePath, receivedType },
|
|
219
|
+
"UI_UNSUPPORTED_JSX_TYPE"
|
|
220
|
+
);
|
|
221
|
+
},
|
|
222
|
+
split(tag, props) {
|
|
223
|
+
if (tag !== "Chart") return;
|
|
224
|
+
const split = host$1.splitUIRuntimeProps("chart", props);
|
|
225
|
+
return { ...split, hasCallbacks: split.binding.callbacks.length > 0 };
|
|
226
|
+
},
|
|
227
|
+
bind: host.bindUIRuntime,
|
|
228
|
+
validate: host.validateUILayoutDocument
|
|
229
|
+
});
|
|
230
|
+
return {
|
|
231
|
+
document: compiled.document,
|
|
232
|
+
handlers: compiled.handlers,
|
|
233
|
+
runtimeBindings: compiled.runtimeBindings,
|
|
234
|
+
releaseRuntimeBindings: compiled.releaseRuntimeBindings
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function hasTableUIJSX(value, depth = 0) {
|
|
238
|
+
if (depth > 100) throw new host.UIJSXTypeError("UI JSX \u8D85\u8FC7\u6DF1\u5EA6\u4E0A\u9650");
|
|
239
|
+
if (Array.isArray(value))
|
|
240
|
+
return value.length === 0 || value.some((node) => hasTableUIJSX(node, depth + 1));
|
|
241
|
+
return typeof value === "boolean" || !!value && typeof value === "object" && ("$$typeof" in value || "then" in value);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
// src/cell/adapt-cell-columns.ts
|
|
245
|
+
var caches = /* @__PURE__ */ new WeakMap();
|
|
246
|
+
var headerCaches = /* @__PURE__ */ new WeakMap();
|
|
247
|
+
function adaptCellColumns(columns, runtime) {
|
|
248
|
+
let cache = caches.get(runtime);
|
|
249
|
+
if (!cache) {
|
|
250
|
+
cache = /* @__PURE__ */ new WeakMap();
|
|
251
|
+
caches.set(runtime, cache);
|
|
252
|
+
}
|
|
253
|
+
function adapt(column) {
|
|
254
|
+
const { children, render, title, ...rest } = column;
|
|
255
|
+
let nativeTitle = title;
|
|
256
|
+
if (hasTableUIJSX(title)) {
|
|
257
|
+
let headers = headerCaches.get(runtime);
|
|
258
|
+
if (!headers) headerCaches.set(runtime, headers = /* @__PURE__ */ new WeakMap());
|
|
259
|
+
let cached = headers.get(column);
|
|
260
|
+
if (!cached || cached.source !== title) {
|
|
261
|
+
const columnKey = column.key?.trim() || utils.stringifyDataIndex(column.dataIndex);
|
|
262
|
+
cached = {
|
|
263
|
+
source: title,
|
|
264
|
+
compiled: compileTableUIJSX(title, {
|
|
265
|
+
record: void 0,
|
|
266
|
+
rowIndex: -1,
|
|
267
|
+
rowKey: `@header:${columnKey}`,
|
|
268
|
+
columnKey
|
|
269
|
+
})
|
|
270
|
+
};
|
|
271
|
+
headers.set(column, cached);
|
|
272
|
+
}
|
|
273
|
+
runtime.registerHeader?.(cached.compiled);
|
|
274
|
+
nativeTitle = cached.compiled.document;
|
|
275
|
+
} else if (typeof title === "number") nativeTitle = String(title);
|
|
276
|
+
let wrapped;
|
|
277
|
+
if (render) {
|
|
278
|
+
const cached = cache.get(column);
|
|
279
|
+
if (cached?.source === render) wrapped = cached.wrapped;
|
|
280
|
+
else {
|
|
281
|
+
wrapped = (value, record, rowIndex) => {
|
|
282
|
+
const result = render(value, record, rowIndex, column);
|
|
283
|
+
if (!hasTableUIJSX(result)) return result;
|
|
284
|
+
const columnKey = column.key === void 0 ? void 0 : String(column.key);
|
|
285
|
+
const context = runtime.context?.(record, rowIndex, columnKey) ?? {
|
|
286
|
+
record,
|
|
287
|
+
rowIndex,
|
|
288
|
+
columnKey
|
|
289
|
+
};
|
|
290
|
+
const compiled = compileTableUIJSX(result, context);
|
|
291
|
+
runtime.register?.(compiled, context);
|
|
292
|
+
return compiled.document;
|
|
293
|
+
};
|
|
294
|
+
cache.set(column, { source: render, wrapped });
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
return {
|
|
298
|
+
...rest,
|
|
299
|
+
title: nativeTitle,
|
|
300
|
+
...rest.settingTitle === void 0 && nativeTitle && !Array.isArray(nativeTitle) && typeof nativeTitle === "object" && (nativeTitle.type === "canvas-ui" || nativeTitle.type === "cell-layout") ? { settingTitle: listTable.getCellLayoutPlainText(nativeTitle) } : {},
|
|
301
|
+
...children ? { children: children.map(adapt) } : {},
|
|
302
|
+
...wrapped ? { render: wrapped } : {}
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
return columns.map(adapt);
|
|
306
|
+
}
|
|
42
307
|
function useStorageKeyState(storageKey, createInitial) {
|
|
43
308
|
const initial = react.useMemo(createInitial, [storageKey]);
|
|
44
309
|
const [state, setState] = react.useState(() => ({ storageKey, value: initial }));
|
|
@@ -1057,6 +1322,7 @@ function buildCacheMenuItems(request) {
|
|
|
1057
1322
|
const categories = [
|
|
1058
1323
|
["sort", "\u6392\u5E8F"],
|
|
1059
1324
|
["filter", "\u7B5B\u9009"],
|
|
1325
|
+
["filterPanelPosition", "\u8FC7\u6EE4\u9762\u677F\u4F4D\u7F6E"],
|
|
1060
1326
|
["summary", "\u6C47\u603B"],
|
|
1061
1327
|
["alignment", "\u5BF9\u9F50"],
|
|
1062
1328
|
["dataFormat", "\u683C\u5F0F"],
|
|
@@ -7151,8 +7417,10 @@ function ReactTableFilterPanelView(props) {
|
|
|
7151
7417
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
7152
7418
|
reactComponents.ReactFilterPanel,
|
|
7153
7419
|
{
|
|
7420
|
+
allowDrag: true,
|
|
7154
7421
|
request: props.request
|
|
7155
|
-
}
|
|
7422
|
+
},
|
|
7423
|
+
props.request?.columnKey
|
|
7156
7424
|
);
|
|
7157
7425
|
}
|
|
7158
7426
|
|
|
@@ -8131,8 +8399,14 @@ function useReactListTableState(options) {
|
|
|
8131
8399
|
ui: uiOptions
|
|
8132
8400
|
});
|
|
8133
8401
|
appliedOptionsRef.current = { options, uiOptions };
|
|
8134
|
-
|
|
8135
|
-
|
|
8402
|
+
try {
|
|
8403
|
+
table.mount();
|
|
8404
|
+
tableRef.current = table;
|
|
8405
|
+
} catch (error) {
|
|
8406
|
+
table.destroy();
|
|
8407
|
+
appliedOptionsRef.current = null;
|
|
8408
|
+
throw error;
|
|
8409
|
+
}
|
|
8136
8410
|
return () => {
|
|
8137
8411
|
table.destroy();
|
|
8138
8412
|
tableRef.current = null;
|
|
@@ -8279,13 +8553,14 @@ function useStableTableProps(props) {
|
|
|
8279
8553
|
}
|
|
8280
8554
|
|
|
8281
8555
|
// src/components/build-list-table-options.ts
|
|
8556
|
+
var defaultCellRuntime = {};
|
|
8282
8557
|
function resolveDensityLinkedHeight(densityOverride, configuredHeight) {
|
|
8283
8558
|
return typeof densityOverride === "number" ? densityOverride : configuredHeight;
|
|
8284
8559
|
}
|
|
8285
8560
|
function resolveFullscreenTableSize(width, height, isFullscreen) {
|
|
8286
8561
|
return isFullscreen ? { width: "100%", height: "100%" } : { width, height };
|
|
8287
8562
|
}
|
|
8288
|
-
function buildListTableOptions(props) {
|
|
8563
|
+
function buildListTableOptions(props, cellRuntime = defaultCellRuntime) {
|
|
8289
8564
|
const {
|
|
8290
8565
|
width,
|
|
8291
8566
|
height,
|
|
@@ -8294,11 +8569,13 @@ function buildListTableOptions(props) {
|
|
|
8294
8569
|
locale,
|
|
8295
8570
|
onChange,
|
|
8296
8571
|
query,
|
|
8572
|
+
columns,
|
|
8297
8573
|
...restProps
|
|
8298
8574
|
} = props;
|
|
8299
8575
|
return {
|
|
8300
8576
|
type: "list",
|
|
8301
8577
|
...restProps,
|
|
8578
|
+
columns: adaptCellColumns(columns, cellRuntime),
|
|
8302
8579
|
rowHeight: restProps.rowHeight ?? 32,
|
|
8303
8580
|
width: scroll?.x === true ? "100%" : scroll?.x ?? width,
|
|
8304
8581
|
height: scroll?.y ?? height,
|
|
@@ -8485,6 +8762,7 @@ function retainEqualQueryOption(previous, next) {
|
|
|
8485
8762
|
}
|
|
8486
8763
|
function ReactListTableInner(props, ref) {
|
|
8487
8764
|
props = useStableTableProps(props);
|
|
8765
|
+
const cellRuntime = useCellLayoutRuntime(props);
|
|
8488
8766
|
const printIntegration = useReactListTablePrintIntegration();
|
|
8489
8767
|
const {
|
|
8490
8768
|
className,
|
|
@@ -8502,6 +8780,7 @@ function ReactListTableInner(props, ref) {
|
|
|
8502
8780
|
dataSource,
|
|
8503
8781
|
loading,
|
|
8504
8782
|
onRow,
|
|
8783
|
+
onCellLayoutAction,
|
|
8505
8784
|
theme,
|
|
8506
8785
|
styles,
|
|
8507
8786
|
striped,
|
|
@@ -8616,57 +8895,61 @@ function ReactListTableInner(props, ref) {
|
|
|
8616
8895
|
const autoContentHeight = height == null && style?.height == null && scroll?.y == null ? (resolvedHeaderRowHeight ?? 40) + dataSource.length * (typeof resolvedRowHeight === "number" ? resolvedRowHeight : 40) + paginationHeight : void 0;
|
|
8617
8896
|
const resolvedTableHeight = autoContentHeight ?? height;
|
|
8618
8897
|
const options = react.useMemo(() => {
|
|
8619
|
-
const nextOptions = buildListTableOptions(
|
|
8620
|
-
|
|
8621
|
-
|
|
8622
|
-
|
|
8623
|
-
|
|
8624
|
-
|
|
8625
|
-
|
|
8626
|
-
|
|
8627
|
-
|
|
8628
|
-
|
|
8629
|
-
|
|
8630
|
-
|
|
8631
|
-
|
|
8632
|
-
|
|
8633
|
-
|
|
8634
|
-
|
|
8635
|
-
|
|
8636
|
-
|
|
8637
|
-
|
|
8638
|
-
|
|
8639
|
-
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8646
|
-
|
|
8647
|
-
|
|
8648
|
-
|
|
8649
|
-
|
|
8650
|
-
|
|
8651
|
-
|
|
8652
|
-
|
|
8653
|
-
|
|
8654
|
-
|
|
8655
|
-
|
|
8656
|
-
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8666
|
-
|
|
8667
|
-
|
|
8668
|
-
|
|
8669
|
-
|
|
8898
|
+
const nextOptions = buildListTableOptions(
|
|
8899
|
+
{
|
|
8900
|
+
exportOptions,
|
|
8901
|
+
width,
|
|
8902
|
+
height: resolvedTableHeight,
|
|
8903
|
+
emptyText,
|
|
8904
|
+
scroll,
|
|
8905
|
+
locale,
|
|
8906
|
+
onChange,
|
|
8907
|
+
rowKey,
|
|
8908
|
+
columns: resolvedColumns,
|
|
8909
|
+
showCollapsedColumnIcon,
|
|
8910
|
+
showHeaderActions,
|
|
8911
|
+
dataSource,
|
|
8912
|
+
loading,
|
|
8913
|
+
onRow,
|
|
8914
|
+
onCellLayoutAction,
|
|
8915
|
+
theme,
|
|
8916
|
+
styles,
|
|
8917
|
+
striped,
|
|
8918
|
+
highlightMode,
|
|
8919
|
+
highlight,
|
|
8920
|
+
onHighlightChange,
|
|
8921
|
+
duplicateHighlight,
|
|
8922
|
+
onDuplicateHighlightChange,
|
|
8923
|
+
keyboardNavigation,
|
|
8924
|
+
contextMenu,
|
|
8925
|
+
grouping,
|
|
8926
|
+
rowHeight: resolvedRowHeight,
|
|
8927
|
+
headerRowHeight: resolvedHeaderRowHeight,
|
|
8928
|
+
summaryRowHeight: resolvedSummaryRowHeight,
|
|
8929
|
+
overscanRowCount,
|
|
8930
|
+
query: stableQuery,
|
|
8931
|
+
experimental,
|
|
8932
|
+
rowSelector,
|
|
8933
|
+
rowSelection,
|
|
8934
|
+
expandable,
|
|
8935
|
+
pagination,
|
|
8936
|
+
onPaginationConfigChange,
|
|
8937
|
+
scrollbar: effectiveScrollbar,
|
|
8938
|
+
stickToBottom,
|
|
8939
|
+
editClickCount,
|
|
8940
|
+
carouselScroll,
|
|
8941
|
+
stretchColumns,
|
|
8942
|
+
resizable,
|
|
8943
|
+
storageKey,
|
|
8944
|
+
cacheColumnSettings: resolvedColumnSettingsCache,
|
|
8945
|
+
cachePreferences: resolvedCachePreferences,
|
|
8946
|
+
draggable,
|
|
8947
|
+
tableId,
|
|
8948
|
+
rowDrag,
|
|
8949
|
+
debug: resolvedDebug
|
|
8950
|
+
},
|
|
8951
|
+
cellRuntime
|
|
8952
|
+
);
|
|
8670
8953
|
const fullscreenSize = resolveFullscreenTableSize(
|
|
8671
8954
|
nextOptions.width,
|
|
8672
8955
|
nextOptions.height,
|
|
@@ -8674,15 +8957,34 @@ function ReactListTableInner(props, ref) {
|
|
|
8674
8957
|
);
|
|
8675
8958
|
return {
|
|
8676
8959
|
...nextOptions,
|
|
8960
|
+
onCellLayoutAction: (action) => {
|
|
8961
|
+
if (action.actionId.startsWith("@cell/"))
|
|
8962
|
+
cellRuntime.bindings.dispatch(action);
|
|
8963
|
+
else nextOptions.onCellLayoutAction?.(action);
|
|
8964
|
+
},
|
|
8677
8965
|
...fullscreenSize,
|
|
8678
8966
|
columnConfigRevision,
|
|
8679
8967
|
columnConfigResetRevision,
|
|
8680
8968
|
ui: {
|
|
8681
8969
|
...nextOptions.ui,
|
|
8970
|
+
cellLayoutBindings: cellRuntime.bindings,
|
|
8971
|
+
onCellLayoutError: cellRuntime.onError,
|
|
8682
8972
|
onDensityChange: setDensityOverride,
|
|
8683
8973
|
onScrollbarChange: setScrollbarOverride,
|
|
8684
|
-
onColumnSettingsChange: (
|
|
8974
|
+
onColumnSettingsChange: (restoredCoreColumns, source) => {
|
|
8685
8975
|
if (activeStorageKey.current !== storageKey) return;
|
|
8976
|
+
const sources = /* @__PURE__ */ new Map();
|
|
8977
|
+
const collect = (items) => items.forEach((column) => {
|
|
8978
|
+
sources.set(String(column.key ?? column.dataIndex), column);
|
|
8979
|
+
if (column.children) collect(column.children);
|
|
8980
|
+
});
|
|
8981
|
+
collect(sourceColumns);
|
|
8982
|
+
const restore = (items) => items.map((column) => ({
|
|
8983
|
+
...column,
|
|
8984
|
+
render: sources.get(String(column.key ?? column.dataIndex))?.render,
|
|
8985
|
+
children: column.children ? restore(column.children) : void 0
|
|
8986
|
+
}));
|
|
8987
|
+
const restoredColumns = restore(restoredCoreColumns);
|
|
8686
8988
|
const signature = getColumnSettingsSignature(restoredColumns);
|
|
8687
8989
|
const current = restoredColumnTreeRef.current;
|
|
8688
8990
|
if (current?.sourceColumns === sourceColumns && current.storageKey === storageKey && current.signature === signature)
|
|
@@ -8719,6 +9021,7 @@ function ReactListTableInner(props, ref) {
|
|
|
8719
9021
|
}
|
|
8720
9022
|
};
|
|
8721
9023
|
}, [
|
|
9024
|
+
cellRuntime,
|
|
8722
9025
|
exportOptions,
|
|
8723
9026
|
width,
|
|
8724
9027
|
resolvedTableHeight,
|
|
@@ -8733,6 +9036,7 @@ function ReactListTableInner(props, ref) {
|
|
|
8733
9036
|
dataSource,
|
|
8734
9037
|
loading,
|
|
8735
9038
|
onRow,
|
|
9039
|
+
onCellLayoutAction,
|
|
8736
9040
|
theme,
|
|
8737
9041
|
styles,
|
|
8738
9042
|
striped,
|
|
@@ -8928,7 +9232,7 @@ function ReactListTableInner(props, ref) {
|
|
|
8928
9232
|
cacheColumnSettings: Boolean(storageKey) && resolvedColumnSettingsCache,
|
|
8929
9233
|
columnSettingsCacheAvailable: Boolean(storageKey),
|
|
8930
9234
|
onColumnSettingsCacheChange: (enabled) => tableRef.current?.setColumnSettingsCache(enabled),
|
|
8931
|
-
columns:
|
|
9235
|
+
columns: options.columns,
|
|
8932
9236
|
sortState: toolbarSortState,
|
|
8933
9237
|
onColumnSettingsOpen: () => setToolbarSortState(tableRef.current?.getSortState() ?? []),
|
|
8934
9238
|
onColumnSortChange: (columnKey, order) => {
|
|
@@ -8997,7 +9301,7 @@ function ReactListTableInner(props, ref) {
|
|
|
8997
9301
|
);
|
|
8998
9302
|
void listTable.resetListTableStoredColumnConfig({
|
|
8999
9303
|
storageKey,
|
|
9000
|
-
columns: initialColumns
|
|
9304
|
+
columns: adaptCellColumns(initialColumns, {})
|
|
9001
9305
|
}).finally(() => {
|
|
9002
9306
|
if (activeStorageKey.current !== storageKey) return;
|
|
9003
9307
|
setColumnVisibility({ storageKey, values: /* @__PURE__ */ new Map() });
|
|
@@ -9172,4 +9476,5 @@ exports.ReactListTable = ReactListTable;
|
|
|
9172
9476
|
exports.ReactListTableDebugProvider = ReactListTableDebugProvider;
|
|
9173
9477
|
exports.ReactListTableExportNameDialog = ReactListTableExportNameDialog;
|
|
9174
9478
|
exports.ReactListTablePrintProvider = ReactListTablePrintProvider;
|
|
9479
|
+
exports.adaptCellColumns = adaptCellColumns;
|
|
9175
9480
|
exports.defineReactListTablePrintIntegration = defineReactListTablePrintIntegration;
|