Skip to content

Commit

Permalink
feat: solve some unreasonable remarks and some methods used incorrectly
Browse files Browse the repository at this point in the history
  • Loading branch information
xg15472 committed Oct 30, 2024
1 parent d460d4b commit 48abdea
Show file tree
Hide file tree
Showing 47 changed files with 68 additions and 69 deletions.
7 changes: 7 additions & 0 deletions .changeset/soft-guests-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@hyperse/pro-layout": patch
"@hyperse/utils": patch
"@hyperse/antd": patch
---

Solve some unreasonable remarks and some methods used incorrectly
16 changes: 0 additions & 16 deletions packages/antd/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -273,14 +273,6 @@
"types": "./dist/pagination-wrapper/index.d.ts",
"import": "./dist/pagination-wrapper/index.js"
},
"./pdf": {
"types": "./dist/pdf/index.d.ts",
"import": "./dist/pdf/index.js"
},
"./pdf-preview": {
"types": "./dist/pdf-preview/index.d.ts",
"import": "./dist/pdf-preview/index.js"
},
"./permission": {
"types": "./dist/permission/index.d.ts",
"import": "./dist/permission/index.js"
Expand All @@ -301,14 +293,6 @@
"types": "./dist/request-status/index.d.ts",
"import": "./dist/request-status/index.js"
},
"./rich-text-editor": {
"types": "./dist/rich-text-editor/index.d.ts",
"import": "./dist/rich-text-editor/index.js"
},
"./rich-text-viewer": {
"types": "./dist/rich-text-viewer/index.d.ts",
"import": "./dist/rich-text-viewer/index.js"
},
"./roll-location-center": {
"types": "./dist/roll-location-center/index.d.ts",
"import": "./dist/roll-location-center/index.js"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classNames } from '@dimjs/utils';
import { generateIntArray } from '@hyperse/utils';
import { RollLocationInView } from '../../roll-location-in-view/in-view.jsx';
import { Pdf } from '../pdf/index.js';
import { RollLocationInView } from '../roll-location-in-view/in-view.jsx';

