Skip to content

Commit 1fd798f

Browse files
author
FalkWolsky
committed
Prefix Text for Number Input
1 parent dcabdb5 commit 1fd798f

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

client/packages/lowcoder/src/comps/comps/numberInputComp/numberInputComp.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
withExposingConfigs,
2222
} from "comps/generators/withExposing";
2323
import { Section, sectionNames, ValueFromOption } from "lowcoder-design";
24-
import { useEffect, useRef, useState } from "react";
24+
import { ReactNode, useEffect, useRef, useState } from "react";
2525
import styled, { css } from "styled-components";
2626
import { RecordConstructorToView } from "lowcoder-core";
2727
import { InputEventHandlerControl } from "../../controls/eventHandlerControl";
@@ -259,6 +259,7 @@ const childrenMap = {
259259
viewRef: RefControl<HTMLInputElement>,
260260
style: styleControl(InputFieldStyle),
261261
labelStyle:styleControl(LabelStyle),
262+
prefixText : stringExposingStateControl("defaultValue"),
262263
prefixIcon: IconControl,
263264
inputFieldStyle:styleControl(InputLikeStyle),
264265
// validation
@@ -323,7 +324,7 @@ const CustomInputNumber = (props: RecordConstructorToView<typeof childrenMap>) =
323324
stringMode={true}
324325
precision={props.precision}
325326
$style={props.inputFieldStyle}
326-
prefix={hasIcon(props.prefixIcon) && props.prefixIcon}
327+
prefix={hasIcon(props.prefixIcon) ? props.prefixIcon : props.prefixText.value}
327328
onPressEnter={() => {
328329
handleFinish();
329330
props.onEvent("submit");
@@ -420,6 +421,7 @@ let NumberInputTmpComp = (function () {
420421
{children.step.propertyView({ label: trans("numberInput.step") })}
421422
{children.precision.propertyView({ label: trans("numberInput.precision") })}
422423
{children.prefixIcon.propertyView({ label: trans("button.prefixIcon") })}
424+
{children.prefixText.propertyView({ label: trans("button.prefixText") })}
423425
{children.allowNull.propertyView({ label: trans("numberInput.allowNull") })}
424426
{children.thousandsSeparator.propertyView({
425427
label: trans("numberInput.thousandsSeparator"),

client/packages/lowcoder/src/i18n/locales/en.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1765,6 +1765,7 @@ export const en = {
17651765
},
17661766
"button": {
17671767
"prefixIcon": "Prefix Icon",
1768+
"prefixText": "Prefix Text",
17681769
"suffixIcon": "Suffix Icon",
17691770
"icon": "Icon",
17701771
"iconSize": "Icon Size",

0 commit comments

Comments
 (0)