Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita4ecb96

Browse files
authored
Merge pull request#1102 from lowcoder-org/antd-upgrade-5.19.4
Antd upgrade 5.20.0
2 parents29ee629 +7e8dfe0 commita4ecb96

File tree

24 files changed

+561
-349
lines changed

24 files changed

+561
-349
lines changed

‎client/packages/lowcoder-design/src/components/Dropdown.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ export function Dropdown<T extends OptionsType>(props: DropdownProps<T>) {
235235
<SegmentedWrapper$placement={placement}>
236236
<Segmented
237237
block={true}
238-
onChange={(value)=>props.onChange(value.toString())}
238+
onChange={(value)=>props.onChange(String(value))}
239239
defaultValue={props.defaultValue}
240240
value={props.value}
241241
options={props.optionsasany}

‎client/packages/lowcoder-design/src/components/button.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const TacoButton = forwardRef(
181181
props:Omit<ButtonProps,"type">&{
182182
buttonType?:TacoButtonType;
183183
},
184-
ref:React.Ref<HTMLElement>
184+
ref:React.Ref<HTMLButtonElement>
185185
)=>{
186186
const{ buttonType, ...restProps}=props;
187187
letloadingBackground;

‎client/packages/lowcoder/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@types/react-test-renderer":"^18.0.0",
3838
"@types/react-virtualized":"^9.21.21",
3939
"animate.css":"^4.1.1",
40-
"antd":"5.13.2",
40+
"antd":"^5.20.0",
4141
"axios":"^1.6.2",
4242
"buffer":"^6.0.3",
4343
"clsx":"^2.0.0",

‎client/packages/lowcoder/src/components/Segmented.tsx‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import{defaultasAntdSegmented}from"antd/es/segmented";
2+
importtype{SegmentedProps}from"antd/es/segmented";
23
importstyledfrom"styled-components";
34

4-
typePropsType<TextendsReact.ForwardRefExoticComponent<any>>=
5-
TextendsReact.ForwardRefExoticComponent<inferR> ?R :never;
6-
typeSegmentedProps=PropsType<typeofAntdSegmented>;
5+
//type PropsType<T extends React.ForwardRefExoticComponent<any>> =
6+
// T extends React.ForwardRefExoticComponent<infer R> ? R : never;
7+
//type SegmentedProps = PropsType<typeof AntdSegmented>;
78

8-
constStyledSegmented=styled(AntdSegmented)<PropsType<typeofAntdSegmented>>`
9+
constStyledSegmented=styled(AntdSegmented)<SegmentedProps>`
910
width: 100%;
1011
height: 28px;
1112
border-radius: 6px;

‎client/packages/lowcoder/src/comps/comps/buttonComp/scannerComp.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { trans } from "i18n";
2121
importReact,{Suspense,useEffect,useRef,useState,useContext}from"react";
2222
import{arrayStringExposingStateControl}from"comps/controls/codeStateControl";
2323
import{BoolControl}from"comps/controls/boolControl";
24-
importtype{ItemType}from"antd/es/menu/hooks/useItems";
24+
importtype{ItemType}from"antd/es/menu/interface";
2525
import{RefControl}from"comps/controls/refControl";
2626
import{EditorContext}from"comps/editorState";
2727
import{useMergeCompStyles}from"@lowcoder-ee/util/hooks";

‎client/packages/lowcoder/src/comps/comps/dateComp/dateComp.tsx‎

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,19 @@ import {
3737
}from"comps/utils/propertyUtils";
3838
import{trans}from"i18n";
3939
import{DATE_FORMAT,DATE_TIME_FORMAT,DateParser,PickerMode}from"util/dateTimeUtils";
40-
importReact,{ReactNode,useContext,useEffect}from"react";
40+
importReact,{ReactNode,useContext,useEffect,useState}from"react";
4141
import{IconControl}from"comps/controls/iconControl";
4242
import{hasIcon}from"comps/utils";
4343
import{Section,sectionNames}from"components/Section";
44-
import{dateRefMethods,disabledTime,handleDateChange}from"comps/comps/dateComp/dateCompUtil";
44+
import{CommonPickerMethods,dateRefMethods,disabledTime,handleDateChange}from"comps/comps/dateComp/dateCompUtil";
4545
import{DateUIView}from"./dateUIView";
4646
import{useIsMobile}from"util/hooks";
4747
import{RefControl}from"comps/controls/refControl";
48-
import{CommonPickerMethods}from"antd/es/date-picker/generatePicker/interface";
48+
//import { CommonPickerMethods } from "antd/es/date-picker/generatePicker/interface";
4949
import{DateRangeUIView}from"comps/comps/dateComp/dateRangeUIView";
5050
import{EditorContext}from"comps/editorState";
5151
import{useMergeCompStyles}from"@lowcoder-ee/util/hooks";
5252

53-
constdefaultStyle={
54-
borderStyle:'solid',
55-
borderWidth:'1px',
56-
}
57-
5853
constEventOptions=[changeEvent,focusEvent,blurEvent]asconst;
5954

6055
constvalidationChildren={
@@ -169,30 +164,39 @@ export type DateCompViewProps = Pick<
169164
};
170165

171166
exportconstdatePickerControl=newUICompBuilder(childrenMap,(props,dispatch)=>{
172-
useMergeCompStyles(propsasRecord<string,any>,dispatch);
173-
174-
lettime=null;
167+
useMergeCompStyles(propsasRecord<string,any>,dispatch);
168+
169+
lettime:dayjs.Dayjs|null=null;
175170
if(props.value.value!==''){
176171
time=dayjs(props.value.value,DateParser);
177172
}
173+
174+
const[tempValue,setTempValue]=useState<dayjs.Dayjs|null>(time);
175+
176+
useEffect(()=>{
177+
constvalue=props.value.value ?dayjs(props.value.value,DateParser) :null;
178+
setTempValue(value);
179+
},[props.value.value])
178180

179181
returnprops.label({
180182
required:props.required,
181183
style:props.style,
182184
labelStyle:props.labelStyle,
183185
inputFieldStyle:props.inputFieldStyle,
184186
animationStyle:props.animationStyle,
187+
onMouseDown:(e)=>e.stopPropagation(),
185188
children:(
186189
<DateUIView
187190
viewRef={props.viewRef}
188191
disabledTime={()=>disabledTime(props.minTime,props.maxTime)}
189192
$style={props.inputFieldStyle}
190193
disabled={props.disabled}
191194
{...datePickerProps(props)}
195+
hourStep={props.hourStep}
192196
minDate={props.minDate}
193197
maxDate={props.maxDate}
194198
placeholder={props.placeholder}
195-
value={time?.isValid() ?time :null}
199+
value={tempValue?.isValid() ?tempValue :null}
196200
onChange={(time)=>{
197201
handleDateChange(
198202
time&&time.isValid()
@@ -293,24 +297,37 @@ export const dateRangeControl = (function () {
293297
returnnewUICompBuilder(childrenMap,(props,dispatch)=>{
294298
useMergeCompStyles(propsasRecord<string,any>,dispatch);
295299

296-
letstart=null;
297-
letend=null;
300+
letstart:dayjs.Dayjs|null=null;
298301
if(props.start.value!==''){
299302
start=dayjs(props.start.value,DateParser);
300303
}
301-
304+
305+
letend:dayjs.Dayjs|null=null;
302306
if(props.end.value!==''){
303307
end=dayjs(props.end.value,DateParser);
304308
}
305309

310+
const[tempStartValue,setTempStartValue]=useState<dayjs.Dayjs|null>(start);
311+
const[tempEndValue,setTempEndValue]=useState<dayjs.Dayjs|null>(end);
312+
313+
useEffect(()=>{
314+
constvalue=props.start.value ?dayjs(props.start.value,DateParser) :null;
315+
setTempStartValue(value);
316+
},[props.start.value])
317+
318+
useEffect(()=>{
319+
constvalue=props.end.value ?dayjs(props.end.value,DateParser) :null;
320+
setTempEndValue(value);
321+
},[props.end.value])
322+
306323
constchildren=(
307324
<DateRangeUIView
308325
viewRef={props.viewRef}
309326
$style={props.inputFieldStyle}
310327
disabled={props.disabled}
311328
{...datePickerProps(props)}
312-
start={start?.isValid() ?start :null}
313-
end={end?.isValid() ?end :null}
329+
start={tempStartValue?.isValid() ?tempStartValue :null}
330+
end={tempEndValue?.isValid() ?tempEndValue :null}
314331
minDate={props.minDate}
315332
maxDate={props.maxDate}
316333
placeholder={[props.placeholder,props.placeholder]}
@@ -345,6 +362,7 @@ export const dateRangeControl = (function () {
345362
labelStyle:props.labelStyle,
346363
children:children,
347364
inputFieldStyle:props.inputFieldStyle,
365+
onMouseDown:(e)=>e.stopPropagation(),
348366
...(startResult.validateStatus!=="success"
349367
?startResult
350368
:endResult.validateStatus!=="success"

‎client/packages/lowcoder/src/comps/comps/dateComp/dateCompUtil.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,15 @@ import { range } from "lodash";
44
import{DateTimeStyleType}from"../../controls/styleControlConstants";
55
import{css}from"styled-components";
66
import{isDarkColor,lightenColor}from"components/colorSelect/colorUtils";
7-
import{CommonPickerMethods}from"antd/es/date-picker/generatePicker/interface";
7+
//import { CommonPickerMethods } from "antd/es/date-picker/generatePicker/interface";
88
import{blurMethod,focusMethod}from"comps/utils/methodUtils";
99
import{refMethods}from"comps/generators/withMethodExposing";
1010

11+
exportinterfaceCommonPickerMethods{
12+
focus:(options?:FocusOptions)=>void;
13+
blur:VoidFunction;
14+
};
15+
1116
exportconsthandleDateChange=(
1217
time:string,
1318
onChange:(value:string)=>Promise<unknown>,

‎client/packages/lowcoder/src/comps/comps/dateComp/dateMobileUIView.tsx‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,21 @@ import { DataUIViewProps } from "comps/comps/dateComp/dateUIView";
1010
import{defaultasSwapRightOutlined}from"@ant-design/icons/SwapRightOutlined"
1111
import{DateRangeUIViewProps}from"comps/comps/dateComp/dateRangeUIView";
1212
import{DateCompViewProps}from"comps/comps/dateComp/dateComp";
13+
importtype{DatePickerProps}from"antd/es/date-picker";
14+
importtype{Dayjs}from"dayjs";
15+
16+
interfaceDateMobileUIViewPropsextendsOmit<DataUIViewProps,'onChange'>{
17+
onChange:(value:dayjs.Dayjs|null)=>void;
18+
}
1319

1420
consthandleClick=async(
1521
params:Pick<
1622
DateCompViewProps,
1723
"showTime"|"minDate"|"maxDate"|"disabledTime"|"onFocus"|"onBlur"
1824
>&{
19-
value:dayjs.Dayjs|null;
20-
onChange:(value:dayjs.Dayjs|null)=>void;
25+
value?:dayjs.Dayjs|null;
26+
// onChange: (value: dayjs.Dayjs | null) => void;
27+
onChange:DatePickerProps<Dayjs>['onChange'];
2128
}
2229
)=>{
2330
constMobileDatePicker=(awaitimport("antd-mobile/es/components/date-picker")).default;
@@ -45,7 +52,8 @@ const handleClick = async (
4552
},
4653
onConfirm:(value)=>{
4754
consttime=dayjs(value);
48-
params.onChange(time);
55+
consttimeString=time.format(params.showTime ?DATE_TIME_FORMAT :DATE_FORMAT);
56+
params.onChange?.(time,timeString);
4957
},
5058
onClose:params.onBlur,
5159
});

‎client/packages/lowcoder/src/comps/comps/dateComp/dateRangeUIView.tsx‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { EditorContext } from "../../editorState";
1010
import{defaultasDatePicker}from"antd/es/date-picker";
1111
import{hasIcon}from"comps/utils";
1212
import{omit}from"lodash";
13+
import{DateParser}from"@lowcoder-ee/util/dateTimeUtils";
1314

1415
const{ RangePicker}=DatePicker;
1516

@@ -57,6 +58,11 @@ export const DateRangeUIView = (props: DateRangeUIViewProps) => {
5758
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}
5859
suffixIcon={hasIcon(props.suffixIcon)&&props.suffixIcon}
5960
placeholder={placeholders}
61+
minDate={props.minDate ?dayjs(props.minDate,DateParser) :undefined}
62+
maxDate={props.maxDate ?dayjs(props.maxDate,DateParser) :undefined}
63+
hourStep={props.hourStepasany}
64+
minuteStep={props.minuteStepasany}
65+
secondStep={props.secondStepasany}
6066
/>
6167
);
6268
};

‎client/packages/lowcoder/src/comps/comps/dateComp/dateUIView.tsx‎

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@ import styled from "styled-components";
88
importtype{DateTimeStyleType}from"../../controls/styleControlConstants";
99
import{EditorContext}from"../../editorState";
1010
import{defaultasDatePicker}from"antd/es/date-picker";
11+
importtype{DatePickerProps}from"antd/es/date-picker";
12+
importtype{Dayjs}from'dayjs';
13+
import{DateParser}from"@lowcoder-ee/util/dateTimeUtils";
1114

12-
constDatePickerStyled=styled(DatePicker)<{$style:DateTimeStyleType}>`
15+
constDatePickerStyled=styled(DatePicker<Dayjs>)<{$style:DateTimeStyleType}>`
1316
width: 100%;
1417
box-shadow:${props=>`${props.$style.boxShadow}${props.$style.boxShadowColor}`};
1518
${(props)=>props.$style&&getStyle(props.$style)}
1619
`;
1720

21+
1822
exportinterfaceDataUIViewPropsextendsDateCompViewProps{
19-
value:dayjs.Dayjs|null;
20-
onChange:(value:dayjs.Dayjs|null)=>void;
23+
value?:DatePickerProps<Dayjs>['value'];
24+
onChange:DatePickerProps<Dayjs>['onChange'];
2125
onPanelChange:()=>void;
2226
}
2327

@@ -29,12 +33,17 @@ export const DateUIView = (props: DataUIViewProps) => {
2933
consteditorState=useContext(EditorContext);
3034

3135
constplaceholder=Array.isArray(props.placeholder) ?props.placeholder[0] :props.placeholder;
32-
3336
returnuseUIView(
3437
<DateMobileUIView{...props}/>,
3538
<DatePickerStyled
3639
{...props}
40+
multiple={false}
3741
ref={props.viewRefasany}
42+
minDate={props.minDate ?dayjs(props.minDate,DateParser) :undefined}
43+
maxDate={props.maxDate ?dayjs(props.maxDate,DateParser) :undefined}
44+
hourStep={props.hourStepasany}
45+
minuteStep={props.minuteStepasany}
46+
secondStep={props.secondStepasany}
3847
disabledDate={(current)=>disabledDate(current,props.minDate,props.maxDate)}
3948
picker={"date"}
4049
inputReadOnly={checkIsMobile(editorState?.getAppSettings().maxWidth)}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp