@cozeloop/components 0.0.2 → 0.0.3
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/.eslintcache +1 -0
- package/.rush/temp/shrinkwrap-deps.json +770 -0
- package/OWNERS +5 -0
- package/README.md +82 -1
- package/config/rush-project.json +8 -0
- package/dist/es/index.css +661 -0
- package/dist/es/index.js +6044 -65
- package/dist/es/static/svg/select.svg +1 -0
- package/dist/lib/base-search-select/base-search-form-select.d.ts +3 -0
- package/dist/lib/base-search-select/base-search-form-select.js +6 -0
- package/dist/lib/base-search-select/base-search-form-select.js.map +1 -0
- package/dist/lib/base-search-select/base-search-select.d.ts +9 -0
- package/dist/lib/base-search-select/base-search-select.js +127 -0
- package/dist/lib/base-search-select/base-search-select.js.map +1 -0
- package/dist/lib/base-search-select/index.d.ts +3 -0
- package/dist/lib/base-search-select/index.js +3 -0
- package/dist/lib/base-search-select/index.js.map +1 -0
- package/dist/lib/base-search-select/types.d.ts +13 -0
- package/dist/lib/base-search-select/types.js +2 -0
- package/dist/lib/base-search-select/types.js.map +1 -0
- package/dist/lib/base-search-select/utils.d.ts +8 -0
- package/dist/lib/base-search-select/utils.js +48 -0
- package/dist/lib/base-search-select/utils.js.map +1 -0
- package/dist/lib/basic-card/index.d.ts +7 -0
- package/dist/lib/basic-card/index.js +4 -0
- package/dist/lib/basic-card/index.js.map +1 -0
- package/dist/lib/card-pane/index.d.ts +5 -0
- package/dist/lib/card-pane/index.js +9 -0
- package/dist/lib/card-pane/index.js.map +1 -0
- package/dist/lib/chip-select/index.d.ts +2 -0
- package/dist/lib/chip-select/index.js +6 -0
- package/dist/lib/chip-select/index.js.map +1 -0
- package/dist/lib/code-editor/index.d.ts +3 -0
- package/dist/lib/code-editor/index.js +7 -0
- package/dist/lib/code-editor/index.js.map +1 -0
- package/dist/lib/code-usage/index.d.ts +14 -0
- package/dist/lib/code-usage/index.js +31 -0
- package/dist/lib/code-usage/index.js.map +1 -0
- package/dist/lib/codemirror-editor/code-editor.d.ts +2 -0
- package/dist/lib/codemirror-editor/code-editor.js +108 -0
- package/dist/lib/codemirror-editor/code-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/index.d.ts +4 -0
- package/dist/lib/codemirror-editor/index.js +5 -0
- package/dist/lib/codemirror-editor/index.js.map +1 -0
- package/dist/lib/codemirror-editor/json-editor.d.ts +19 -0
- package/dist/lib/codemirror-editor/json-editor.js +97 -0
- package/dist/lib/codemirror-editor/json-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/raw-text-editor.d.ts +11 -0
- package/dist/lib/codemirror-editor/raw-text-editor.js +32 -0
- package/dist/lib/codemirror-editor/raw-text-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/text-editor.d.ts +2 -0
- package/dist/lib/codemirror-editor/text-editor.js +44 -0
- package/dist/lib/codemirror-editor/text-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/themes/coze-dark.d.ts +1 -0
- package/dist/lib/codemirror-editor/themes/coze-dark.js +113 -0
- package/dist/lib/codemirror-editor/themes/coze-dark.js.map +1 -0
- package/dist/lib/codemirror-editor/themes/coze-light.d.ts +1 -0
- package/dist/lib/codemirror-editor/themes/coze-light.js +119 -0
- package/dist/lib/codemirror-editor/themes/coze-light.js.map +1 -0
- package/dist/lib/collapse-card/index.d.ts +13 -0
- package/dist/lib/collapse-card/index.js +31 -0
- package/dist/lib/collapse-card/index.js.map +1 -0
- package/dist/lib/collapsible-card/index.d.ts +13 -0
- package/dist/lib/collapsible-card/index.js +12 -78
- package/dist/lib/collapsible-card/index.js.map +1 -0
- package/dist/{types → lib}/column-manage-storage/index.d.ts +6 -6
- package/dist/lib/column-manage-storage/index.js +43 -93
- package/dist/lib/column-manage-storage/index.js.map +1 -0
- package/dist/lib/columns-select/index.d.ts +19 -0
- package/dist/lib/columns-select/index.js +73 -237
- package/dist/lib/columns-select/index.js.map +1 -0
- package/dist/lib/edit-icon-button/index.d.ts +8 -0
- package/dist/lib/edit-icon-button/index.js +13 -0
- package/dist/lib/edit-icon-button/index.js.map +1 -0
- package/dist/lib/footer-actions/index.d.ts +15 -0
- package/dist/lib/footer-actions/index.js +9 -0
- package/dist/lib/footer-actions/index.js.map +1 -0
- package/dist/{types → lib}/hooks/use-infinite-scroll.d.ts +12 -12
- package/dist/lib/hooks/use-infinite-scroll.js +130 -192
- package/dist/lib/hooks/use-infinite-scroll.js.map +1 -0
- package/dist/lib/hooks/use-mouse-down-offset.d.ts +9 -0
- package/dist/lib/hooks/use-mouse-down-offset.js +38 -64
- package/dist/lib/hooks/use-mouse-down-offset.js.map +1 -0
- package/dist/lib/hooks/use-unsave-leave-warning.d.ts +12 -0
- package/dist/lib/hooks/use-unsave-leave-warning.js +33 -0
- package/dist/lib/hooks/use-unsave-leave-warning.js.map +1 -0
- package/dist/lib/id-render/icon-button-container.d.ts +8 -0
- package/dist/lib/id-render/icon-button-container.js +7 -88
- package/dist/lib/id-render/icon-button-container.js.map +1 -0
- package/dist/lib/id-render/index.d.ts +7 -0
- package/dist/lib/id-render/index.js +20 -111
- package/dist/lib/id-render/index.js.map +1 -0
- package/dist/lib/index-controller/record-navigation.d.ts +6 -0
- package/dist/lib/index-controller/record-navigation.js +9 -0
- package/dist/lib/index-controller/record-navigation.js.map +1 -0
- package/dist/lib/index-controller/use-item-index-controller.d.ts +47 -0
- package/dist/lib/index-controller/use-item-index-controller.js +123 -0
- package/dist/lib/index-controller/use-item-index-controller.js.map +1 -0
- package/dist/lib/index.d.ts +70 -0
- package/dist/lib/index.js +76 -110
- package/dist/lib/index.js.map +1 -0
- package/dist/{types → lib}/infinite-scroll-table/index.d.ts +6 -6
- package/dist/lib/infinite-scroll-table/index.js +31 -123
- package/dist/lib/infinite-scroll-table/index.js.map +1 -0
- package/dist/lib/info-tooltip/index.d.ts +9 -0
- package/dist/lib/info-tooltip/index.js +9 -0
- package/dist/lib/info-tooltip/index.js.map +1 -0
- package/dist/lib/input-components/radio-button.d.ts +14 -0
- package/dist/lib/input-components/radio-button.js +21 -0
- package/dist/lib/input-components/radio-button.js.map +1 -0
- package/dist/lib/input-slider/index.d.ts +15 -0
- package/dist/lib/input-slider/index.js +73 -146
- package/dist/lib/input-slider/index.js.map +1 -0
- package/dist/lib/input-with-count/index.d.ts +2 -0
- package/dist/lib/input-with-count/index.js +7 -0
- package/dist/lib/input-with-count/index.js.map +1 -0
- package/dist/lib/jump-button/jump-icon-button.d.ts +4 -0
- package/dist/lib/jump-button/jump-icon-button.js +7 -0
- package/dist/lib/jump-button/jump-icon-button.js.map +1 -0
- package/dist/{types → lib}/large-txt-render/index.d.ts +2 -2
- package/dist/lib/large-txt-render/index.js +24 -60
- package/dist/lib/large-txt-render/index.js.map +1 -0
- package/dist/lib/layout/content.d.ts +7 -0
- package/dist/lib/layout/content.js +5 -0
- package/dist/lib/layout/content.js.map +1 -0
- package/dist/lib/layout/header.d.ts +7 -0
- package/dist/lib/layout/header.js +6 -0
- package/dist/lib/layout/header.js.map +1 -0
- package/dist/lib/layout/index.d.ts +12 -0
- package/dist/lib/layout/index.js +9 -0
- package/dist/lib/layout/index.js.map +1 -0
- package/dist/lib/layout/tabs.d.ts +6 -0
- package/dist/lib/layout/tabs.js +10 -0
- package/dist/lib/layout/tabs.js.map +1 -0
- package/dist/lib/lazy-load-component/index.d.ts +5 -0
- package/dist/lib/lazy-load-component/index.js +42 -0
- package/dist/lib/lazy-load-component/index.js.map +1 -0
- package/dist/lib/logic-editor/index.d.ts +3 -0
- package/dist/lib/logic-editor/index.js +3 -0
- package/dist/lib/logic-editor/index.js.map +1 -0
- package/dist/lib/logic-editor/logic-editor.d.ts +17 -0
- package/dist/lib/logic-editor/logic-editor.js +69 -0
- package/dist/lib/logic-editor/logic-editor.js.map +1 -0
- package/dist/lib/logic-editor/logic-left-render.d.ts +3 -0
- package/dist/lib/logic-editor/logic-left-render.js +60 -0
- package/dist/lib/logic-editor/logic-left-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-operator-render.d.ts +3 -0
- package/dist/lib/logic-editor/logic-operator-render.js +29 -0
- package/dist/lib/logic-editor/logic-operator-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-right-render.d.ts +3 -0
- package/dist/lib/logic-editor/logic-right-render.js +25 -0
- package/dist/lib/logic-editor/logic-right-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-types.d.ts +49 -0
- package/dist/lib/logic-editor/logic-types.js +136 -0
- package/dist/lib/logic-editor/logic-types.js.map +1 -0
- package/dist/lib/logic-editor/utils.d.ts +2 -0
- package/dist/lib/logic-editor/utils.js +18 -0
- package/dist/lib/logic-editor/utils.js.map +1 -0
- package/dist/lib/logic-expr/consts.d.ts +2 -0
- package/dist/lib/logic-expr/consts.js +5 -0
- package/dist/lib/logic-expr/consts.js.map +1 -0
- package/dist/lib/logic-expr/expr-group-render.d.ts +2 -0
- package/dist/lib/logic-expr/expr-group-render.js +61 -0
- package/dist/lib/logic-expr/expr-group-render.js.map +1 -0
- package/dist/lib/logic-expr/expr-render.d.ts +2 -0
- package/dist/lib/logic-expr/expr-render.js +85 -0
- package/dist/lib/logic-expr/expr-render.js.map +1 -0
- package/dist/lib/logic-expr/index.d.ts +2 -0
- package/dist/lib/logic-expr/index.js +2 -0
- package/dist/lib/logic-expr/index.js.map +1 -0
- package/dist/lib/logic-expr/logic-expr.d.ts +2 -0
- package/dist/lib/logic-expr/logic-expr.js +187 -0
- package/dist/lib/logic-expr/logic-expr.js.map +1 -0
- package/dist/lib/logic-expr/logic-not.d.ts +10 -0
- package/dist/lib/logic-expr/logic-not.js +21 -0
- package/dist/lib/logic-expr/logic-not.js.map +1 -0
- package/dist/lib/logic-expr/logic-toggle.d.ts +12 -0
- package/dist/lib/logic-expr/logic-toggle.js +33 -0
- package/dist/lib/logic-expr/logic-toggle.js.map +1 -0
- package/dist/lib/logic-expr/types.d.ts +79 -0
- package/dist/lib/logic-expr/types.js +2 -0
- package/dist/lib/logic-expr/types.js.map +1 -0
- package/dist/lib/loop-radio-group/index.d.ts +2 -0
- package/dist/lib/loop-radio-group/index.js +7 -0
- package/dist/lib/loop-radio-group/index.js.map +1 -0
- package/dist/lib/multi-part-editor/components/image-item-renderer.d.ts +14 -0
- package/dist/lib/multi-part-editor/components/image-item-renderer.js +57 -0
- package/dist/lib/multi-part-editor/components/image-item-renderer.js.map +1 -0
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.d.ts +10 -0
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js +25 -0
- package/dist/lib/multi-part-editor/components/multipart-item-renderer.js.map +1 -0
- package/dist/lib/multi-part-editor/components/url-input-modal.d.ts +14 -0
- package/dist/lib/multi-part-editor/components/url-input-modal.js +150 -0
- package/dist/lib/multi-part-editor/components/url-input-modal.js.map +1 -0
- package/dist/lib/multi-part-editor/components/video-item-renderer.d.ts +14 -0
- package/dist/lib/multi-part-editor/components/video-item-renderer.js +57 -0
- package/dist/lib/multi-part-editor/components/video-item-renderer.js.map +1 -0
- package/dist/lib/multi-part-editor/index.d.ts +3 -0
- package/dist/lib/multi-part-editor/index.js +300 -0
- package/dist/lib/multi-part-editor/index.js.map +1 -0
- package/dist/lib/multi-part-editor/multi-part-render.d.ts +10 -0
- package/dist/lib/multi-part-editor/multi-part-render.js +40 -0
- package/dist/lib/multi-part-editor/multi-part-render.js.map +1 -0
- package/dist/lib/multi-part-editor/type.d.ts +81 -0
- package/dist/lib/multi-part-editor/type.js +25 -0
- package/dist/lib/multi-part-editor/type.js.map +1 -0
- package/dist/lib/multi-part-editor/upload-button.d.ts +23 -0
- package/dist/lib/multi-part-editor/upload-button.js +103 -0
- package/dist/lib/multi-part-editor/upload-button.js.map +1 -0
- package/dist/lib/multi-part-editor/utils.d.ts +16 -0
- package/dist/lib/multi-part-editor/utils.js +43 -0
- package/dist/lib/multi-part-editor/utils.js.map +1 -0
- package/dist/lib/open-detail-button/index.d.ts +6 -0
- package/dist/lib/open-detail-button/index.js +11 -0
- package/dist/lib/open-detail-button/index.js.map +1 -0
- package/dist/lib/page-content/index.d.ts +20 -0
- package/dist/lib/page-content/index.js +17 -130
- package/dist/lib/page-content/index.js.map +1 -0
- package/dist/lib/primary-page/index.d.ts +1 -0
- package/dist/lib/primary-page/index.js +2 -28
- package/dist/lib/primary-page/index.js.map +1 -0
- package/dist/lib/primary-page/primary-header.d.ts +13 -0
- package/dist/lib/primary-page/primary-header.js +4 -72
- package/dist/lib/primary-page/primary-header.js.map +1 -0
- package/dist/lib/primary-title/index.d.ts +6 -0
- package/dist/lib/primary-title/index.js +8 -0
- package/dist/lib/primary-title/index.js.map +1 -0
- package/dist/lib/provider/index.d.ts +18 -0
- package/dist/lib/provider/index.js +43 -0
- package/dist/lib/provider/index.js.map +1 -0
- package/dist/lib/resizable-side-sheet/index.d.ts +10 -0
- package/dist/lib/resizable-side-sheet/index.js +32 -0
- package/dist/lib/resizable-side-sheet/index.js.map +1 -0
- package/dist/{types → lib}/resize-sidesheet/index.d.ts +4 -3
- package/dist/lib/resize-sidesheet/index.js +15 -129
- package/dist/lib/resize-sidesheet/index.js.map +1 -0
- package/dist/lib/resize-sidesheet/use-drag.d.ts +11 -0
- package/dist/lib/resize-sidesheet/use-drag.js +26 -51
- package/dist/lib/resize-sidesheet/use-drag.js.map +1 -0
- package/dist/lib/schema-editor/index.d.ts +11 -0
- package/dist/lib/schema-editor/index.js +5 -0
- package/dist/lib/schema-editor/index.js.map +1 -0
- package/dist/lib/search-form/index.d.ts +15 -0
- package/dist/lib/search-form/index.js +77 -0
- package/dist/lib/search-form/index.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field-item.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field-item.js +19 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field-item.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field.js +39 -0
- package/dist/lib/semi-schema-form/components/tmpls/array-field.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/base-input.d.ts +8 -0
- package/dist/lib/semi-schema-form/components/tmpls/base-input.js +32 -0
- package/dist/lib/semi-schema-form/components/tmpls/base-input.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/description-field.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/description-field.js +13 -0
- package/dist/lib/semi-schema-form/components/tmpls/description-field.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/error-list.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/error-list.js +14 -0
- package/dist/lib/semi-schema-form/components/tmpls/error-list.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/field-error.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/field-error.js +16 -0
- package/dist/lib/semi-schema-form/components/tmpls/field-error.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/field.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/tmpls/field.js +21 -0
- package/dist/lib/semi-schema-form/components/tmpls/field.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/icon-button.d.ts +11 -0
- package/dist/lib/semi-schema-form/components/tmpls/icon-button.js +29 -0
- package/dist/lib/semi-schema-form/components/tmpls/icon-button.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/index.d.ts +2 -0
- package/dist/lib/semi-schema-form/components/tmpls/index.js +31 -0
- package/dist/lib/semi-schema-form/components/tmpls/index.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/object-field.d.ts +8 -0
- package/dist/lib/semi-schema-form/components/tmpls/object-field.js +81 -0
- package/dist/lib/semi-schema-form/components/tmpls/object-field.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/submit.d.ts +4 -0
- package/dist/lib/semi-schema-form/components/tmpls/submit.js +13 -0
- package/dist/lib/semi-schema-form/components/tmpls/submit.js.map +1 -0
- package/dist/lib/semi-schema-form/components/tmpls/title-field.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/tmpls/title-field.js +12 -0
- package/dist/lib/semi-schema-form/components/tmpls/title-field.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/checkbox.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/widgets/checkbox.js +26 -0
- package/dist/lib/semi-schema-form/components/widgets/checkbox.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/checkboxs.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/widgets/checkboxs.js +27 -0
- package/dist/lib/semi-schema-form/components/widgets/checkboxs.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/index.d.ts +2 -0
- package/dist/lib/semi-schema-form/components/widgets/index.js +15 -0
- package/dist/lib/semi-schema-form/components/widgets/index.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/radio.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/widgets/radio.js +27 -0
- package/dist/lib/semi-schema-form/components/widgets/radio.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/range.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/widgets/range.js +26 -0
- package/dist/lib/semi-schema-form/components/widgets/range.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/select.d.ts +7 -0
- package/dist/lib/semi-schema-form/components/widgets/select.js +44 -0
- package/dist/lib/semi-schema-form/components/widgets/select.js.map +1 -0
- package/dist/lib/semi-schema-form/components/widgets/textarea.d.ts +6 -0
- package/dist/lib/semi-schema-form/components/widgets/textarea.js +18 -0
- package/dist/lib/semi-schema-form/components/widgets/textarea.js.map +1 -0
- package/dist/lib/semi-schema-form/index.d.ts +4 -0
- package/dist/lib/semi-schema-form/index.js +9 -0
- package/dist/lib/semi-schema-form/index.js.map +1 -0
- package/dist/lib/sentinel-form/enum.d.ts +8 -0
- package/dist/lib/sentinel-form/enum.js +15 -0
- package/dist/lib/sentinel-form/enum.js.map +1 -0
- package/dist/lib/sentinel-form/index.d.ts +20 -0
- package/dist/lib/sentinel-form/index.js +289 -0
- package/dist/lib/sentinel-form/index.js.map +1 -0
- package/dist/lib/step-nav/index.d.ts +12 -0
- package/dist/lib/step-nav/index.js +13 -0
- package/dist/lib/step-nav/index.js.map +1 -0
- package/dist/{types → lib}/table/index.d.ts +1 -1
- package/dist/lib/table/index.js +6 -88
- package/dist/lib/table/index.js.map +1 -0
- package/dist/lib/table/sort-icon.d.ts +8 -0
- package/dist/lib/table/sort-icon.js +25 -132
- package/dist/lib/table/sort-icon.js.map +1 -0
- package/dist/lib/table/table-with-pagination.d.ts +21 -0
- package/dist/lib/table/table-with-pagination.js +71 -143
- package/dist/lib/table/table-with-pagination.js.map +1 -0
- package/dist/lib/table/table-without-pagniation.d.ts +6 -0
- package/dist/lib/table/table-without-pagniation.js +36 -107
- package/dist/lib/table/table-without-pagniation.js.map +1 -0
- package/dist/lib/table-batch-operate/table-batch-operation.d.ts +9 -0
- package/dist/lib/table-batch-operate/table-batch-operation.js +14 -0
- package/dist/lib/table-batch-operate/table-batch-operation.js.map +1 -0
- package/dist/lib/table-batch-operate/use-batch-operate.d.ts +30 -0
- package/dist/lib/table-batch-operate/use-batch-operate.js +71 -0
- package/dist/lib/table-batch-operate/use-batch-operate.js.map +1 -0
- package/dist/lib/table-col-actions/index.d.ts +22 -0
- package/dist/lib/table-col-actions/index.js +34 -122
- package/dist/lib/table-col-actions/index.js.map +1 -0
- package/dist/lib/table-cols-config/index.d.ts +11 -0
- package/dist/lib/table-cols-config/index.js +57 -0
- package/dist/lib/table-cols-config/index.js.map +1 -0
- package/dist/lib/table-cols-config/type.d.ts +6 -0
- package/dist/lib/table-cols-config/type.js +2 -0
- package/dist/lib/table-cols-config/type.js.map +1 -0
- package/dist/lib/table-cols-config/use-hidden-col-keys.d.ts +5 -0
- package/dist/lib/table-cols-config/use-hidden-col-keys.js +32 -0
- package/dist/lib/table-cols-config/use-hidden-col-keys.js.map +1 -0
- package/dist/lib/table-cols-config/util.d.ts +3 -0
- package/dist/lib/table-cols-config/util.js +39 -0
- package/dist/lib/table-cols-config/util.js.map +1 -0
- package/dist/lib/table-empty/index.d.ts +2 -0
- package/dist/lib/table-empty/index.js +10 -0
- package/dist/lib/table-empty/index.js.map +1 -0
- package/dist/lib/table-header/index.d.ts +14 -0
- package/dist/lib/table-header/index.js +10 -95
- package/dist/lib/table-header/index.js.map +1 -0
- package/dist/{types → lib}/tabs/index.d.ts +1 -1
- package/dist/lib/tabs/index.js +9 -74
- package/dist/lib/tabs/index.js.map +1 -0
- package/dist/lib/text-area-pro/index.d.ts +6 -0
- package/dist/lib/text-area-pro/index.js +10 -0
- package/dist/lib/text-area-pro/index.js.map +1 -0
- package/dist/lib/text-with-copy/index.d.ts +14 -0
- package/dist/lib/text-with-copy/index.js +23 -104
- package/dist/lib/text-with-copy/index.js.map +1 -0
- package/dist/lib/title-with-sub/index.d.ts +7 -0
- package/dist/lib/title-with-sub/index.js +6 -0
- package/dist/lib/title-with-sub/index.js.map +1 -0
- package/dist/lib/tooltip-when-disabled/index.d.ts +6 -0
- package/dist/lib/tooltip-when-disabled/index.js +9 -0
- package/dist/lib/tooltip-when-disabled/index.js.map +1 -0
- package/dist/lib/tooltip-with-disabled/index.d.ts +5 -0
- package/dist/lib/tooltip-with-disabled/index.js +7 -69
- package/dist/lib/tooltip-with-disabled/index.js.map +1 -0
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -0
- package/dist/lib/upload/index.d.ts +9 -0
- package/dist/lib/upload/index.js +25 -0
- package/dist/lib/upload/index.js.map +1 -0
- package/dist/lib/user-profile/index.d.ts +9 -0
- package/dist/lib/user-profile/index.js +21 -0
- package/dist/lib/user-profile/index.js.map +1 -0
- package/dist/lib/utils/basic.d.ts +2 -0
- package/dist/lib/utils/basic.js +27 -76
- package/dist/lib/utils/basic.js.map +1 -0
- package/dist/lib/version-list/version-descriptions.d.ts +15 -0
- package/dist/lib/version-list/version-descriptions.js +14 -0
- package/dist/lib/version-list/version-descriptions.js.map +1 -0
- package/dist/lib/version-list/version-item.d.ts +9 -0
- package/dist/lib/version-list/version-item.js +6 -0
- package/dist/lib/version-list/version-item.js.map +1 -0
- package/dist/lib/version-list/version-list.d.ts +11 -0
- package/dist/lib/version-list/version-list.js +11 -0
- package/dist/lib/version-list/version-list.js.map +1 -0
- package/dist/lib/version-list/version-switch-panel.d.ts +5 -0
- package/dist/lib/version-list/version-switch-panel.js +10 -0
- package/dist/lib/version-list/version-switch-panel.js.map +1 -0
- package/eslint.config.js +7 -0
- package/package.json +29 -25
- package/rslib.config.js +7 -0
- package/script/publish.js +146 -0
- package/src/base-search-select/base-search-form-select.tsx +10 -0
- package/src/base-search-select/base-search-select.tsx +200 -0
- package/src/base-search-select/index.module.less +16 -0
- package/src/base-search-select/index.tsx +3 -0
- package/src/base-search-select/types.ts +16 -0
- package/src/base-search-select/utils.ts +78 -0
- package/src/basic-card/index.tsx +23 -0
- package/src/card-pane/index.module.less +14 -0
- package/src/card-pane/index.tsx +25 -0
- package/src/chip-select/index.module.less +17 -0
- package/src/chip-select/index.tsx +7 -0
- package/src/code-editor/index.tsx +9 -0
- package/src/code-usage/code-item.module.less +32 -0
- package/src/code-usage/index.tsx +91 -0
- package/src/codemirror-editor/code-editor.tsx +139 -0
- package/src/codemirror-editor/index.ts +4 -0
- package/src/codemirror-editor/json-editor.tsx +183 -0
- package/src/codemirror-editor/raw-text-editor.tsx +68 -0
- package/src/codemirror-editor/text-editor.tsx +58 -0
- package/src/codemirror-editor/themes/coze-dark.ts +116 -0
- package/src/codemirror-editor/themes/coze-light.ts +122 -0
- package/src/collapse-card/index.module.less +27 -0
- package/src/collapse-card/index.tsx +93 -0
- package/src/collapsible-card/index.module.less +63 -0
- package/src/collapsible-card/index.tsx +57 -0
- package/src/column-manage-storage/index.tsx +64 -0
- package/src/columns-select/index.tsx +244 -0
- package/src/edit-icon-button/index.tsx +36 -0
- package/src/footer-actions/index.tsx +33 -0
- package/src/hooks/use-infinite-scroll.ts +183 -0
- package/src/hooks/use-mouse-down-offset.ts +50 -0
- package/src/hooks/use-unsave-leave-warning.ts +49 -0
- package/src/id-render/icon-button-container.tsx +37 -0
- package/src/id-render/index.tsx +64 -0
- package/src/index-controller/record-navigation.tsx +57 -0
- package/src/index-controller/use-item-index-controller.ts +197 -0
- package/src/index.ts +208 -0
- package/src/infinite-scroll-table/index.tsx +99 -0
- package/src/info-tooltip/index.tsx +41 -0
- package/src/input-components/radio-button.tsx +63 -0
- package/src/input-slider/index.module.less +30 -0
- package/src/input-slider/index.tsx +161 -0
- package/src/input-with-count/index.tsx +31 -0
- package/src/jump-button/jump-icon-button.tsx +12 -0
- package/src/large-txt-render/index.tsx +46 -0
- package/src/layout/content.tsx +28 -0
- package/src/layout/header.tsx +15 -0
- package/src/layout/index.module.less +28 -0
- package/src/layout/index.tsx +9 -0
- package/src/layout/tabs.tsx +11 -0
- package/src/lazy-load-component/index.tsx +55 -0
- package/src/logic-editor/index.ts +3 -0
- package/src/logic-editor/logic-editor.module.less +13 -0
- package/src/logic-editor/logic-editor.tsx +200 -0
- package/src/logic-editor/logic-left-render.tsx +100 -0
- package/src/logic-editor/logic-operator-render.tsx +54 -0
- package/src/logic-editor/logic-right-render.tsx +51 -0
- package/src/logic-editor/logic-types.tsx +238 -0
- package/src/logic-editor/utils.ts +22 -0
- package/src/logic-expr/assets/select.svg +1 -0
- package/src/logic-expr/consts.ts +6 -0
- package/src/logic-expr/expr-group-render.tsx +238 -0
- package/src/logic-expr/expr-render.tsx +226 -0
- package/src/logic-expr/index.module.less +252 -0
- package/src/logic-expr/index.ts +13 -0
- package/src/logic-expr/logic-expr.tsx +261 -0
- package/src/logic-expr/logic-not.tsx +46 -0
- package/src/logic-expr/logic-toggle.tsx +96 -0
- package/src/logic-expr/types.ts +95 -0
- package/src/loop-radio-group/index.tsx +16 -0
- package/src/multi-part-editor/components/image-item-renderer.tsx +134 -0
- package/src/multi-part-editor/components/index.module.less +21 -0
- package/src/multi-part-editor/components/multipart-item-renderer.tsx +74 -0
- package/src/multi-part-editor/components/url-input-modal.tsx +317 -0
- package/src/multi-part-editor/components/video-item-renderer.tsx +145 -0
- package/src/multi-part-editor/index.module.less +8 -0
- package/src/multi-part-editor/index.tsx +571 -0
- package/src/multi-part-editor/multi-part-render.tsx +87 -0
- package/src/multi-part-editor/type.tsx +103 -0
- package/src/multi-part-editor/upload-button.tsx +256 -0
- package/src/multi-part-editor/utils.ts +64 -0
- package/src/open-detail-button/index.tsx +30 -0
- package/src/page-content/index.tsx +99 -0
- package/src/primary-page/index.tsx +1 -0
- package/src/primary-page/primary-header.tsx +64 -0
- package/src/primary-title/index.module.less +14 -0
- package/src/primary-title/index.tsx +18 -0
- package/src/provider/index.tsx +89 -0
- package/src/resizable-side-sheet/index.tsx +69 -0
- package/src/resize-sidesheet/index.module.less +14 -0
- package/src/resize-sidesheet/index.tsx +68 -0
- package/src/resize-sidesheet/use-drag.ts +43 -0
- package/src/schema-editor/index.tsx +52 -0
- package/src/search-form/index.tsx +134 -0
- package/src/semi-schema-form/components/tmpls/array-field-item.tsx +97 -0
- package/src/semi-schema-form/components/tmpls/array-field.tsx +127 -0
- package/src/semi-schema-form/components/tmpls/base-input.tsx +126 -0
- package/src/semi-schema-form/components/tmpls/description-field.tsx +23 -0
- package/src/semi-schema-form/components/tmpls/error-list.tsx +44 -0
- package/src/semi-schema-form/components/tmpls/field-error.tsx +33 -0
- package/src/semi-schema-form/components/tmpls/field.tsx +54 -0
- package/src/semi-schema-form/components/tmpls/icon-button.tsx +112 -0
- package/src/semi-schema-form/components/tmpls/index.ts +39 -0
- package/src/semi-schema-form/components/tmpls/object-field.tsx +173 -0
- package/src/semi-schema-form/components/tmpls/submit.tsx +31 -0
- package/src/semi-schema-form/components/tmpls/title-field.tsx +30 -0
- package/src/semi-schema-form/components/widgets/checkbox.tsx +67 -0
- package/src/semi-schema-form/components/widgets/checkboxs.tsx +100 -0
- package/src/semi-schema-form/components/widgets/index.ts +17 -0
- package/src/semi-schema-form/components/widgets/radio.tsx +105 -0
- package/src/semi-schema-form/components/widgets/range.tsx +73 -0
- package/src/semi-schema-form/components/widgets/select.tsx +108 -0
- package/src/semi-schema-form/components/widgets/textarea.tsx +63 -0
- package/src/semi-schema-form/index.tsx +14 -0
- package/src/sentinel-form/enum.ts +16 -0
- package/src/sentinel-form/index.tsx +382 -0
- package/src/step-nav/index.module.less +45 -0
- package/src/step-nav/index.tsx +53 -0
- package/src/table/index.module.less +144 -0
- package/src/table/index.tsx +18 -0
- package/src/table/sort-icon.tsx +73 -0
- package/src/table/table-with-pagination.tsx +150 -0
- package/src/table/table-without-pagniation.tsx +66 -0
- package/src/table-batch-operate/table-batch-operation.tsx +47 -0
- package/src/table-batch-operate/use-batch-operate.ts +111 -0
- package/src/table-col-actions/index.module.less +8 -0
- package/src/table-col-actions/index.tsx +149 -0
- package/src/table-cols-config/index.module.less +34 -0
- package/src/table-cols-config/index.tsx +171 -0
- package/src/table-cols-config/type.ts +12 -0
- package/src/table-cols-config/use-hidden-col-keys.ts +53 -0
- package/src/table-cols-config/util.ts +56 -0
- package/src/table-empty/index.tsx +23 -0
- package/src/table-header/index.module.less +7 -0
- package/src/table-header/index.tsx +70 -0
- package/src/tabs/index.module.less +48 -0
- package/src/tabs/index.tsx +9 -0
- package/src/text-area-pro/index.module.less +5 -0
- package/src/text-area-pro/index.tsx +49 -0
- package/src/text-with-copy/index.tsx +95 -0
- package/src/title-with-sub/index.tsx +27 -0
- package/src/tooltip-when-disabled/index.tsx +23 -0
- package/src/tooltip-with-disabled/index.tsx +17 -0
- package/src/types.d.ts +24 -0
- package/src/upload/index.ts +39 -0
- package/src/user-profile/index.tsx +49 -0
- package/src/utils/basic.ts +29 -0
- package/src/version-list/index.module.less +16 -0
- package/src/version-list/version-descriptions.tsx +80 -0
- package/src/version-list/version-item.tsx +30 -0
- package/src/version-list/version-list.tsx +59 -0
- package/src/version-list/version-switch-panel.tsx +31 -0
- package/tailwind.config.ts +6 -0
- package/tsconfig.build.json +44 -0
- package/tsconfig.json +17 -0
- package/tsconfig.misc.json +28 -0
- package/vitest.config.mts +7 -0
- package/dist/es/collapsible-card/index.js +0 -45
- package/dist/es/collapsible-card/index.module.js +0 -5
- package/dist/es/collapsible-card/index_module.css +0 -48
- package/dist/es/column-manage-storage/index.js +0 -73
- package/dist/es/columns-select/index.js +0 -219
- package/dist/es/hooks/use-infinite-scroll.js +0 -178
- package/dist/es/hooks/use-mouse-down-offset.js +0 -41
- package/dist/es/id-render/icon-button-container.js +0 -61
- package/dist/es/id-render/index.js +0 -78
- package/dist/es/infinite-scroll-table/index.js +0 -98
- package/dist/es/input-slider/index.js +0 -123
- package/dist/es/input-slider/index.module.js +0 -5
- package/dist/es/input-slider/index_module.css +0 -21
- package/dist/es/large-txt-render/index.js +0 -38
- package/dist/es/page-content/index.js +0 -108
- package/dist/es/primary-page/index.js +0 -4
- package/dist/es/primary-page/primary-header.js +0 -38
- package/dist/es/resize-sidesheet/index.js +0 -100
- package/dist/es/resize-sidesheet/index.module.js +0 -5
- package/dist/es/resize-sidesheet/index_module.css +0 -9
- package/dist/es/resize-sidesheet/use-drag.js +0 -31
- package/dist/es/table/index.js +0 -56
- package/dist/es/table/index.module.js +0 -5
- package/dist/es/table/index_module.css +0 -90
- package/dist/es/table/sort-icon.js +0 -105
- package/dist/es/table/table-with-pagination.js +0 -112
- package/dist/es/table/table-without-pagniation.js +0 -74
- package/dist/es/table-col-actions/index.js +0 -103
- package/dist/es/table-header/index.js +0 -68
- package/dist/es/table-header/index.module.js +0 -5
- package/dist/es/table-header/index_module.css +0 -3
- package/dist/es/tabs/index.js +0 -42
- package/dist/es/tabs/index.module.js +0 -5
- package/dist/es/tabs/index_module.css +0 -37
- package/dist/es/text-with-copy/index.js +0 -71
- package/dist/es/tooltip-with-disabled/index.js +0 -49
- package/dist/es/utils/basic.js +0 -44
- package/dist/es/utils/rect.js +0 -37
- package/dist/lib/collapsible-card/index.module.js +0 -25
- package/dist/lib/collapsible-card/index_module.css +0 -48
- package/dist/lib/input-slider/index.module.js +0 -25
- package/dist/lib/input-slider/index_module.css +0 -21
- package/dist/lib/resize-sidesheet/index.module.js +0 -25
- package/dist/lib/resize-sidesheet/index_module.css +0 -9
- package/dist/lib/table/index.module.js +0 -25
- package/dist/lib/table/index_module.css +0 -90
- package/dist/lib/table-header/index.module.js +0 -25
- package/dist/lib/table-header/index_module.css +0 -3
- package/dist/lib/tabs/index.module.js +0 -25
- package/dist/lib/tabs/index_module.css +0 -37
- package/dist/lib/utils/rect.js +0 -65
- package/dist/types/collapsible-card/index.d.ts +0 -22
- package/dist/types/columns-select/index.d.ts +0 -29
- package/dist/types/hooks/use-mouse-down-offset.d.ts +0 -9
- package/dist/types/id-render/icon-button-container.d.ts +0 -12
- package/dist/types/id-render/index.d.ts +0 -13
- package/dist/types/index.d.ts +0 -19
- package/dist/types/input-slider/index.d.ts +0 -14
- package/dist/types/page-content/index.d.ts +0 -36
- package/dist/types/primary-page/index.d.ts +0 -1
- package/dist/types/primary-page/primary-header.d.ts +0 -17
- package/dist/types/resize-sidesheet/use-drag.d.ts +0 -10
- package/dist/types/table/sort-icon.d.ts +0 -13
- package/dist/types/table/table-with-pagination.d.ts +0 -14
- package/dist/types/table/table-without-pagniation.d.ts +0 -8
- package/dist/types/table-col-actions/index.d.ts +0 -21
- package/dist/types/table-header/index.d.ts +0 -20
- package/dist/types/text-with-copy/index.d.ts +0 -24
- package/dist/types/tooltip-with-disabled/index.d.ts +0 -9
- package/dist/types/utils/basic.d.ts +0 -1
- package/dist/types/utils/rect.d.ts +0 -10
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { isNull, isUndefined } from 'lodash-es';
|
|
5
|
+
import classNames from 'classnames';
|
|
6
|
+
import { useRequest } from 'ahooks';
|
|
7
|
+
import { IconCozRefresh } from '@coze-arch/coze-design/icons';
|
|
8
|
+
import {
|
|
9
|
+
type RenderSelectedItemFn,
|
|
10
|
+
Select,
|
|
11
|
+
type OptionProps,
|
|
12
|
+
Tooltip,
|
|
13
|
+
Button,
|
|
14
|
+
} from '@coze-arch/coze-design';
|
|
15
|
+
|
|
16
|
+
import { getOptionsNotInList, transformValueToArray } from './utils';
|
|
17
|
+
import { type BaseSelectProps } from './types';
|
|
18
|
+
|
|
19
|
+
import styles from './index.module.less';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 基础选择器组件
|
|
23
|
+
* 解决两个主要问题:
|
|
24
|
+
* 1. 初始选中值不在第一页数据中导致只显示ID
|
|
25
|
+
* 2. 搜索后选中值不在结果中导致只显示ID
|
|
26
|
+
*/
|
|
27
|
+
// eslint-disable-next-line @coze-arch/max-line-per-function
|
|
28
|
+
const BaseSearchSelect = (props: BaseSelectProps) => {
|
|
29
|
+
const {
|
|
30
|
+
optionList: _optionList,
|
|
31
|
+
loadOptionByIds,
|
|
32
|
+
value,
|
|
33
|
+
defaultValue,
|
|
34
|
+
onSearch,
|
|
35
|
+
renderSelectedItem,
|
|
36
|
+
onChangeWithObject,
|
|
37
|
+
onDropdownVisibleChange,
|
|
38
|
+
showRefreshBtn,
|
|
39
|
+
onClickRefresh,
|
|
40
|
+
disabledCacheOptions,
|
|
41
|
+
} = props;
|
|
42
|
+
|
|
43
|
+
// 是否在搜索中
|
|
44
|
+
const [searchWord, setSearchWord] = useState('');
|
|
45
|
+
const [refreshFlag, setRefreshFlag] = useState([]);
|
|
46
|
+
const [dropdownVisible, setDropdownVisible] = useState(false);
|
|
47
|
+
const optionMapRef = useRef<Record<string, OptionProps>>({});
|
|
48
|
+
|
|
49
|
+
const optionList = useMemo(() => _optionList || [], [_optionList]);
|
|
50
|
+
|
|
51
|
+
const isOptionListNotExists = useMemo(() => !_optionList, [_optionList]);
|
|
52
|
+
|
|
53
|
+
useEffect(() => {
|
|
54
|
+
if (isOptionListNotExists) {
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
// 每次 optionList 变化, 将 optionList 中的 option 添加到 optionMapRef 中缓存
|
|
58
|
+
(optionList || []).forEach(item => {
|
|
59
|
+
optionMapRef.current[item?.value as string] = item;
|
|
60
|
+
});
|
|
61
|
+
}, [optionList]);
|
|
62
|
+
|
|
63
|
+
// 初始化
|
|
64
|
+
useRequest(
|
|
65
|
+
async () => {
|
|
66
|
+
const initialValue = value || defaultValue;
|
|
67
|
+
// 1. 判断 list 有没有value, 有则不发请求
|
|
68
|
+
if (
|
|
69
|
+
isUndefined(initialValue) ||
|
|
70
|
+
isNull(initialValue) ||
|
|
71
|
+
initialValue === '' ||
|
|
72
|
+
!loadOptionByIds
|
|
73
|
+
) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 2. 判断 optionList 中有没有 value 中不存在的 选项, 有则不发请求
|
|
78
|
+
const optionsNotInList = getOptionsNotInList({
|
|
79
|
+
value: initialValue,
|
|
80
|
+
optionList,
|
|
81
|
+
onChangeWithObject,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
if (optionsNotInList.length === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
try {
|
|
89
|
+
const payload = transformValueToArray(value, onChangeWithObject);
|
|
90
|
+
const fetchOptions = await loadOptionByIds(payload);
|
|
91
|
+
if (fetchOptions) {
|
|
92
|
+
setRefreshFlag([]);
|
|
93
|
+
optionMapRef.current = {
|
|
94
|
+
...optionMapRef.current,
|
|
95
|
+
...fetchOptions.reduce((acc, item) => {
|
|
96
|
+
acc[item?.value as string] = item;
|
|
97
|
+
return acc;
|
|
98
|
+
}, {}),
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error('Failed to load selected option:', error);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
refreshDeps: [value],
|
|
107
|
+
},
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 最后展示的选项
|
|
112
|
+
*/
|
|
113
|
+
const cacheOptions = useMemo(() => {
|
|
114
|
+
// searchWord 表示处于搜索中, 不应该展示不在选项列表中的选项
|
|
115
|
+
if (!value || searchWord || disabledCacheOptions) {
|
|
116
|
+
return optionList;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const optionsNotInList = getOptionsNotInList({
|
|
120
|
+
value,
|
|
121
|
+
optionList,
|
|
122
|
+
onChangeWithObject,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
// value 所有选项都在选项列表中, 直接返回
|
|
126
|
+
if (optionsNotInList.length === 0) {
|
|
127
|
+
return optionList;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// value 不在选项列表, 则对value进行处理, 前面已经处理为arr了
|
|
131
|
+
// 所以这里可以直接按arr 处理 返回缓存中的选项
|
|
132
|
+
const optionsInCache = optionsNotInList.map(k => optionMapRef.current[k]);
|
|
133
|
+
// 有可能存在远端数据被删除,id无法拉去到的情况
|
|
134
|
+
const newOptions = [...optionsInCache, ...optionList].filter(Boolean);
|
|
135
|
+
return newOptions;
|
|
136
|
+
}, [optionList, value, searchWord, refreshFlag]);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* 选中项渲染, 如果list中没有, 从缓存中拿当前的选种值
|
|
140
|
+
*/
|
|
141
|
+
const RenderSelectedItem = useCallback(
|
|
142
|
+
(optionNode: Record<string, unknown>, multipleProps?: any) => {
|
|
143
|
+
const renderOpt =
|
|
144
|
+
optionMapRef.current[optionNode?.value as string] || optionNode;
|
|
145
|
+
|
|
146
|
+
if (renderSelectedItem) {
|
|
147
|
+
return renderSelectedItem(renderOpt, multipleProps);
|
|
148
|
+
}
|
|
149
|
+
// 多选
|
|
150
|
+
if (multipleProps) {
|
|
151
|
+
return {
|
|
152
|
+
isRenderInTag: true,
|
|
153
|
+
content: renderOpt?.label || renderOpt?.value,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
return renderOpt?.label || renderOpt?.value;
|
|
157
|
+
},
|
|
158
|
+
[renderSelectedItem],
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<Select
|
|
163
|
+
suffix={
|
|
164
|
+
showRefreshBtn && dropdownVisible ? (
|
|
165
|
+
<Tooltip theme="dark" content="刷新">
|
|
166
|
+
<div className="flex flex-row items-center">
|
|
167
|
+
<Button
|
|
168
|
+
className="!h-6 !w-6"
|
|
169
|
+
icon={<IconCozRefresh />}
|
|
170
|
+
size="small"
|
|
171
|
+
color="secondary"
|
|
172
|
+
onClick={() => onClickRefresh?.()}
|
|
173
|
+
/>
|
|
174
|
+
<div className="h-3 w-0 border-0 border-l border-solid coz-stroke-primary ml-[2px]" />
|
|
175
|
+
</div>
|
|
176
|
+
</Tooltip>
|
|
177
|
+
) : null
|
|
178
|
+
}
|
|
179
|
+
{...props}
|
|
180
|
+
onDropdownVisibleChange={visible => {
|
|
181
|
+
setDropdownVisible(visible);
|
|
182
|
+
onDropdownVisibleChange?.(visible);
|
|
183
|
+
}}
|
|
184
|
+
dropdownClassName={classNames(
|
|
185
|
+
styles['select-dropdown-style'],
|
|
186
|
+
props.dropdownClassName,
|
|
187
|
+
)}
|
|
188
|
+
optionList={isOptionListNotExists ? undefined : cacheOptions}
|
|
189
|
+
renderSelectedItem={RenderSelectedItem as RenderSelectedItemFn}
|
|
190
|
+
onSearch={(vs, e) => {
|
|
191
|
+
setSearchWord(vs);
|
|
192
|
+
if (onSearch) {
|
|
193
|
+
onSearch?.(vs, e);
|
|
194
|
+
}
|
|
195
|
+
}}
|
|
196
|
+
/>
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export default BaseSearchSelect;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* stylelint-disable selector-class-pattern */
|
|
2
|
+
.select-dropdown-style {
|
|
3
|
+
:global {
|
|
4
|
+
.coz-select-option-item .option-text-wrapper {
|
|
5
|
+
padding-left: 8px;
|
|
6
|
+
.option-text {
|
|
7
|
+
padding-left: 0px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
.coz-select-option-item.disabled {
|
|
11
|
+
.option-text-wrapper {
|
|
12
|
+
color: rgba(var(--coze-fg-1), var(--coze-fg-1-alpha));
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { type OptionProps, type SelectProps } from '@coze-arch/coze-design';
|
|
3
|
+
|
|
4
|
+
export type LoadOptionByIds = (
|
|
5
|
+
ids: string[] | number[],
|
|
6
|
+
) => Promise<(OptionProps & { [key: string]: any })[]>;
|
|
7
|
+
|
|
8
|
+
export interface BaseSelectProps extends SelectProps {
|
|
9
|
+
/** 是否禁用缓存选项 */
|
|
10
|
+
disabledCacheOptions?: boolean;
|
|
11
|
+
loadOptionByIds?: LoadOptionByIds;
|
|
12
|
+
/** 是否显示刷新按钮 */
|
|
13
|
+
showRefreshBtn?: boolean;
|
|
14
|
+
/** 点击刷新按钮的回调 */
|
|
15
|
+
onClickRefresh?: () => void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
export const transformValueToArray = (
|
|
3
|
+
value: any,
|
|
4
|
+
onChangeWithObject = false,
|
|
5
|
+
): string[] | number[] => {
|
|
6
|
+
// 对象传入
|
|
7
|
+
if (onChangeWithObject) {
|
|
8
|
+
// 对象数组
|
|
9
|
+
if (Array.isArray(value)) {
|
|
10
|
+
return value.map(item => item?.value || '').filter(Boolean);
|
|
11
|
+
}
|
|
12
|
+
// 单个对象
|
|
13
|
+
return value?.value ? [value?.value] : [];
|
|
14
|
+
}
|
|
15
|
+
// 普通数组 或 字符串
|
|
16
|
+
return Array.isArray(value) ? value : [value];
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// 过滤 value 中不在 optionlist 中的 option
|
|
20
|
+
export const filterValueNotInOptionList = (
|
|
21
|
+
value: any,
|
|
22
|
+
optionSet: Set<string | number | undefined>,
|
|
23
|
+
onChangeWithObject = false,
|
|
24
|
+
): Int64[] => {
|
|
25
|
+
if (onChangeWithObject) {
|
|
26
|
+
// 对象数组
|
|
27
|
+
if (Array.isArray(value)) {
|
|
28
|
+
return value
|
|
29
|
+
.filter(item => !optionSet.has(item?.value))
|
|
30
|
+
.map(it => it?.value);
|
|
31
|
+
}
|
|
32
|
+
// 单个对象
|
|
33
|
+
return optionSet.has(value?.value) ? [] : [value?.value];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
return value.filter(item => !optionSet.has(item));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
41
|
+
return optionSet.has(value) ? [] : [value];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return [];
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const getOptionsNotInList = ({
|
|
48
|
+
value,
|
|
49
|
+
optionList,
|
|
50
|
+
onChangeWithObject = false,
|
|
51
|
+
}: {
|
|
52
|
+
value: any;
|
|
53
|
+
optionList: any[];
|
|
54
|
+
onChangeWithObject?: boolean;
|
|
55
|
+
}) => {
|
|
56
|
+
// 集合
|
|
57
|
+
const existingValues = new Set(optionList.map(item => item.value));
|
|
58
|
+
|
|
59
|
+
// 找到 value 里面不在选项列表中的选项
|
|
60
|
+
const optionsNotInList = filterValueNotInOptionList(
|
|
61
|
+
value,
|
|
62
|
+
existingValues,
|
|
63
|
+
onChangeWithObject,
|
|
64
|
+
);
|
|
65
|
+
return optionsNotInList;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const initialValueChecker = (
|
|
69
|
+
value: any,
|
|
70
|
+
optionList: any[],
|
|
71
|
+
onChangeWithObject = false,
|
|
72
|
+
) => {
|
|
73
|
+
if (typeof value === 'string') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return value;
|
|
78
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
export interface CardProps {
|
|
6
|
+
title: ReactNode;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const BasicCard = ({ title, children, className }: CardProps) => (
|
|
12
|
+
<div
|
|
13
|
+
className={classNames(
|
|
14
|
+
'border border-solid coz-stroke-plus rounded-[6px] overflow-hidden',
|
|
15
|
+
className,
|
|
16
|
+
)}
|
|
17
|
+
>
|
|
18
|
+
<div className="text-sm font-medium px-4 h-[44px] flex items-center coze-fg-primary bg-[#F7F7FC]">
|
|
19
|
+
{title}
|
|
20
|
+
</div>
|
|
21
|
+
{children ? <div className="p-4 bg-white">{children}</div> : null}
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
.container {
|
|
2
|
+
padding: 8px 16px;
|
|
3
|
+
|
|
4
|
+
border: 1px solid var(--semi-color-border);
|
|
5
|
+
border-radius: var(--semi-border-radius-medium);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.shadow {
|
|
9
|
+
transition: box-shadow 0.3s;
|
|
10
|
+
&:hover {
|
|
11
|
+
box-shadow: var(--semi-shadow-elevated);
|
|
12
|
+
z-index: 1;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
|
|
5
|
+
import styles from './index.module.less';
|
|
6
|
+
|
|
7
|
+
export interface CardPaneProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
8
|
+
/* hover 的时候是否展示 shadow 样式 */
|
|
9
|
+
hoverShadow?: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function CardPane({ hoverShadow, className, ...props }: CardPaneProps) {
|
|
13
|
+
return (
|
|
14
|
+
<div
|
|
15
|
+
className={classNames(
|
|
16
|
+
styles.container,
|
|
17
|
+
{
|
|
18
|
+
[styles.shadow]: hoverShadow,
|
|
19
|
+
},
|
|
20
|
+
className,
|
|
21
|
+
)}
|
|
22
|
+
{...props}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* stylelint-disable declaration-no-important */
|
|
2
|
+
.select{
|
|
3
|
+
height: 24px !important;
|
|
4
|
+
min-height: 24px !important;
|
|
5
|
+
|
|
6
|
+
:global{
|
|
7
|
+
.semi-select-selection-text{
|
|
8
|
+
.coz-chip{
|
|
9
|
+
padding-right: 0;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.semi-select-arrow{
|
|
14
|
+
padding-left: 0 !important;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import cls from 'classnames';
|
|
2
|
+
import { Select, type SelectProps } from '@coze-arch/coze-design';
|
|
3
|
+
|
|
4
|
+
import styles from './index.module.less';
|
|
5
|
+
export const ChipSelect = (props: SelectProps) => (
|
|
6
|
+
<Select {...props} className={cls(styles.select, props.className)} />
|
|
7
|
+
);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/// <reference path="../types.d.ts" />
|
|
2
|
+
export { default as CodeEditor, DiffEditor } from '@monaco-editor/react';
|
|
3
|
+
export { type Monaco, type MonacoDiffEditor } from '@monaco-editor/react';
|
|
4
|
+
export { type editor } from 'monaco-editor';
|
|
5
|
+
import { loader } from '@monaco-editor/react';
|
|
6
|
+
|
|
7
|
+
loader.config({
|
|
8
|
+
paths: { vs: MONACO_UNPKG },
|
|
9
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
.usage-detail {
|
|
2
|
+
position: relative;
|
|
3
|
+
padding-left: 16px;
|
|
4
|
+
|
|
5
|
+
padding-bottom: 16px;
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
&:not(:last-child) {
|
|
9
|
+
&::before {
|
|
10
|
+
content: '';
|
|
11
|
+
position: absolute;
|
|
12
|
+
left: 6px;
|
|
13
|
+
top: 20px;
|
|
14
|
+
bottom: 4px;
|
|
15
|
+
border-left: 2px solid var(--semi-color-primary);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
&::after {
|
|
21
|
+
content: '•';
|
|
22
|
+
position: absolute;
|
|
23
|
+
left: 0;
|
|
24
|
+
top: -2px;
|
|
25
|
+
margin: auto 0;
|
|
26
|
+
height: 32px;
|
|
27
|
+
color: var(--semi-color-primary);
|
|
28
|
+
font-size: 32px;
|
|
29
|
+
line-height: 20px;
|
|
30
|
+
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconCozCopy } from '@coze-arch/coze-design/icons';
|
|
3
|
+
import { handleCopy } from '../utils/basic';
|
|
4
|
+
import { CodeEditor } from '../code-editor';
|
|
5
|
+
|
|
6
|
+
import styles from './code-item.module.less';
|
|
7
|
+
|
|
8
|
+
export enum SupportedLang {
|
|
9
|
+
Golang = 'go',
|
|
10
|
+
Js = 'javascript',
|
|
11
|
+
Python = 'python',
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface UsageContentProps {
|
|
15
|
+
content: string;
|
|
16
|
+
copyable?: boolean;
|
|
17
|
+
lang?: SupportedLang;
|
|
18
|
+
height?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const UsageContent = ({
|
|
22
|
+
content,
|
|
23
|
+
copyable,
|
|
24
|
+
lang = SupportedLang.Js,
|
|
25
|
+
height = 300,
|
|
26
|
+
}: UsageContentProps) => (
|
|
27
|
+
<div className="bg-[var(--semi-color-fill-0)] p-[16px] rounded-[8px] text-[14px] flex">
|
|
28
|
+
<div className="flex-1 whitespace-pre-wrap break-all">
|
|
29
|
+
<CodeEditor
|
|
30
|
+
width={'100%'}
|
|
31
|
+
height={height}
|
|
32
|
+
language={lang}
|
|
33
|
+
value={content}
|
|
34
|
+
theme={'code-block-grey'}
|
|
35
|
+
options={{
|
|
36
|
+
minimap: { enabled: false },
|
|
37
|
+
wordWrap: 'on',
|
|
38
|
+
scrollBeyondLastLine: false,
|
|
39
|
+
unicodeHighlight: { ambiguousCharacters: false },
|
|
40
|
+
lineNumbers: 'on',
|
|
41
|
+
formatOnPaste: true,
|
|
42
|
+
readOnly: true,
|
|
43
|
+
}}
|
|
44
|
+
beforeMount={monaco => {
|
|
45
|
+
monaco.editor.defineTheme('code-block-grey', {
|
|
46
|
+
base: 'vs',
|
|
47
|
+
inherit: true,
|
|
48
|
+
rules: [],
|
|
49
|
+
colors: {
|
|
50
|
+
'editor.background': '#F4F4F4', // Set the background color of the editor
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
}}
|
|
54
|
+
/>
|
|
55
|
+
</div>
|
|
56
|
+
<div className="ml-[8px]">
|
|
57
|
+
{copyable ? (
|
|
58
|
+
<IconCozCopy
|
|
59
|
+
className="ml-[4px] text-[var(--coz-fg-dim)] cursor-pointer hover:coz-fg-primary"
|
|
60
|
+
onClick={() => handleCopy(content || '')}
|
|
61
|
+
/>
|
|
62
|
+
) : null}
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
interface UsageItemProps {
|
|
68
|
+
title?: React.ReactNode;
|
|
69
|
+
content?: string;
|
|
70
|
+
lang?: SupportedLang;
|
|
71
|
+
contentHeight?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const UsageItem = ({
|
|
75
|
+
title,
|
|
76
|
+
content,
|
|
77
|
+
lang,
|
|
78
|
+
contentHeight,
|
|
79
|
+
}: UsageItemProps) => (
|
|
80
|
+
<div className={styles['usage-detail']}>
|
|
81
|
+
<div className="text-[#16px] font-[500] mb-4">{title}</div>
|
|
82
|
+
{content ? (
|
|
83
|
+
<UsageContent
|
|
84
|
+
content={content}
|
|
85
|
+
copyable={true}
|
|
86
|
+
lang={lang}
|
|
87
|
+
height={contentHeight}
|
|
88
|
+
/>
|
|
89
|
+
) : null}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { type ComponentType } from 'react';
|
|
3
|
+
|
|
4
|
+
import { createRenderer, option } from '@coze-editor/editor/react';
|
|
5
|
+
import preset, { languages, themes } from '@coze-editor/editor/preset-code';
|
|
6
|
+
import { shell } from '@coze-editor/editor/language-shell';
|
|
7
|
+
import { json } from '@coze-editor/editor/language-json';
|
|
8
|
+
import { mixLanguages } from '@coze-editor/editor';
|
|
9
|
+
import { EditorView } from '@codemirror/view';
|
|
10
|
+
|
|
11
|
+
import { cozeLight } from './themes/coze-light';
|
|
12
|
+
import { cozeDark } from './themes/coze-dark';
|
|
13
|
+
|
|
14
|
+
// 注册语言
|
|
15
|
+
languages.register('json', {
|
|
16
|
+
// mixLanguages 用于解决 「插值也使用了括号,导致无法正确高亮」的问题
|
|
17
|
+
language: mixLanguages({
|
|
18
|
+
outerLanguage: json.language,
|
|
19
|
+
}),
|
|
20
|
+
languageService: json.languageService,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
languages.register('shell', shell);
|
|
24
|
+
|
|
25
|
+
// 注册主题
|
|
26
|
+
themes.register('coze-light', cozeLight);
|
|
27
|
+
themes.register('coze-dark', cozeDark);
|
|
28
|
+
|
|
29
|
+
const minHeightOption = (value?: string | number) =>
|
|
30
|
+
EditorView.theme({
|
|
31
|
+
'.cm-content, .cm-gutter, .cm-right-gutter': {
|
|
32
|
+
minHeight:
|
|
33
|
+
typeof value === 'number'
|
|
34
|
+
? `${value}px`
|
|
35
|
+
: typeof value === 'string'
|
|
36
|
+
? value
|
|
37
|
+
: 'unset',
|
|
38
|
+
},
|
|
39
|
+
'&.cm-editor': {
|
|
40
|
+
minHeight:
|
|
41
|
+
typeof value === 'number'
|
|
42
|
+
? `${value}px`
|
|
43
|
+
: typeof value === 'string'
|
|
44
|
+
? value
|
|
45
|
+
: 'unset',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const maxHeightOption = (value?: string | number) =>
|
|
50
|
+
EditorView.theme({
|
|
51
|
+
'&.cm-editor': {
|
|
52
|
+
maxHeight:
|
|
53
|
+
typeof value === 'number'
|
|
54
|
+
? `${value}px`
|
|
55
|
+
: typeof value === 'string'
|
|
56
|
+
? value
|
|
57
|
+
: 'unset',
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const heightOption = (value?: string | number) =>
|
|
62
|
+
EditorView.theme({
|
|
63
|
+
'&.cm-editor': {
|
|
64
|
+
height:
|
|
65
|
+
typeof value === 'number'
|
|
66
|
+
? `${value}px`
|
|
67
|
+
: typeof value === 'string'
|
|
68
|
+
? value
|
|
69
|
+
: 'unset',
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
const paddingOption = (value?: string | number) =>
|
|
74
|
+
EditorView.theme({
|
|
75
|
+
'&.cm-editor': {
|
|
76
|
+
padding:
|
|
77
|
+
typeof value === 'number'
|
|
78
|
+
? `${value}px`
|
|
79
|
+
: typeof value === 'string'
|
|
80
|
+
? value
|
|
81
|
+
: 'unset',
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
const borderRadiusOption = (value?: string | number) =>
|
|
86
|
+
EditorView.theme({
|
|
87
|
+
'&.cm-editor, .cm-gutters': {
|
|
88
|
+
borderRadius:
|
|
89
|
+
typeof value === 'number'
|
|
90
|
+
? `${value}px`
|
|
91
|
+
: typeof value === 'string'
|
|
92
|
+
? value
|
|
93
|
+
: 'unset',
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
const lineHeightOption = (value?: string | number) =>
|
|
98
|
+
EditorView.theme({
|
|
99
|
+
'.cm-content, .cm-gutter, .cm-right-gutter': {
|
|
100
|
+
lineHeight:
|
|
101
|
+
typeof value === 'number'
|
|
102
|
+
? `${value}px`
|
|
103
|
+
: typeof value === 'string'
|
|
104
|
+
? value
|
|
105
|
+
: 'unset',
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
function createStyleOptions() {
|
|
110
|
+
return [
|
|
111
|
+
option('minHeight', minHeightOption),
|
|
112
|
+
option('maxHeight', maxHeightOption),
|
|
113
|
+
option('editerHeight', heightOption),
|
|
114
|
+
option('borderRadius', borderRadiusOption),
|
|
115
|
+
option('padding', paddingOption),
|
|
116
|
+
option('lineHeight', lineHeightOption),
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
const builtinExtensions = [
|
|
121
|
+
EditorView.theme({
|
|
122
|
+
'&.cm-focused': {
|
|
123
|
+
outline: 'none',
|
|
124
|
+
},
|
|
125
|
+
'& *': {
|
|
126
|
+
fontFamily: 'Menlo, Monaco, "Courier New", monospace',
|
|
127
|
+
},
|
|
128
|
+
}),
|
|
129
|
+
EditorView.theme({
|
|
130
|
+
'&.cm-content': {
|
|
131
|
+
wordBreak: 'break-all',
|
|
132
|
+
},
|
|
133
|
+
}),
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
export const CodeMirrorCodeEditor: ComponentType<any> = createRenderer(
|
|
137
|
+
[...preset, ...createStyleOptions()],
|
|
138
|
+
builtinExtensions,
|
|
139
|
+
);
|