type NavigationProps = {
numPages: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export type PdfPreviewProps = {
/**
* pdf预览
* ```
* 使用方式:在cdn.ts中引入 '//file.40017.cn/tcsk/react/[email protected]/pdf.min.js'
* 使用方式:在cdn.ts中引入 '//xx.com/react/[email protected]/pdf.min.js'
* Git: https://github.com/mozilla/pdfjs-dist/tree/master
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/file/pdf
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/file/pdf-seal
* Demo: https://xx.xx.com/docs/admin/main/file/pdf
* Demo: https://xx.xx.com/docs/admin/main/file/pdf-seal
* ```
*/
export const PdfPreview = (props: PdfPreviewProps) => {
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type ReactElement, type ReactNode, useState } from 'react';
import { Result, Spin } from 'antd';
import { classNames } from '@dimjs/utils';
import { fbaHooks } from '../fba-hooks/index.js';
import { fbaHooks } from '../../fba-hooks/index.js';
import { CtxProvider } from './context.js';
import './style.less';

Expand All @@ -21,7 +21,7 @@ export const PdfDocument = (props: PdfProps) => {
fbaHooks.useEffectCustomAsync(async () => {
const { pdfjsLib } = globalThis as any;
pdfjsLib.GlobalWorkerOptions.workerSrc =
'//file.40017.cn/tcsk/react/[email protected]/pdf.worker.min.js';
'//xx.com/react/[email protected]/pdf.worker.min.js';
try {
const loadingTask = pdfjsLib.getDocument(props.pdfUrl);
const pdfInstance = await loadingTask.promise;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import { PdfPage } from './page.jsx';
/**
* pdf预览
* ```
* 使用方式:在cdn.ts中引入 '//file.40017.cn/tcsk/react/[email protected]/pdf.min.js'
* 使用方式:在cdn.ts中引入 '//xx.com/react/[email protected]/pdf.min.js'
* Git: https://github.com/mozilla/pdfjs-dist/tree/master
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/file/pdf
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/file/pdf-seal
* Demo: https://xx.xx.com/docs/admin/main/file/pdf
* Demo: https://xx.xx.com/docs/admin/main/file/pdf-seal
* ```
*/
export const Pdf = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type CSSProperties, type ReactNode, useState } from 'react';
import { Spin } from 'antd';
import { classNames } from '@dimjs/utils';
import { hooks } from '@wove/react';
import { fbaHooks } from '../fba-hooks/index.js';
import { fbaHooks } from '../../fba-hooks/index.js';
import { getCtx } from './context.js';
import './style.less';

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Fragment } from 'react';
import { Image } from 'antd';
import { PlusCircleOutlined } from '@ant-design/icons';
import { dynamicNode } from '../../dynamic-node/index.js';
import { fbaHooks } from '../../fba-hooks/index.js';
import { dynamicNode } from '../../../dynamic-node/index.js';
import { fbaHooks } from '../../../fba-hooks/index.js';
import './preview.less';

export const Preview = (props) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ export const RichTextEditor = (props: RichTextEditorProps) => {
}
);

const tinymceBaseUrl = 'https://file.40017.cn/tcsk/[email protected]';
const tinymceBaseUrl = 'https://xx.com/tcsk/[email protected]';

const getImgRatio = (width: number) => {
if (imgRatio.length === 0) return 1;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import type { Editor as TinyMCEEditor } from 'tinymce';
import { FullscreenOutlined } from '@ant-design/icons';
import { classNames } from '@dimjs/utils';
import { hooks } from '@wove/react';
import { fbaHooks } from '../fba-hooks/index.js';
import { IconWrapper } from '../icon-wrapper/index.js';
import { fbaHooks } from '../../fba-hooks/index.js';
import { IconWrapper } from '../../icon-wrapper/index.js';
import { RichTextEditor } from '../rich-text-editor/rich-text-editor.jsx';
import './style.less';

Expand Down
6 changes: 3 additions & 3 deletions packages/antd/src/cascader-wrapper/cascader-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
import { Button, Cascader, type CascaderProps, message } from 'antd';
import { RedoOutlined } from '@ant-design/icons';
import { isArray } from '@dimjs/lang';
import { cloneState } from '@dimjs/model';
import { classNames, extend, get } from '@dimjs/utils';
import {
cloneObject,
type TAny,
type TPlainObject,
treeLeafParentsArray,
Expand Down Expand Up @@ -164,14 +164,14 @@ export const CascaderWrapper = forwardRef<
fbaHooks.useEffectCustom(() => {
if (window[requestPreKey]) return;
if (state.requestStatus === 'request-success') {
setOptions(cloneState(state.selectorList));
setOptions(cloneObject(state.selectorList));
} else {
void startDataSourceRequest();
}
}, []);

fbaHooks.useEffectCustom(() => {
const cloneList = cloneState(state.selectorList);
const cloneList = cloneObject(state.selectorList);
if (props.value) {
const filterList = treeLeafParentsArray(
props.value,
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/drag-form-list/drag-form-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ const FormListTitleRender = (props: {
/**
* 可拖拽FormList
* ```
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list
* Demo: https://xx.xx.com/docs/admin/main/form/list
* 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置
* 2. 通过 itemGap 设置FormList Item 之间间隙
* ```
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/easy-form/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export type EasyFormProps = Omit<FormWrapperProps, 'children'> & {
/**
* 简单Form布局,可自定义网格布局
* ```
* 1. demo:https://fex.qa.tcshuke.com/docs/admin/main/form/grid
* 1. demo:https://xx.xx.com/docs/admin/main/form/grid
* 2. EasyForm的children列表会进行网格化布局,可通过设置 isPure = true设置纯净模式(对EasyForm的子节点不做任何包装处理)
* 3. EasyForm可嵌套使用,嵌套内部的<EasyForm />节点Form相关属性失效,例如属性form、initialValues等都失效
* <EasyForm form={form}>
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/easy-table/easy-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import {
} from 'react';
import { Form, message } from 'antd';
import { isArray, isString, isUndefined } from '@dimjs/lang';
import { cloneState } from '@dimjs/model';
import { classNames, get } from '@dimjs/utils';
import {
cloneObject,
localStorageCache,
type TAny,
type TPlainObject,
Expand Down Expand Up @@ -101,7 +101,7 @@ export const EasyTable = forwardRef<EasyTableRefApi, EasyTableProps>(
}
setLoading(true);
const allState = await actions.updateFilterCondition(params);
const queryCondition = cloneState(allState.queryCondition || {});
const queryCondition = cloneObject(allState.queryCondition || {});
const {
requestParamsAdapter,
onRequest,
Expand Down
1 change: 0 additions & 1 deletion packages/antd/src/easy-table/hooks/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { ButtonWrapper } from '../../button-wrapper/index.js';
import { fbaHooks } from '../../fba-hooks/index.js';
import { FlexLayout } from '../../flex-layout/index.js';
import { IconWrapper } from '../../icon-wrapper/index.js';
import { SvgHttpView } from '../../svg-http-view/index.js';
import { TipsWrapper } from '../../tips-wrapper/index.js';
import { FoldOperateDropdown } from '../fold-operate-dropdown.jsx';
import { type EasyTableProps } from '../type.js';
Expand Down
6 changes: 3 additions & 3 deletions packages/antd/src/easy-table/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { EasyTableTable } from './table.jsx';
/**
* 对 查询条件+表格数据 进行深度封装,内置数据交互处理
* ```
* Demo https://fex.qa.tcshuke.com/docs/admin/main/crud/easy-table
* Demo https://xx.xx.com/docs/admin/main/crud/easy-table
*
* 1. 废弃modelKey参数
* 2. 如果需要在路由跳转回退中缓存查询条件,设置cacheSwitch=true;如果存在多个EasyTable缓存情况可设置cacheSwitch为自定义字符串
Expand All @@ -19,8 +19,8 @@ import { EasyTableTable } from './table.jsx';
* 8. paginationFixed=true,可设置分页条件在底部固定,不随滚动条滚动
* 9. foldKeys=string[],查询条件展开、收起,被收起数组内容为EasyTable.Filter 子节点key值
* 10. windows环境下,会在EasyTable.Table外部包装一下 TableScrollbar,提高windows下table左右滚动体验
* 11. 可实现部分字段折叠,手动选择显示,将EasyTable.Table columns中isFold属性设为true,可通过EasyTable columnFoldConfig配置属性,demo(https://fex.qa.tcshuke.com/docs/admin/main/crud/demo1)
* 12. 通过asyncColumnRequest、asyncRender配合使用可实现表格列数据接口渲染(demo:https://fex.qa.tcshuke.com/docs/admin/main/crud/easy-table)
* 11. 可实现部分字段折叠,手动选择显示,将EasyTable.Table columns中isFold属性设为true,可通过EasyTable columnFoldConfig配置属性,demo(https://xx.xx.com/docs/admin/main/crud/demo1)
* 12. 通过asyncColumnRequest、asyncRender配合使用可实现表格列数据接口渲染(demo:https://xx.xx.com/docs/admin/main/crud/easy-table)
* ```
*/
export const EasyTable = fbaUtils.attachPropertiesToComponent(EasyTableInner, {
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/easy-table/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export type EasyTableRefApi = {
* 更新 table columns 数据
* ```
* 1. 初始化阶段可使用 EasyTable.serviceConfig.dynamicColumsAdapter 实现动态表格列
* demo: https://fex.qa.tcshuke.com/docs/admin/main/table/easy-table?tabKey=key7
* demo: https://xx.xx.com/docs/admin/main/table/easy-table?tabKey=key7
* ```
*/
onChangeTableColumns: (
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/editable-table/editable-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,14 +172,14 @@ export type EditableTableProps = {

/**
* 可编辑表格(通过FormList实现)
* demo:https://fex.qa.tcshuke.com/docs/admin/main/table/row-editable1
* demo:https://xx.xx.com/docs/admin/main/table/row-editable1
* ```
* 1. 表格数据必须要有唯一值字段,通过属性uidFieldKey设置
* 2. 通过 tableProps 设置Table属性,table size默认:small
* 3. Table children column 不可编辑
* 4. 当存在折叠children数据时,组件会在children中内置_isChildrenItem字段
* 5. 可通过tableChildrenColumnRender自定义渲染 table children column 显示
* 6. 4.5.0版本移除 ref.getTableItemDataByFormListItemKey 功能,可选择表格参考(https://fex.qa.tcshuke.com/docs/admin/main/table/row-editable2)
* 6. 4.5.0版本移除 ref.getTableItemDataByFormListItemKey 功能,可选择表格参考(https://xx.xx.com/docs/admin/main/table/row-editable2)
* ```
*/
export const EditableTable = (props: EditableTableProps) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/file-export/file-export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export type FileExportProps = {
/**
* 文件导出
* ```
* demo:https://fex.qa.tcshuke.com/docs/admin/main/widget?key=file-export
* demo:https://xx.xx.com/docs/admin/main/widget?key=file-export
* 例如:
<FileExport
action={<Button>下载</Button>}
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/file-import/file-import.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export type FileImportProps = {
/**
* 文件导入
* ```
* demo:https://fex.qa.tcshuke.com/docs/admin/main/widget?key=file-export
* demo:https://xx.xx.com/docs/admin/main/widget?key=file-export
* 1. accept默认值 '.xlsx,.xls',
* 2. formData 上传key默认值 file
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export type FormItemHorizontalUnionProps = {
/**
* FormItem 水平布局
* ```
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/input
* Demo: https://xx.xx.com/docs/admin/main/form/input
* ```
* @param props
* @returns
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/form-list-wrapper/form-list-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const FormListTitleRender = (props: {
/**
* Form.List 包装组件,使用更简单
* ```
* Demo: https://fex.qa.tcshuke.com/docs/admin/main/form/list
* Demo: https://xx.xx.com/docs/admin/main/form/list
* 1. FormList数组中必须要有唯一值字段,默认值字段名称uid,可通过uidFieldName自定义设置
* 2. 通过 itemGap 设置FormList Item 之间间隙
* ```
Expand Down
4 changes: 0 additions & 4 deletions packages/antd/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,11 @@ export * from './modal-action/index.js';
export * from './page-fixed-footer/index.js';
export * from './page404/index.js';
export * from './pagination-wrapper/index.js';
export * from './pdf/index.js';
export * from './pdf-preview/index.js';
export * from './permission/index.js';
export * from './pre-defined-class-name/index.js';
export * from './radio-group-wrapper/index.js';
export * from './relation-tree/index.js';
export * from './request-status/index.js';
export * from './rich-text-editor/index.js';
export * from './rich-text-viewer/index.js';
export * from './roll-location-center/index.js';
export * from './roll-location-in-view/index.js';
export * from './rule-describe/index.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/mention-editor/mention-editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export type MentionEditorProps = Omit<MentionsWrapperProps, 'prefix'> & {
* 2. 不同类型模版参数可配置多个
* 3. mention 会根据 传入的params自动推断出关键字
* 4. 模版参数建议都以${_xxx}为格式
* 5. Demo: https://fex.qa.tcshuke.com/docs/admin/main/widget?key=mention-editor
* 5. Demo: https://xx.xx.com/docs/admin/main/widget?key=mention-editor
*/
export const MentionEditor = (props: MentionEditorProps) => {
const iMap = useRef<Record<string, number>>({});
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/mentions-wrapper/mentions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export type MentionsWrapperProps = Omit<
* 您的订单号为${订单号},订单交易时间为${订单时间}
* <MentionsWrapper prefix="$" options={['${订单号}', '${订单时间}']}/>
*
* demo:https://fex.qa.tcshuke.com/docs/admin/main/other/widget
* demo:https://xx.xx.com/docs/admin/main/other/widget
* ```
*
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/antd/src/tree-wrapper/tree-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import {
import { Button, message, Spin, Tree, type TreeProps } from 'antd';
import { CaretDownFilled } from '@ant-design/icons';
import { isArray } from '@dimjs/lang';
import { cloneState } from '@dimjs/model';
import { classNames, extend, get } from '@dimjs/utils';
import {
cloneObject,
isUndefinedOrNull,
type TAny,
type TPlainObject,
Expand Down Expand Up @@ -697,10 +697,10 @@ export const TreeWrapper = forwardRef<TreeWrapperRefApi, TreeWrapperProps>(
});

const originalDataList = useMemo(() => {
const list = cloneState(state.treeList || []);
const list = cloneObject(state.treeList || []);
if (treeSearchValue && searchResultType !== 'highlight') {
return treeFilter(
cloneState(state.treeList || []),
list,
(node) => {
if (customSearchRule) {
return customSearchRule(node, treeSearchValue);
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/tree-wrapper/utils.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { type DataNode } from 'antd/es/tree';
import { dequal } from 'dequal';
import { isArray, isObject } from '@dimjs/lang';
import { cloneState } from '@dimjs/model';
import { walkThroughTree } from '@dimjs/utils';
import {
cloneObject,
isUndefinedOrNull,
type LabelValueItem,
type TAny,
Expand Down Expand Up @@ -126,7 +126,7 @@ export const onTreeDrop: OnTreeDropMethod = (dataList, fieldNames, info) => {
}
}
};
const data = cloneState(dataList) as DataNode[];
const data = cloneObject(dataList) as DataNode[];

// Find dragObject
let dragObj: DataNode;
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/upload-wrapper/upload-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export type UploadWrapperProps<T extends TPlainObject = TPlainObject> = {
/**
* 文件上传
* ```
* demo: https://fex.qa.tcshuke.com/docs/admin/main/file/upload
* demo: https://xx.xx.com/docs/admin/main/file/upload
* 1. 可通过配置children替换默认上传触发布局
* 2. 接口返回结构:
* formData上传接口返回值
Expand Down
4 changes: 2 additions & 2 deletions packages/pro-layout/src/app-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { useMemo, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
import { isUndefined } from '@dimjs/lang';
import { cloneState } from '@dimjs/model';
import { extend } from '@dimjs/utils';
import { fbaHooks } from '@hyperse/antd';
import {
arrayFindByLoosely,
arrayFindIndexByLoosely,
cloneObject,
toLinkPath,
treeToArray,
valueIsEqual,
Expand Down Expand Up @@ -463,7 +463,7 @@ export const AppProvider = (props) => {
url: string,
data: { name: string; metaTitle: string }
) => {
const prevIframeTabActiveItem = cloneState(iframeTabActiveItem);
const prevIframeTabActiveItem = cloneObject(iframeTabActiveItem);
const cahceTabList = getIframeTabCacheList();
const { pathSearch } = parseIframeTabItemUrlInfo(url);
const iframeTablink = guessIframeTabItemLink(url);
Expand Down
Loading

0 comments on commit 48abdea

Please sign in to comment.