Skip to content

[Feat]: #1883 add tab-index on more controls #1931

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
buttonRefMethods,
ButtonStyleControl,
} from "comps/comps/buttonComp/buttonCompConstants";
import { BoolCodeControl, StringControl } from "comps/controls/codeControl";
import { BoolCodeControl, StringControl, NumberControl } from "comps/controls/codeControl";
import { ScannerEventHandlerControl } from "comps/controls/eventHandlerControl";
import { withDefault } from "comps/generators";
import { UICompBuilder } from "comps/generators/uiCompBuilder";
Expand Down Expand Up @@ -128,6 +128,7 @@ const ScannerTmpComp = (function () {
disabled: BoolCodeControl,
style: ButtonStyleControl,
viewRef: RefControl<HTMLElement>,
tabIndex: NumberControl,
};
return new UICompBuilder(childrenMap, (props) => {
const [showModal, setShowModal] = useState(false);
Expand Down Expand Up @@ -199,6 +200,7 @@ const ScannerTmpComp = (function () {
ref={props.viewRef}
$buttonStyle={props.style}
disabled={props.disabled}
tabIndex={typeof props.tabIndex === 'number' ? props.tabIndex : undefined}
onClick={() => {
props.onEvent("click");
setShowModal(true);
Expand Down Expand Up @@ -284,6 +286,7 @@ const ScannerTmpComp = (function () {
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
</Section>
<Section name={sectionNames.advanced}>
{children.continuous.propertyView({
Expand Down
24 changes: 16 additions & 8 deletions client/packages/lowcoder/src/comps/comps/fileComp/fileComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { default as AntdUpload } from "antd/es/upload";
import { default as Dropdown } from "antd/es/dropdown";
import { UploadFile, UploadProps, UploadChangeParam, UploadFileStatus, RcFile } from "antd/es/upload/interface";
import { Buffer } from "buffer";
import { v4 as uuidv4 } from "uuid";
import { darkenColor } from "components/colorSelect/colorUtils";
import { Section, sectionNames } from "components/Section";
import { IconControl } from "comps/controls/iconControl";
Expand Down Expand Up @@ -448,6 +449,7 @@ const Upload = (
text: string;
dispatch: (action: CompAction) => void;
forceCapture: boolean;
tabIndex?: number;
},
) => {
const { dispatch, files, style } = props;
Expand Down Expand Up @@ -564,13 +566,17 @@ const Upload = (
onChange={handleOnChange}

>
<Button disabled={props.disabled} onClick={(e) => {
if (props.forceCapture && !isMobile) {
e.preventDefault();
e.stopPropagation();
setShowModal(true);
}
}}>
<Button
disabled={props.disabled}
tabIndex={typeof props.tabIndex === 'number' ? props.tabIndex : undefined}
onClick={(e) => {
if (props.forceCapture && !isMobile) {
e.preventDefault();
e.stopPropagation();
setShowModal(true);
}
}}
>
{hasChildren && (
<span>
{hasIcon(props.prefixIcon) && <IconWrapper>{props.prefixIcon}</IconWrapper>}
Expand All @@ -589,7 +595,7 @@ const Upload = (
const res: Response = await fetch(image);
const blob: Blob = await res.blob();
const file = new File([blob], "image.jpg", {type: 'image/jpeg'});
const fileUid = uuid.v4();
const fileUid = uuidv4();
const uploadFile = {
uid: fileUid,
name: file.name,
Expand All @@ -616,6 +622,7 @@ const UploadTypeOptions = [
const childrenMap = {
text: withDefault(StringControl, trans("file.upload")),
uploadType: dropdownControl(UploadTypeOptions, "single"),
tabIndex: NumberControl,
...commonChildren,
...formDataChildren,
};
Expand Down Expand Up @@ -645,6 +652,7 @@ let FileTmpComp = new UICompBuilder(childrenMap, (props, dispatch) => {
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
</Section>
<Section name={sectionNames.advanced}>
{children.fileType.propertyView({
Expand Down
25 changes: 24 additions & 1 deletion client/packages/lowcoder/src/comps/comps/ratingComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,31 @@ const RatingBasicComp = (function () {
'labelStyle',
),
inputFieldStyle: migrateOldData(styleControl(RatingStyle, 'inputFieldStyle'), fixOldData),
tabIndex: NumberControl,
...formDataChildren,
};
return new UICompBuilder(childrenMap, (props) => {
const defaultValue = { ...props.defaultValue }.value;
const value = { ...props.value }.value;
const changeRef = useRef(false);
const mountedRef = useRef(true);
const rateRef = useRef<HTMLDivElement | null>(null);

useEffect(() => {
if (!mountedRef.current) return;
if (rateRef.current && typeof props.tabIndex === 'number') {
const stars = rateRef.current.querySelectorAll('li');
stars.forEach((star, index) => {
(star as HTMLElement).setAttribute('tabindex', (props.tabIndex + index).toString());
});
}
}, [props.tabIndex, props.max]);

useEffect(() => {
return () => {
mountedRef.current = false;
};
}, []);

useEffect(() => {
props.value.onChange(defaultValue);
Expand All @@ -76,7 +95,8 @@ const RatingBasicComp = (function () {
inputFieldStyle:props.inputFieldStyle,
animationStyle:props.animationStyle,
children: (
<RateStyled
<div ref={rateRef}>
<RateStyled
count={props.max}
value={value}
onChange={(e) => {
Expand All @@ -86,7 +106,9 @@ const RatingBasicComp = (function () {
allowHalf={props.allowHalf}
disabled={props.disabled}
$style={props.inputFieldStyle}
tabIndex={typeof props.tabIndex === 'number' ? props.tabIndex : undefined}
/>
</div>
),
});
})
Expand All @@ -108,6 +130,7 @@ const RatingBasicComp = (function () {
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
</Section>
<Section name={sectionNames.advanced}>
{children.allowHalf.propertyView({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ let CascaderBasicComp = (function () {
showSearch={props.showSearch}
$style={props.inputFieldStyle}
$childrenInputFieldStyle={props.childrenInputFieldStyle}
tabIndex={typeof props.tabIndex === 'number' ? props.tabIndex : undefined}
onFocus={() => props.onEvent("focus")}
onBlur={() => props.onEvent("blur")}
popupRender={(menus: React.ReactNode) => (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SelectEventHandlerControl } from "../../controls/eventHandlerControl";
import { Section, sectionNames } from "lowcoder-design";
import { RecordConstructorToComp } from "lowcoder-core";
import { BoolCodeControl, JSONObjectArrayControl, StringControl } from "comps/controls/codeControl";
import { BoolCodeControl, JSONObjectArrayControl, StringControl, NumberControl } from "comps/controls/codeControl";
import { arrayStringExposingStateControl } from "comps/controls/codeStateControl";
import { BoolControl } from "comps/controls/boolControl";
import { LabelControl } from "comps/controls/labelControl";
Expand Down Expand Up @@ -43,7 +43,8 @@ export const CascaderChildren = {
padding: PaddingControl,
inputFieldStyle:styleControl(CascaderStyle , 'inputFieldStyle'),
childrenInputFieldStyle:styleControl(ChildrenMultiSelectStyle),
animationStyle:styleControl(AnimationStyle ,'animationStyle')
animationStyle:styleControl(AnimationStyle ,'animationStyle'),
tabIndex: NumberControl
};

export const CascaderPropertyView = (
Expand All @@ -62,6 +63,7 @@ export const CascaderPropertyView = (
{disabledPropertyView(children)}
{hiddenPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children as any)}
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
</Section>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
} from "./treeUtils";
import { baseSelectRefMethods, getStyle } from "../selectInputComp/selectCompConstants";
import { useSelectInputValidate, SelectInputValidationSection } from "../selectInputComp/selectInputConstants";
import { StringControl } from "comps/controls/codeControl";
import { StringControl, NumberControl } from "comps/controls/codeControl";
import { SelectEventHandlerControl } from "comps/controls/eventHandlerControl";
import { selectInputValidate } from "../selectInputComp/selectInputConstants";
import { BoolControl } from "comps/controls/boolControl";
Expand Down Expand Up @@ -70,6 +70,7 @@ const childrenMap = {
labelStyle:styleControl(LabelStyle , 'labelStyle'),
inputFieldStyle: styleControl(TreeSelectStyle, 'inputFieldStyle'),
viewRef: RefControl<BaseSelectRef>,
tabIndex: NumberControl,
};

function getCheckedStrategy(v: ValueFromOption<typeof checkedStrategyOptions>) {
Expand Down Expand Up @@ -123,6 +124,7 @@ const TreeCompView = (
treeLine={props.showLine ? { showLeafIcon: props.showLeafIcon } : false}
// fix expand issue when searching
treeExpandedKeys={inputValue ? undefined : expanded.value}
tabIndex={typeof props.tabIndex === 'number' ? props.tabIndex : undefined}
onTreeExpand={(keys) => {
expanded.onChange(keys as (string | number)[]);
}}
Expand Down Expand Up @@ -172,6 +174,7 @@ let TreeBasicComp = (function () {
{allowClearPropertyView(children)}
{showSearchPropertyView(children)}
{showDataLoadingIndicatorsPropertyView(children)}
{children.tabIndex.propertyView({ label: trans("prop.tabIndex") })}
</Section>
</>
)}
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy