@cozeloop/components 0.0.12-beta-1778488172610 → 0.0.12-beta-1378.344125032425
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/index.css +0 -49
- package/dist/es/index.mjs +17 -510
- 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.js +130 -0
- package/dist/lib/base-search-select/base-search-select.js.map +1 -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.js +2 -0
- package/dist/lib/base-search-select/types.js.map +1 -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.js +4 -0
- package/dist/lib/basic-card/index.js.map +1 -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.js +6 -0
- package/dist/lib/chip-select/index.js.map +1 -0
- package/dist/lib/codemirror-editor/code-editor.d.ts +2 -23
- package/dist/lib/codemirror-editor/code-editor.js +135 -0
- package/dist/lib/codemirror-editor/code-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/index.js +7 -0
- package/dist/lib/codemirror-editor/index.js.map +1 -0
- package/dist/lib/codemirror-editor/json-editor.js +104 -0
- package/dist/lib/codemirror-editor/json-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/raw-code-editor.js +104 -0
- package/dist/lib/codemirror-editor/raw-code-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/raw-text-editor.js +33 -0
- package/dist/lib/codemirror-editor/raw-text-editor.js.map +1 -0
- package/dist/lib/codemirror-editor/text-editor.d.ts +2 -23
- package/dist/lib/codemirror-editor/text-editor.js +50 -0
- package/dist/lib/codemirror-editor/text-editor.js.map +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.js +119 -0
- package/dist/lib/codemirror-editor/themes/coze-light.js.map +1 -0
- package/dist/lib/collapse-card/index.js +31 -0
- package/dist/lib/collapse-card/index.js.map +1 -0
- package/dist/lib/collapse-item/index.js +9 -0
- package/dist/lib/collapse-item/index.js.map +1 -0
- package/dist/lib/collapsible-card/index.js +13 -0
- package/dist/lib/collapsible-card/index.js.map +1 -0
- package/dist/lib/column-manage-storage/index.js +48 -0
- package/dist/lib/column-manage-storage/index.js.map +1 -0
- package/dist/lib/columns-select/index.js +78 -0
- package/dist/lib/columns-select/index.js.map +1 -0
- package/dist/lib/copyable/index.js +12 -0
- package/dist/lib/copyable/index.js.map +1 -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.js +8 -0
- package/dist/lib/footer-actions/index.js.map +1 -0
- package/dist/lib/hooks/use-infinite-scroll.js +133 -0
- package/dist/lib/hooks/use-infinite-scroll.js.map +1 -0
- package/dist/lib/hooks/use-mouse-down-offset.js +39 -0
- package/dist/lib/hooks/use-mouse-down-offset.js.map +1 -0
- package/dist/lib/hooks/use-unsave-leave-warning.js +26 -0
- package/dist/lib/hooks/use-unsave-leave-warning.js.map +1 -0
- package/dist/lib/id-render/icon-button-container.js +7 -0
- package/dist/lib/id-render/icon-button-container.js.map +1 -0
- package/dist/lib/id-render/index.js +22 -0
- package/dist/lib/id-render/index.js.map +1 -0
- package/dist/lib/index-controller/record-navigation.js +10 -0
- package/dist/lib/index-controller/record-navigation.js.map +1 -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 +0 -6
- package/dist/lib/index.js +77 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/infinite-scroll-table/index.js +35 -0
- package/dist/lib/infinite-scroll-table/index.js.map +1 -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.js +21 -0
- package/dist/lib/input-components/radio-button.js.map +1 -0
- package/dist/lib/input-slider/index.js +81 -0
- package/dist/lib/input-slider/index.js.map +1 -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.js +7 -0
- package/dist/lib/jump-button/jump-icon-button.js.map +1 -0
- package/dist/lib/large-txt-render/index.js +27 -0
- package/dist/lib/large-txt-render/index.js.map +1 -0
- package/dist/lib/layout/content.js +5 -0
- package/dist/lib/layout/content.js.map +1 -0
- package/dist/lib/layout/header.js +6 -0
- package/dist/lib/layout/header.js.map +1 -0
- package/dist/lib/layout/index.js +9 -0
- package/dist/lib/layout/index.js.map +1 -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.js +42 -0
- package/dist/lib/lazy-load-component/index.js.map +1 -0
- package/dist/lib/link-button/index.js +23 -0
- package/dist/lib/link-button/index.js.map +1 -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.js +70 -0
- package/dist/lib/logic-editor/logic-editor.js.map +1 -0
- package/dist/lib/logic-editor/logic-left-render.js +62 -0
- package/dist/lib/logic-editor/logic-left-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-operator-render.js +31 -0
- package/dist/lib/logic-editor/logic-operator-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-right-render.js +26 -0
- package/dist/lib/logic-editor/logic-right-render.js.map +1 -0
- package/dist/lib/logic-editor/logic-types.js +144 -0
- package/dist/lib/logic-editor/logic-types.js.map +1 -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.js +5 -0
- package/dist/lib/logic-expr/consts.js.map +1 -0
- package/dist/lib/logic-expr/expr-group-render.js +60 -0
- package/dist/lib/logic-expr/expr-group-render.js.map +1 -0
- package/dist/lib/logic-expr/expr-render.js +84 -0
- package/dist/lib/logic-expr/expr-render.js.map +1 -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.js +187 -0
- package/dist/lib/logic-expr/logic-expr.js.map +1 -0
- package/dist/lib/logic-expr/logic-not.js +20 -0
- package/dist/lib/logic-expr/logic-not.js.map +1 -0
- package/dist/lib/logic-expr/logic-toggle.js +32 -0
- package/dist/lib/logic-expr/logic-toggle.js.map +1 -0
- package/dist/lib/logic-expr/types.js +2 -0
- package/dist/lib/logic-expr/types.js.map +1 -0
- package/dist/lib/loop-icons/index.js +3 -0
- package/dist/lib/loop-icons/index.js.map +1 -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-modal-dataset-item-render/audio-render/index.js +34 -0
- package/dist/lib/multi-modal-dataset-item-render/audio-render/index.js.map +1 -0
- package/dist/lib/multi-modal-dataset-item-render/index.js +3 -0
- package/dist/lib/multi-modal-dataset-item-render/index.js.map +1 -0
- package/dist/lib/multi-modal-dataset-item-render/video-render/index.js +47 -0
- package/dist/lib/multi-modal-dataset-item-render/video-render/index.js.map +1 -0
- package/dist/lib/multi-part-editor/components/image-item-renderer.js +58 -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.js +26 -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.js +151 -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.js +58 -0
- package/dist/lib/multi-part-editor/components/video-item-renderer.js.map +1 -0
- package/dist/lib/multi-part-editor/index.js +301 -0
- package/dist/lib/multi-part-editor/index.js.map +1 -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.js +27 -0
- package/dist/lib/multi-part-editor/type.js.map +1 -0
- package/dist/lib/multi-part-editor/upload-button.js +104 -0
- package/dist/lib/multi-part-editor/upload-button.js.map +1 -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.js +12 -0
- package/dist/lib/open-detail-button/index.js.map +1 -0
- package/dist/lib/ops-agent/fox-icon.js +8 -0
- package/dist/lib/ops-agent/fox-icon.js.map +1 -0
- package/dist/lib/page-content/index.js +24 -0
- package/dist/lib/page-content/index.js.map +1 -0
- package/dist/lib/primary-page/index.js +2 -0
- package/dist/lib/primary-page/index.js.map +1 -0
- package/dist/lib/primary-page/primary-header.js +4 -0
- package/dist/lib/primary-page/primary-header.js.map +1 -0
- package/dist/lib/primary-title/index.js +8 -0
- package/dist/lib/primary-title/index.js.map +1 -0
- package/dist/lib/resizable-side-sheet/index.js +32 -0
- package/dist/lib/resizable-side-sheet/index.js.map +1 -0
- package/dist/lib/resize-sidesheet/index.js +15 -0
- package/dist/lib/resize-sidesheet/index.js.map +1 -0
- package/dist/lib/resize-sidesheet/use-drag.js +30 -0
- package/dist/lib/resize-sidesheet/use-drag.js.map +1 -0
- package/dist/lib/schema-editor/index.js +5 -0
- package/dist/lib/schema-editor/index.js.map +1 -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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.js +18 -0
- package/dist/lib/semi-schema-form/components/widgets/textarea.js.map +1 -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.js +15 -0
- package/dist/lib/sentinel-form/enum.js.map +1 -0
- package/dist/lib/sentinel-form/index.d.ts +1 -1
- package/dist/lib/sentinel-form/index.js +323 -0
- package/dist/lib/sentinel-form/index.js.map +1 -0
- package/dist/lib/step-nav/index.js +13 -0
- package/dist/lib/step-nav/index.js.map +1 -0
- package/dist/lib/table/index.js +7 -0
- package/dist/lib/table/index.js.map +1 -0
- package/dist/lib/table/sort-icon.js +31 -0
- package/dist/lib/table/sort-icon.js.map +1 -0
- package/dist/lib/table/table-with-pagination.js +74 -0
- package/dist/lib/table/table-with-pagination.js.map +1 -0
- package/dist/lib/table/table-without-pagniation.js +37 -0
- package/dist/lib/table/table-without-pagniation.js.map +1 -0
- package/dist/lib/table-batch-operate/table-batch-operation.js +17 -0
- package/dist/lib/table-batch-operate/table-batch-operation.js.map +1 -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.js +39 -0
- package/dist/lib/table-col-actions/index.js.map +1 -0
- package/dist/lib/table-cols-config/index.js +60 -0
- package/dist/lib/table-cols-config/index.js.map +1 -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.js +32 -0
- package/dist/lib/table-cols-config/use-hidden-col-keys.js.map +1 -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.js +9 -0
- package/dist/lib/table-empty/index.js.map +1 -0
- package/dist/lib/table-header/index.d.ts +1 -1
- package/dist/lib/table-header/index.js +12 -0
- package/dist/lib/table-header/index.js.map +1 -0
- package/dist/lib/tabs/index.js +9 -0
- package/dist/lib/tabs/index.js.map +1 -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.js +25 -0
- package/dist/lib/text-with-copy/index.js.map +1 -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.js +9 -0
- package/dist/lib/tooltip-when-disabled/index.js.map +1 -0
- package/dist/lib/tooltip-with-disabled/index.js +9 -0
- package/dist/lib/tooltip-with-disabled/index.js.map +1 -0
- package/dist/lib/tsconfig.build.tsbuildinfo +1 -0
- package/dist/lib/upload/index.js +25 -0
- package/dist/lib/upload/index.js.map +1 -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.js +30 -0
- package/dist/lib/utils/basic.js.map +1 -0
- package/dist/lib/version-list/version-descriptions.js +15 -0
- package/dist/lib/version-list/version-descriptions.js.map +1 -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.js +12 -0
- package/dist/lib/version-list/version-list.js.map +1 -0
- package/dist/lib/version-list/version-switch-panel.js +11 -0
- package/dist/lib/version-list/version-switch-panel.js.map +1 -0
- package/package.json +31 -23
- package/dist/lib/accessible-option-label/index.d.ts +0 -14
- package/dist/lib/banner/index.d.ts +0 -8
- package/dist/lib/code-editor/index.d.ts +0 -3
- package/dist/lib/code-editor-with-loading/index.d.ts +0 -10
- package/dist/lib/input-number-bigint/__tests__/input-number-bigint.test.d.ts +0 -1
- package/dist/lib/input-number-bigint/index.d.ts +0 -3
- package/dist/lib/rich-text-editor/editor.d.ts +0 -2
- package/dist/lib/rich-text-editor/index.d.ts +0 -2
- package/dist/lib/rich-text-editor/mention-extension.d.ts +0 -16
- package/dist/lib/rich-text-editor/mention-node-view.d.ts +0 -4
- package/dist/lib/rich-text-editor/types.d.ts +0 -45
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { I18n } from '@cozeloop/i18n';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { IconCozIllus404Dark, IconCozIllus404, IconCozIllusErrorDark, IconCozIllusError, IconCozIllusLock, IconCozIllusLockDark, IconCozIllusEmpty, IconCozIllusEmptyDark, } from '@coze-arch/coze-design/illustrations';
|
|
5
|
+
import { Empty, Spin } from '@coze-arch/coze-design';
|
|
6
|
+
export function FullPage({ children, className, style }) {
|
|
7
|
+
return (_jsx("div", { className: classNames('w-full h-full flex items-center justify-center bg-semi-bg-1 z-10', className), style: style, children: children }));
|
|
8
|
+
}
|
|
9
|
+
export function PageLoading(props) {
|
|
10
|
+
return (_jsx(FullPage, { className: props.className, style: props.style, children: _jsx(Spin, { wrapperClassName: "w-full h-full", spinning: true, tip: props.tip }) }));
|
|
11
|
+
}
|
|
12
|
+
export function PageNotFound({ className, ...props }) {
|
|
13
|
+
return (_jsx(FullPage, { className: className, children: _jsx(Empty, { image: _jsx(IconCozIllus404, { className: "text-[160px]" }), darkModeImage: _jsx(IconCozIllus404Dark, { className: "text-[160px]" }), description: I18n.t('page_not_found'), ...props }) }));
|
|
14
|
+
}
|
|
15
|
+
export function PageError({ className, ...props }) {
|
|
16
|
+
return (_jsx(FullPage, { className: className, children: _jsx(Empty, { image: _jsx(IconCozIllusError, { className: "text-[160px]" }), darkModeImage: _jsx(IconCozIllusErrorDark, { className: "text-[160px]" }), description: I18n.t('page_load_failed'), ...props }) }));
|
|
17
|
+
}
|
|
18
|
+
export function PageNoAuth({ className, ...props }) {
|
|
19
|
+
return (_jsx(FullPage, { className: className, children: _jsx(Empty, { image: _jsx(IconCozIllusLock, { className: "text-[160px]" }), darkModeImage: _jsx(IconCozIllusLockDark, { className: "text-[160px]" }), description: I18n.t('no_permission'), ...props }) }));
|
|
20
|
+
}
|
|
21
|
+
export function PageNoContent({ className, ...props }) {
|
|
22
|
+
return (_jsx(FullPage, { className: className, children: _jsx(Empty, { image: _jsx(IconCozIllusEmpty, { className: "text-[160px]" }), darkModeImage: _jsx(IconCozIllusEmptyDark, { className: "text-[160px]" }), ...props }) }));
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/page-content/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAGtC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EACL,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAwB,MAAM,wBAAwB,CAAC;AAe3E,MAAM,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAiB;IACpE,OAAO,CACL,cACE,SAAS,EAAE,UAAU,CACnB,kEAAkE,EAClE,SAAS,CACV,EACD,KAAK,EAAE,KAAK,YAEX,QAAQ,GACL,CACP,CAAC;AACJ,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,OAAO,CACL,KAAC,QAAQ,IAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,YACtD,KAAC,IAAI,IAAC,gBAAgB,EAAC,eAAe,EAAC,QAAQ,QAAC,GAAG,EAAE,KAAK,CAAC,GAAG,GAAI,GACzD,CACZ,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAAE,SAAS,EAAE,GAAG,KAA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AAc,GAAG,EACrD,aAAa,EAAE,KAAC,qBAAqB,IAAC,SAAS,EAAC,cAAc,GAAG,KAC7D,KAAK,GACT,GACO,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primary-page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
export const PrimaryPage = ({ pageTitle, renderCustomHeader, filterSlot, children, contentClassName, className, headerClassName, titleClassName, titleSlot, ...restProps }) => (_jsxs("div", { className: classNames('pt-2 pb-3 h-full max-h-full flex flex-col', className), ...restProps, children: [renderCustomHeader ? (renderCustomHeader) : pageTitle || titleSlot ? (_jsxs("div", { className: classNames('flex items-center justify-between py-4 px-6', headerClassName), children: [_jsx("div", { className: classNames('text-[20px] font-medium leading-6 coz-fg-plus', titleClassName), children: pageTitle }), _jsx("div", { children: titleSlot })] })) : null, filterSlot ? (_jsx("div", { className: "box-border coz-fg-secondary pt-1 pb-3 px-6", children: filterSlot })) : null, _jsx("div", { className: classNames('flex-1 h-full max-h-full overflow-hidden px-6', contentClassName), children: children })] }));
|
|
4
|
+
//# sourceMappingURL=primary-header.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"primary-header.js","sourceRoot":"","sources":["../../../src/primary-page/primary-header.tsx"],"names":[],"mappings":";AAEA,OAAO,UAAU,MAAM,YAAY,CAAC;AAcpC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,SAAS,EACT,kBAAkB,EAClB,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,cAAc,EACd,SAAS,EACT,GAAG,SAAS,EACW,EAAE,EAAE,CAAC,CAC5B,eACE,SAAS,EAAE,UAAU,CACnB,2CAA2C,EAC3C,SAAS,CACV,KACG,SAAS,aAEZ,kBAAkB,CAAC,CAAC,CAAC,CACpB,kBAAkB,CACnB,CAAC,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,CAAC,CAAC,CAC3B,eACE,SAAS,EAAE,UAAU,CACnB,6CAA6C,EAC7C,eAAe,CAChB,aAED,cACE,SAAS,EAAE,UAAU,CACnB,+CAA+C,EAC/C,cAAc,CACf,YAEA,SAAS,GACN,EACN,wBAAM,SAAS,GAAO,IAClB,CACP,CAAC,CAAC,CAAC,IAAI,EACP,UAAU,CAAC,CAAC,CAAC,CACZ,cAAK,SAAS,EAAC,4CAA4C,YACxD,UAAU,GACP,CACP,CAAC,CAAC,CAAC,IAAI,EACR,cACE,SAAS,EAAE,UAAU,CACnB,+CAA+C,EAC/C,gBAAgB,CACjB,YAEA,QAAQ,GACL,IACF,CACP,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { Typography } from '@coze-arch/coze-design';
|
|
4
|
+
import styles from './index.module.less';
|
|
5
|
+
export function PrimaryTitle({ title, className }) {
|
|
6
|
+
return (_jsx(Typography.Text, { className: classNames(styles['primary-title'], className), children: title }));
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/primary-title/index.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAOzC,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,SAAS,EAAqB;IAClE,OAAO,CACL,KAAC,UAAU,CAAC,IAAI,IAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC,YACvE,KAAK,GACU,CACnB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import classNames from 'classnames';
|
|
4
|
+
import { useMouseDownOffset } from '@cozeloop/hooks';
|
|
5
|
+
import { SideSheet } from '@coze-arch/coze-design';
|
|
6
|
+
const SIZE_MAP = {
|
|
7
|
+
small: 448,
|
|
8
|
+
medium: 684,
|
|
9
|
+
large: 920,
|
|
10
|
+
};
|
|
11
|
+
/** 仅支持 left 模式 */
|
|
12
|
+
export const ResizableSideSheet = (props) => {
|
|
13
|
+
const { minSize = Number.MIN_VALUE, defaultSize, maxSize = Number.MAX_VALUE, size = 'small', onResizeEnd, className, children, ...restProps } = props;
|
|
14
|
+
const [sidePaneWidth, setSidePaneWidth] = useState(defaultSize ?? SIZE_MAP[size]);
|
|
15
|
+
const prevWidthRef = useRef(sidePaneWidth);
|
|
16
|
+
const { ref, isActive } = useMouseDownOffset(({ offsetX }) => {
|
|
17
|
+
const newWidth = prevWidthRef.current - offsetX;
|
|
18
|
+
setSidePaneWidth([maxSize, newWidth, minSize].sort((a, b) => a - b)[1]);
|
|
19
|
+
});
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
prevWidthRef.current = sidePaneWidth;
|
|
22
|
+
document.body.style.cursor = isActive ? 'col-resize' : '';
|
|
23
|
+
document.body.style.userSelect = isActive ? 'none' : 'auto';
|
|
24
|
+
if (!isActive) {
|
|
25
|
+
onResizeEnd?.(sidePaneWidth);
|
|
26
|
+
}
|
|
27
|
+
}, [isActive]);
|
|
28
|
+
return (_jsxs(SideSheet, { className: classNames('relative', className), size: size, width: sidePaneWidth, ...restProps, children: [_jsx("div", { ref: ref, className: classNames('absolute h-full w-1 bg-white top-0 left-0 hover:cursor-col-resize hover:bg-blue-400 transition', {
|
|
29
|
+
'bg-blue-400 cursor-col-resize': isActive,
|
|
30
|
+
}) }), children] }));
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resizable-side-sheet/index.tsx"],"names":[],"mappings":";AAAA,OAAc,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE3D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAA4B,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAS7E,MAAM,QAAQ,GAAG;IACf,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,GAAG;CACX,CAAC;AACF,kBAAkB;AAClB,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,KAA8B,EAAE,EAAE;IACnE,MAAM,EACJ,OAAO,GAAG,MAAM,CAAC,SAAS,EAC1B,WAAW,EACX,OAAO,GAAG,MAAM,CAAC,SAAS,EAC1B,IAAI,GAAG,OAAO,EACd,WAAW,EACX,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,GAAG,KAAK,CAAC;IAEV,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAChD,WAAW,IAAI,QAAQ,CAAC,IAAI,CAAC,CAC9B,CAAC;IACF,MAAM,YAAY,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;IAE3C,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,kBAAkB,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;QAC3D,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,GAAG,OAAO,CAAC;QAChD,gBAAgB,CAAC,CAAC,OAAO,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,CAAC,OAAO,GAAG,aAAa,CAAC;QACrC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC;QAC1D,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;QAC5D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,WAAW,EAAE,CAAC,aAAa,CAAC,CAAC;QAC/B,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IACf,OAAO,CACL,MAAC,SAAS,IACR,SAAS,EAAE,UAAU,CAAC,UAAU,EAAE,SAAS,CAAC,EAC5C,IAAI,EAAE,IAAI,EACV,KAAK,EAAE,aAAa,KAChB,SAAS,aAEb,cACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,UAAU,CACnB,gGAAgG,EAChG;oBACE,+BAA+B,EAAE,QAAQ;iBAC1C,CACF,GACD,EACD,QAAQ,IACC,CACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { IconCozCrossFill } from '@coze-arch/coze-design/icons';
|
|
4
|
+
import { Divider, SideSheet, } from '@coze-arch/coze-design';
|
|
5
|
+
import { Button } from '@coze-arch/coze-design';
|
|
6
|
+
import { useDrag } from './use-drag';
|
|
7
|
+
import styles from './index.module.less';
|
|
8
|
+
export const ResizeSidesheet = (props) => {
|
|
9
|
+
const { children, dragOptions, title, onCancel, className, showDivider, disableDrag, ...rest } = props;
|
|
10
|
+
const { containerRef, isActive, sidePaneWidth } = useDrag(dragOptions);
|
|
11
|
+
return (_jsxs(SideSheet, { title: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx("div", { className: "flex-1", children: title }), showDivider ? (_jsx(Divider, { layout: "vertical", className: "h-[12px]" })) : null, _jsx(Button, { type: "primary", color: "secondary", icon: _jsx(IconCozCrossFill, { className: "w-[16px] h-[16px]" }), onClick: onCancel })] }), width: disableDrag ? undefined : sidePaneWidth, className: cn(styles.sheet, className), ...rest, onCancel: onCancel, closable: false, children: [disableDrag ? null : (_jsx("div", { ref: containerRef, className: cn('absolute h-full w-[2px] z-[20000] bg-transparent top-0 left-0 hover:cursor-col-resize hover:bg-[rgb(var(--coze-up-brand-9))] transition ', {
|
|
12
|
+
'bg-[rgb(var(--coze-up-brand-9))] cursor-col-resize': isActive,
|
|
13
|
+
}) })), props.children] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resize-sidesheet/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAEL,OAAO,EACP,SAAS,GACV,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAoB,MAAM,YAAY,CAAC;AAEvD,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,MAAM,CAAC,MAAM,eAAe,GAAG,CAC7B,KAIC,EACD,EAAE;IACF,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,KAAK,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,GAAG,IAAI,EACR,GAAG,KAAK,CAAC;IACV,MAAM,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IACvE,OAAO,CACL,MAAC,SAAS,IACR,KAAK,EACH,eAAK,SAAS,EAAC,yBAAyB,aACtC,cAAK,SAAS,EAAC,QAAQ,YAAE,KAAK,GAAO,EACpC,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,OAAO,IAAC,MAAM,EAAC,UAAU,EAAC,SAAS,EAAC,UAAU,GAAG,CACnD,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,MAAM,IACL,IAAI,EAAC,SAAS,EACd,KAAK,EAAC,WAAW,EACjB,IAAI,EAAE,KAAC,gBAAgB,IAAC,SAAS,EAAC,mBAAmB,GAAG,EACxD,OAAO,EAAE,QAAQ,GACjB,IACE,EAER,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,EAC9C,SAAS,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,KAClC,IAAI,EACR,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,KAAK,aAEd,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CACpB,cACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,EAAE,CACX,2IAA2I,EAC3I;oBACE,oDAAoD,EAAE,QAAQ;iBAC/D,CACF,GACD,CACH,EACA,KAAK,CAAC,QAAQ,IACL,CACb,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useEffect, useRef, useState } from 'react';
|
|
2
|
+
import { useMouseDownOffset } from '../hooks/use-mouse-down-offset';
|
|
3
|
+
const DEFAULT_WIDTH = 500;
|
|
4
|
+
const MAX_WIDTH = 800;
|
|
5
|
+
const MIN_WIDTH = 300;
|
|
6
|
+
export const useDrag = (options = {}) => {
|
|
7
|
+
const { defaultWidth = DEFAULT_WIDTH, maxWidth = MAX_WIDTH, minWidth = MIN_WIDTH, } = options;
|
|
8
|
+
const [sidePaneWidth, setSidePaneWidth] = useState(defaultWidth);
|
|
9
|
+
const prevWidthRef = useRef(sidePaneWidth);
|
|
10
|
+
const isActiveRef = useRef(false);
|
|
11
|
+
const { ref, isActive } = useMouseDownOffset(({ offsetX }) => {
|
|
12
|
+
const newWidth = prevWidthRef.current - offsetX;
|
|
13
|
+
setSidePaneWidth([maxWidth, newWidth, minWidth].sort((a, b) => a - b)[1]);
|
|
14
|
+
});
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
prevWidthRef.current = sidePaneWidth;
|
|
17
|
+
document.body.style.cursor = isActive ? 'col-resize' : '';
|
|
18
|
+
document.body.style.userSelect = isActive ? 'none' : 'auto';
|
|
19
|
+
if (isActiveRef.current && !isActive) {
|
|
20
|
+
options?.onDragEnd?.(sidePaneWidth);
|
|
21
|
+
}
|
|
22
|
+
isActiveRef.current = isActive;
|
|
23
|
+
}, [isActive]);
|
|
24
|
+
return {
|
|
25
|
+
sidePaneWidth,
|
|
26
|
+
containerRef: ref,
|
|
27
|
+
isActive,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=use-drag.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-drag.js","sourceRoot":"","sources":["../../../src/resize-sidesheet/use-drag.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,SAAS,GAAG,GAAG,CAAC;AACtB,MAAM,SAAS,GAAG,GAAG,CAAC;AAStB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,UAAuB,EAAE,EAAE,EAAE;IACnD,MAAM,EACJ,YAAY,GAAG,aAAa,EAC5B,QAAQ,GAAG,SAAS,EACpB,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1,5 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import classNames from 'classnames';
|
|
3
|
+
import { CodeMirrorJsonEditor, CodeMirrorRawCodeEditor, CodeMirrorRawTextEditor, } from '../codemirror-editor';
|
|
4
|
+
export const SchemaEditor = ({ value, onChange, placeholder, readOnly, language, className, backgroundColor, }) => (_jsx("div", { className: classNames('w-full h-[500px] border border-solid border-[rgba(68,83,130,0.25)] rounded-[4px] overflow-hidden relative', { 'opacity-70': readOnly, 'bg-white': !backgroundColor }, className), style: backgroundColor ? { backgroundColor } : undefined, children: language === 'json' ? (_jsx(CodeMirrorJsonEditor, { className: "w-full h-full overflow-y-auto", onChange: onChange, value: value || '', placeholder: placeholder, readonly: readOnly, borderRadius: 4, backgroundColor: backgroundColor })) : language ? (_jsx(CodeMirrorRawCodeEditor, { className: "w-full h-full overflow-y-auto", language: language, onChange: onChange, value: value || '', placeholder: placeholder, readonly: readOnly, backgroundColor: backgroundColor })) : (_jsx(CodeMirrorRawTextEditor, { className: "w-full h-full overflow-y-auto", onChange: onChange, value: value || '', placeholder: placeholder, readonly: readOnly, backgroundColor: backgroundColor })) }));
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/schema-editor/index.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EACL,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,sBAAsB,CAAC;AAa9B,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAC3B,KAAK,EACL,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,eAAe,GACG,EAAE,EAAE,CAAC,CACvB,cACE,SAAS,EAAE,UAAU,CACnB,2GAA2G,EAC3G,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC,eAAe,EAAE,EACxD,SAAS,CACV,EACD,KAAK,EAAE,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,YAEvD,QAAQ,KAAK,MAAM,CAAC,CAAC,CAAC,CACrB,KAAC,oBAAoB,IACnB,SAAS,EAAC,+BAA+B,EACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,YAAY,EAAE,CAAC,EACf,eAAe,EAAE,eAAe,GAChC,CACH,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CACb,KAAC,uBAAuB,IACtB,SAAS,EAAC,+BAA+B,EACzC,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,GAChC,CACH,CAAC,CAAC,CAAC,CACF,KAAC,uBAAuB,IACtB,SAAS,EAAC,+BAA+B,EACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,IAAI,EAAE,EAClB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,QAAQ,EAClB,eAAe,EAAE,eAAe,GAChC,CACH,GACG,CACP,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ButtonGroup, Col, Row } from '@coze-arch/coze-design';
|
|
3
|
+
const BTN_GRP_STYLE = {
|
|
4
|
+
width: '100%',
|
|
5
|
+
};
|
|
6
|
+
const BTN_STYLE = {
|
|
7
|
+
width: 'calc(100% / 4)',
|
|
8
|
+
};
|
|
9
|
+
/** The `ArrayFieldItemTemplate` component is the template used to render an items of an array.
|
|
10
|
+
*
|
|
11
|
+
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
12
|
+
*/
|
|
13
|
+
export default function ArrayFieldItemTemplate(props) {
|
|
14
|
+
const { children, disabled, hasCopy, hasMoveDown, hasMoveUp, hasRemove, hasToolbar, index, onCopyIndexClick, onDropIndexClick, onReorderClick, readonly, registry, uiSchema, } = props;
|
|
15
|
+
const { CopyButton, MoveDownButton, MoveUpButton, RemoveButton } = registry.templates.ButtonTemplates;
|
|
16
|
+
const { rowGutter = 24, toolbarAlign = 'top' } = registry.formContext;
|
|
17
|
+
return (_jsxs(Row, { align: toolbarAlign, gutter: rowGutter, children: [_jsx(Col, { span: 18, children: children }), hasToolbar ? (_jsx(Col, { span: 6, children: _jsxs(ButtonGroup, { style: BTN_GRP_STYLE, children: [hasMoveUp || hasMoveDown ? (_jsx(MoveUpButton, { disabled: disabled || readonly || !hasMoveUp, onClick: onReorderClick(index, index - 1), style: BTN_STYLE, uiSchema: uiSchema, registry: registry })) : null, hasMoveUp || hasMoveDown ? (_jsx(MoveDownButton, { disabled: disabled || readonly || !hasMoveDown, onClick: onReorderClick(index, index + 1), style: BTN_STYLE, uiSchema: uiSchema, registry: registry })) : null, hasCopy ? (_jsx(CopyButton, { disabled: disabled || readonly, onClick: onCopyIndexClick(index), style: BTN_STYLE, uiSchema: uiSchema, registry: registry })) : null, hasRemove ? (_jsx(RemoveButton, { disabled: disabled || readonly, onClick: onDropIndexClick(index), style: BTN_STYLE, uiSchema: uiSchema, registry: registry })) : null] }) })) : null] }, `array-item-${index}`));
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=array-field-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-field-item.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/array-field-item.tsx"],"names":[],"mappings":";AASA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAE/D,MAAM,aAAa,GAAG;IACpB,KAAK,EAAE,MAAM;CACd,CAAC;AAE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AC,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,EACzC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,EACP,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,UAAU,IACT,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAChC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,EACP,SAAS,CAAC,CAAC,CAAC,CACX,KAAC,YAAY,IACX,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAChC,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,IACI,GACV,CACP,CAAC,CAAC,CAAC,IAAI,KA5CqB,cAAc,KAAK,EAAE,CA6C9C,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { getTemplate, getUiOptions, } from '@rjsf/utils';
|
|
4
|
+
import { Col, Row } from '@coze-arch/coze-design';
|
|
5
|
+
// const DESCRIPTION_COL_STYLE = {
|
|
6
|
+
// paddingBottom: '8px',
|
|
7
|
+
// };
|
|
8
|
+
/** The `ArrayFieldTemplate` component is the template used to render all items in an array.
|
|
9
|
+
*
|
|
10
|
+
* @param props - The `ArrayFieldTemplateItemType` props for the component
|
|
11
|
+
*/
|
|
12
|
+
export default function ArrayFieldTemplate(props) {
|
|
13
|
+
const { canAdd, className, disabled, formContext, idSchema, items, onAddClick, readonly, registry,
|
|
14
|
+
// required,
|
|
15
|
+
// schema,
|
|
16
|
+
// title,
|
|
17
|
+
uiSchema, } = props;
|
|
18
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
19
|
+
// const ArrayFieldDescriptionTemplate = getTemplate<
|
|
20
|
+
// 'ArrayFieldDescriptionTemplate',
|
|
21
|
+
// T,
|
|
22
|
+
// S,
|
|
23
|
+
// F
|
|
24
|
+
// >('ArrayFieldDescriptionTemplate', registry, uiOptions);
|
|
25
|
+
const ArrayFieldItemTemplate = getTemplate('ArrayFieldItemTemplate', registry, uiOptions);
|
|
26
|
+
// const ArrayFieldTitleTemplate = getTemplate<
|
|
27
|
+
// 'ArrayFieldTitleTemplate',
|
|
28
|
+
// T,
|
|
29
|
+
// S,
|
|
30
|
+
// F
|
|
31
|
+
// >('ArrayFieldTitleTemplate', registry, uiOptions);
|
|
32
|
+
// Button templates are not overridden in the uiSchema
|
|
33
|
+
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
34
|
+
const { rowGutter = 24 } = formContext;
|
|
35
|
+
return (_jsx("div", { className: cn('p-3 semi-card-bordered rounded-[4px]', className), id: idSchema.$id, children: _jsxs(Row, { gutter: rowGutter, children: [_jsx(Col, { className: "row array-item-list", span: 24, children: items
|
|
36
|
+
? items.map(({ key, ...itemProps }) => (_jsx(ArrayFieldItemTemplate, { ...itemProps }, key)))
|
|
37
|
+
: null }), canAdd ? (_jsx(Col, { span: 24, children: _jsx(Row, { gutter: rowGutter, justify: "end", children: _jsx(Col, { span: 6, children: _jsx(AddButton, { className: "array-item-add", disabled: disabled || readonly, onClick: onAddClick, uiSchema: uiSchema, registry: registry }) }) }) })) : null] }) }));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=array-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"array-field.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/array-field.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,YAAY,CAAC;AA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S,IAAlB,GAAG,CAAmB,CACpD,CACF;wBACH,CAAC,CAAC,IAAI,GACJ,EAEL,MAAM,CAAC,CAAC,CAAC,CACR,KAAC,GAAG,IAAC,IAAI,EAAE,EAAE,YACX,KAAC,GAAG,IAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAC,KAAK,YACnC,KAAC,GAAG,IAAC,IAAI,EAAE,CAAC,YACV,KAAC,SAAS,IACR,SAAS,EAAC,gBAAgB,EAC1B,QAAQ,EAAE,QAAQ,IAAI,QAAQ,EAC9B,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACE,GACF,GACF,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,GACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ariaDescribedByIds, examplesId, getInputProps, } from '@rjsf/utils';
|
|
3
|
+
import { Input, CozInputNumber, } from '@coze-arch/coze-design';
|
|
4
|
+
const INPUT_STYLE = {
|
|
5
|
+
width: '100%',
|
|
6
|
+
};
|
|
7
|
+
/** The `BaseInputTemplate` is the template to use to render the basic `<input>` component for the `core` theme.
|
|
8
|
+
* It is used as the template for rendering many of the <input> based widgets that differ by `type` and callbacks only.
|
|
9
|
+
* It can be customized/overridden for other themes or individual implementations as needed.
|
|
10
|
+
*
|
|
11
|
+
* @param props - The `WidgetProps` for this template
|
|
12
|
+
*/
|
|
13
|
+
export default function BaseInputTemplate(props) {
|
|
14
|
+
const { disabled, formContext, id, onBlur, onChange, onChangeOverride, onFocus, options, placeholder, readonly, schema, value, type, } = props;
|
|
15
|
+
const { step, type: fieldType, ...inputProps } = getInputProps(schema, type, options, false);
|
|
16
|
+
const { readonlyAsDisabled = true } = formContext;
|
|
17
|
+
const handleNumberChange = nextValue => onChange(nextValue);
|
|
18
|
+
const handleTextChange = (nextValue, e) => {
|
|
19
|
+
onChangeOverride
|
|
20
|
+
? onChangeOverride(e)
|
|
21
|
+
: onChange(nextValue === '' ? options.emptyValue : nextValue);
|
|
22
|
+
};
|
|
23
|
+
const handleBlur = ({ target }) => onBlur(id, target && target.value);
|
|
24
|
+
const handleFocus = ({ target }) => onFocus(id, target && target.value);
|
|
25
|
+
const input = fieldType === 'number' || fieldType === 'integer' ? (_jsx(CozInputNumber, { disabled: disabled || (readonlyAsDisabled && readonly), id: id, name: id, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleNumberChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, style: INPUT_STYLE, list: schema.examples ? examplesId(id) : undefined, ...inputProps, step: step, value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) })) : (_jsx(Input, { disabled: disabled || (readonlyAsDisabled && readonly), id: id, name: id, onBlur: !readonly ? handleBlur : undefined, onChange: !readonly ? handleTextChange : undefined, onFocus: !readonly ? handleFocus : undefined, placeholder: placeholder, style: INPUT_STYLE, list: schema.examples ? examplesId(id) : undefined, ...inputProps, value: value, "aria-describedby": ariaDescribedByIds(id, !!schema.examples) }));
|
|
26
|
+
return (_jsxs(_Fragment, { children: [input, Array.isArray(schema.examples) && (_jsx("datalist", { id: examplesId(id), children: schema.examples
|
|
27
|
+
.concat(schema.default && !schema.examples.includes(schema.default)
|
|
28
|
+
? [schema.default]
|
|
29
|
+
: [])
|
|
30
|
+
.map(example => (_jsx("option", { value: example }, example))) }))] }));
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=base-input.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-input.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/base-input.tsx"],"names":[],"mappings":";AAGA,OAAO,EACL,kBAAkB,EAElB,UAAU,EACV,aAAa,GAKd,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,EACL,cAAc,GAGf,MAAM,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K,EAAE,KAAK,sBACM,kBAAkB,CAAI,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,GAC9D,CACH,CAAC;IAEJ,OAAO,CACL,8BACG,KAAK,EACL,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CACjC,mBAAU,EAAE,EAAE,UAAU,CAAI,EAAE,CAAC,YAC3B,MAAM,CAAC,QAAqB;qBAC3B,MAAM,CACL,MAAM,CAAC,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC;oBACzD,CAAC,CAAE,CAAC,MAAM,CAAC,OAAO,CAAc;oBAChC,CAAC,CAAC,EAAE,CACP;qBACA,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CACd,iBAAsB,KAAK,EAAE,OAAO,IAAvB,OAAO,CAAoB,CACzC,CAAC,GACK,CACZ,IACA,CACJ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/** The `DescriptionField` is the template to use to render the description of a field
|
|
3
|
+
*
|
|
4
|
+
* @param props - The `DescriptionFieldProps` for this component
|
|
5
|
+
*/
|
|
6
|
+
export default function DescriptionField(props) {
|
|
7
|
+
const { id, description } = props;
|
|
8
|
+
if (!description) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return _jsx("span", { id: id, children: description });
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=description-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"description-field.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/description-field.tsx"],"names":[],"mappings":";AAOA;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAItC,KAAqC;IACrC,MAAM,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,KAAK,CAAC;IAElC,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,eAAM,EAAE,EAAE,EAAE,YAAG,WAAW,GAAQ,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { TranslatableString, } from '@rjsf/utils';
|
|
3
|
+
import { IconCozWarningCircle } from '@coze-arch/coze-design/icons';
|
|
4
|
+
import { Banner, List, Space } from '@coze-arch/coze-design';
|
|
5
|
+
/** The `ErrorList` component is the template that renders the all the errors associated with the fields in the `Form`
|
|
6
|
+
*
|
|
7
|
+
* @param props - The `ErrorListProps` for this component
|
|
8
|
+
*/
|
|
9
|
+
export default function ErrorList({ errors, registry }) {
|
|
10
|
+
const { translateString } = registry;
|
|
11
|
+
const renderErrors = () => (_jsx(List, { className: "list-group", size: "small", children: errors.map((error, index) => (_jsx(List.Item, { children: _jsxs(Space, { children: [_jsx(IconCozWarningCircle, {}), error.stack] }) }, index))) }));
|
|
12
|
+
return (_jsx(Banner, { type: "danger", className: "panel panel-danger errors", title: translateString(TranslatableString.ErrorsLabel), description: renderErrors() }));
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=error-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-list.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/error-list.tsx"],"names":[],"mappings":";AAEA,OAAO,EAKL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAE7D;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,SAAS,CAI/B,EAAE,MAAM,EAAE,QAAQ,EAA2B;IAC7C,MAAM,EAAE,eAAe,EAAE,GAAG,QAAQ,CAAC;IACrC,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CACzB,KAAC,IAAI,IAAC,SAAS,EAAC,YAAY,EAAC,IAAI,EAAC,OAAO,YACtC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,CAC5B,KAAC,IAAI,CAAC,IAAI,cACR,MAAC,KAAK,eACJ,KAAC,oBAAoB,KAAG,EACvB,KAAK,CAAC,KAAK,IACN,IAJM,KAAK,CAKT,CACb,CAAC,GACG,CACR,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IACL,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,2BAA2B,EACrC,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,WAAW,CAAC,EACtD,WAAW,EAAE,YAAY,EAAE,GAC3B,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { errorId, } from '@rjsf/utils';
|
|
3
|
+
import { Form } from '@coze-arch/coze-design';
|
|
4
|
+
/** The `FieldErrorTemplate` component renders the errors local to the particular field
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `FieldErrorProps` for the errors being rendered
|
|
7
|
+
*/
|
|
8
|
+
export default function FieldErrorTemplate(props) {
|
|
9
|
+
const { errors = [], idSchema } = props;
|
|
10
|
+
if (errors.length === 0) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
const id = errorId(idSchema);
|
|
14
|
+
return (_jsx("div", { id: id, children: errors.map(error => (_jsx(Form.ErrorMessage, { error: error }, `field-${id}-error-${error}`))) }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=field-error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-error.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/field-error.tsx"],"names":[],"mappings":";AACA,OAAO,EAKL,OAAO,GACR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAIxC,KAA+B;IAC/B,MAAM,EAAE,MAAM,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IACxC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,MAAM,EAAE,GAAG,OAAO,CAAI,QAAQ,CAAC,CAAC;IAEhC,OAAO,CACL,cAAK,EAAE,EAAE,EAAE,YACR,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACnB,KAAC,IAAI,CAAC,YAAY,IAAoC,KAAK,EAAE,KAAK,IAA1C,SAAS,EAAE,UAAU,KAAK,EAAE,CAAkB,CACvE,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Form, Typography } from '@coze-arch/coze-design';
|
|
3
|
+
/** The `FieldTemplate` component is the template used by `SchemaField` to render any field. It renders the field
|
|
4
|
+
* content, (label, description, children, errors and help) inside of a `WrapIfAdditional` component.
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `FieldTemplateProps` for this component
|
|
7
|
+
*/
|
|
8
|
+
export default function FieldTemplate(props) {
|
|
9
|
+
const { children, description, rawErrors, hidden, label, rawDescription, required, } = props;
|
|
10
|
+
if (hidden) {
|
|
11
|
+
return _jsx("div", { className: "field-hidden", children: children });
|
|
12
|
+
}
|
|
13
|
+
// check to see if there is rawDescription(string) before using description(ReactNode)
|
|
14
|
+
// to prevent showing a blank description area
|
|
15
|
+
const descriptionNode = rawDescription ? description : undefined;
|
|
16
|
+
return (_jsxs(Form.Slot, { label: { text: label, required }, className: "mb-4", error: {
|
|
17
|
+
error: rawErrors,
|
|
18
|
+
validateStatus: rawErrors?.length ? 'error' : undefined,
|
|
19
|
+
}, children: [children, _jsx(Typography.Paragraph, { className: "text-xs w-full text-gray-500", children: descriptionNode })] }));
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/field.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE1D;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,aAAa,CAInC,KAAkC;IAClC,MAAM,EACJ,QAAQ,EACR,WAAW,EACX,SAAS,EACT,MAAM,EACN,KAAK,EACL,cAAc,EACd,QAAQ,GACT,GAAG,KAAK,CAAC;IAEV,IAAI,MAAM,EAAE,CAAC;QACX,OAAO,cAAK,SAAS,EAAC,cAAc,YAAE,QAAQ,GAAO,CAAC;IACxD,CAAC;IAED,sFAAsF;IACtF,8CAA8C;IAC9C,MAAM,eAAe,GAAG,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;IAEjE,OAAO,CACL,MAAC,IAAI,CAAC,IAAI,IACR,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,EAChC,SAAS,EAAC,MAAM,EAChB,KAAK,EAAE;YACL,KAAK,EAAE,SAAS;YAChB,cAAc,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;SACxD,aAEA,QAAQ,EAET,KAAC,UAAU,CAAC,SAAS,IAAC,SAAS,EAAC,8BAA8B,YAC3D,eAAe,GACK,IACb,CACb,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { TranslatableString, } from '@rjsf/utils';
|
|
3
|
+
import { IconCozCopy, IconCozLongArrowUp, IconCozPlusCircle, IconCozTrashCan, } from '@coze-arch/coze-design/icons';
|
|
4
|
+
import { IconButton, } from '@coze-arch/coze-design';
|
|
5
|
+
export default function BaseIconButton(props) {
|
|
6
|
+
const { iconType, icon, onClick, uiSchema, registry, style, ...otherProps } = props;
|
|
7
|
+
return (_jsx(IconButton, { onClick: onClick, icon: icon, ...otherProps, size: "small" }));
|
|
8
|
+
}
|
|
9
|
+
export const AddButton = props => {
|
|
10
|
+
const { registry: { translateString }, } = props;
|
|
11
|
+
return (_jsx(BaseIconButton, { title: translateString(TranslatableString.AddItemButton), ...props, icon: _jsx(IconCozPlusCircle, {}) }));
|
|
12
|
+
};
|
|
13
|
+
export const CopyButton = props => {
|
|
14
|
+
const { registry: { translateString }, } = props;
|
|
15
|
+
return (_jsx(BaseIconButton, { title: translateString(TranslatableString.CopyButton), ...props, icon: _jsx(IconCozCopy, {}) }));
|
|
16
|
+
};
|
|
17
|
+
export const MoveDownButton = props => {
|
|
18
|
+
const { registry: { translateString }, } = props;
|
|
19
|
+
return (_jsx(BaseIconButton, { title: translateString(TranslatableString.MoveDownButton), ...props, icon: _jsx(IconCozLongArrowUp, { className: "rotate-180" }) }));
|
|
20
|
+
};
|
|
21
|
+
export const MoveUpButton = props => {
|
|
22
|
+
const { registry: { translateString }, } = props;
|
|
23
|
+
return (_jsx(BaseIconButton, { title: translateString(TranslatableString.MoveUpButton), ...props, icon: _jsx(IconCozLongArrowUp, {}) }));
|
|
24
|
+
};
|
|
25
|
+
export const RemoveButton = props => {
|
|
26
|
+
const { registry: { translateString }, } = props;
|
|
27
|
+
return (_jsx(BaseIconButton, { title: translateString(TranslatableString.RemoveButton), ...props, type: "danger", icon: _jsx(IconCozTrashCan, {}) }));
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=icon-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-button.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components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,eAAe,EAAE,GAC9B,GAAG,KAAK,CAAC;IACV,OAAO,CACL,KAAC,cAAc,IACb,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,cAAc,CAAC,KACrD,KAAK,EACT,IAAI,EAAE,KAAC,kBAAkB,IAAC,SAAS,EAAC,YAAY,GAAG,GACnD,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAwB,KAAK,CAAC,EAAE;IACvD,MAAM,EACJ,QAAQ,EAAE,EAAE,eAAe,EAAE,GAC9B,GAAG,KAAK,CAAC;IACV,OAAO,CACL,KAAC,cAAc,IACb,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,KACnD,KAAK,EACT,IAAI,EAAE,KAAC,kBAAkB,KAAG,GAC5B,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAwB,KAAK,CAAC,EAAE;IACvD,MAAM,EACJ,QAAQ,EAAE,EAAE,eAAe,EAAE,GAC9B,GAAG,KAAK,CAAC;IACV,OAAO,CACL,KAAC,cAAc,IACb,KAAK,EAAE,eAAe,CAAC,kBAAkB,CAAC,YAAY,CAAC,KACnD,KAAK,EACT,IAAI,EAAC,QAAQ,EACb,IAAI,EAAE,KAAC,eAAe,KAAG,GACzB,CACH,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import TitleFieldTemplate from './title-field';
|
|
2
|
+
import SubmitButton from './submit';
|
|
3
|
+
import ObjectFieldTemplate from './object-field';
|
|
4
|
+
import { AddButton, CopyButton, MoveDownButton, MoveUpButton, RemoveButton, } from './icon-button';
|
|
5
|
+
import FieldErrorTemplate from './field-error';
|
|
6
|
+
import FieldTemplate from './field';
|
|
7
|
+
import ErrorListTemplate from './error-list';
|
|
8
|
+
import DescriptionFieldTemplate from './description-field';
|
|
9
|
+
import BaseInputTemplate from './base-input';
|
|
10
|
+
import ArrayFieldItemTemplate from './array-field-item';
|
|
11
|
+
import ArrayFieldTemplate from './array-field';
|
|
12
|
+
export const templates = {
|
|
13
|
+
ArrayFieldTemplate,
|
|
14
|
+
ArrayFieldItemTemplate,
|
|
15
|
+
BaseInputTemplate,
|
|
16
|
+
FieldTemplate,
|
|
17
|
+
ObjectFieldTemplate,
|
|
18
|
+
ButtonTemplates: {
|
|
19
|
+
AddButton,
|
|
20
|
+
CopyButton,
|
|
21
|
+
MoveDownButton,
|
|
22
|
+
MoveUpButton,
|
|
23
|
+
RemoveButton,
|
|
24
|
+
SubmitButton,
|
|
25
|
+
},
|
|
26
|
+
TitleFieldTemplate,
|
|
27
|
+
DescriptionFieldTemplate,
|
|
28
|
+
FieldErrorTemplate,
|
|
29
|
+
ErrorListTemplate,
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/index.ts"],"names":[],"mappings":"AAEA,OAAO,kBAAkB,MAAM,eAAe,CAAC;AAC/C,OAAO,YAAY,MAAM,UAAU,CAAC;AACpC,OAAO,mBAAmB,MAAM,gBAAgB,CAAC;AACjD,OAAO,EACL,SAAS,EACT,UAAU,EACV,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,kBAAkB,MAAM,eAAe,CAAC;AAC/C,OAAO,aAAa,MAAM,SAAS,CAAC;AACpC,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,wBAAwB,MAAM,qBAAqB,CAAC;AAC3D,OAAO,iBAAiB,MAAM,cAAc,CAAC;AAC7C,OAAO,sBAAsB,MAAM,oBAAoB,CAAC;AACxD,OAAO,kBAAkB,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,SAAS,GAA2B;IAC/C,kBAAkB;IAClB,sBAAsB;IACtB,iBAAiB;IACjB,aAAa;IACb,mBAAmB;IACnB,eAAe,EAAE;QACf,SAAS;QACT,UAAU;QACV,cAAc;QACd,YAAY;QACZ,YAAY;QACZ,YAAY;KACb;IACD,kBAAkB;IAClB,wBAAwB;IACxB,kBAAkB;IAClB,iBAAiB;CAClB,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isString, isObject, isNumber } from 'lodash-es';
|
|
3
|
+
import { canExpand,
|
|
4
|
+
// descriptionId,
|
|
5
|
+
// getTemplate,
|
|
6
|
+
getUiOptions,
|
|
7
|
+
// titleId,
|
|
8
|
+
} from '@rjsf/utils';
|
|
9
|
+
import { Col, Row, TextArea } from '@coze-arch/coze-design';
|
|
10
|
+
// const DESCRIPTION_COL_STYLE = {
|
|
11
|
+
// paddingBottom: '8px',
|
|
12
|
+
// };
|
|
13
|
+
/** The `ObjectFieldTemplate` is the template to use to render all the inner properties of an object along with the
|
|
14
|
+
* title and description if available. If the object is expandable, then an `AddButton` is also rendered after all
|
|
15
|
+
* the properties.
|
|
16
|
+
*
|
|
17
|
+
* @param props - The `ObjectFieldTemplateProps` for this component
|
|
18
|
+
*/
|
|
19
|
+
export default function ObjectFieldTemplate(props) {
|
|
20
|
+
const {
|
|
21
|
+
// description,
|
|
22
|
+
disabled, formContext, formData, idSchema, onAddClick, properties, readonly,
|
|
23
|
+
// required,
|
|
24
|
+
registry, schema,
|
|
25
|
+
// title,
|
|
26
|
+
uiSchema, } = props;
|
|
27
|
+
// const uiOptions = getUiOptions<T, S, F>(uiSchema);
|
|
28
|
+
// const TitleFieldTemplate = getTemplate<'TitleFieldTemplate', T, S, F>(
|
|
29
|
+
// 'TitleFieldTemplate',
|
|
30
|
+
// registry,
|
|
31
|
+
// uiOptions,
|
|
32
|
+
// );
|
|
33
|
+
// const DescriptionFieldTemplate = getTemplate<
|
|
34
|
+
// 'DescriptionFieldTemplate',
|
|
35
|
+
// T,
|
|
36
|
+
// S,
|
|
37
|
+
// F
|
|
38
|
+
// >('DescriptionFieldTemplate', registry, uiOptions);
|
|
39
|
+
// Button templates are not overridden in the uiSchema
|
|
40
|
+
const { ButtonTemplates: { AddButton }, } = registry.templates;
|
|
41
|
+
const { colSpan = 24, rowGutter = 24 } = formContext;
|
|
42
|
+
const findSchema = (element) => element.content.props.schema;
|
|
43
|
+
const findSchemaType = (element) => findSchema(element).type;
|
|
44
|
+
const findUiSchema = (element) => element.content.props.uiSchema;
|
|
45
|
+
const findUiSchemaField = (element) => getUiOptions(findUiSchema(element)).field;
|
|
46
|
+
const findUiSchemaWidget = (element) => getUiOptions(findUiSchema(element)).widget;
|
|
47
|
+
const calculateColSpan = (element) => {
|
|
48
|
+
const type = findSchemaType(element);
|
|
49
|
+
const field = findUiSchemaField(element);
|
|
50
|
+
const widget = findUiSchemaWidget(element);
|
|
51
|
+
const defaultColSpan = properties.length < 2 || // Single or no field in object.
|
|
52
|
+
type === 'object' ||
|
|
53
|
+
type === 'array' ||
|
|
54
|
+
widget === 'textarea'
|
|
55
|
+
? 24
|
|
56
|
+
: 12;
|
|
57
|
+
if (isObject(colSpan)) {
|
|
58
|
+
const colSpanObj = colSpan;
|
|
59
|
+
if (isString(widget)) {
|
|
60
|
+
return colSpanObj[widget];
|
|
61
|
+
}
|
|
62
|
+
if (isString(field)) {
|
|
63
|
+
return colSpanObj[field];
|
|
64
|
+
}
|
|
65
|
+
if (isString(type)) {
|
|
66
|
+
return colSpanObj[type];
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
if (isNumber(colSpan)) {
|
|
70
|
+
return colSpan;
|
|
71
|
+
}
|
|
72
|
+
return defaultColSpan;
|
|
73
|
+
};
|
|
74
|
+
if (!props.properties.length) {
|
|
75
|
+
return _jsx(TextArea, { id: idSchema.$id });
|
|
76
|
+
}
|
|
77
|
+
return (_jsxs("fieldset", { id: idSchema.$id, className: 'p-3 semi-card-bordered rounded-[4px]', children: [_jsx(Row, { gutter: rowGutter, children: properties
|
|
78
|
+
.filter(e => !e.hidden)
|
|
79
|
+
.map((element) => (_jsx(Col, { span: calculateColSpan(element), children: element.content }, element.name))) }), canExpand(schema, uiSchema, formData) && (_jsx(Col, { span: 24, children: _jsx(Row, { gutter: rowGutter, justify: "end", children: _jsx(Col, { span: 6, children: _jsx(AddButton, { className: "object-property-expand", disabled: disabled || readonly, onClick: onAddClick(schema), uiSchema: uiSchema, registry: registry }) }) }) }))] }));
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=object-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"object-field.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/object-field.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAQL,SAAS;AACT,iBAAiB;AACjB,eAAe;AACf,YAAY;AACZ,WAAW;EACZ,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAE5D,kCAAkC;AAClC,0BAA0B;AAC1B,KAAK;AAEL;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAIzC,KAAwC;IACxC,MAAM;IACJ,eAAe;IACf,QAAQ,EACR,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,UAAU,EACV,QAAQ;IACR,YAAY;IACZ,QAAQ,EACR,MAAM;IACN,SAAS;IACT,QAAQ,GACT,GAAG,KAAK,CAAC;IACV,qDAAqD;IACrD,yEAAyE;IACzE,0BAA0B;IAC1B,cAAc;IACd,eAAe;IACf,KAAK;IACL,gDAAgD;IAChD,gCAAgC;IAChC,OAAO;IACP,OAAO;IACP,MAAM;IACN,sDAAsD;IACtD,sDAAsD;IACtD,MAAM,EACJ,eAAe,EAAE,EAAE,SAAS,EAAE,GAC/B,GAAG,QAAQ,CAAC,SAAS,C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AC,EAC3B,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,GAClB,GACE,GACF,GACF,CACP,IACQ,CACZ,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getSubmitButtonOptions, } from '@rjsf/utils';
|
|
3
|
+
import { Button } from '@coze-arch/coze-design';
|
|
4
|
+
/** The `SubmitButton` renders a button that represent the `Submit` action on a form
|
|
5
|
+
*/
|
|
6
|
+
export default function SubmitButton({ uiSchema }) {
|
|
7
|
+
const { submitText, norender, props: submitButtonProps, } = getSubmitButtonOptions(uiSchema);
|
|
8
|
+
if (norender) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
return (_jsx(Button, { type: "primary", ...submitButtonProps, htmlType: "submit", children: submitText }));
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=submit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"submit.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/submit.tsx"],"names":[],"mappings":";AACA,OAAO,EACL,sBAAsB,GAKvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;GACG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAIlC,EAAE,QAAQ,EAA8B;IACxC,MAAM,EACJ,UAAU,EACV,QAAQ,EACR,KAAK,EAAE,iBAAiB,GACzB,GAAG,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACrC,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAC,SAAS,KAAK,iBAAiB,EAAE,QAAQ,EAAC,QAAQ,YAC5D,UAAU,GACJ,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getUiOptions, } from '@rjsf/utils';
|
|
3
|
+
import { Typography } from '@coze-arch/coze-design';
|
|
4
|
+
/** The `TitleField` is the template to use to render the title of a field
|
|
5
|
+
*
|
|
6
|
+
* @param props - The `TitleFieldProps` for this component
|
|
7
|
+
*/
|
|
8
|
+
export default function TitleField({ id, uiSchema, title }) {
|
|
9
|
+
const uiOptions = getUiOptions(uiSchema);
|
|
10
|
+
return (_jsxs("div", { id: id, className: "my-1", children: [_jsx(Typography.Title, { heading: 5, children: uiOptions.title || title }), _jsx("hr", { className: "border-0 bg-secondary", style: { height: '1px' } })] }));
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=title-field.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"title-field.js","sourceRoot":"","sources":["../../../../../src/semi-schema-form/components/tmpls/title-field.tsx"],"names":[],"mappings":";AACA,OAAO,EAKL,YAAY,GACb,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAIhC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAA4B;IACjD,MAAM,SAAS,GAAG,YAAY,CAAU,QAAQ,CAAC,CAAC;IAElD,OAAO,CACL,eAAK,EAAE,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,aAC3B,KAAC,UAAU,CAAC,KAAK,IAAC,OAAO,EAAE,CAAC,YACzB,SAAS,CAAC,KAAK,IAAI,KAAK,GACR,EACnB,aAAI,SAAS,EAAC,uBAAuB,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAI,IAC9D,CACP,CAAC;AACJ,CAAC"}
|