Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 76a458c

Browse files
author
Connell, Joseph
committed
Merge remote-tracking branch 'upstream/dev' into databricks-plugin
2 parents 5d1625e + 4022c65 commit 76a458c

File tree

13 files changed

+202
-167
lines changed

13 files changed

+202
-167
lines changed

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

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ import { default as AutoComplete } from "antd/es/auto-complete";
4343
import { RefControl } from "comps/controls/refControl";
4444
import {
4545
booleanExposingStateControl,
46+
jsonValueExposingStateControl,
4647
} from "comps/controls/codeStateControl";
4748

4849
import { getDayJSLocale } from "i18n/dayjsLocale";
@@ -88,6 +89,7 @@ const childrenMap = {
8889
autocompleteIconColor: dropdownControl(autocompleteIconColor, "blue"),
8990
componentSize: dropdownControl(componentSize, "small"),
9091
valueInItems: booleanExposingStateControl("valueInItems"),
92+
selectedOption: jsonValueExposingStateControl("selectedOption", {}),
9193
style: styleControl(InputFieldStyle , 'style'),
9294
labelStyle: styleControl(LabelStyle , 'labelStyle'),
9395
inputFieldStyle: styleControl(InputLikeStyle , 'inputFieldStyle'),
@@ -247,14 +249,18 @@ let AutoCompleteCompBase = (function () {
247249
setsearchtext(value);
248250
props.value.onChange(value);
249251
props.onEvent("change");
250-
}, [props.valueInItems, getTextInputValidate, props.value, props.onEvent]);
252+
if(!Boolean(value)) {
253+
props.selectedOption.onChange({});
254+
}
255+
}, [props.valueInItems, getTextInputValidate, props.value, props.onEvent, props.selectedOption]);
251256

252257
const handleSelect = useCallback((data: string, option: any) => {
253258
setsearchtext(option[valueOrLabel]);
254259
props.valueInItems.onChange(true);
255260
props.value.onChange(option[valueOrLabel]);
261+
props.selectedOption.onChange(option);
256262
props.onEvent("submit");
257-
}, [valueOrLabel, props.valueInItems, props.value, props.onEvent]);
263+
}, [valueOrLabel, props.valueInItems, props.value, props.onEvent, props.selectedOption]);
258264

