Skip to content

Commit

Permalink
升级改造初步完成
Browse files Browse the repository at this point in the history
  • Loading branch information
xg15472 committed Oct 21, 2024
1 parent 1f35b59 commit bda975e
Show file tree
Hide file tree
Showing 75 changed files with 331 additions and 306 deletions.
9 changes: 3 additions & 6 deletions packages/antd-demo/flatjs-evolve.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ export default defineConfig((env) => ({
libraryDirectory: 'es/icons',
transformToDefaultImport: true,
camel2DashComponentName: false, // default: true
customName(transformedMethodName) {
return `@ant-design/icons/es/icons/${transformedMethodName}.js`;
},
},
{
libraryName: '@wove/react',
Expand All @@ -92,9 +89,9 @@ export default defineConfig((env) => ({
{
libraryName: '@dimjs/utils',
},
// {
// libraryName: '@hyperse/antd',
// },
{
libraryName: '@hyperse/antd',
},
],
},
multiHtmlCdn: {
Expand Down
2 changes: 2 additions & 0 deletions packages/antd-demo/src/utils/Demo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ButtonWrapper } from '@hyperse/antd';
import { toArray } from '@hyperse/utils';

export const Demo = () => {
console.log(toArray(undefined));
return (
<div>
<ButtonWrapper>xxx</ButtonWrapper>
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hyperse/antd",
"version": "1.0.0",
"version": "1.0.1",
"description": "hyperse antd react admin components library",
"license": "SEE LICENSE IN FILE 'LICENSE'",
"type": "module",
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/_utils/i18n/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { en } from './en.js';
import { zhCn } from './zh-cn.js';

/**
* 设置 @flatbiz/antd中的国际化语言
* 设置 @hyperse/antd中的国际化语言
* @param locale
* @param customLocaleMessage
*/
Expand All @@ -25,7 +25,7 @@ export const setFbaLocaleMessage = (
};

/**
* 读取 @flatbiz/antd中的国际化语言
* 读取 @hyperse/antd中的国际化语言
* @param key
* @returns
*/
Expand Down
6 changes: 3 additions & 3 deletions packages/antd/src/amount-fen-input/amount-fen-input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InputNumber, type InputNumberProps } from 'antd';
import { flatbizPrice, isUndefinedOrNull } from '@hyperse/utils';
import { hypersePrice, isUndefinedOrNull } from '@hyperse/utils';

export type AmountFenInputProps = Omit<InputNumberProps, 'defaultValue'> & {
value?: number;
Expand All @@ -9,7 +9,7 @@ export type AmountFenInputProps = Omit<InputNumberProps, 'defaultValue'> & {
export const AmountFenInput = (props: AmountFenInputProps) => {
const value = isUndefinedOrNull(props.value)
? undefined
: flatbizPrice.fen2yuan(props.value);
: hypersePrice.fen2yuan(props.value);
return (
<InputNumber
{...props}
Expand All @@ -19,7 +19,7 @@ export const AmountFenInput = (props: AmountFenInputProps) => {
props.onChange?.(
isUndefinedOrNull(value)
? undefined
: Number(flatbizPrice.yuan2fen(value as number))
: Number(hypersePrice.yuan2fen(value as number))
);
}}
/>
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/bootstrap/bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export type BootstrapProps = {
};
};
/**
* 如果当前项目入口不使用@flatbiz/pro-layout,必须使用 Bootstrap 组件包装
* 如果当前项目入口不使用@hyperse/pro-layout,必须使用 Bootstrap 组件包装
* ```
* Bootstrap 内部
* 1. 封装 antd App组件
* 2. 封装 @flatbiz/antd FbaApp组件
* 2. 封装 @hyperse/antd FbaApp组件
* 3. 适配 light/dark模式
* 4. 封装 antd ConfigProvider 可配置主题
* ```
Expand Down
10 changes: 5 additions & 5 deletions packages/antd/src/date-picker-wrapper/date-picker-wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useMemo } from 'react';
import { DatePicker } from 'antd';
import type { PickerProps } from 'antd/es/date-picker/generatePicker';
import dayjs from 'dayjs';
import { flatbizDate, TAny } from '@hyperse/utils';
import { hyperseDate, TAny } from '@hyperse/utils';
import { hooks } from '@wove/react';
import { DayjsDateTypeEnum, TDayjsDateType } from '../_utils/constants.js';
import {
Expand Down Expand Up @@ -92,7 +92,7 @@ export const DatePickerWrapper = (props: DatePickerWrapperProps) => {
}
if (minDateTimeDayInst && maxDateTimeDayInst) {
if (
!flatbizDate.in(
!hyperseDate.in(
currentDate,
minDateTimeDayInst.format(DayjsDateTypeEnum.YMD),
maxDateTimeDayInst.format(DayjsDateTypeEnum.YMD)
Expand All @@ -102,7 +102,7 @@ export const DatePickerWrapper = (props: DatePickerWrapperProps) => {
}
} else if (minDateTimeDayInst) {
if (
!flatbizDate.gte(
!hyperseDate.gte(
currentDate,
minDateTimeDayInst.format(DayjsDateTypeEnum.YMD)
)
Expand All @@ -111,7 +111,7 @@ export const DatePickerWrapper = (props: DatePickerWrapperProps) => {
}
} else if (maxDateTimeDayInst) {
if (
!flatbizDate.gte(
!hyperseDate.gte(
maxDateTimeDayInst.format(DayjsDateTypeEnum.YMD),
currentDate
)
Expand All @@ -126,7 +126,7 @@ export const DatePickerWrapper = (props: DatePickerWrapperProps) => {
if (value) {
const valueFt = inputNormalize ? inputNormalize(value) : value;
if (valueFt) {
return dayjs(flatbizDate.dateNormalize(valueFt));
return dayjs(hyperseDate.dateNormalize(valueFt));
}
}
return undefined;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useMemo, useState } from 'react';
import { DatePicker, GetProps } from 'antd';
import dayjs, { Dayjs } from 'dayjs';
import { flatbizDate, TAny } from '@hyperse/utils';
import { hyperseDate, TAny } from '@hyperse/utils';
import { hooks } from '@wove/react';
import { DayjsDateTypeEnum, TDayjsDateType } from '../_utils/constants.js';
import {
Expand Down Expand Up @@ -89,8 +89,8 @@ export const DateRangePickerWrapper = (props: DateRangePickerWrapperProps) => {
}, [value]);
const rangePickerValue = useMemo(() => {
if (date1 && date2) {
const newDate1 = flatbizDate.dateNormalize(date1);
const newDate2 = flatbizDate.dateNormalize(date2);
const newDate1 = hyperseDate.dateNormalize(date1);
const newDate2 = hyperseDate.dateNormalize(date2);
return [dayjs(newDate1), dayjs(newDate2)];
}
return undefined;
Expand Down Expand Up @@ -129,7 +129,7 @@ export const DateRangePickerWrapper = (props: DateRangePickerWrapperProps) => {
}
if (minDateTimeDayInst && maxDateTimeDayInst) {
if (
!flatbizDate.in(
!hyperseDate.in(
currentDate,
minDateTimeDayInst.format(DayjsDateTypeEnum.YMD),
maxDateTimeDayInst.format(DayjsDateTypeEnum.YMD)
Expand All @@ -139,7 +139,7 @@ export const DateRangePickerWrapper = (props: DateRangePickerWrapperProps) => {
}
} else if (minDateTimeDayInst) {
if (
!flatbizDate.gte(
!hyperseDate.gte(
currentDate,
minDateTimeDayInst.format(DayjsDateTypeEnum.YMD)
)
Expand All @@ -148,7 +148,7 @@ export const DateRangePickerWrapper = (props: DateRangePickerWrapperProps) => {
}
} else if (maxDateTimeDayInst) {
if (
!flatbizDate.gte(
!hyperseDate.gte(
maxDateTimeDayInst.format(DayjsDateTypeEnum.YMD),
currentDate
)
Expand Down
16 changes: 12 additions & 4 deletions packages/antd/src/drag-editable-table/drag.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,14 @@ export type DragEditableTableProps = EditableTableProps & {
* 2. Table 参数 components.body.row 被组件内部使用
* ```
*/
export const DragEditableTable = (props) => {
export const DragEditableTable = (props: DragEditableTableProps) => {
const { dragIcon, uidFieldKey, onDragChange, disabledDrag, ...otherProps } =
props;
const form = Form.useFormInstance();
const dataList = Form.useWatch(props.name, form);
const dataList = Form.useWatch(
props.completeName ? props.completeName : props.name,
form
);

const sensors = useSensors(
useSensor(PointerSensor, {
Expand All @@ -88,7 +91,7 @@ export const DragEditableTable = (props) => {
const dataListNew = arrayMove(dataList, activeIndex, overIndex);
form.setFields([
{
name: props.name,
name: props.completeName ? props.completeName : props.name,
value: dataListNew,
},
]);
Expand All @@ -103,7 +106,12 @@ export const DragEditableTable = (props) => {
const columns: EditableTableColumn[] = disabledDrag
? otherProps.columns
: [
{ dataIndex: '__sort', width: 40, key: '__sort', align: 'center' },
{
dataIndex: '__sort',
width: 40,
key: '__sort',
align: 'center',
} as EditableTableColumn,
].concat(otherProps.columns || []);

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface DropdownMenuWrapperProps extends Omit<DropdownProps, 'menu'> {

/**
* DropdownMenuWrapper
* 升级 antd 5.5.1 后,Dropdown 中 Popconfirm弹框使用存在问题,所以在 @flatbiz/[email protected]版本修改为使用dialogConfirm组件实现二次弹框确认功能
* 升级 antd 5.5.1 后,Dropdown 中 Popconfirm弹框使用存在问题,所以在 @hyperse/[email protected]版本修改为使用dialogConfirm组件实现二次弹框确认功能
* @param props
* @returns
* ```
Expand Down
2 changes: 1 addition & 1 deletion packages/antd/src/dropdown-menu-wrapper/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// dropdown-menu-wrapper.zip 为 Popconfirm 实现组件,升级 antd 5.5.1 后,Dropdown 中 Popconfirm弹框使用存在问题,所以在 @flatbiz/[email protected]版本修改为使用dialogConfirm组件实现二次弹框确认功能
// dropdown-menu-wrapper.zip 为 Popconfirm 实现组件,升级 antd 5.5.1 后,Dropdown 中 Popconfirm弹框使用存在问题,所以在 @hyperse/[email protected]版本修改为使用dialogConfirm组件实现二次弹框确认功能
export * from './dropdown-menu-wrapper.js';
5 changes: 4 additions & 1 deletion packages/antd/src/easy-table/style.less
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,13 @@
.fba-easy-table-pagination {
background-color: var(--block-bg-color);
padding : 15px 15px 20px 15px;
text-align : right;
box-shadow : 0px 0px 17px rgba(0, 0, 0, 0.06);
position : relative;
z-index : 2;

.ant-pagination {
justify-content: right;
}
}

.fba-easy-table-wrapper-inline {
Expand Down
9 changes: 6 additions & 3 deletions packages/antd/src/editable-table/editable-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export type EditableTableProps = {
* ```
* 例如 处在formList内部
* 1. name=[0,dataList]
* 2. prevCompleteName=[array, 0, dataList]
* 2. completeName=[xxxList, 0, dataList]
* ```
*/
completeName?: Array<string | number>;
Expand Down Expand Up @@ -308,11 +308,14 @@ export const EditableTable = (props: EditableTableProps) => {
form,
]);

const formListDataSource = Form.useWatch(props.name, form);
const formListDataSource = Form.useWatch(
props.completeName ? props.completeName : props.name,
form
);

useEffect(() => {
const names = toArray<string>(props.name);
if (names[0] === undefined || /^\d+$/.test(`${names[0]}`)) {
if (/^\d+$/.test(`${names?.[0]}`) && props.completeName === undefined) {
void message.error(
'当前Editable处在FormList内部,必须赋值completeName参数'
);
Expand Down
4 changes: 2 additions & 2 deletions packages/antd/src/fba-hooks/use-copy-remove-space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffectCustom } from './use-effect-custom.js';
const innerIgnoreClass = [
'ace_editor',
'tox-tinymce',
'cancel-flatbiz-antd-copy',
'cancel-hyperse-antd-copy',
];

export type CopyRemoveSpaceProps = {
Expand Down Expand Up @@ -36,7 +36,7 @@ export type CopyRemoveSpaceProps = {
* };
* 2. 某些控件(例如:ace编辑器、富文本等)内部自定义处理copy逻辑,此处不能进行拦截,通过配置class属性来忽略
* 3. ignoreClass包括操作目标class、以及层层父节点class,通过目标节点层层父节点的class匹配成功后,取消后续copy文案处理逻辑
* 3. ignoreClass 内置有 ['ace_editor', 'tox-tinymce', 'cancel-flatbiz-antd-copy']
* 3. ignoreClass 内置有 ['ace_editor', 'tox-tinymce', 'cancel-hyperse-antd-copy']
* ```
*/
export const useCopyRemoveSpace = (props?: CopyRemoveSpaceProps) => {
Expand Down
13 changes: 7 additions & 6 deletions packages/antd/src/svg-http-view/style.less
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
.http-svg-view {
overflow: hidden;
overflow : hidden;
line-height: initial;
display: inline-block;
display : inline-block;
}

.hsv-content {
transform: translateX(-200px);
width: 100%;
height: 100%;
width : 100%;
height : 100%;

img {
width: 100%;
width : 100%;
height: 100%;
}
}
}
20 changes: 10 additions & 10 deletions packages/antd/src/table-cell-render/cell-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { get } from '@dimjs/utils';
import {
cutString,
DateFormatType,
flatbizDate,
flatbizPrice,
hyperseDate,
hypersePrice,
isNumber,
isUndefinedOrNull,
TAny,
Expand Down Expand Up @@ -35,7 +35,7 @@ const tableColumnDateRender = (
return (value: string | number) => {
if (isEmpty(value) || value === '') return defaultValue;
try {
return flatbizDate.format(new Date(value), dateFormatType);
return hyperseDate.format(new Date(value), dateFormatType);
} catch (_error) {
return value || defaultValue;
}
Expand Down Expand Up @@ -104,17 +104,17 @@ const tableColumnFen2yuanCellRender = (options?: {
if (isNumber(options?.defaultValue as string | number)) {
return (
<span className={className}>
{flatbizPrice.format(options?.defaultValue)}
{hypersePrice.format(options?.defaultValue)}
</span>
);
}
return <span className={className}>{options?.defaultValue}</span>;
}
if (!isNumber(value as number | string)) return value;
const amount = flatbizPrice.fen2yuan(value);
const amount = hypersePrice.fen2yuan(value);
return (
<span className={className}>
{flatbizPrice.format(amount, options?.defaultValue, {
{hypersePrice.format(amount, options?.defaultValue, {
separator: options?.separator || false,
})}
</span>
Expand All @@ -138,19 +138,19 @@ const tableColumnFen2wanCellRender = (options?: {
if (isNumber(options?.defaultValue as string | number)) {
return (
<span className={className}>
{flatbizPrice.format(options?.defaultValue)}
{hypersePrice.format(options?.defaultValue)}
</span>
);
}
return <span className={className}>{options?.defaultValue}</span>;
}
if (!isNumber(value as number | string)) return value;
const amount = flatbizPrice.fen2wan(value);
const amount = hypersePrice.fen2wan(value);
const amountNew = options?.removeTailZero
? flatbizPrice.removeTailZero(amount, options?.defaultValue, {
? hypersePrice.removeTailZero(amount, options?.defaultValue, {
separator: options?.separator || false,
})
: flatbizPrice.format(amount, options?.defaultValue, {
: hypersePrice.format(amount, options?.defaultValue, {
separator: options?.separator || false,
});
return <span className={className}>{amountNew}</span>;
Expand Down
2 changes: 1 addition & 1 deletion packages/pro-layout/flatjs-forge.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { defineConfig } from '@flatjs/forge';
import { forgePluginStyling } from '@flatjs/forge-plugin-styling';
const __filename = fileURLToPath(import.meta.url);

const stylingPlugin = forgePluginStyling({
const stylingPlugin = await forgePluginStyling({
projectCwd: dirname(__filename),
format: 'esm',
use: ['less'],
Expand Down
Loading

0 comments on commit bda975e

Please sign in to comment.