@easyv/biz-components 1.0.22 → 1.0.24
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/_virtual/index.es2.js +2 -2
- package/dist/_virtual/index.es3.js +2 -2
- package/dist/_virtual/index.es4.js +2 -2
- package/dist/ant-components/input/input.d.ts +1 -1
- package/dist/ant-components/input/input.es.js +1 -2
- package/dist/ant-components/input/input.es.js.map +1 -1
- package/dist/ant-components/input/input.module.less.es.js +1 -1
- package/dist/components/ai-model-select/ai-model-select-panel.d.ts +6 -0
- package/dist/components/ai-model-select/ai-model-select-panel.es.js +24 -24
- package/dist/components/ai-model-select/ai-model-select-panel.es.js.map +1 -1
- package/dist/node_modules/.pnpm/classnames@2.3.2/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/.pnpm/co-web-worker@1.0.1/node_modules/co-web-worker/index.es.js +1 -1
- package/dist/node_modules/.pnpm/prop-types@15.8.1/node_modules/prop-types/index.es.js +1 -1
- package/dist/stats.html +1 -1
- package/dist/style.pkg.css +1 -1
- package/dist/tailwindcss.pkg.css +1 -1
- package/package.json +3 -2
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.es.js";
|
|
2
2
|
import Input from "../../node_modules/.pnpm/antd@4.24.1_react-dom@18.2.0_react@18.2.0__react@18.2.0/node_modules/antd/es/input/index.es.js";
|
|
3
3
|
import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
4
|
-
/* empty css */
|
|
5
4
|
import styles from "./input.module.less.es.js";
|
|
6
5
|
const EasyvInput = (props) => {
|
|
7
6
|
const { className = "", ...rest } = props;
|
|
8
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles["easyv-input"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: classNames("biz-bg-bg-white", className), ...rest }) });
|
|
7
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: styles["easyv-input-wrapper"], children: /* @__PURE__ */ jsxRuntimeExports.jsx(Input, { className: classNames("biz-bg-bg-white", className), ...rest }) });
|
|
9
8
|
};
|
|
10
9
|
export {
|
|
11
10
|
EasyvInput
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.es.js","sources":["../../../src/ant-components/input/input.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"input.es.js","sources":["../../../src/ant-components/input/input.tsx"],"sourcesContent":["// import 'antd/es/input/style/index.css';\nimport { ComponentProps } from 'react';\nimport Input from 'antd/es/input';\nimport classNames from 'classnames';\nimport styles from './input.module.less';\n\nexport interface EasyvInputProps {\n className?: string;\n}\n\ntype inputProps = ComponentProps<typeof Input>;\n\nexport const EasyvInput = (props: inputProps) => {\n const { className = '', ...rest } = props;\n\n return (\n <div className={styles['easyv-input-wrapper']}>\n <Input className={classNames('biz-bg-bg-white', className)} {...rest} />\n </div>\n );\n};\n"],"names":["jsx"],"mappings":";;;;AAYa,MAAA,aAAa,CAAC,UAAsB;AAC/C,QAAM,EAAE,YAAY,IAAI,GAAG,KAAS,IAAA;AAEpC,SACGA,kCAAAA,IAAA,OAAA,EAAI,WAAW,OAAO,qBAAqB,GAC1C,UAAAA,kCAAA,IAAC,OAAM,EAAA,WAAW,WAAW,mBAAmB,SAAS,GAAI,GAAG,KAAM,CAAA,GACxE;AAEJ;"}
|
|
@@ -7,5 +7,11 @@ export interface AiModelSelectPanelProps {
|
|
|
7
7
|
style?: React.CSSProperties;
|
|
8
8
|
titleClassName?: string;
|
|
9
9
|
itemClassName?: string;
|
|
10
|
+
renderInput: (props: {
|
|
11
|
+
value: string;
|
|
12
|
+
onChange: (value: string) => void;
|
|
13
|
+
onPressEnter: () => void;
|
|
14
|
+
onBlur: () => void;
|
|
15
|
+
}) => React.ReactNode;
|
|
10
16
|
}
|
|
11
17
|
export declare const AiModelSelectPanel: (props: AiModelSelectPanelProps) => JSX.Element;
|
|
@@ -3,7 +3,6 @@ import { useState } from "react";
|
|
|
3
3
|
import { PlusOutlined, EditOutlined } from "../../node_modules/.pnpm/@easyv_react-icons@6.3.0/node_modules/@easyv/react-icons/dist/index.esm.es.js";
|
|
4
4
|
import classNames from "../../node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/index.es.js";
|
|
5
5
|
import { produce } from "../../node_modules/.pnpm/immer@10.1.1/node_modules/immer/dist/immer.es.js";
|
|
6
|
-
import { EasyvInput } from "../../ant-components/input/input.es.js";
|
|
7
6
|
import { IconBtn } from "./iconBtn.es.js";
|
|
8
7
|
const AiModelSelectPanel = (props) => {
|
|
9
8
|
const {
|
|
@@ -12,7 +11,8 @@ const AiModelSelectPanel = (props) => {
|
|
|
12
11
|
onSelect,
|
|
13
12
|
style,
|
|
14
13
|
titleClassName,
|
|
15
|
-
itemClassName
|
|
14
|
+
itemClassName,
|
|
15
|
+
renderInput
|
|
16
16
|
} = props;
|
|
17
17
|
const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(
|
|
18
18
|
modelServiceProviderList.filter((item) => item.isCustom)
|
|
@@ -61,9 +61,10 @@ const AiModelSelectPanel = (props) => {
|
|
|
61
61
|
modelProvider.isCustom && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
62
62
|
IconBtn,
|
|
63
63
|
{
|
|
64
|
-
onClick: () => {
|
|
64
|
+
onClick: (e) => {
|
|
65
65
|
setShowInputProviderId(modelProvider.id);
|
|
66
66
|
setInputValue((model == null ? void 0 : model.name) || "");
|
|
67
|
+
e.stopPropagation();
|
|
67
68
|
},
|
|
68
69
|
className: "biz-hidden group-hover:!biz-flex",
|
|
69
70
|
style: { display: "none" },
|
|
@@ -71,6 +72,20 @@ const AiModelSelectPanel = (props) => {
|
|
|
71
72
|
}
|
|
72
73
|
)
|
|
73
74
|
] });
|
|
75
|
+
const handlePressEnter = () => {
|
|
76
|
+
if (inputValue) {
|
|
77
|
+
setCustomModelServiceProviderList(
|
|
78
|
+
produce(customModelServiceProviderList, (draft) => {
|
|
79
|
+
const index = draft.findIndex((i) => i.id === modelProvider.id);
|
|
80
|
+
if (index !== -1) {
|
|
81
|
+
draft[index].modelList = [{ id: inputValue, name: inputValue }];
|
|
82
|
+
}
|
|
83
|
+
})
|
|
84
|
+
);
|
|
85
|
+
setShowInputProviderId("");
|
|
86
|
+
setInputValue("");
|
|
87
|
+
}
|
|
88
|
+
};
|
|
74
89
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
75
90
|
"div",
|
|
76
91
|
{
|
|
@@ -85,27 +100,12 @@ const AiModelSelectPanel = (props) => {
|
|
|
85
100
|
handleSelect(modelProvider, model);
|
|
86
101
|
}
|
|
87
102
|
},
|
|
88
|
-
children: showInputProviderId === modelProvider.id ?
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
placeholder: "输入后,回车创建",
|
|
95
|
-
onPressEnter: () => {
|
|
96
|
-
setCustomModelServiceProviderList(
|
|
97
|
-
produce(customModelServiceProviderList, (draft) => {
|
|
98
|
-
const index = draft.findIndex((i) => i.id === modelProvider.id);
|
|
99
|
-
if (index !== -1) {
|
|
100
|
-
draft[index].modelList = [{ id: inputValue, name: inputValue }];
|
|
101
|
-
}
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
setShowInputProviderId("");
|
|
105
|
-
setInputValue("");
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
) }) : normalContent
|
|
103
|
+
children: showInputProviderId === modelProvider.id ? renderInput({
|
|
104
|
+
value: inputValue,
|
|
105
|
+
onChange: (value) => setInputValue(value),
|
|
106
|
+
onPressEnter: handlePressEnter,
|
|
107
|
+
onBlur: handlePressEnter
|
|
108
|
+
}) : normalContent
|
|
109
109
|
},
|
|
110
110
|
model == null ? void 0 : model.id
|
|
111
111
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport {
|
|
1
|
+
{"version":3,"file":"ai-model-select-panel.es.js","sources":["../../../src/components/ai-model-select/ai-model-select-panel.tsx"],"sourcesContent":["import { useState } from 'react';\nimport { EditOutlined, PlusOutlined } from '@easyv/react-icons';\nimport classNames from 'classnames';\nimport { produce } from 'immer';\nimport { IconBtn } from './iconBtn';\nimport { AiModel, AiModelServiceProvider } from './types';\n\nexport interface AiModelSelectPanelProps {\n className?: string;\n modelServiceProviderList: AiModelServiceProvider[];\n onSelect?: (AiModelServiceProvider: AiModelServiceProvider, model: AiModel) => void;\n style?: React.CSSProperties;\n titleClassName?: string;\n itemClassName?: string;\n renderInput: (props: {\n value: string;\n onChange: (value: string) => void;\n onPressEnter: () => void;\n onBlur: () => void;\n }) => React.ReactNode;\n}\n\nexport const AiModelSelectPanel = (props: AiModelSelectPanelProps) => {\n const {\n className = '',\n modelServiceProviderList,\n onSelect,\n style,\n titleClassName,\n itemClassName,\n renderInput,\n } = props;\n\n const [customModelServiceProviderList, setCustomModelServiceProviderList] = useState(\n modelServiceProviderList.filter((item) => item.isCustom),\n );\n const [showInputProviderId, setShowInputProviderId] = useState<string>('');\n const [inputValue, setInputValue] = useState<string>('');\n\n const otherModelServiceProviderList = modelServiceProviderList.filter((item) => !item.isCustom);\n\n const handleSelect = (modelProvider: AiModelServiceProvider, model: AiModel) => {\n onSelect?.(modelProvider, model);\n };\n\n const renderTitle = (modelProvider: AiModelServiceProvider) => {\n return (\n <div\n className={classNames(\n 'biz-h-6 biz-text-text-3 biz-px-3 biz-pt-1 biz-w-full',\n 'biz-flex biz-items-center biz-box-border biz-gap-2.5 biz-text-[14px]',\n titleClassName,\n )}\n title={modelProvider.name}\n >\n <div className='biz-w-0 biz-flex-1 biz-truncate'>{modelProvider.name}</div>\n {modelProvider.isCustom && modelProvider.modelList.length === 0 && (\n <IconBtn\n onClick={() => {\n setShowInputProviderId(modelProvider.id);\n }}\n icon={\n <PlusOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </div>\n );\n };\n\n const renderItem = (modelProvider: AiModelServiceProvider, model?: AiModel) => {\n if (modelProvider.isCustom) {\n if (modelProvider.id !== showInputProviderId && !modelProvider.modelList?.length) {\n return null;\n }\n }\n const normalContent = (\n <>\n <img src={modelProvider.iconSrc} className='biz-w-4 biz-h-4' />\n <div className='biz-truncate biz-w-0 biz-flex-1 biz-text-[14px]' title={model?.name}>\n {model?.name}\n </div>\n {modelProvider.isCustom && (\n <IconBtn\n onClick={(e) => {\n setShowInputProviderId(modelProvider.id);\n setInputValue(model?.name || '');\n e.stopPropagation();\n }}\n className='biz-hidden group-hover:!biz-flex'\n style={{ display: 'none' }}\n icon={\n <EditOutlined className='biz-w-3 biz-h-3 biz-text-text-2 hover:biz-text-text-1 biz-flex-center' />\n }\n />\n )}\n </>\n );\n\n const handlePressEnter = () => {\n if (inputValue) {\n setCustomModelServiceProviderList(\n produce(customModelServiceProviderList, (draft) => {\n const index = draft.findIndex((i) => i.id === modelProvider.id);\n if (index !== -1) {\n draft[index].modelList = [{ id: inputValue, name: inputValue }];\n }\n }),\n );\n setShowInputProviderId('');\n setInputValue('');\n }\n };\n\n return (\n <div\n key={model?.id}\n className={classNames(\n 'biz-px-3 biz-py-[3px] biz-flex biz-items-center biz-gap-2',\n 'biz-text-text-2 biz-h-8 biz-w-full biz-box-border',\n 'hover:biz-bg-bg-white biz-cursor-pointer biz-group',\n itemClassName,\n )}\n onClick={() => {\n if (model && !showInputProviderId) {\n handleSelect(modelProvider, model);\n }\n }}\n >\n {showInputProviderId === modelProvider.id\n ? renderInput({\n value: inputValue,\n onChange: (value) => setInputValue(value),\n onPressEnter: handlePressEnter,\n onBlur: handlePressEnter,\n })\n : normalContent}\n </div>\n );\n };\n\n return (\n <div\n style={style}\n className={classNames(\n 'biz-bg-[#181B22] biz-border-one biz-rounded-[4px] biz-py-1',\n 'biz-flex biz-flex-col gap-1 biz-w-[160px] biz-max-h-[450px] biz-overflow-auto',\n className,\n )}\n >\n {otherModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {provider.modelList.map((model) => renderItem(provider, model))}\n </div>\n </div>\n ))}\n {customModelServiceProviderList.map((provider) => (\n <div\n key={provider.id}\n className='biz-flex biz-flex-col biz-gap-1 biz-w-full biz-box-border'\n >\n {renderTitle(provider)}\n <div className='biz-flex biz-flex-col gap-1 biz-w-full'>\n {renderItem(provider, provider.modelList[0])}\n </div>\n </div>\n ))}\n </div>\n );\n};\n"],"names":["jsxs","jsx","Fragment"],"mappings":";;;;;;AAsBa,MAAA,qBAAqB,CAAC,UAAmC;AAC9D,QAAA;AAAA,IACJ,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAEE,QAAA,CAAC,gCAAgC,iCAAiC,IAAI;AAAA,IAC1E,yBAAyB,OAAO,CAAC,SAAS,KAAK,QAAQ;AAAA,EACzD;AACA,QAAM,CAAC,qBAAqB,sBAAsB,IAAI,SAAiB,EAAE;AACzE,QAAM,CAAC,YAAY,aAAa,IAAI,SAAiB,EAAE;AAEvD,QAAM,gCAAgC,yBAAyB,OAAO,CAAC,SAAS,CAAC,KAAK,QAAQ;AAExF,QAAA,eAAe,CAAC,eAAuC,UAAmB;AAC9E,yCAAW,eAAe;AAAA,EAC5B;AAEM,QAAA,cAAc,CAAC,kBAA0C;AAE3D,WAAAA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAA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;AAAA,cAAA,YAAY,QAAQ;AAAA,cACrBC,kCAAAA,IAAC,OAAI,EAAA,WAAU,0CACZ,UAAA,WAAW,UAAU,SAAS,UAAU,CAAC,CAAC,EAC7C,CAAA;AAAA,YAAA;AAAA,UAAA;AAAA,UANK,SAAS;AAAA,QAQjB,CAAA;AAAA,MAAA;AAAA,IAAA;AAAA,EACH;AAEJ;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as classnames$1 } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as classnames$1 } from "../../../../../_virtual/index.es4.js";
|
|
3
3
|
/*!
|
|
4
4
|
Copyright (c) 2018 Jed Watson.
|
|
5
5
|
Licensed under the MIT License (MIT), see
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as coWebWorker } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as coWebWorker } from "../../../../../_virtual/index.es2.js";
|
|
3
3
|
class CrossOriginWorker extends Worker {
|
|
4
4
|
constructor(scriptUrl) {
|
|
5
5
|
const b = new Blob([`importScripts('${new URL(scriptUrl).toString()}')`], { type: "application/javascript" });
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getDefaultExportFromCjs } from "../../../../../_virtual/_commonjsHelpers.es.js";
|
|
2
|
-
import { __module as propTypes } from "../../../../../_virtual/index.
|
|
2
|
+
import { __module as propTypes } from "../../../../../_virtual/index.es3.js";
|
|
3
3
|
import { __require as requireReactIs } from "../../../react-is@16.13.1/node_modules/react-is/index.es.js";
|
|
4
4
|
import { __require as requireFactoryWithTypeCheckers } from "./factoryWithTypeCheckers.es.js";
|
|
5
5
|
import { __require as requireFactoryWithThrowingShims } from "./factoryWithThrowingShims.es.js";
|