@carbon/ai-chat-components 0.5.0 → 0.6.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +9201 -295
- package/dist/16-dhcD1XnN.js +91 -0
- package/dist/apl-DqFn9Cbk.js +91 -0
- package/dist/asciiarmor-CQVR_D9L.js +91 -0
- package/dist/asn1-Bdl290ll.js +91 -0
- package/dist/asterisk-CHhwduFx.js +91 -0
- package/dist/button-C7jiyqgq.js +157 -0
- package/dist/button-skeleton-CmP7IJd9.js +116 -0
- package/dist/carbon-element-Bx5dT_rO.js +91 -0
- package/dist/carbon-element-GZbOyRvd.js +91 -0
- package/dist/chain-of-thought.min.js +276 -0
- package/dist/chat-button.min.js +71 -81
- package/dist/checkbox-skeleton-DwliWSxe.js +166 -0
- package/dist/class-map-C991A_SZ.js +106 -0
- package/dist/clike-D_BRCCKx.js +91 -0
- package/dist/clojure-DJgQfSNr.js +91 -0
- package/dist/cmake-B-ZvYGPj.js +91 -0
- package/dist/cobol-DQkSt8H4.js +91 -0
- package/dist/code-snippet.min.js +91 -0
- package/dist/codemirror-runtime-BNdgITbn.js +173 -0
- package/dist/coffeescript-BLbmGaLw.js +91 -0
- package/dist/collection-helpers-CFQuvZZA.js +91 -0
- package/dist/commonlisp-C9udfub_.js +91 -0
- package/dist/crystal-Cx264mZy.js +91 -0
- package/dist/css-C3wBe_UD.js +91 -0
- package/dist/custom-element-Cn0sJQhF.js +96 -0
- package/dist/cypher-B6v9gzB5.js +91 -0
- package/dist/d-TP3OUaM_.js +91 -0
- package/dist/diff-Y92SrBOy.js +91 -0
- package/dist/dockerfile-b9e_zbYe.js +91 -0
- package/dist/dtd-CyzcM_UR.js +91 -0
- package/dist/dylan-CLgWKLaP.js +91 -0
- package/dist/ebnf-Cj21Kqae.js +91 -0
- package/dist/ecl-BcwtDAaq.js +91 -0
- package/dist/eiffel-Dgs2eMt8.js +91 -0
- package/dist/elm-Lz8luKdH.js +91 -0
- package/dist/erlang-M1-xYwsL.js +91 -0
- package/dist/factor-DMuLpKP7.js +91 -0
- package/dist/fcl-6D51jO4g.js +91 -0
- package/dist/feedback.min.js +300 -0
- package/dist/forth-C50AZvgy.js +91 -0
- package/dist/fortran-Dpu0QrPi.js +91 -0
- package/dist/gas-B9QnMcpy.js +91 -0
- package/dist/gherkin-DTyHG7By.js +91 -0
- package/dist/groovy-C5hIRvZS.js +91 -0
- package/dist/haskell-riE-Rg6U.js +91 -0
- package/dist/haxe-BKi5Bt6T.js +91 -0
- package/dist/http-CCf5f1Lw.js +91 -0
- package/dist/icon-button-slcp5_YI.js +143 -0
- package/dist/icon-loader-B470ctm0.js +101 -0
- package/dist/idl-ChujC8hT.js +91 -0
- package/dist/if-defined-KYZWA80L.js +96 -0
- package/dist/index-BE2hQiYV.js +91 -0
- package/dist/index-BJSu7ZrY.js +91 -0
- package/dist/index-BNCWBho3.js +91 -0
- package/dist/index-Bo9Cedlp.js +91 -0
- package/dist/index-BtGjzzQh.js +91 -0
- package/dist/index-BvcTcg8N.js +91 -0
- package/dist/index-CL7jwlI7.js +91 -0
- package/dist/index-CPho0oBg.js +91 -0
- package/dist/index-CSzVoPB_.js +91 -0
- package/dist/index-CbsQNetX.js +91 -0
- package/dist/index-CdZ_a1WB.js +91 -0
- package/dist/index-Ce_RTZPK.js +91 -0
- package/dist/index-Cic4krlv.js +91 -0
- package/dist/index-CqP0C8Q_.js +91 -0
- package/dist/index-CsEIBvob.js +91 -0
- package/dist/index-D5o8uLCI.js +168 -0
- package/dist/index-D8SIiSq6.js +367 -0
- package/dist/index-DP_9bMys.js +91 -0
- package/dist/index-DofS9KDk.js +91 -0
- package/dist/index-Duo7vkZg.js +91 -0
- package/dist/index-DxcNpyu9.js +91 -0
- package/dist/index-ET89Rloy.js +91 -0
- package/dist/index-LQA85hjt.js +91 -0
- package/dist/index-T4fwu_xG.js +91 -0
- package/dist/javascript-BXzknqbJ.js +91 -0
- package/dist/julia-Ks6uUXS_.js +91 -0
- package/dist/{settings-XW6XylsZ.js → lit-element-Cj6JUqRW.js} +70 -12
- package/dist/livescript-C-N_oa0B.js +91 -0
- package/dist/lua-DyvKK1uJ.js +91 -0
- package/dist/markdown.min.js +296 -0
- package/dist/mathematica-DEg7Ra1Y.js +91 -0
- package/dist/mbox-DreqCmNH.js +91 -0
- package/dist/mirc-Cf2JTO1B.js +91 -0
- package/dist/mllike-BrIsM2v2.js +91 -0
- package/dist/modelica-B8SYrhCg.js +91 -0
- package/dist/mscgen-Ci9STQqX.js +91 -0
- package/dist/mumps-DdZIEnoV.js +91 -0
- package/dist/nginx-csHLvOI4.js +91 -0
- package/dist/nsis-BJ14NiV_.js +91 -0
- package/dist/ntriples-r4TsB1vg.js +91 -0
- package/dist/octave-DAywLo7W.js +91 -0
- package/dist/oz-DF39EOLJ.js +91 -0
- package/dist/pascal-Cdx2JBFI.js +91 -0
- package/dist/perl-CUDzEjb5.js +91 -0
- package/dist/pig-BgGDN3Fs.js +91 -0
- package/dist/powershell-yf7ZzrwA.js +91 -0
- package/dist/processing.min.js +71 -4
- package/dist/properties-Cna57Jh2.js +91 -0
- package/dist/protobuf-CWUMO8BP.js +91 -0
- package/dist/pug-D44aRpDl.js +91 -0
- package/dist/puppet-9oZPpLZK.js +91 -0
- package/dist/python-BzmgDs2d.js +91 -0
- package/dist/q-DDRrIilQ.js +91 -0
- package/dist/query-CIc5rDzI.js +101 -0
- package/dist/r-DT4JIpvb.js +91 -0
- package/dist/radio-group-manager-Dy7yXQky.js +91 -0
- package/dist/reasoning-steps.min.js +171 -0
- package/dist/repeat-DA7noZfi.js +96 -0
- package/dist/rpm-Q94njsnC.js +91 -0
- package/dist/ruby-p6VwoSsc.js +91 -0
- package/dist/sas-C8r72_Ai.js +91 -0
- package/dist/scheme-Bw1qfPdY.js +91 -0
- package/dist/settings-Bx1fCry0.js +99 -0
- package/dist/shell-B0162WXP.js +91 -0
- package/dist/sieve-DcAl9TNY.js +91 -0
- package/dist/simple-mode-dBIHJK_w.js +91 -0
- package/dist/smalltalk-BRpoyy0q.js +91 -0
- package/dist/solr-CntivwdY.js +91 -0
- package/dist/sparql-CPxRv-GB.js +91 -0
- package/dist/spreadsheet-DiWzltX0.js +91 -0
- package/dist/sql-BZFWK8-D.js +91 -0
- package/dist/state-ldHJ0lGt.js +96 -0
- package/dist/stex-DVnajZzj.js +91 -0
- package/dist/stylus-BCkTgCvi.js +91 -0
- package/dist/swift-DumH6rGA.js +91 -0
- package/dist/sync-BrWXU4C6.js +91 -0
- package/dist/table-runtime-C-85Ozvo.js +510 -0
- package/dist/table.min.js +91 -0
- package/dist/tcl-Ds60z3Ro.js +91 -0
- package/dist/text-input-BNmEJ8ys.js +158 -0
- package/dist/textile-CgTb_UUX.js +91 -0
- package/dist/throttle-CT5ZAUBU.js +91 -0
- package/dist/tiddlywiki-D0BukLzX.js +91 -0
- package/dist/tiki-DlrtqA5_.js +91 -0
- package/dist/tile-container.min.js +70 -14
- package/dist/toml-CG0tgYZ1.js +91 -0
- package/dist/toolbar.min.js +180 -0
- package/dist/troff-DZdS2uzR.js +91 -0
- package/dist/ttcn-D2NdeEoM.js +91 -0
- package/dist/ttcn-cfg-dCpHFW8J.js +91 -0
- package/dist/turtle-DBImhCBD.js +91 -0
- package/dist/vb-BdASAZha.js +91 -0
- package/dist/vbscript-DlJph2V7.js +91 -0
- package/dist/velocity-ds6Akj1B.js +91 -0
- package/dist/verilog-KFajwNWD.js +91 -0
- package/dist/vhdl-DWozufY6.js +91 -0
- package/dist/webidl-BSUbcB__.js +91 -0
- package/dist/workspace-shell.min.js +162 -0
- package/dist/xquery-CvISDSSw.js +91 -0
- package/dist/yacas-BNn6e9ff.js +91 -0
- package/dist/z80-BwinLJKG.js +91 -0
- package/es/components/chain-of-thought/index.d.ts +4 -0
- package/es/components/chain-of-thought/index.js +11 -0
- package/es/components/chain-of-thought/index.js.map +1 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.d.ts +15 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js +36 -0
- package/es/components/chain-of-thought/src/cds-aichat-chain-of-thought.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.d.ts +87 -0
- package/es/components/chain-of-thought/src/chain-of-thought.js +189 -0
- package/es/components/chain-of-thought/src/chain-of-thought.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.scss.js +13 -0
- package/es/components/chain-of-thought/src/chain-of-thought.scss.js.map +1 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.d.ts +5 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.js +206 -0
- package/es/components/chain-of-thought/src/chain-of-thought.template.js.map +1 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.d.ts +10 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js +50 -0
- package/es/components/chain-of-thought/src/parse-unknown-data-to-markdown.js.map +1 -0
- package/es/components/chain-of-thought/src/types.d.ts +73 -0
- package/es/components/chain-of-thought/src/types.js +29 -0
- package/es/components/chain-of-thought/src/types.js.map +1 -0
- package/es/components/chat-button/defs.d.ts +25 -0
- package/es/components/chat-button/defs.js +36 -0
- package/es/components/chat-button/defs.js.map +1 -0
- package/es/components/chat-button/index.d.ts +1 -1
- package/es/components/chat-button/index.js +1 -1
- package/es/components/chat-button/src/chat-button.d.ts +32 -0
- package/es/components/chat-button/{chat-button.js → src/chat-button.js} +16 -10
- package/es/components/chat-button/src/chat-button.js.map +1 -0
- package/es/components/chat-button/src/chat-button.scss.js +1 -1
- package/es/components/code-snippet/index.d.ts +3 -0
- package/es/components/code-snippet/index.js +10 -0
- package/es/components/code-snippet/index.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.d.ts +32 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.js +143 -0
- package/es/components/code-snippet/src/code-snippet-tile-container.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet.d.ts +482 -0
- package/es/components/code-snippet/src/code-snippet.js +592 -0
- package/es/components/code-snippet/src/code-snippet.js.map +1 -0
- package/es/components/code-snippet/src/code-snippet.scss.js +13 -0
- package/es/components/code-snippet/src/code-snippet.scss.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/base-setup.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/base-setup.js +65 -0
- package/es/components/code-snippet/src/codemirror/base-setup.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js +36 -0
- package/es/components/code-snippet/src/codemirror/codemirror-loader.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.d.ts +7 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.js +13 -0
- package/es/components/code-snippet/src/codemirror/codemirror-runtime.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/content-sync.d.ts +12 -0
- package/es/components/code-snippet/src/codemirror/content-sync.js +72 -0
- package/es/components/code-snippet/src/codemirror/content-sync.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.d.ts +28 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.js +75 -0
- package/es/components/code-snippet/src/codemirror/editor-manager.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-controller.d.ts +38 -0
- package/es/components/code-snippet/src/codemirror/language-controller.js +220 -0
- package/es/components/code-snippet/src/codemirror/language-controller.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-data.d.ts +6 -0
- package/es/components/code-snippet/src/codemirror/language-data.js +1043 -0
- package/es/components/code-snippet/src/codemirror/language-data.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/language-utils.d.ts +79 -0
- package/es/components/code-snippet/src/codemirror/language-utils.js +219 -0
- package/es/components/code-snippet/src/codemirror/language-utils.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.d.ts +123 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.js +183 -0
- package/es/components/code-snippet/src/codemirror/marker-utils.js.map +1 -0
- package/es/components/code-snippet/src/codemirror/theme.d.ts +54 -0
- package/es/components/code-snippet/src/codemirror/theme.js +320 -0
- package/es/components/code-snippet/src/codemirror/theme.js.map +1 -0
- package/es/components/code-snippet/src/dom-utils.d.ts +24 -0
- package/es/components/code-snippet/src/dom-utils.js +63 -0
- package/es/components/code-snippet/src/dom-utils.js.map +1 -0
- package/es/components/code-snippet/src/formatters.d.ts +4 -0
- package/es/components/code-snippet/src/formatters.js +19 -0
- package/es/components/code-snippet/src/formatters.js.map +1 -0
- package/es/components/code-snippet/src/layout-utils.d.ts +22 -0
- package/es/components/code-snippet/src/layout-utils.js +63 -0
- package/es/components/code-snippet/src/layout-utils.js.map +1 -0
- package/es/components/code-snippet/src/streaming-manager.d.ts +24 -0
- package/es/components/code-snippet/src/streaming-manager.js +120 -0
- package/es/components/code-snippet/src/streaming-manager.js.map +1 -0
- package/es/components/feedback/index.d.ts +7 -0
- package/es/components/feedback/index.js +12 -0
- package/es/components/feedback/index.js.map +1 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.d.ts +15 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js +36 -0
- package/es/components/feedback/src/cds-aichat-feedback-buttons.js.map +1 -0
- package/es/components/feedback/src/cds-aichat-feedback.d.ts +15 -0
- package/es/components/feedback/src/cds-aichat-feedback.js +36 -0
- package/es/components/feedback/src/cds-aichat-feedback.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.d.ts +56 -0
- package/es/components/feedback/src/feedback-buttons.js +104 -0
- package/es/components/feedback/src/feedback-buttons.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.scss.js +13 -0
- package/es/components/feedback/src/feedback-buttons.scss.js.map +1 -0
- package/es/components/feedback/src/feedback-buttons.template.d.ts +4 -0
- package/es/components/feedback/src/feedback-buttons.template.js +79 -0
- package/es/components/feedback/src/feedback-buttons.template.js.map +1 -0
- package/es/components/feedback/src/feedback.d.ts +114 -0
- package/es/components/feedback/src/feedback.js +182 -0
- package/es/components/feedback/src/feedback.js.map +1 -0
- package/es/components/feedback/src/feedback.scss.js +13 -0
- package/es/components/feedback/src/feedback.scss.js.map +1 -0
- package/es/components/feedback/src/feedback.template.d.ts +12 -0
- package/es/components/feedback/src/feedback.template.js +115 -0
- package/es/components/feedback/src/feedback.template.js.map +1 -0
- package/es/components/markdown/index.d.ts +2 -0
- package/es/components/markdown/index.js +9 -0
- package/es/components/markdown/index.js.map +1 -0
- package/es/components/markdown/src/cds-aichat-markdown.d.ts +13 -0
- package/es/components/markdown/src/cds-aichat-markdown.js +35 -0
- package/es/components/markdown/src/cds-aichat-markdown.js.map +1 -0
- package/es/components/markdown/src/markdown-renderer.d.ts +62 -0
- package/es/components/markdown/src/markdown-renderer.js +353 -0
- package/es/components/markdown/src/markdown-renderer.js.map +1 -0
- package/es/components/markdown/src/markdown-token-tree.d.ts +32 -0
- package/es/components/markdown/src/markdown-token-tree.js +178 -0
- package/es/components/markdown/src/markdown-token-tree.js.map +1 -0
- package/es/components/markdown/src/markdown.d.ts +44 -0
- package/es/components/markdown/src/markdown.js +238 -0
- package/es/components/markdown/src/markdown.js.map +1 -0
- package/es/components/markdown/src/markdown.scss.js +13 -0
- package/es/components/markdown/src/markdown.scss.js.map +1 -0
- package/es/components/markdown/src/markdown.template.d.ts +3 -0
- package/es/components/markdown/src/markdown.template.js +24 -0
- package/es/components/markdown/src/markdown.template.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.d.ts +7 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.js +84 -0
- package/es/components/markdown/src/plugins/markdown-it-attrs.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.d.ts +7 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.js +59 -0
- package/es/components/markdown/src/plugins/markdown-it-highlight.js.map +1 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.d.ts +12 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.js +73 -0
- package/es/components/markdown/src/plugins/markdown-it-task-lists.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.d.ts +26 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.js +330 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/core.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.d.ts +6 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js +63 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/blocks.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.d.ts +6 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js +43 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/code.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.d.ts +5 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js +55 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/index.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.d.ts +19 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js +210 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/inline.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.d.ts +13 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js +156 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/lists.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.d.ts +13 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js +216 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/patterns/tables.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.d.ts +34 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.js +8 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/types.js.map +1 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.d.ts +25 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.js +62 -0
- package/es/components/markdown/src/plugins/markdownItAttrs/utils.js.map +1 -0
- package/es/components/markdown/src/utils/html-helpers.d.ts +2 -0
- package/es/components/markdown/src/utils/html-helpers.js +204 -0
- package/es/components/markdown/src/utils/html-helpers.js.map +1 -0
- package/es/components/markdown/src/utils/table-helpers.d.ts +31 -0
- package/es/components/markdown/src/utils/table-helpers.js +106 -0
- package/es/components/markdown/src/utils/table-helpers.js.map +1 -0
- package/es/components/markdown/src/utils.d.ts +8 -0
- package/es/components/markdown/src/utils.js +31 -0
- package/es/components/markdown/src/utils.js.map +1 -0
- package/es/components/reasoning-steps/index.d.ts +2 -0
- package/es/components/reasoning-steps/index.js +10 -0
- package/es/components/reasoning-steps/index.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.d.ts +29 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js +231 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-step.scss.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.d.ts +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js +96 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.js.map +1 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js +13 -0
- package/es/components/reasoning-steps/src/cds-aichat-reasoning-steps.scss.js.map +1 -0
- package/es/components/table/index.d.ts +3 -0
- package/es/components/table/index.js +9 -0
- package/es/components/table/index.js.map +1 -0
- package/es/components/table/src/cds-aichat-table.d.ts +262 -0
- package/es/components/table/src/cds-aichat-table.js +511 -0
- package/es/components/table/src/cds-aichat-table.js.map +1 -0
- package/es/components/table/src/table-loader.d.ts +4 -0
- package/es/components/table/src/table-loader.js +28 -0
- package/es/components/table/src/table-loader.js.map +1 -0
- package/es/components/table/src/table-pagination.template.d.ts +27 -0
- package/es/components/table/src/table-pagination.template.js +55 -0
- package/es/components/table/src/table-pagination.template.js.map +1 -0
- package/es/components/table/src/table-runtime.d.ts +2 -0
- package/es/components/table/src/table-runtime.js +10 -0
- package/es/components/table/src/table-runtime.js.map +1 -0
- package/es/components/table/src/table-skeleton.template.d.ts +6 -0
- package/es/components/table/src/table-skeleton.template.js +34 -0
- package/es/components/table/src/table-skeleton.template.js.map +1 -0
- package/es/components/table/src/table.scss.js +13 -0
- package/es/components/table/src/table.scss.js.map +1 -0
- package/es/components/table/src/table.template.d.ts +10 -0
- package/es/components/table/src/table.template.js +89 -0
- package/es/components/table/src/table.template.js.map +1 -0
- package/es/components/table/src/types.d.ts +13 -0
- package/es/components/table/src/types.js +8 -0
- package/es/components/table/src/types.js.map +1 -0
- package/es/components/tile-container/src/styles.scss.js +1 -1
- package/es/components/toolbar/index.d.ts +1 -0
- package/es/components/toolbar/index.js +9 -0
- package/es/components/toolbar/index.js.map +1 -0
- package/es/components/toolbar/src/toolbar.d.ts +39 -0
- package/es/components/toolbar/src/toolbar.js +179 -0
- package/es/components/toolbar/src/toolbar.js.map +1 -0
- package/es/components/toolbar/src/toolbar.scss.js +13 -0
- package/es/components/toolbar/src/toolbar.scss.js.map +1 -0
- package/es/components/workspace-shell/index.d.ts +5 -0
- package/es/components/workspace-shell/index.js +13 -0
- package/es/components/workspace-shell/index.js.map +1 -0
- package/es/components/workspace-shell/src/styles.scss.js +13 -0
- package/es/components/workspace-shell/src/styles.scss.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-body.d.ts +16 -0
- package/es/components/workspace-shell/src/workspace-shell-body.js +50 -0
- package/es/components/workspace-shell/src/workspace-shell-body.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.d.ts +19 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.js +53 -0
- package/es/components/workspace-shell/src/workspace-shell-footer.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-header.d.ts +27 -0
- package/es/components/workspace-shell/src/workspace-shell-header.js +77 -0
- package/es/components/workspace-shell/src/workspace-shell-header.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.d.ts +22 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js +61 -0
- package/es/components/workspace-shell/src/workspace-shell-toolbar.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell.d.ts +20 -0
- package/es/components/workspace-shell/src/workspace-shell.js +83 -0
- package/es/components/workspace-shell/src/workspace-shell.js.map +1 -0
- package/es/components/workspace-shell/src/workspace-shell.scss.js +13 -0
- package/es/components/workspace-shell/src/workspace-shell.scss.js.map +1 -0
- package/es/globals/utils/uuid.d.ts +5 -0
- package/es/globals/utils/uuid.js +32 -0
- package/es/globals/utils/uuid.js.map +1 -0
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js +9 -0
- package/es/node_modules/@carbon/utilities/es/documentLang/documentLang.js.map +1 -0
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js +11 -0
- package/es/node_modules/@carbon/utilities/es/overflowHandler/overflowHandler.js.map +1 -0
- package/es/node_modules/@codemirror/autocomplete/dist/index.js +258 -0
- package/es/node_modules/@codemirror/autocomplete/dist/index.js.map +1 -0
- package/es/node_modules/@codemirror/commands/dist/index.js +1140 -0
- package/es/node_modules/@codemirror/commands/dist/index.js.map +1 -0
- package/es/node_modules/@codemirror/lint/dist/index.js +636 -0
- package/es/node_modules/@codemirror/lint/dist/index.js.map +1 -0
- package/es/node_modules/@lezer/common/dist/index.js +253 -0
- package/es/node_modules/@lezer/common/dist/index.js.map +1 -0
- package/es/node_modules/crelt/index.js +37 -0
- package/es/node_modules/crelt/index.js.map +1 -0
- package/es/react/ai-label.d.ts +2 -1
- package/es/react/ai-label.js +3 -2
- package/es/react/ai-label.js.map +1 -1
- package/es/react/button.d.ts +2 -1
- package/es/react/button.js +3 -2
- package/es/react/button.js.map +1 -1
- package/es/react/chain-of-thought.d.ts +7 -0
- package/es/react/chain-of-thought.js +29 -0
- package/es/react/chain-of-thought.js.map +1 -0
- package/es/react/chat-button.d.ts +4 -4
- package/es/react/chat-button.js +6 -4
- package/es/react/chat-button.js.map +1 -1
- package/es/react/code-snippet-tile-container.d.ts +5 -0
- package/es/react/code-snippet-tile-container.js +30 -0
- package/es/react/code-snippet-tile-container.js.map +1 -0
- package/es/react/code-snippet.d.ts +4 -0
- package/es/react/code-snippet.js +31 -0
- package/es/react/code-snippet.js.map +1 -0
- package/es/react/content-switcher.d.ts +7 -0
- package/es/react/content-switcher.js +37 -0
- package/es/react/content-switcher.js.map +1 -0
- package/es/react/feedback-buttons.d.ts +4 -0
- package/es/react/feedback-buttons.js +28 -0
- package/es/react/feedback-buttons.js.map +1 -0
- package/es/react/feedback.d.ts +6 -0
- package/es/react/feedback.js +32 -0
- package/es/react/feedback.js.map +1 -0
- package/es/react/icon-button.d.ts +2 -1
- package/es/react/icon-button.js +3 -2
- package/es/react/icon-button.js.map +1 -1
- package/es/react/icon.d.ts +4 -0
- package/es/react/icon.js +28 -0
- package/es/react/icon.js.map +1 -0
- package/es/react/markdown.d.ts +4 -0
- package/es/react/markdown.js +28 -0
- package/es/react/markdown.js.map +1 -0
- package/es/react/overflow-menu.d.ts +9 -0
- package/es/react/overflow-menu.js +40 -0
- package/es/react/overflow-menu.js.map +1 -0
- package/es/react/processing.d.ts +2 -1
- package/es/react/processing.js +3 -2
- package/es/react/processing.js.map +1 -1
- package/es/react/reasoning-step.d.ts +6 -0
- package/es/react/reasoning-step.js +31 -0
- package/es/react/reasoning-step.js.map +1 -0
- package/es/react/reasoning-steps.d.ts +3 -0
- package/es/react/reasoning-steps.js +27 -0
- package/es/react/reasoning-steps.js.map +1 -0
- package/es/react/tile-container.d.ts +2 -1
- package/es/react/tile-container.js +3 -2
- package/es/react/tile-container.js.map +1 -1
- package/es/react/tile.d.ts +3 -2
- package/es/react/tile.js +5 -4
- package/es/react/tile.js.map +1 -1
- package/es/react/toolbar.d.ts +4 -0
- package/es/react/toolbar.js +28 -0
- package/es/react/toolbar.js.map +1 -0
- package/es/react/utils/withWebComponentBridge.d.ts +15 -0
- package/es/react/utils/withWebComponentBridge.js +95 -0
- package/es/react/utils/withWebComponentBridge.js.map +1 -0
- package/es/testing/load-all-lazy-deps.d.ts +10 -0
- package/es/testing/load-all-lazy-deps.js +30 -0
- package/es/testing/load-all-lazy-deps.js.map +1 -0
- package/package.json +39 -5
- package/dist/carbon-element-CMR7BOhG.js +0 -24
- package/dist/class-map-h7IEvsL_.js +0 -39
- package/es/components/chat-button/chat-button.d.ts +0 -23
- package/es/components/chat-button/chat-button.js.map +0 -1
- package/es/components/chat-button/src/chat-button.template.d.ts +0 -16
- package/es/components/chat-button/src/chat-button.template.js +0 -27
- package/es/components/chat-button/src/chat-button.template.js.map +0 -1
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { __decorate } from 'tslib';
|
|
9
|
+
import { LitElement, html } from 'lit';
|
|
10
|
+
import { property, state } from 'lit/decorators.js';
|
|
11
|
+
import { carbonElement } from '../../../globals/decorators/carbon-element.js';
|
|
12
|
+
import { tableSkeletonTemplate } from './table-skeleton.template.js';
|
|
13
|
+
import { loadTableRuntime } from './table-loader.js';
|
|
14
|
+
import styles from './table.scss.js';
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Copyright IBM Corp. 2025
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
20
|
+
* LICENSE file in the root directory of this source tree.
|
|
21
|
+
*
|
|
22
|
+
* @license
|
|
23
|
+
*/
|
|
24
|
+
// Width threshold for determining default page size. Tables wider than this get 10 rows, narrower get 5 rows.
|
|
25
|
+
const PAGE_SIZE_WIDTH_THRESHOLD = 400;
|
|
26
|
+
// We will have to give this component a unique ID on the name when we register it to avoid conflicts in a world where
|
|
27
|
+
// multiple versions of the Carbon AI Chat can be on the same page.
|
|
28
|
+
const TABLE_COMPONENT_TAG_NAME = "cds-aichat-table";
|
|
29
|
+
/**
|
|
30
|
+
* Class functionality for the Table custom element.
|
|
31
|
+
*/
|
|
32
|
+
let TableElement = class TableElement extends LitElement {
|
|
33
|
+
constructor() {
|
|
34
|
+
super(...arguments);
|
|
35
|
+
/**
|
|
36
|
+
* The array of cells for the header.
|
|
37
|
+
*/
|
|
38
|
+
this.headers = [];
|
|
39
|
+
/**
|
|
40
|
+
* The array of rows. Each row includes an array of cells.
|
|
41
|
+
*/
|
|
42
|
+
this.rows = [];
|
|
43
|
+
/**
|
|
44
|
+
* Whether or not the table content is loading. If it is then a skeleton state should be shown instead.
|
|
45
|
+
*/
|
|
46
|
+
this.loading = false;
|
|
47
|
+
/**
|
|
48
|
+
* The text used for the filter placeholder.
|
|
49
|
+
*/
|
|
50
|
+
this.filterPlaceholderText = "";
|
|
51
|
+
/**
|
|
52
|
+
* The text used for the pagination's previous button tooltip.
|
|
53
|
+
*/
|
|
54
|
+
this.previousPageText = "";
|
|
55
|
+
/**
|
|
56
|
+
* The text used for the pagination's next button tooltip.
|
|
57
|
+
*/
|
|
58
|
+
this.nextPageText = "";
|
|
59
|
+
/**
|
|
60
|
+
* The text used for the pagination's item pre page text.
|
|
61
|
+
*/
|
|
62
|
+
this.itemsPerPageText = "";
|
|
63
|
+
/**
|
|
64
|
+
* The locale. Used by the carbon table component to change the collator for sorting.
|
|
65
|
+
*/
|
|
66
|
+
this.locale = "";
|
|
67
|
+
/**
|
|
68
|
+
* The calculated default page size based on component width.
|
|
69
|
+
* 10 for width > PAGE_SIZE_WIDTH_THRESHOLD, 5 for width <= PAGE_SIZE_WIDTH_THRESHOLD.
|
|
70
|
+
*/
|
|
71
|
+
this._defaultPageSize = 5;
|
|
72
|
+
/**
|
|
73
|
+
* If the table is valid or not.
|
|
74
|
+
*/
|
|
75
|
+
this._isValid = true;
|
|
76
|
+
/**
|
|
77
|
+
* The current page of the table we're on.
|
|
78
|
+
*/
|
|
79
|
+
this._currentPageNumber = 1;
|
|
80
|
+
/**
|
|
81
|
+
* How many rows are on each page of the table.
|
|
82
|
+
*/
|
|
83
|
+
this._currentPageSize = this.defaultPageSize;
|
|
84
|
+
/**
|
|
85
|
+
* Whether or not the number of rows per page was changed with the pagination component. If the user used the
|
|
86
|
+
* pagination controls to show all rows, the pagination component would normally hide itself because the number of is
|
|
87
|
+
* no longer greater than the page size. However the pagination component needs to persist in this case, since the
|
|
88
|
+
* user may want to change the page size again. This is used to keep track of whether the pagination controls were
|
|
89
|
+
* used to change page size, and if they have, it forces pagination component to persist.
|
|
90
|
+
*/
|
|
91
|
+
this._rowsPerPageChanged = false;
|
|
92
|
+
/**
|
|
93
|
+
* The rows that have not been filtered out.
|
|
94
|
+
*/
|
|
95
|
+
this._filterVisibleRowIDs = new Set();
|
|
96
|
+
/**
|
|
97
|
+
* All of the rows for the table with IDs.
|
|
98
|
+
*/
|
|
99
|
+
this._rowsWithIDs = [];
|
|
100
|
+
/**
|
|
101
|
+
* Whether or not the table should be able to be filtered.
|
|
102
|
+
*/
|
|
103
|
+
this._allowFiltering = false;
|
|
104
|
+
this.tableRuntime = null;
|
|
105
|
+
this.tableRuntimePromise = null;
|
|
106
|
+
/**
|
|
107
|
+
* Handles pagination events from the Carbon pagination component.
|
|
108
|
+
* Updates the visible rows when the user navigates to a different page.
|
|
109
|
+
*
|
|
110
|
+
* Note: This event sometimes fires twice due to a Carbon framework quirk,
|
|
111
|
+
* but since the page/size values are identical, it doesn't affect functionality.
|
|
112
|
+
*
|
|
113
|
+
* @param event - The page change event containing the new page number and size
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
116
|
+
this._handlePageChangeEvent = (event) => {
|
|
117
|
+
this._updateVisibleRows(event.detail?.page, event.detail?.pageSize);
|
|
118
|
+
event.stopPropagation();
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Handles page size change events from the pagination component.
|
|
122
|
+
* Updates the current page size and recalculates visible rows.
|
|
123
|
+
* Marks that the page size has been manually changed by the user.
|
|
124
|
+
*
|
|
125
|
+
* @param event - The page size change event containing the new page size
|
|
126
|
+
* @public
|
|
127
|
+
*/
|
|
128
|
+
this._handlePageSizeChangeEvent = (event) => {
|
|
129
|
+
this._rowsPerPageChanged = true;
|
|
130
|
+
this._currentPageSize = event.detail?.pageSize;
|
|
131
|
+
this._updateVisibleRows();
|
|
132
|
+
event.stopPropagation();
|
|
133
|
+
};
|
|
134
|
+
/**
|
|
135
|
+
* Handles filter and sort events from the Carbon table component.
|
|
136
|
+
* Updates the set of visible rows based on filtering/sorting results and resets to the first page.
|
|
137
|
+
*
|
|
138
|
+
* This event is triggered by:
|
|
139
|
+
* - Column sorting (clicking on sortable column headers)
|
|
140
|
+
* - Table filtering (using the search bar)
|
|
141
|
+
*
|
|
142
|
+
* @param event - The filter event containing the array of unfiltered rows
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
this._handleFilterEvent = (event) => {
|
|
146
|
+
// Record the new set of unfiltered row ids.
|
|
147
|
+
this._filterVisibleRowIDs = new Set(event?.detail?.unfilteredRows.map((row) => row.id));
|
|
148
|
+
// Go back to the first page.
|
|
149
|
+
this._currentPageNumber = 1;
|
|
150
|
+
// Update which rows are visible.
|
|
151
|
+
this._updateVisibleRows();
|
|
152
|
+
event.stopPropagation();
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
get defaultPageSize() {
|
|
156
|
+
return this._defaultPageSize;
|
|
157
|
+
}
|
|
158
|
+
set defaultPageSize(value) {
|
|
159
|
+
this._defaultPageSize = value;
|
|
160
|
+
}
|
|
161
|
+
connectedCallback() {
|
|
162
|
+
super.connectedCallback();
|
|
163
|
+
void this.ensureTableRuntime();
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Called after the element's DOM has been updated for the first time.
|
|
167
|
+
* Initializes the table page size.
|
|
168
|
+
*
|
|
169
|
+
* @param _changedProperties - Map of properties that changed during the update
|
|
170
|
+
*/
|
|
171
|
+
async firstUpdated(_changedProperties) {
|
|
172
|
+
await this.updateComplete;
|
|
173
|
+
this._updateDefaultPageSize();
|
|
174
|
+
this._setPageSize();
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Updates the CSS custom property `--cds-chat-table-width` based on the parent element's width.
|
|
178
|
+
* Also calculates the default page size on first run based on the measured width.
|
|
179
|
+
* This method is called once during component initialization.
|
|
180
|
+
*
|
|
181
|
+
* @private
|
|
182
|
+
*/
|
|
183
|
+
_updateDefaultPageSize() {
|
|
184
|
+
if (this.parentElement) {
|
|
185
|
+
let parentWidth = this.parentElement.offsetWidth;
|
|
186
|
+
// If parent width is 0, use fallback width that ensures 5-row default page size
|
|
187
|
+
if (parentWidth === 0) {
|
|
188
|
+
parentWidth = PAGE_SIZE_WIDTH_THRESHOLD - 1;
|
|
189
|
+
}
|
|
190
|
+
// Calculate default page size based on the width we just measured
|
|
191
|
+
// Only set it once, don't recalculate on resize
|
|
192
|
+
if (parentWidth > 0 && this._defaultPageSize === 5) {
|
|
193
|
+
this._defaultPageSize =
|
|
194
|
+
parentWidth > PAGE_SIZE_WIDTH_THRESHOLD ? 10 : 5;
|
|
195
|
+
// Update _currentPageSize if it's still at the initial value
|
|
196
|
+
if (this._currentPageSize === 5) {
|
|
197
|
+
this._currentPageSize = this._defaultPageSize;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Called before the element updates to prepare state changes.
|
|
204
|
+
* Handles validation and re-initialization of table data when headers or rows change.
|
|
205
|
+
*
|
|
206
|
+
* @param changedProperties - Map of properties that changed during the update
|
|
207
|
+
* @protected
|
|
208
|
+
*/
|
|
209
|
+
willUpdate(changedProperties) {
|
|
210
|
+
// If the headers or rows has recently updated and both are defined than we should validate the table
|
|
211
|
+
// data. This will likely only happen on the web components first render cycle when the props go from undefined to
|
|
212
|
+
// defined.
|
|
213
|
+
if ((changedProperties.has("headers") || changedProperties.has("rows")) &&
|
|
214
|
+
this.headers !== undefined &&
|
|
215
|
+
this.rows !== undefined) {
|
|
216
|
+
this._calcIsTableValid();
|
|
217
|
+
}
|
|
218
|
+
// If the value of tableRows updated then initialize the internal rows arrays.
|
|
219
|
+
if (changedProperties.has("rows") && this.rows !== undefined) {
|
|
220
|
+
this._initializeRowsArrays();
|
|
221
|
+
this._setPageSize();
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Validates the table structure by checking if all rows have the same number of cells as the header.
|
|
226
|
+
* Sets the internal `_isValid` state to false if any row has a mismatched cell count.
|
|
227
|
+
*
|
|
228
|
+
* A valid table requires:
|
|
229
|
+
* - All rows must have the same number of cells as there are headers
|
|
230
|
+
* - No rows can have more or fewer cells than the column count
|
|
231
|
+
*
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
_calcIsTableValid() {
|
|
235
|
+
const columnCount = this.headers.length;
|
|
236
|
+
// If one of the rows has a different number of cells than the number of columns in the header then set our internal
|
|
237
|
+
// valid state to false.
|
|
238
|
+
this._isValid = !this.rows.some((row) => row.cells.length !== columnCount);
|
|
239
|
+
// In the future, once we have an inlineError web component to use, we can render that when our table is not valid
|
|
240
|
+
// (as well as throwing the below error). Until then our React container is rendering the error component and
|
|
241
|
+
// throwing the error.
|
|
242
|
+
// throw new Error(
|
|
243
|
+
// `${WA_CONSOLE_PREFIX} Number of cells in the table header does not match the number of cells in one or more of the table rows. In order to render a table there needs to be the same number of columns in the table header and all of the table rows.`,
|
|
244
|
+
// );
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Initializes internal arrays used for table functionality.
|
|
248
|
+
* Creates a new array of rows with unique IDs and initializes the filter visibility tracking.
|
|
249
|
+
*
|
|
250
|
+
* This method:
|
|
251
|
+
* 1. Resets the `_rowsWithIDs` array and `_filterVisibleRowIDs` set
|
|
252
|
+
* 2. Assigns string-based IDs to each row for tracking purposes
|
|
253
|
+
* 3. Marks all rows as initially visible (not filtered out)
|
|
254
|
+
*
|
|
255
|
+
* @private
|
|
256
|
+
*/
|
|
257
|
+
_initializeRowsArrays() {
|
|
258
|
+
// Reset both arrays.
|
|
259
|
+
this._rowsWithIDs = [];
|
|
260
|
+
this._filterVisibleRowIDs = new Set();
|
|
261
|
+
this.rows.forEach((row, index) => {
|
|
262
|
+
const id = index.toString();
|
|
263
|
+
this._rowsWithIDs.push({ ...row, id });
|
|
264
|
+
this._filterVisibleRowIDs.add(id);
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Configures the table's page size and filtering behavior.
|
|
269
|
+
* Determines whether filtering/searching should be enabled based on the number of rows
|
|
270
|
+
* relative to the current page size.
|
|
271
|
+
*
|
|
272
|
+
* Filtering is enabled when there are more rows than can fit on a single page,
|
|
273
|
+
* allowing users to search and paginate through large datasets.
|
|
274
|
+
*
|
|
275
|
+
* @private
|
|
276
|
+
*/
|
|
277
|
+
_setPageSize() {
|
|
278
|
+
// If there are more rows than the page size then enable filtering.
|
|
279
|
+
this._allowFiltering = this.rows.length > this._currentPageSize;
|
|
280
|
+
// Update the visible rows in case the page size has changed or this is the first time this web component has
|
|
281
|
+
// rendered.
|
|
282
|
+
this._updateVisibleRows();
|
|
283
|
+
}
|
|
284
|
+
async ensureTableRuntime() {
|
|
285
|
+
if (this.tableRuntime) {
|
|
286
|
+
return this.tableRuntime;
|
|
287
|
+
}
|
|
288
|
+
if (typeof window === "undefined") {
|
|
289
|
+
return null;
|
|
290
|
+
}
|
|
291
|
+
if (!this.tableRuntimePromise) {
|
|
292
|
+
this.tableRuntimePromise = loadTableRuntime();
|
|
293
|
+
}
|
|
294
|
+
try {
|
|
295
|
+
const runtime = await this.tableRuntimePromise;
|
|
296
|
+
this.tableRuntime = runtime;
|
|
297
|
+
this.requestUpdate();
|
|
298
|
+
return runtime;
|
|
299
|
+
}
|
|
300
|
+
catch (error) {
|
|
301
|
+
console.error("Failed to load table runtime", error);
|
|
302
|
+
this.tableRuntimePromise = null;
|
|
303
|
+
return null;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Controls which table rows are visible based on pagination and filtering.
|
|
308
|
+
* Uses CSS display properties to show/hide rows rather than DOM manipulation.
|
|
309
|
+
*
|
|
310
|
+
* This approach is necessary because Carbon's table component handles its own
|
|
311
|
+
* sorting and we need to preserve the DOM order it creates. The method:
|
|
312
|
+
* 1. Hides all rows initially
|
|
313
|
+
* 2. Filters to only rows that haven't been filtered out
|
|
314
|
+
* 3. Shows only the rows that belong to the current page
|
|
315
|
+
*
|
|
316
|
+
* @param page - The page number to display (1-based)
|
|
317
|
+
* @param pageSize - Number of rows per page
|
|
318
|
+
* @private
|
|
319
|
+
*/
|
|
320
|
+
_updateVisibleRows(page = this._currentPageNumber, pageSize = this._currentPageSize) {
|
|
321
|
+
// Set the current page number and only show the rows for that page.
|
|
322
|
+
this._currentPageNumber = page;
|
|
323
|
+
// Grab all the rows that have been rendered. It's necessary to grab them from the page because the cds-table puts
|
|
324
|
+
// the rows in a specific order when sorting and we want to preserve that order.
|
|
325
|
+
const rows = Array.from(this.renderRoot.querySelectorAll("cds-table-row"));
|
|
326
|
+
// This is similar to the carbon example here https://stackblitz.com/edit/github-kbd9xw-s3y3s6?file=index.html. I
|
|
327
|
+
// originally tried creating and passing an array of the specific rows the template should render for the current
|
|
328
|
+
// page. Unfortunately doing that doesn't work with the combination of the is-sortable prop for the table and
|
|
329
|
+
// page-size prop for pagination. What would happen is old rows would persist if you were on the last page and there
|
|
330
|
+
// weren't enough rows to fill the page (even though the old rows weren't included in the new rows provided to the
|
|
331
|
+
// template). Using Carbon's example of hiding the rows with styling works so I'm extending that concept here even
|
|
332
|
+
// though, ideally, render controls the view and reacts to the state that would be determined here.
|
|
333
|
+
// Hide all the rows to start.
|
|
334
|
+
rows.forEach((row) => row.style.setProperty("display", "none"));
|
|
335
|
+
// Now filter the rows down to what is visible according to the filter.
|
|
336
|
+
const filterVisibleRows = rows.filter((row) => this._filterVisibleRowIDs.has(row.id));
|
|
337
|
+
// Now show all the rows that are within the current page.
|
|
338
|
+
const pageStart = (page - 1) * pageSize;
|
|
339
|
+
const pageEnd = page * pageSize - 1;
|
|
340
|
+
for (let index = pageStart; index <= pageEnd; index++) {
|
|
341
|
+
// If there is a row at that index then show it. If there aren't enough rows to fill the page then there won't be
|
|
342
|
+
// a row at that index.
|
|
343
|
+
filterVisibleRows[index]?.removeAttribute("style");
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Handles the table download functionality by exporting all table data as a CSV file.
|
|
348
|
+
*
|
|
349
|
+
* This custom implementation is necessary because Carbon's default download feature:
|
|
350
|
+
* - Only exports selected rows (we want all data)
|
|
351
|
+
* - Only exports as JSON (we want CSV format)
|
|
352
|
+
* - Doesn't include all the data we need
|
|
353
|
+
*
|
|
354
|
+
* The method dynamically imports the CSV stringify library to avoid bundle bloat,
|
|
355
|
+
* creates a data URL to comply with CSP policies, and triggers a download.
|
|
356
|
+
*
|
|
357
|
+
* @public
|
|
358
|
+
*/
|
|
359
|
+
async _handleDownload() {
|
|
360
|
+
// Don't save content from the expandable rows at this time. This could be added in the future but it's unclear how
|
|
361
|
+
// this would look in the download.
|
|
362
|
+
const tableArray = [
|
|
363
|
+
this.headers.map((cell) => cell.text),
|
|
364
|
+
...this.rows.map((row) => row.cells.map((cell) => cell.text)),
|
|
365
|
+
];
|
|
366
|
+
try {
|
|
367
|
+
// Lazy load the CSV stringify function only when needed
|
|
368
|
+
const { stringify } = await import('csv-stringify/browser/esm/sync');
|
|
369
|
+
// Convert table data to CSV format
|
|
370
|
+
const csvContent = stringify(tableArray);
|
|
371
|
+
// Use data URL instead of Blob to avoid CSP issues with object-src
|
|
372
|
+
const dataUrl = `data:text/csv;charset=utf-8,${encodeURIComponent(csvContent)}`;
|
|
373
|
+
// Create and trigger download using anchor element
|
|
374
|
+
const link = document.createElement("a");
|
|
375
|
+
link.setAttribute("href", dataUrl);
|
|
376
|
+
link.setAttribute("download", "table-data.csv");
|
|
377
|
+
link.style.visibility = "hidden";
|
|
378
|
+
document.body.appendChild(link);
|
|
379
|
+
// Trigger download and cleanup
|
|
380
|
+
link.click();
|
|
381
|
+
document.body.removeChild(link);
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
console.error("Failed to download table data:", error);
|
|
385
|
+
// Fallback: could show user notification or use alternative method
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Renders the table component based on current state and data.
|
|
390
|
+
*
|
|
391
|
+
* The render logic follows this priority:
|
|
392
|
+
* 1. Shows skeleton loading state if `loading` is true
|
|
393
|
+
* 2. Shows table with pagination if there are more rows than the page size OR pagination was used
|
|
394
|
+
* 3. Shows table only if all rows fit on one page
|
|
395
|
+
*
|
|
396
|
+
* The method also applies the appropriate Carbon theme class (cds--g90 for dark, cds--white for light)
|
|
397
|
+
* to ensure proper styling based on the `dark` property.
|
|
398
|
+
*
|
|
399
|
+
* @returns The lit-html template for the table component
|
|
400
|
+
* @public
|
|
401
|
+
*/
|
|
402
|
+
render() {
|
|
403
|
+
// TODO TABLE: Once we have a web component version of the inline error state we could render that here if
|
|
404
|
+
// !this._isValid.
|
|
405
|
+
// This could be used while we wait for a md stream containing a table to complete.
|
|
406
|
+
const runtime = this.tableRuntime;
|
|
407
|
+
if (this.loading || !runtime) {
|
|
408
|
+
if (!runtime) {
|
|
409
|
+
void this.ensureTableRuntime();
|
|
410
|
+
}
|
|
411
|
+
return tableSkeletonTemplate(this._currentPageSize);
|
|
412
|
+
}
|
|
413
|
+
const { tableTemplate, tablePaginationTemplate } = runtime;
|
|
414
|
+
// If there are more rows than the page size then we need to add the pagination component. If the rows per page has
|
|
415
|
+
// been changed by the pagination component then we need to keep the pagination component around so the user can
|
|
416
|
+
// change the page size again, even if the current page size is the same as the number of table rows.
|
|
417
|
+
if (this.rows.length > this._currentPageSize || this._rowsPerPageChanged) {
|
|
418
|
+
return html `<div class="cds-ai-chat-table-container">
|
|
419
|
+
${tableTemplate(this)}
|
|
420
|
+
${tablePaginationTemplate({
|
|
421
|
+
_currentPageSize: this._currentPageSize,
|
|
422
|
+
_currentPageNumber: this._currentPageNumber,
|
|
423
|
+
_filterVisibleRowIDs: this._filterVisibleRowIDs,
|
|
424
|
+
rows: this.rows,
|
|
425
|
+
previousPageText: this.previousPageText,
|
|
426
|
+
nextPageText: this.nextPageText,
|
|
427
|
+
itemsPerPageText: this.itemsPerPageText,
|
|
428
|
+
getPaginationSupplementalText: this.getPaginationSupplementalText,
|
|
429
|
+
getPaginationStatusText: this.getPaginationStatusText,
|
|
430
|
+
_handlePageChangeEvent: this._handlePageChangeEvent,
|
|
431
|
+
_handlePageSizeChangeEvent: this._handlePageSizeChangeEvent,
|
|
432
|
+
})}
|
|
433
|
+
</div>`;
|
|
434
|
+
}
|
|
435
|
+
// Otherwise, just render the table.
|
|
436
|
+
return html `<div class="cds-ai-chat-table-container">
|
|
437
|
+
${tableTemplate(this)}
|
|
438
|
+
</div>`;
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
TableElement.styles = styles;
|
|
442
|
+
__decorate([
|
|
443
|
+
property({ type: String, attribute: "table-title" })
|
|
444
|
+
], TableElement.prototype, "tableTitle", void 0);
|
|
445
|
+
__decorate([
|
|
446
|
+
property({ type: String, attribute: "table-description" })
|
|
447
|
+
], TableElement.prototype, "tableDescription", void 0);
|
|
448
|
+
__decorate([
|
|
449
|
+
property({ type: Array, attribute: false })
|
|
450
|
+
], TableElement.prototype, "headers", void 0);
|
|
451
|
+
__decorate([
|
|
452
|
+
property({ type: Array, attribute: false })
|
|
453
|
+
], TableElement.prototype, "rows", void 0);
|
|
454
|
+
__decorate([
|
|
455
|
+
property({ type: Boolean, attribute: "loading" })
|
|
456
|
+
], TableElement.prototype, "loading", void 0);
|
|
457
|
+
__decorate([
|
|
458
|
+
property({ type: String, attribute: "filter-placeholder-text" })
|
|
459
|
+
], TableElement.prototype, "filterPlaceholderText", void 0);
|
|
460
|
+
__decorate([
|
|
461
|
+
property({ type: String, attribute: "previous-page-text" })
|
|
462
|
+
], TableElement.prototype, "previousPageText", void 0);
|
|
463
|
+
__decorate([
|
|
464
|
+
property({ type: String, attribute: "next-page-text" })
|
|
465
|
+
], TableElement.prototype, "nextPageText", void 0);
|
|
466
|
+
__decorate([
|
|
467
|
+
property({ type: String, attribute: "items-per-page-text" })
|
|
468
|
+
], TableElement.prototype, "itemsPerPageText", void 0);
|
|
469
|
+
__decorate([
|
|
470
|
+
property({ type: String, attribute: "locale" })
|
|
471
|
+
], TableElement.prototype, "locale", void 0);
|
|
472
|
+
__decorate([
|
|
473
|
+
state()
|
|
474
|
+
], TableElement.prototype, "_defaultPageSize", void 0);
|
|
475
|
+
__decorate([
|
|
476
|
+
property({ type: Number, attribute: "default-page-size" })
|
|
477
|
+
], TableElement.prototype, "defaultPageSize", null);
|
|
478
|
+
__decorate([
|
|
479
|
+
property({ type: Function, attribute: false })
|
|
480
|
+
], TableElement.prototype, "getPaginationSupplementalText", void 0);
|
|
481
|
+
__decorate([
|
|
482
|
+
property({ type: Function, attribute: false })
|
|
483
|
+
], TableElement.prototype, "getPaginationStatusText", void 0);
|
|
484
|
+
__decorate([
|
|
485
|
+
state()
|
|
486
|
+
], TableElement.prototype, "_isValid", void 0);
|
|
487
|
+
__decorate([
|
|
488
|
+
state()
|
|
489
|
+
], TableElement.prototype, "_currentPageNumber", void 0);
|
|
490
|
+
__decorate([
|
|
491
|
+
state()
|
|
492
|
+
], TableElement.prototype, "_currentPageSize", void 0);
|
|
493
|
+
__decorate([
|
|
494
|
+
state()
|
|
495
|
+
], TableElement.prototype, "_rowsPerPageChanged", void 0);
|
|
496
|
+
__decorate([
|
|
497
|
+
state()
|
|
498
|
+
], TableElement.prototype, "_filterVisibleRowIDs", void 0);
|
|
499
|
+
__decorate([
|
|
500
|
+
state()
|
|
501
|
+
], TableElement.prototype, "_rowsWithIDs", void 0);
|
|
502
|
+
__decorate([
|
|
503
|
+
state()
|
|
504
|
+
], TableElement.prototype, "_allowFiltering", void 0);
|
|
505
|
+
TableElement = __decorate([
|
|
506
|
+
carbonElement(TABLE_COMPONENT_TAG_NAME)
|
|
507
|
+
], TableElement);
|
|
508
|
+
var TableElement_default = TableElement;
|
|
509
|
+
|
|
510
|
+
export { TABLE_COMPONENT_TAG_NAME, TableElement, TableElement_default as default };
|
|
511
|
+
//# sourceMappingURL=cds-aichat-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cds-aichat-table.js","sources":["../../../../src/components/table/src/cds-aichat-table.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAuCH;AACA,MAAM,yBAAyB,GAAG,GAAG;AAErC;AACA;AACA,MAAM,wBAAwB,GAAG;AAEjC;;AAEG;AAEH,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU,CAAA;AAArC,IAAA,WAAA,GAAA;;AAaE;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAuB,EAAE;AAEhC;;AAEG;QAEH,IAAA,CAAA,IAAI,GAAsB,EAAE;AAE5B;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAG,KAAK;AAEf;;AAEG;QAEH,IAAA,CAAA,qBAAqB,GAAG,EAAE;AAE1B;;AAEG;QAEH,IAAA,CAAA,gBAAgB,GAAG,EAAE;AAErB;;AAEG;QAEH,IAAA,CAAA,YAAY,GAAG,EAAE;AAEjB;;AAEG;QAEH,IAAA,CAAA,gBAAgB,GAAG,EAAE;AAErB;;AAEG;QAEH,IAAA,CAAA,MAAM,GAAG,EAAE;AAEX;;;AAGG;QAEK,IAAA,CA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AA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAUhD,UAAA,CAAA;AADN,IAAA,KAAK;AAC6B,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,MAAA,CAAA;AAM5B,UAAA,CAAA;AADN,IAAA,KAAK;AAC+C,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,sBAAA,EAAA,MAAA,CAAA;AAM9C,UAAA,CAAA;AADN,IAAA,KAAK;AACsC,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAMrC,UAAA,CAAA;AADN,IAAA,KAAK;AACyB,CAAA,EAAA,YAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AA7I3B,YAAY,GAAA,UAAA,CAAA;IADjB,aAAa,CAAC,wBAAwB;AACjC,CAAA,EAAA,YAAY,CA+gBjB;AAID,2BAAe,YAAY;;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Copyright IBM Corp. 2025
|
|
10
|
+
*
|
|
11
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
12
|
+
* LICENSE file in the root directory of this source tree.
|
|
13
|
+
*
|
|
14
|
+
* @license
|
|
15
|
+
*/
|
|
16
|
+
let tableRuntimePromise = null;
|
|
17
|
+
function loadTableRuntime() {
|
|
18
|
+
if (!tableRuntimePromise) {
|
|
19
|
+
tableRuntimePromise = import('./table-runtime.js');
|
|
20
|
+
}
|
|
21
|
+
return tableRuntimePromise;
|
|
22
|
+
}
|
|
23
|
+
function loadTableDeps() {
|
|
24
|
+
return loadTableRuntime();
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { loadTableDeps, loadTableRuntime };
|
|
28
|
+
//# sourceMappingURL=table-loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-loader.js","sources":["../../../../src/components/table/src/table-loader.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAIH,IAAI,mBAAmB,GAAuC,IAAI;SAElD,gBAAgB,GAAA;IAC9B,IAAI,CAAC,mBAAmB,EAAE;AACxB,QAAA,mBAAmB,GAAG,OAAO,oBAAoB,CAAC;IACpD;AACA,IAAA,OAAO,mBAAmB;AAC5B;SAEgB,aAAa,GAAA;IAC3B,OAAO,gBAAgB,EAAE;AAC3B;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import "@carbon/web-components/es/components/pagination/index.js";
|
|
2
|
+
import "@carbon/web-components/es/components/select/index.js";
|
|
3
|
+
import { TableRowContent } from "./cds-aichat-table.js";
|
|
4
|
+
interface TablePaginationProps {
|
|
5
|
+
_currentPageSize: number;
|
|
6
|
+
_currentPageNumber: number;
|
|
7
|
+
_filterVisibleRowIDs: Set<string>;
|
|
8
|
+
rows: TableRowContent[];
|
|
9
|
+
previousPageText: string;
|
|
10
|
+
nextPageText: string;
|
|
11
|
+
itemsPerPageText: string;
|
|
12
|
+
getPaginationSupplementalText?: ({ count }: {
|
|
13
|
+
count: number;
|
|
14
|
+
}) => string;
|
|
15
|
+
getPaginationStatusText?: ({ start, end, count, }: {
|
|
16
|
+
start: number;
|
|
17
|
+
end: number;
|
|
18
|
+
count: number;
|
|
19
|
+
}) => string;
|
|
20
|
+
_handlePageChangeEvent: (event: any) => void;
|
|
21
|
+
_handlePageSizeChangeEvent: (event: any) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Table pagination view logic.
|
|
25
|
+
*/
|
|
26
|
+
declare function tablePaginationTemplate(props: TablePaginationProps): import("lit-html").TemplateResult<1>;
|
|
27
|
+
export { tablePaginationTemplate };
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import '@carbon/web-components/es/components/pagination/index.js';
|
|
9
|
+
import '@carbon/web-components/es/components/select/index.js';
|
|
10
|
+
import { html } from 'lit';
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright IBM Corp. 2025
|
|
14
|
+
*
|
|
15
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
16
|
+
* LICENSE file in the root directory of this source tree.
|
|
17
|
+
*
|
|
18
|
+
* @license
|
|
19
|
+
*/
|
|
20
|
+
// Import only the constants, not the class
|
|
21
|
+
const POSSIBLE_PAGE_SIZES = [5, 10, 15, 20, 50];
|
|
22
|
+
/**
|
|
23
|
+
* Table pagination view logic.
|
|
24
|
+
*/
|
|
25
|
+
function tablePaginationTemplate(props) {
|
|
26
|
+
const { _currentPageSize: currentPageSize, _currentPageNumber: currentPageNumber, _filterVisibleRowIDs: filterVisibleRowIDs, rows, previousPageText, nextPageText, itemsPerPageText, getPaginationSupplementalText, getPaginationStatusText, _handlePageChangeEvent: handlePageChangeEvent, _handlePageSizeChangeEvent: handlePageSizeChangeEvent, } = props;
|
|
27
|
+
if (!filterVisibleRowIDs || !filterVisibleRowIDs.size) {
|
|
28
|
+
return html ``;
|
|
29
|
+
}
|
|
30
|
+
const totalVisibleRows = filterVisibleRowIDs.size;
|
|
31
|
+
const totalRows = rows.length;
|
|
32
|
+
// Page sizes will only be included if the page size is less than the total number of rows.
|
|
33
|
+
const supportedPageSizes = POSSIBLE_PAGE_SIZES.filter((pageSize) => pageSize < totalRows);
|
|
34
|
+
return html `<cds-pagination
|
|
35
|
+
page-size=${currentPageSize}
|
|
36
|
+
page=${currentPageNumber}
|
|
37
|
+
total-items=${totalVisibleRows}
|
|
38
|
+
totalPages=${Math.ceil(totalVisibleRows / currentPageSize)}
|
|
39
|
+
backward-text=${previousPageText}
|
|
40
|
+
forward-text=${nextPageText}
|
|
41
|
+
items-per-page-text=${itemsPerPageText}
|
|
42
|
+
.formatSupplementalText=${getPaginationSupplementalText}
|
|
43
|
+
.formatStatusWithDeterminateTotal=${getPaginationStatusText}
|
|
44
|
+
@cds-pagination-changed-current=${handlePageChangeEvent}
|
|
45
|
+
@cds-page-sizes-select-changed=${handlePageSizeChangeEvent}
|
|
46
|
+
>
|
|
47
|
+
${supportedPageSizes.map((pageSize) => html `<cds-select-item value="${pageSize}"
|
|
48
|
+
>${pageSize}</cds-select-item
|
|
49
|
+
>`)}
|
|
50
|
+
<cds-select-item value="${totalRows}">${totalRows}</cds-select-item>
|
|
51
|
+
</cds-pagination>`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export { tablePaginationTemplate };
|
|
55
|
+
//# sourceMappingURL=table-pagination.template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-pagination.template.js","sources":["../../../../src/components/table/src/table-pagination.template.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAAA;;;;;;;AAOG;AAQH;AACA,MAAM,mBAAmB,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAwB/C;;AAEG;AACH,SAAS,uBAAuB,CAAC,KAA2B,EAAA;AAC1D,IAAA,MAAM,EACJ,gBAAgB,EAAE,eAAe,EACjC,kBAAkB,EAAE,iBAAiB,EACrC,oBAAoB,EAAE,mBAAmB,EACzC,IAAI,EACJ,gBAAgB,EAChB,YAAY,EACZ,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,EACvB,sBAAsB,EAAE,qBAAqB,EAC7C,0BAA0B,EAAE,yBAAyB,GACtD,GAAG,KAAK;IAET,IAAI,CAAC,mBAAmB,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE;QACrD,OAAO,IAAI,CAAA,CAAA,CAAE;IACf;AAEA,IAAA,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,IAAI;AACjD,IAAA,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM;;AAG7B,IAAA,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,MAAM,CACnD,CAAC,QAAQ,KAAK,QAAQ,GAAG,SAAS,CACnC;AAED,IAAA,OAAO,IAAI,CAAA,CAAA;gBACG,eAAe;WACpB,iBAAiB;kBACV,gBAAgB;AACjB,eAAA,EAAA,IAAI,CAAC,IAAI,CAAC,gBAAgB,GAAG,eAAe,CAAC;oBAC1C,gBAAgB;mBACjB,YAAY;0BACL,gBAAgB;8BACZ,6BAA6B;wCACnB,uBAAuB;sCACzB,qBAAqB;qCACtB,yBAAyB;;MAExD,kBAAkB,CAAC,GAAG,CACtB,CAAC,QAAQ,KACP,IAAI,CAAA,CAAA,wBAAA,EAA2B,QAAQ,CAAA;aAClC,QAAQ,CAAA;UACX,CACL;AACyB,4BAAA,EAAA,SAAS,KAAK,SAAS,CAAA;oBACjC;AACpB;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright IBM Corp. 2025
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
export { tableTemplate } from './table.template.js';
|
|
9
|
+
export { tablePaginationTemplate } from './table-pagination.template.js';
|
|
10
|
+
//# sourceMappingURL=table-runtime.js.map
|