Skip to content
Open
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
32 changes: 27 additions & 5 deletions client/packages/lowcoder-design/src/components/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,24 @@ const SwitchStyle: any = styled.input`
border-radius: 20px;
background-color: #ffffff;
}

&:disabled {
background-color: #e0e0e0;
opacity: 0.6;
cursor: not-allowed;
}

&:disabled::before {
background-color: #cccccc;
}

&:disabled:checked {
background-color: #a0a0a0;
}

&:disabled:hover {
cursor: not-allowed;
}
`;

const SwitchDiv = styled.div<{
Expand Down Expand Up @@ -104,16 +122,18 @@ const JsIconGray = styled(jsIconGray)<Ishow>`
interface SwitchProps extends Omit<React.HTMLAttributes<HTMLInputElement>, "value" | "onChange"> {
value: boolean;
onChange: (value: boolean) => void;
disabled?: boolean;
}

export const Switch = (props: SwitchProps) => {
const { value, onChange, ...inputChanges } = props;
const { value, onChange, disabled, ...inputChanges } = props;
return (
<SwitchStyle
type="checkbox"
checked={props.value}
onClick={() => props.onChange(!props.value)}
checked={value}
onClick={() => onChange(!value)}
onChange={() => {}}
disabled={disabled}
{...inputChanges}
/>
);
Expand Down Expand Up @@ -154,15 +174,17 @@ export const SwitchWrapper = (props: {
export function TacoSwitch(props: {
label: string;
checked: boolean;
onChange: (checked: boolean) => void;
disabled?: boolean;
onChange?: (checked: boolean) => void;
}) {
return (
<SwitchWrapper label={props.label}>
<Switch
onChange={(value) => {
props.onChange(value);
props.onChange ? props.onChange(value) : null;
}}
value={props.checked}
disabled={props.disabled}
/>
</SwitchWrapper>
);
Expand Down
14 changes: 12 additions & 2 deletions client/packages/lowcoder/src/api/applicationApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ export interface ApplicationResp extends ApiResponse {
data: ApplicationDetail;
}

export interface ApplicationPublishRequest {
commitMessage?: string;
tag: string;
}

interface GrantAppPermissionReq {
applicationId: string;
role: ApplicationRoleType;
Expand Down Expand Up @@ -171,8 +176,13 @@ class ApplicationApi extends Api {
return Api.put(ApplicationApi.updateApplicationURL(applicationId), rest);
}

static publishApplication(request: PublishApplicationPayload): AxiosPromise<ApiResponse> {
return Api.post(ApplicationApi.publishApplicationURL(request.applicationId));
static publishApplication(
request: PublishApplicationPayload
): AxiosPromise<ApiResponse> {
return Api.post(
ApplicationApi.publishApplicationURL(request.applicationId),
request?.request
);
}

static getApplicationDetail(request: FetchAppInfoPayload): AxiosPromise<ApplicationResp> {
Expand Down
Loading
Loading