From c1d326149671c536684894af65a1993f905a8fc9 Mon Sep 17 00:00:00 2001 From: xg15472 Date: Sat, 19 Oct 2024 09:42:56 +0800 Subject: [PATCH] updates --- .../antd/src/ace-editor-groovy/editor.tsx | 129 ----------- packages/antd/src/ace-editor-groovy/index.ts | 1 - packages/antd/src/ace-editor-java/editor.tsx | 128 ---------- packages/antd/src/ace-editor-java/index.ts | 1 - packages/antd/src/ace-editor-json/editor.tsx | 212 ----------------- packages/antd/src/ace-editor-json/index.ts | 1 - packages/antd/src/ace-editor-mysql/editor.tsx | 147 ------------ packages/antd/src/ace-editor-mysql/index.ts | 1 - packages/antd/src/ace-editor-xml/editor.tsx | 219 ------------------ packages/antd/src/ace-editor-xml/index.ts | 1 - .../antd/src/ace-editor-xml/validate-xml.ts | 51 ---- packages/antd/src/global.d.ts | 3 - packages/antd/src/index.ts | 6 - packages/antd/src/split-wrapper/index.ts | 1 - packages/antd/src/split-wrapper/split.tsx | 54 ----- packages/antd/src/split-wrapper/style.less | 31 --- 16 files changed, 986 deletions(-) delete mode 100644 packages/antd/src/ace-editor-groovy/editor.tsx delete mode 100644 packages/antd/src/ace-editor-groovy/index.ts delete mode 100644 packages/antd/src/ace-editor-java/editor.tsx delete mode 100644 packages/antd/src/ace-editor-java/index.ts delete mode 100644 packages/antd/src/ace-editor-json/editor.tsx delete mode 100644 packages/antd/src/ace-editor-json/index.ts delete mode 100644 packages/antd/src/ace-editor-mysql/editor.tsx delete mode 100644 packages/antd/src/ace-editor-mysql/index.ts delete mode 100644 packages/antd/src/ace-editor-xml/editor.tsx delete mode 100644 packages/antd/src/ace-editor-xml/index.ts delete mode 100644 packages/antd/src/ace-editor-xml/validate-xml.ts delete mode 100644 packages/antd/src/global.d.ts delete mode 100644 packages/antd/src/split-wrapper/index.ts delete mode 100644 packages/antd/src/split-wrapper/split.tsx delete mode 100644 packages/antd/src/split-wrapper/style.less diff --git a/packages/antd/src/ace-editor-groovy/editor.tsx b/packages/antd/src/ace-editor-groovy/editor.tsx deleted file mode 100644 index 0f727e3..0000000 --- a/packages/antd/src/ace-editor-groovy/editor.tsx +++ /dev/null @@ -1,129 +0,0 @@ -import { useMemo, useRef, useState } from 'react'; -import Ace, { type IAceEditorProps } from 'react-ace'; -import { isObject } from '@dimjs/lang'; -import { classNames } from '@dimjs/utils'; -import { - isUndefinedOrNull, - type TAny, - type TPlainObject, -} from '@hyperse/utils'; -import { hooks } from '@wove/react'; -import { ErrorBoundaryWrapper } from '../error-boundary-wrapper/error-boundary.js'; -import 'ace-builds/src-noconflict/ext-language_tools.js'; -import 'ace-builds/src-noconflict/mode-groovy.js'; -import 'ace-builds/src-noconflict/snippets/groovy.js'; - -export type AceEditorGroovyProps = Omit< - IAceEditorProps, - 'mode' | 'value' | 'onChange' | 'theme' -> & { - /** 编辑器高度,默认值:100%,可输入值例如 300px、100% */ - height?: string; - value?: string | TPlainObject | TPlainObject[]; - onChange?: (value?: string | TPlainObject | TPlainObject[]) => void; - /** 配置输入自动提示关键字 */ - autoCompleterList?: { name: string; desc?: string }[]; - /** - * 编辑器主题配置,例如:github、terminal、xcode - * ``` - * 1. 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 2. 配置 theme = xxxx - * ``` - */ - theme?: string; -}; - -/** - * groovy编辑器 - * ``` - * 1. 受控组件,需要使用value、onChange配合显示数据 - * 2. heigth 默认为100%,如果外层无高度,需要自定义设置height属性 - * 3. 通过 autoCompleterList 配置自动提示关键字 - * 4. 通过 hiddenVerifyBtn、hiddenFormatterBtn可隐藏底部操作按钮 - * 5. 通过 theme 配置编辑器主题,例如: - * 5.1 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 5.2 配置 theme = xxxx - * ``` - */ -export const AceEditorGroovy = (props: AceEditorGroovyProps) => { - const { value, onChange, height, autoCompleterList, onLoad, ...otherProps } = - props; - const heightFt = isUndefinedOrNull(height) ? '100%' : height; - - const [rootNodekey, setRootNodekey] = useState(Date.now()); - - const editorRef = useRef(); - - const valueNew = useMemo(() => { - if (isObject(value)) { - return JSON.stringify(value, null, 2); - } - return value as string | undefined; - }, [value]); - - const getCompletions = hooks.useCallbackRef((_a, _b, _c, _d, callback) => { - callback( - null, - autoCompleterList?.map((item) => ({ - name: item.name, - value: item.name, - // score: 100, - meta: item.desc, - })) - ); - }); - - const onLoadHandle = (editor) => { - editorRef.current = editor; - /** 向编辑器中添加自动补全列表 */ - const findIndex = editor.completers.findIndex( - (item) => item.id === 'custom' - ); - if (findIndex >= 0) { - editor.completers[findIndex] = { getCompletions, id: 'custom' }; - } else { - editor.completers.push({ getCompletions, id: 'custom' }); - } - onLoad?.(editor); - }; - - return ( -
- { - onChange?.(undefined); - setRootNodekey(Date.now()); - }} - > - - -
- ); -}; diff --git a/packages/antd/src/ace-editor-groovy/index.ts b/packages/antd/src/ace-editor-groovy/index.ts deleted file mode 100644 index d58d05e..0000000 --- a/packages/antd/src/ace-editor-groovy/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './editor.js'; diff --git a/packages/antd/src/ace-editor-java/editor.tsx b/packages/antd/src/ace-editor-java/editor.tsx deleted file mode 100644 index 179939b..0000000 --- a/packages/antd/src/ace-editor-java/editor.tsx +++ /dev/null @@ -1,128 +0,0 @@ -import { useMemo, useRef, useState } from 'react'; -import Ace, { type IAceEditorProps } from 'react-ace'; -import { isObject } from '@dimjs/lang'; -import { classNames } from '@dimjs/utils'; -import { - isUndefinedOrNull, - type TAny, - type TPlainObject, -} from '@hyperse/utils'; -import { hooks } from '@wove/react'; -import { ErrorBoundaryWrapper } from '../error-boundary-wrapper/error-boundary.js'; -import 'ace-builds/src-noconflict/ext-language_tools.js'; -import 'ace-builds/src-noconflict/mode-java.js'; -import 'ace-builds/src-noconflict/snippets/java.js'; - -export type AceEditorJavaProps = Omit< - IAceEditorProps, - 'mode' | 'value' | 'onChange' | 'theme' -> & { - /** 编辑器高度,默认值:100%,可输入值例如 300px、100% */ - height?: string; - value?: string | TPlainObject | TPlainObject[]; - onChange?: (value?: string | TPlainObject | TPlainObject[]) => void; - /** 配置输入自动提示关键字 */ - autoCompleterList?: { name: string; desc?: string }[]; - /** - * 编辑器主题配置,例如:github、terminal、xcode - * ``` - * 1. 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 2. 配置 theme = xxxx - * ``` - */ - theme?: string; -}; - -/** - * java编辑器 - * ``` - * 1. 受控组件,需要使用value、onChange配合显示数据 - * 2. heigth 默认为100%,如果外层无高度,需要自定义设置height属性 - * 3. 通过 autoCompleterList 配置自动提示关键字 - * 4. 通过 hiddenVerifyBtn、hiddenFormatterBtn可隐藏底部操作按钮 - * 5. 通过 theme 配置编辑器主题,例如: - * 5.1 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 5.2 配置 theme = xxxx - * ``` - */ -export const AceEditorJava = (props: AceEditorJavaProps) => { - const { value, onChange, height, autoCompleterList, onLoad, ...otherProps } = - props; - const heightFt = isUndefinedOrNull(height) ? '100%' : height; - - const [rootNodekey, setRootNodekey] = useState(Date.now()); - - const editorRef = useRef(); - - const valueNew = useMemo(() => { - if (isObject(value)) { - return JSON.stringify(value, null, 2); - } - return value as string | undefined; - }, [value]); - - const getCompletions = hooks.useCallbackRef((_a, _b, _c, _d, callback) => { - callback( - null, - autoCompleterList?.map((item) => ({ - name: item.name, - value: item.name, - // score: 100, - meta: item.desc, - })) - ); - }); - - const onLoadHandle = (editor) => { - editorRef.current = editor; - /** 向编辑器中添加自动补全列表 */ - const findIndex = editor.completers.findIndex( - (item) => item.id === 'custom' - ); - if (findIndex >= 0) { - editor.completers[findIndex] = { getCompletions, id: 'custom' }; - } else { - editor.completers.push({ getCompletions, id: 'custom' }); - } - onLoad?.(editor); - }; - - return ( -
- { - onChange?.(undefined); - setRootNodekey(Date.now()); - }} - > - - -
- ); -}; diff --git a/packages/antd/src/ace-editor-java/index.ts b/packages/antd/src/ace-editor-java/index.ts deleted file mode 100644 index d58d05e..0000000 --- a/packages/antd/src/ace-editor-java/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './editor.js'; diff --git a/packages/antd/src/ace-editor-json/editor.tsx b/packages/antd/src/ace-editor-json/editor.tsx deleted file mode 100644 index 99f66a3..0000000 --- a/packages/antd/src/ace-editor-json/editor.tsx +++ /dev/null @@ -1,212 +0,0 @@ -import { - CSSProperties, - Fragment, - ReactElement, - useMemo, - useRef, - useState, -} from 'react'; -import Ace, { type IAceEditorProps } from 'react-ace'; -import { isObject } from '@dimjs/lang'; -import { classNames } from '@dimjs/utils'; -import { - isUndefinedOrNull, - jsonStringToJsonObject, - type TAny, - type TPlainObject, -} from '@hyperse/utils'; -import { hooks } from '@wove/react'; -import { ButtonWrapper } from '../button-wrapper/button-wrapper.js'; -import { ErrorBoundaryWrapper } from '../error-boundary-wrapper/error-boundary.js'; -import { FlexLayout } from '../flex-layout/flex-layout.js'; -import 'ace-builds/src-noconflict/ext-language_tools.js'; -import 'ace-builds/src-noconflict/mode-json.js'; -import 'ace-builds/src-noconflict/snippets/json.js'; - -export type AceEditorJsonProps = Omit< - IAceEditorProps, - 'mode' | 'value' | 'onChange' | 'theme' -> & { - /** 编辑器高度,默认值:100%,可输入值例如 300px、100% */ - height?: string; - value?: string | TPlainObject | TPlainObject[]; - onChange?: (value?: string | TPlainObject | TPlainObject[]) => void; - /** 配置输入自动提示关键字 */ - autoCompleterList?: { name: string; desc?: string }[]; - /** 是否隐藏【验证数据】按钮 */ - hiddenVerifyBtn?: boolean; - /** 是否隐藏内部验证异常文案 */ - hiddenErrorMsg?: boolean; - /** - * 编辑器主题配置,例如:github、terminal、xcode - * ``` - * 1. 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 2. 配置 theme = xxxx - * ``` - */ - theme?: string; - /** 底部额外布局 */ - footerExtraRender?: (children: ReactElement) => ReactElement; - footerStyle?: CSSProperties; -}; - -/** - * Json编辑器 - * ``` - * 1. 受控组件,需要使用value、onChange配合显示数据 - * 2. heigth 默认为100%,如果外层无高度,需要自定义设置height属性 - * 3. 通过 autoCompleterList 配置自动提示关键字 - * 4. 通过 hiddenVerifyBtn 配置隐藏底部操作按钮 - * 5. 通过 theme 配置编辑器主题,例如: - * 5.1 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 5.2 配置 theme = xxxx - * ``` - */ -export const AceEditorJson = (props: AceEditorJsonProps) => { - const { - value, - onChange, - height, - hiddenVerifyBtn, - autoCompleterList, - onLoad, - hiddenErrorMsg, - ...otherProps - } = props; - const heightFt = isUndefinedOrNull(height) ? '100%' : height; - - const [rootNodekey, setRootNodekey] = useState(Date.now()); - const [errorMsg, setErrorMsg] = useState(); - - const editorRef = useRef(); - - const valueNew = useMemo(() => { - if (isObject(value)) { - return JSON.stringify(value, null, 2); - } - return value as string | undefined; - }, [value]); - - const handleChange = hooks.useCallbackRef((content: string) => { - if (errorMsg) { - setErrorMsg(undefined); - } - onChange?.(content); - }); - - const getCompletions = hooks.useCallbackRef((_a, _b, _c, _d, callback) => { - callback( - null, - autoCompleterList?.map((item) => ({ - name: item.name, - value: item.name, - // score: 100, - meta: item.desc, - })) - ); - }); - - const onLoadHandle = (editor) => { - editorRef.current = editor; - /** 向编辑器中添加自动补全列表 */ - const findIndex = editor.completers.findIndex( - (item) => item.id === 'custom' - ); - if (findIndex >= 0) { - editor.completers[findIndex] = { getCompletions, id: 'custom' }; - } else { - editor.completers.push({ getCompletions, id: 'custom' }); - } - onLoad?.(editor); - }; - - const inputValueVerify = (inputValue: string) => { - try { - const result = jsonStringToJsonObject(inputValue); - onChange?.(result); - } catch (_error: TAny) { - setErrorMsg('数据解析异常,正确格式:{"name":"张三", "age": 20}'); - } - }; - const footer = ( - - - {!hiddenErrorMsg && errorMsg ? ( - {errorMsg} - ) : null} - - ); - - return ( - -
- { - onChange?.(undefined); - setRootNodekey(Date.now()); - }} - > - { - const value = editor?.getValue(); - if (value) { - inputValueVerify(value); - } - }} - value={valueNew} - /> - -
-
- {props.footerExtraRender ? ( - props.footerExtraRender(footer) - ) : ( - {footer} - )} -
-
- ); -}; diff --git a/packages/antd/src/ace-editor-json/index.ts b/packages/antd/src/ace-editor-json/index.ts deleted file mode 100644 index d58d05e..0000000 --- a/packages/antd/src/ace-editor-json/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './editor.js'; diff --git a/packages/antd/src/ace-editor-mysql/editor.tsx b/packages/antd/src/ace-editor-mysql/editor.tsx deleted file mode 100644 index 6133b9b..0000000 --- a/packages/antd/src/ace-editor-mysql/editor.tsx +++ /dev/null @@ -1,147 +0,0 @@ -import { CSSProperties, ReactElement, useRef, useState } from 'react'; -import type { IAceEditorProps } from 'react-ace'; -import Ace from 'react-ace'; -import { format } from 'sql-formatter'; -import { classNames } from '@dimjs/utils'; -import { type TAny } from '@hyperse/utils'; -import { hooks } from '@wove/react'; -import { ButtonWrapper } from '../button-wrapper/button-wrapper.js'; -import { ErrorBoundaryWrapper } from '../error-boundary-wrapper/error-boundary.js'; -import 'ace-builds/src-noconflict/ext-language_tools.js'; -import 'ace-builds/src-noconflict/mode-mysql.js'; -import 'ace-builds/src-noconflict/snippets/mysql.js'; - -const formatSql = (sqlContent: string) => { - return format(sqlContent, { language: 'sql' }) - .replace(/\$ /g, '$') - .replace(/\{ /g, '{') - .replace(/ \}/g, '}'); -}; - -export type AceEditorMysqlProps = Omit< - IAceEditorProps, - 'theme' | 'mode' | 'value' | 'onChange' -> & { - /** 编辑器高度,默认值:100%,可输入值例如 300px、100% */ - height?: string; - value?: string; - onChange?: (value?: string) => void; - /** 配置输入自动提示关键字 */ - autoCompleterList?: { name: string; desc?: string }[]; - /** 隐藏【美化】按钮 */ - hiddenFormatterBtn?: boolean; - /** - * 编辑器主题配置,例如:github、terminal、xcode - * ``` - * 1. 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 2. 配置 theme = xxxx - * ``` - */ - theme?: string; - /** 底部额外布局 */ - footerExtraRender?: (children: ReactElement) => ReactElement; - footerStyle?: CSSProperties; -}; - -export const AceEditorMysql = (props: AceEditorMysqlProps) => { - const [rootNodekey, setRootNodekey] = useState(Date.now()); - const { - value, - hiddenFormatterBtn, - autoCompleterList, - onChange, - onLoad, - ...otherProps - } = props; - - const editorRef = useRef(); - - const handleChange = hooks.useCallbackRef((content: string) => { - onChange?.(content); - }); - - const getCompletions = hooks.useCallbackRef((_a, _b, _c, _d, callback) => { - callback( - null, - autoCompleterList?.map((item) => ({ - name: item.name, - value: item.name, - // score: 100, - meta: item.desc, - })) - ); - }); - - const onLoadHandle = (editor) => { - editorRef.current = editor; - /** 向编辑器中添加自动补全列表 */ - const findIndex = editor.completers.findIndex( - (item) => item.id === 'custom' - ); - if (findIndex >= 0) { - editor.completers[findIndex] = { getCompletions, id: 'custom' }; - } else { - editor.completers.push({ getCompletions, id: 'custom' }); - } - onLoad?.(editor); - }; - - const footer = ( - - ); - - return ( -
- { - onChange?.(undefined); - setRootNodekey(Date.now()); - }} - > - - -
- {props.footerExtraRender ? props.footerExtraRender(footer) : footer} -
-
- ); -}; diff --git a/packages/antd/src/ace-editor-mysql/index.ts b/packages/antd/src/ace-editor-mysql/index.ts deleted file mode 100644 index d58d05e..0000000 --- a/packages/antd/src/ace-editor-mysql/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './editor.js'; diff --git a/packages/antd/src/ace-editor-xml/editor.tsx b/packages/antd/src/ace-editor-xml/editor.tsx deleted file mode 100644 index 26c6319..0000000 --- a/packages/antd/src/ace-editor-xml/editor.tsx +++ /dev/null @@ -1,219 +0,0 @@ -import { CSSProperties, ReactElement, useMemo, useRef, useState } from 'react'; -import Ace, { type IAceEditorProps } from 'react-ace'; -import { Space } from 'antd'; -import xmlFormat from 'xml-formatter'; -import { isObject } from '@dimjs/lang'; -import { - isUndefinedOrNull, - type TAny, - type TPlainObject, -} from '@hyperse/utils'; -import { hooks } from '@wove/react'; -import { ButtonWrapper } from '../button-wrapper/button-wrapper.js'; -import { ErrorBoundaryWrapper } from '../error-boundary-wrapper/error-boundary.js'; -import { FlexLayout } from '../flex-layout/flex-layout.js'; -import { validateXML } from './validate-xml.js'; -import 'ace-builds/src-noconflict/ext-language_tools.js'; -import 'ace-builds/src-noconflict/mode-xml.js'; -import 'ace-builds/src-noconflict/snippets/xml.js'; - -export type AceEditorXmlProps = Omit< - IAceEditorProps, - 'mode' | 'value' | 'onChange' | 'theme' -> & { - /** 编辑器高度,默认值:100%,可输入值例如 300px、100% */ - height?: string; - value?: string | TPlainObject | TPlainObject[]; - onChange?: (value?: string | TPlainObject | TPlainObject[]) => void; - /** 配置输入自动提示关键字 */ - autoCompleterList?: { name: string; desc?: string }[]; - /** 隐藏【验证数据】按钮 */ - hiddenVerifyBtn?: boolean; - /** 是否隐藏内部验证异常文案 */ - hiddenErrorMsg?: boolean; - /** 隐藏【美化】按钮 */ - hiddenFormatterBtn?: boolean; - /** - * 编辑器主题配置,例如:github、terminal、xcode - * ``` - * 1. 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 2. 配置 theme = xxxx - * ``` - */ - theme?: string; - /** 底部额外布局 */ - footerExtraRender?: (children: ReactElement) => ReactElement; - footerStyle?: CSSProperties; -}; - -/** - * xml编辑器 - * ``` - * 1. 受控组件,需要使用value、onChange配合显示数据 - * 2. heigth 默认为100%,如果外层无高度,需要自定义设置height属性 - * 3. 通过 autoCompleterList 配置自动提示关键字 - * 4. 通过 hiddenVerifyBtn、hiddenFormatterBtn可隐藏底部操作按钮 - * 5. 通过 theme 配置编辑器主题,例如: - * 5.1 顶部引入 import 'ace-builds/src-noconflict/theme-xxxx'; - * 5.2 配置 theme = xxxx - * ``` - */ -export const AceEditorXml = (props: AceEditorXmlProps) => { - const { - value, - onChange, - height, - hiddenVerifyBtn, - hiddenFormatterBtn, - autoCompleterList, - onLoad, - hiddenErrorMsg, - ...otherProps - } = props; - const heightFt = isUndefinedOrNull(height) ? '100%' : height; - - const [rootNodekey, setRootNodekey] = useState(Date.now()); - const [errorMsg, setErrorMsg] = useState(); - - const editorRef = useRef(); - - const valueNew = useMemo(() => { - if (isObject(value)) { - return JSON.stringify(value, null, 2); - } - return value as string | undefined; - }, [value]); - - const handleChange = hooks.useCallbackRef((content: string) => { - if (errorMsg) { - setErrorMsg(undefined); - } - onChange?.(content); - }); - - const getCompletions = hooks.useCallbackRef((_a, _b, _c, _d, callback) => { - callback( - null, - autoCompleterList?.map((item) => ({ - name: item.name, - value: item.name, - // score: 100, - meta: item.desc, - })) - ); - }); - - const onLoadHandle = (editor) => { - editorRef.current = editor; - /** 向编辑器中添加自动补全列表 */ - const findIndex = editor.completers.findIndex( - (item) => item.id === 'custom' - ); - if (findIndex >= 0) { - editor.completers[findIndex] = { getCompletions, id: 'custom' }; - } else { - editor.completers.push({ getCompletions, id: 'custom' }); - } - onLoad?.(editor); - }; - - const inputValueVerify = (inputValue: string) => { - const result = validateXML(inputValue); - if (result.result) { - onChange?.(inputValue); - } else { - setErrorMsg(result.message); - } - }; - - const footer = ( - - - - {!hiddenErrorMsg && errorMsg ? ( - - ) : null} - - ); - - return ( - -
- { - onChange?.(undefined); - setRootNodekey(Date.now()); - }} - > - { - const value = editor?.getValue(); - if (value) { - inputValueVerify(value); - } - }} - value={valueNew} - /> - -
-
- {props.footerExtraRender ? props.footerExtraRender(footer) : footer} -
-
- ); -}; diff --git a/packages/antd/src/ace-editor-xml/index.ts b/packages/antd/src/ace-editor-xml/index.ts deleted file mode 100644 index d58d05e..0000000 --- a/packages/antd/src/ace-editor-xml/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './editor.js'; diff --git a/packages/antd/src/ace-editor-xml/validate-xml.ts b/packages/antd/src/ace-editor-xml/validate-xml.ts deleted file mode 100644 index 513ff74..0000000 --- a/packages/antd/src/ace-editor-xml/validate-xml.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 验证xml格式的正确性 - * ``` - * result / true 验证通过 - * result / false 验证不通过,message为失败描述(使用富文本渲染) - * ``` - */ -export const validateXML = (xmlContent: string) => { - // errorCode 0是xml正确,1是xml错误,2是无法验证 - let errorCode = 0; - let errorMessage; - // code for IE - if (window['ActiveXObject']) { - const xmlDoc = new window['ActiveXObject']('Microsoft.XMLDOM'); - xmlDoc.async = 'false'; - xmlDoc.loadXML(xmlContent); - - if (xmlDoc.parseError.errorCode != 0) { - errorMessage = `错误code: ${xmlDoc.parseError.errorCode} \n`; - errorMessage = `${errorMessage} 错误原因: ${xmlDoc.parseError.reason} \n`; - errorMessage = `${errorMessage} 错误位置: ${xmlDoc.parseError.line}`; - errorCode = 1; - } else { - errorMessage = '格式正确'; - } - } - // code for Mozilla, Firefox, Opera, chrome, safari,etc. - else if (document.implementation['createDocument']) { - const parser = new DOMParser(); - const xmlDoc = parser.parseFromString(xmlContent, 'text/xml'); - const error = xmlDoc.getElementsByTagName('parsererror'); - if (error.length > 0) { - if (xmlDoc.documentElement.nodeName == 'parsererror') { - errorCode = 1; - errorMessage = xmlDoc.documentElement.childNodes[0].nodeValue; - } else { - errorCode = 1; - errorMessage = xmlDoc.getElementsByTagName('parsererror')[0].innerHTML; - } - } else { - errorMessage = '格式正确'; - } - } else { - errorCode = 2; - errorMessage = '浏览器不支持验证,无法验证xml正确性'; - } - return { - message: errorMessage, - result: errorCode == 0 ? true : false, - }; -}; diff --git a/packages/antd/src/global.d.ts b/packages/antd/src/global.d.ts deleted file mode 100644 index cb16c5d..0000000 --- a/packages/antd/src/global.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { IAceEditorProps } from 'react-ace'; -declare const ace: IAceEditorProps; -export default ace; diff --git a/packages/antd/src/index.ts b/packages/antd/src/index.ts index 65e2885..895c7f5 100755 --- a/packages/antd/src/index.ts +++ b/packages/antd/src/index.ts @@ -1,8 +1,3 @@ -export * from './ace-editor-groovy/index.js'; -export * from './ace-editor-java/index.js'; -export * from './ace-editor-json/index.js'; -export * from './ace-editor-mysql/index.js'; -export * from './ace-editor-xml/index.js'; export * from './alert-wrapper/index.js'; export * from './amount-fen-input/index.js'; export * from './amount-fen-input-form-item/index.js'; @@ -88,7 +83,6 @@ export * from './selector-wrapper/index.js'; export * from './selector-wrapper-search/index.js'; export * from './selector-wrapper-simple/index.js'; export * from './sms-count-down/index.js'; -export * from './split-wrapper/index.js'; export * from './styles/index.js'; export * from './svg-http-view/index.js'; export * from './switch-confirm-wrapper/index.js'; diff --git a/packages/antd/src/split-wrapper/index.ts b/packages/antd/src/split-wrapper/index.ts deleted file mode 100644 index dfa64c3..0000000 --- a/packages/antd/src/split-wrapper/index.ts +++ /dev/null @@ -1 +0,0 @@ -export * from './split.js'; diff --git a/packages/antd/src/split-wrapper/split.tsx b/packages/antd/src/split-wrapper/split.tsx deleted file mode 100644 index 7c7fe81..0000000 --- a/packages/antd/src/split-wrapper/split.tsx +++ /dev/null @@ -1,54 +0,0 @@ -import { Children, type CSSProperties, useState } from 'react'; -import Split, { type SplitProps } from 'react-split'; -import { classNames } from '@dimjs/utils'; -import { hooks } from '@wove/react'; -import './style.less'; -type SplitWrapperProps = SplitProps & { - panelStyle?: CSSProperties; -}; -/** - * 分屏可拖动组件 - * ``` - * {...} - 1. 通过 sizes 来初始化设置面板分屏尺寸 - 2. 通过 minSize 来设置面板最小尺寸 - 3. 通过 direction 设置方向 - * ``` - */ -export const SplitWrapper = (props: SplitWrapperProps) => { - const childrenList = Children.toArray(props.children); - const [key, setKey] = useState(Date.now()); - - hooks.useUpdateEffect(() => { - setKey(Date.now()); - }, [props.direction]); - - return ( - - {childrenList.map((item, index) => { - return ( -
- {item} -
- ); - })} -
- ); -}; diff --git a/packages/antd/src/split-wrapper/style.less b/packages/antd/src/split-wrapper/style.less deleted file mode 100644 index b1b1e91..0000000 --- a/packages/antd/src/split-wrapper/style.less +++ /dev/null @@ -1,31 +0,0 @@ -.split-warpper-horizontal { - display: flex; - height: 100%; - overflow: hidden; -} -.split-warpper-vertical { - display: flex; - flex-direction: column; - height: 100%; -} - -.split-warpper-panel { - background-color: var(--block-bg-color); - - overflow: auto; - position: relative; - height: 100%; -} - -.split-warpper .gutter-horizontal { - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAeCAYAAADkftS9AAAAIklEQVQoU2M4c+bMfxAGAgYYmwGrIIiDjrELjpo5aiZeMwF+yNnOs5KSvgAAAABJRU5ErkJggg=='); - background-repeat: no-repeat; - background-position: center center; -} - -.split-warpper .gutter-vertical { - background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAFAQMAAABo7865AAAABlBMVEVHcEzMzMzyAv2sAAAAAXRSTlMAQObYZgAAABBJREFUeF5jOAMEEAIEEFwAn3kMwcB6I2AAAAAASUVORK5CYII='); - cursor: row-resize; - background-repeat: no-repeat; - background-position: center center; -}