259265
const handleFocus = useCallback(() => {
260266
setActivationFlag(true);
@@ -313,17 +319,7 @@ let AutoCompleteCompBase = (function () {
313319
.setPropertyViewFn((children) => {
314320
return (
315321
<>
316-
<Section>
317-
{children.autoCompleteType.getView() === 'normal' &&
318-
children.prefixIcon.propertyView({
319-
label: trans('button.prefixIcon'),
320-
})}
321-
{children.autoCompleteType.getView() === 'normal' &&
322-
children.suffixIcon.propertyView({
323-
label: trans('button.suffixIcon'),
324-
})}
325-
{allowClearPropertyView(children)}
326-
</Section>
322+
<TextInputBasicSection {...children} />
327323
<Section name={trans('autoComplete.SectionDataName')}>
328324
{children.items.propertyView({
329325
label: trans('autoComplete.value'),
@@ -351,25 +347,35 @@ let AutoCompleteCompBase = (function () {
351347
label: trans('autoComplete.ignoreCase'),
352348
})
353349
)}
354-
{children.filterOptionsByInput.getView() && (
355-
children.valueOrLabel.propertyView({
356-
label: trans('autoComplete.checkedValueFrom'),
357-
radioButton: true,
358-
})
359-
)}
350+
{children.valueOrLabel.propertyView({
351+
label: trans('autoComplete.checkedValueFrom'),
352+
radioButton: true,
353+
})}
360354
</Section>
361-
<TextInputBasicSection {...children} />
362355

363356
<FormDataPropertyView {...children} />
364357
{children.label.getPropertyView()}
365358

366359
<TextInputInteractionSection {...children} />
367360

368-
{<TextInputValidationSection {...children} />}
369361

370362
<Section name={sectionNames.layout}>
371363
{hiddenPropertyView(children)}
372364
</Section>
365+
366+
<Section name={sectionNames.advanced}>
367+
{children.autoCompleteType.getView() === 'normal' &&
368+
children.prefixIcon.propertyView({
369+
label: trans('button.prefixIcon'),
370+
})}
371+
{children.autoCompleteType.getView() === 'normal' &&
372+
children.suffixIcon.propertyView({
373+
label: trans('button.suffixIcon'),
374+
})}
375+
{allowClearPropertyView(children)}
376+
</Section>
377+
378+
{<TextInputValidationSection {...children} />}
373379

374380
<Section name={sectionNames.style}>
375381
{children.style.getPropertyView()}
@@ -389,9 +395,6 @@ let AutoCompleteCompBase = (function () {
389395
>
390396
{children.animationStyle.getPropertyView()}
391397
</Section>
392-
<Section name={sectionNames.advanced}>
393-
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
394-
</Section>
395398
</>
396399
);
397400
})
@@ -415,6 +418,7 @@ AutoCompleteCompBase = class extends AutoCompleteCompBase {
415418
export const AutoCompleteComp = withExposingConfigs(AutoCompleteCompBase, [
416419
new NameConfig("value", trans("export.inputValueDesc")),
417420
new NameConfig("valueInItems", trans("autoComplete.valueInItems")),
421+
new NameConfig("selectedOption", trans("autoComplete.selectedOption")),
418422
NameConfigPlaceHolder,
419423
NameConfigRequired,
420424
...TextInputConfigs,

‎client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnDateComp.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ const Wrapper = styled.div`
127127

128128
export function formatDate(date: string, format: string) {
129129
let mom = dayjs(date);
130-
if (isNumber(Number(date)) && date !== "") {
130+
if (isNumber(Number(date)) && !isNaN(Number(date)) && date !== "") {
131131
mom = dayjs(Number(date));
132132
}
133133
if (!mom.isValid()) {

‎client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnLinkComp.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const LinkEventOptions = [clickEvent] as const;
1919

2020
const childrenMap = {
2121
text: StringControl,
22+
onClick: ActionSelectorControlInContext,
2223
onEvent: eventHandlerControl(LinkEventOptions),
2324
disabled: BoolCodeControl,
2425
style: styleControl(TableColumnLinkStyle),
@@ -37,12 +38,12 @@ const StyledLink = styled.a<{ $disabled: boolean }>`
3738
`;
3839

3940
// Memoized link component
40-
export const ColumnLink = React.memo(({ disabled, label, onEvent }: { disabled: boolean; label: string; onEvent?: (eventName: string) => void }) => {
41+
export const ColumnLink = React.memo(({ disabled, label, onClick, onEvent }: { disabled: boolean; label: string; onClick?: () => void; onEvent?: (eventName: string) => void }) => {
4142
const handleClick = useCallback(() => {
42-
if (!disabled && onEvent) {
43-
onEvent("click");
44-
}
45-
}, [disabled, onEvent]);
43+
if (disabled) return;
44+
onClick?.();
45+
// onEvent?.("click");
46+
}, [disabled, onClick, onEvent]);
4647

4748
return (
4849
<StyledLink
@@ -109,7 +110,7 @@ export const LinkComp = (function () {
109110
childrenMap,
110111
(props, dispatch) => {
111112
const value = props.changeValue ?? getBaseValue(props, dispatch);
112-
return <ColumnLink disabled={props.disabled} label={value} onEvent={props.onEvent} />;
113+
return <ColumnLink disabled={props.disabled} label={value} onClick={props.onClick} />;
113114
},
114115
(nodeValue) => nodeValue.text.value,
115116
getBaseValue
@@ -128,7 +129,11 @@ export const LinkComp = (function () {
128129
tooltip: ColumnValueTooltip,
129130
})}
130131
{disabledPropertyView(children)}
131-
{children.onEvent.propertyView()}
132+
{/* {children.onEvent.propertyView()} */}
133+
{children.onClick.propertyView({
134+
label: trans("table.action"),
135+
placement: "table",
136+
})}
132137
</>
133138
))
134139
.setStylePropertyViewFn((children) => (

‎client/packages/lowcoder/src/comps/comps/tableComp/column/columnTypeComps/columnLinksComp.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ const OptionItem = new MultiCompBuilder(
6363
})}
6464
{hiddenPropertyView(children)}
6565
{disabledPropertyView(children)}
66-
{children.onEvent.propertyView()}
66+
{/* {children.onEvent.propertyView()} */}
6767
</>
6868
);
6969
})
@@ -76,9 +76,9 @@ const MenuItem = React.memo(({ option, index, onMainEvent }: { option: any; inde
7676
if (option.onClick) {
7777
option.onClick();
7878
}
79-
if (option.onEvent) {
80-
option.onEvent("click");
81-
}
79+
// if (option.onEvent) {
80+
// option.onEvent("click");
81+
// }
8282
// Trigger the main component's event handler
8383
if (onMainEvent) {
8484
onMainEvent("click");

‎client/packages/lowcoder/src/comps/comps/tableComp/column/simpleColumnTypeComps.tsx

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,21 @@ import { CSSProperties } from "react";
1414
import { RecordConstructorToComp } from "lowcoder-core";
1515
import { ToViewReturn } from "@lowcoder-ee/comps/generators/multi";
1616
import { clickEvent, eventHandlerControl } from "comps/controls/eventHandlerControl";
17+
import { migrateOldData } from "@lowcoder-ee/comps/generators/simpleGenerators";
1718

19+
export const fixOldActionData = (oldData: any) => {
20+
if (!oldData) return oldData;
21+
if (Boolean(oldData.onClick)) {
22+
return {
23+
...oldData,
24+
onClick: [{
25+
name: "click",
26+
handler: oldData.onClick,
27+
}],
28+
};
29+
}
30+
return oldData;
31+
}
1832
export const ColumnValueTooltip = trans("table.columnValueTooltip");
1933

2034
export const ButtonTypeOptions = [
@@ -37,7 +51,7 @@ const ButtonEventOptions = [clickEvent] as const;
3751
const childrenMap = {
3852
text: StringControl,
3953
buttonType: dropdownControl(ButtonTypeOptions, "primary"),
40-
onEvent: eventHandlerControl(ButtonEventOptions),
54+
onClick: eventHandlerControl(ButtonEventOptions),
4155
loading: BoolCodeControl,
4256
disabled: BoolCodeControl,
4357
prefixIcon: IconControl,
@@ -52,8 +66,8 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
5266
const iconOnly = !hasText && (hasPrefixIcon || hasSuffixIcon);
5367

5468
const handleClick = useCallback((e: React.MouseEvent) => {
55-
props.onEvent("click");
56-
}, [props.onEvent]);
69+
props.onClick?.("click");
70+
}, [props.onClick]);
5771

5872
const buttonStyle = useMemo(() => ({
5973
margin: 0,
@@ -79,7 +93,7 @@ const ButtonStyled = React.memo(({ props }: { props: ToViewReturn<RecordConstruc
7993
);
8094
});
8195

82-
export const ButtonComp = (function () {
96+
const ButtonCompTmp = (function () {
8397
return new ColumnTypeCompBuilder(
8498
childrenMap,
8599
(props) => <ButtonStyled props={props} />,
@@ -103,8 +117,10 @@ export const ButtonComp = (function () {
103117
})}
104118
{loadingPropertyView(children)}
105119
{disabledPropertyView(children)}
106-
{children.onEvent.propertyView()}
120+
{children.onClick.propertyView()}
107121
</>
108122
))
109123
.build();
110124
})();
125+
126+
export const ButtonComp = migrateOldData(ButtonCompTmp, fixOldActionData);

‎client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -194,26 +194,27 @@ const ColumnPropertyView = React.memo(({
194194
summaryRowIndex: number;
195195
}) => {
196196
const selectedColumn = comp.children.render.getSelectedComp();
197-
198197
const columnType = useMemo(() =>
199198
selectedColumn.getComp().children.compType.getView(),
200199
[selectedColumn]
201200
);
202-
201+
202+
const initialColumns = useMemo(() =>
203+
selectedColumn.getParams()?.initialColumns as OptionType[] || [],
204+
[selectedColumn]
205+
);
206+
203207
const columnValue = useMemo(() => {
204208
const column = selectedColumn.getComp().toJsonValue();
205209
if (column.comp?.hasOwnProperty('src')) {
206210
return (column.comp as any).src;
207211
} else if (column.comp?.hasOwnProperty('text')) {
208-
return (column.comp as any).text;
212+
const value = (column.comp as any).text;
213+
const isDynamicValue = initialColumns.find((column) => column.value === value);
214+
return !isDynamicValue ? '{{currentCell}}' : value;
209215
}
210216
return '{{currentCell}}';
211-
}, [selectedColumn]);
212-
213-
const initialColumns = useMemo(() =>
214-
selectedColumn.getParams()?.initialColumns as OptionType[] || [],
215-
[selectedColumn]
216-
);
217+
}, [selectedColumn, initialColumns]);
217218

218219
const summaryColumns = comp.children.summaryColumns.getView();
219220

0 commit comments

Comments
 (0)