Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
9d2bb31
Added properties for currency type input in Input widget
vicky-primathon Jun 7, 2021
796829c
Added search to dropdown
vicky-primathon Jun 8, 2021
cd3fdeb
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 8, 2021
622bc70
Currency type dropdown alignment fixed
vicky-primathon Jun 8, 2021
e6a28c5
Changes to handle formatting
vicky-primathon Jun 10, 2021
414218f
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 10, 2021
1354a8c
Handle decimal points for current type input widget
vicky-primathon Jun 10, 2021
ac8dd2d
Added cypress test to validate currency type input
vicky-primathon Jun 10, 2021
768be59
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 11, 2021
1013b64
Changed property pane currency type dropdown to be searchable
vicky-primathon Jun 14, 2021
61207e7
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 14, 2021
d3c3e41
Fix currency type input widget
vicky-primathon Jun 14, 2021
ad4e0a8
Fix currencType property to be updated in canvas mode only since its …
vicky-primathon Jun 14, 2021
a38ba7e
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jun 16, 2021
13cab87
Added changes to handle phone number code selection for input widget
vicky-primathon Jun 17, 2021
114639e
Added dialing code options, made selected country code as meta prop
vicky-primathon Jun 18, 2021
6ab06ce
Added test case to validate phone number and country flag is visible
vicky-primathon Jun 18, 2021
1ee6752
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 22, 2021
513c41b
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 22, 2021
6fc61c7
Rename PhoneNumberCodeDropdown to ISDCodeDropdown
vicky-primathon Jun 22, 2021
9988579
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jun 22, 2021
7417828
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jun 30, 2021
2796dc9
useMemo, calling function once for optimizations
vicky-primathon Jul 1, 2021
f4bc511
useMemo, calling function once for optimizations
vicky-primathon Jul 1, 2021
6983006
remove incorrect usage of useMemo from component
vicky-primathon Jul 1, 2021
6ee0f0b
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 1, 2021
31eed21
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 1, 2021
5a0e9b2
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 2, 2021
4ee46b0
Fix unit test
vicky-primathon Jul 2, 2021
7bc0190
Fix currency selection not displayed after initial selection
vicky-primathon Jul 2, 2021
15a3770
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 2, 2021
4fb326d
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 2, 2021
4f91044
Fixes for unit test
vicky-primathon Jul 2, 2021
0c221a8
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 3, 2021
5e5d5cf
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 7, 2021
c217057
Fix default curerncy selection and removed 0 decimal counts option
vicky-primathon Jul 7, 2021
cb455f8
Fix NaN issue on clearing the currency input
vicky-primathon Jul 7, 2021
5544251
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 7, 2021
fed0fa6
Add selected countryCode as widget api property
vicky-primathon Jul 7, 2021
2e5ce92
Add selected currency countryCode as widget api property
vicky-primathon Jul 7, 2021
2510b49
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 7, 2021
09563f1
Fix test case
vicky-primathon Jul 8, 2021
d2fa0ce
Fix phonenumber value
vicky-primathon Jul 9, 2021
a5c56ed
Convert default text to default number for number type inputs
vicky-primathon Jul 9, 2021
0e87198
Fix overflow issue for property actions component
vicky-primathon Jul 9, 2021
ef5f193
Fix no of digits after decimal issue
vicky-primathon Jul 13, 2021
62a2fbd
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 13, 2021
2dc471e
Fix decimal point rounding off
vicky-primathon Jul 13, 2021
58e1eeb
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 13, 2021
39e214f
Fix cypress test for Input spec
vicky-primathon Jul 14, 2021
25164ed
Fix disable input with phone number type
vicky-primathon Jul 15, 2021
d5a004f
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 15, 2021
b487cef
Merge branch 'currency-type-input' of https://github.com/appsmithorg/…
vicky-primathon Jul 15, 2021
0a3f2d6
Fix default value validation
vicky-primathon Jul 15, 2021
ee161b4
Fix build issue and default value validations
vicky-primathon Jul 15, 2021
56180d9
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 15, 2021
42505a6
Issue during merge fixed
vicky-primathon Jul 16, 2021
c250ecb
Use overflow elipsis for selected dropdown label
vicky-primathon Jul 16, 2021
314eadd
Show dropdown flag and icon when disabled
vicky-primathon Jul 16, 2021
e45ad0b
Fix line-height css property
vicky-primathon Jul 19, 2021
8f7877d
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 20, 2021
0359dd7
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 20, 2021
f08f562
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 21, 2021
5a4e4cd
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Jul 28, 2021
85d1d1f
Merge remote-tracking branch 'origin/release' into phone-number-type-…
techbhavin Aug 5, 2021
8ff126a
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 11, 2021
d357079
Merge branch 'phone-number-type-input' of https://github.com/appsmith…
vicky-primathon Aug 11, 2021
eef80f5
Fix input widget default value validation
vicky-primathon Aug 12, 2021
7bc57a5
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 12, 2021
fb4351a
Fix default value validation
vicky-primathon Aug 13, 2021
2a0900f
fix input text validation
vicky-primathon Aug 16, 2021
7397cd1
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 16, 2021
d47cb8f
Add inputType to dependecies
vicky-primathon Aug 17, 2021
2066f53
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 17, 2021
164a65d
Hide icon configurations for currency and phone number type inputs
vicky-primathon Aug 17, 2021
8e1fdfd
Fix phone number type widget validation in form widget
vicky-primathon Aug 18, 2021
5b792c5
valid regex property fix
vicky-primathon Aug 18, 2021
270ef22
Fix input widget isValid
vicky-primathon Aug 19, 2021
159260e
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 19, 2021
7f087d6
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 20, 2021
17461ef
Fix invalid input error for currency widget
vicky-primathon Aug 23, 2021
4625bdd
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 23, 2021
cd85a24
Fix height prop missing
vicky-primathon Aug 24, 2021
5f354de
Fix height prop missing
vicky-primathon Aug 24, 2021
fb85799
Fix cypress test case
vicky-primathon Aug 25, 2021
2b22a88
Merge branch 'release' of https://github.com/appsmithorg/appsmith int…
vicky-primathon Aug 25, 2021
73ef75e
Fix cypress test case
vicky-primathon Aug 25, 2021
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 @@ -159,6 +159,19 @@ describe("Input Widget Functionality", function() {
});
});

it("Input Functionality To check phone number input type", function() {
// cy.openPropertyPane("inputwidget");
cy.get(widgetsPage.innertext)
.click()
.clear();
cy.selectDropdownValue(commonlocators.dataType, "Phone Number");
cy.get(commonlocators.inputCountryCodeChangeType)
.invoke("text")
.then((text) => {
expect(text).to.equal("πŸ‡ΊπŸ‡Έ+1");
});
});

it("Input label wrapper do not show if lable and tooltip is empty", () => {
cy.get(".t--input-label-wrapper").should("not.exist");
});
Expand Down
1 change: 1 addition & 0 deletions app/client/cypress/locators/commonlocators.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"decimalType": ".t--property-control-decimals .bp3-popover-target",
"allowCurrencyChange": ".t--property-control-allowcurrencychange input[type='checkbox']",
"inputCurrencyChangeType": ".t--input-currency-change",
"inputCountryCodeChangeType": ".t--input-country-code-change",
"viewerPage": ".t--app-viewer-page",
"dropDownOptSelected": "//span[@type='p1']"
}
13 changes: 5 additions & 8 deletions app/client/cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -2303,10 +2303,9 @@ Cypress.Commands.add("onClickActions", (forSuccess, forFailure) => {
.click()
.type(forSuccess)
.get("button.t--open-dropdown-Select-type")
.click()
.get("a.single-select div")
.contains(forSuccess)
.click();
.first()
.click({ force: true })
.selectOnClickOption(forSuccess);

cy.wait(2000);
// For Failure
Expand All @@ -2322,10 +2321,8 @@ Cypress.Commands.add("onClickActions", (forSuccess, forFailure) => {
.type(forFailure)
.get("button.t--open-dropdown-Select-type")
.last()
.click()
.get("a.single-select div")
.contains(forFailure)
.click();
.click({ force: true })
.selectOnClickOption(forFailure);
});

Cypress.Commands.add("copyWidget", (widget, widgetLocator) => {
Expand Down
108 changes: 108 additions & 0 deletions app/client/src/components/ads/CurrencyCodeDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from "react";
import styled from "styled-components";
import Dropdown, { DropdownOption } from "components/ads/Dropdown";
import { CurrencyTypeOptions, CurrencyOptionProps } from "constants/Currency";
import Icon, { IconSize } from "components/ads/Icon";
import { countryToFlag } from "components/designSystems/blueprint/InputComponent/utilties";

const DropdownTriggerIconWrapper = styled.div`
height: 19px;
padding: 9px 5px 9px 12px;
width: 40px;
height: 19px;
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
line-height: 19px;
letter-spacing: -0.24px;
color: #090707;
`;

const CurrencyIconWrapper = styled.span`
height: 100%;
padding: 6px 4px 6px 12px;
width: 28px;
position: absolute;
left: 0;
z-index: 16;
font-size: 14px;
line-height: 19px;
letter-spacing: -0.24px;
color: #090707;
`;

const getCurrencyOptions = (): Array<DropdownOption> => {
return CurrencyTypeOptions.map((item: CurrencyOptionProps) => {
return {
leftElement: countryToFlag(item.code),
searchText: item.label,
label: `${item.currency} - ${item.currency_name}`,
value: item.code,
id: item.symbol_native,
};
});
};

export const CurrencyDropdownOptions = getCurrencyOptions();

export const getSelectedCurrency = (
currencyCountryCode?: string,
): DropdownOption => {
let selectedCurrency: CurrencyOptionProps | undefined = currencyCountryCode
? CurrencyTypeOptions.find((item: CurrencyOptionProps) => {
return item.code === currencyCountryCode;
})
: undefined;
if (!selectedCurrency) {
selectedCurrency = {
code: "US",
currency: "USD",
currency_name: "US Dollar",
label: "United States",
phone: "1",
symbol_native: "$",
};
}
return {
label: `${selectedCurrency.currency} - ${selectedCurrency.currency_name}`,
searchText: selectedCurrency.label,
value: selectedCurrency.code,
id: selectedCurrency.symbol_native,
};
};

interface CurrencyDropdownProps {
onCurrencyTypeChange: (currencyCountryCode?: string) => void;
options: Array<DropdownOption>;
selected: DropdownOption;
allowCurrencyChange?: boolean;
}

export default function CurrencyTypeDropdown(props: CurrencyDropdownProps) {
const selectedCurrency = getSelectedCurrency(props.selected.value).id;
if (!props.allowCurrencyChange) {
return <CurrencyIconWrapper>{selectedCurrency}</CurrencyIconWrapper>;
}
const dropdownTriggerIcon = (
<DropdownTriggerIconWrapper className="t--input-currency-change">
{selectedCurrency}
<Icon name="downArrow" size={IconSize.XXS} />
</DropdownTriggerIconWrapper>
);
return (
<Dropdown
containerClassName="currency-type-filter"
dropdownHeight="195px"
dropdownTriggerIcon={dropdownTriggerIcon}
enableSearch
height="32px"
onSelect={props.onCurrencyTypeChange}
optionWidth="260px"
options={props.options}
searchPlaceholder="Search by currency or country"
selected={props.selected}
showLabelOnly
/>
);
}
6 changes: 4 additions & 2 deletions app/client/src/components/ads/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ export const DropdownContainer = styled.div<{ width: string }>`
const DropdownTriggerWrapper = styled.div<{
isOpen: boolean;
disabled?: boolean;
height: string;
}>`
height: 100%;
display: flex;
Expand Down Expand Up @@ -153,6 +152,10 @@ const Selected = styled.div<{
? "box-shadow: 0px 0px 4px 4px rgba(203, 72, 16, 0.18)"
: null};
.${Classes.TEXT} {
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
width: calc(100% - 10px);
${(props) =>
props.disabled
? `color: ${props.theme.colors.dropdown.header.disabledText}`
Expand Down Expand Up @@ -511,7 +514,6 @@ export default function Dropdown(props: DropdownProps) {
const dropdownTrigger = props.dropdownTriggerIcon ? (
<DropdownTriggerWrapper
disabled={props.disabled}
height={dropdownHeight}
isOpen={isOpen}
onClick={onClickHandler}
>
Expand Down
108 changes: 108 additions & 0 deletions app/client/src/components/ads/ISDCodeDropdown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
import React from "react";
import styled from "styled-components";
import Dropdown, { DropdownOption } from "components/ads/Dropdown";
import Icon, { IconSize } from "components/ads/Icon";
import { countryToFlag } from "components/designSystems/blueprint/InputComponent/utilties";
import { ISDCodeOptions, ISDCodeProps } from "constants/ISDCodes";

const DropdownTriggerIconWrapper = styled.div<{ disabled?: boolean }>`
padding: 9px 0px 9px 12px;
width: 85px;
min-width: 85px;
opacity: ${(props) => props.disabled && "0.6"};
display: flex;
align-items: center;
justify-content: space-between;
font-size: 14px;
height: ${(props) => (props.disabled ? 32 : 19)}px;
line-height: ${(props) => (props.disabled ? 32 : 19)}px;
letter-spacing: -0.24px;
color: #090707;
position: ${(props) => props.disabled && "absolute"};
.code {
margin-right: 4px;
pointer-events: none;
}
.icon-dropdown {
display: flex;
width: 30px;
justify-content: space-between;
}
`;

const getISDCodeOptions = (): Array<DropdownOption> => {
return ISDCodeOptions.map((item: ISDCodeProps) => {
return {
leftElement: countryToFlag(item.code),
searchText: item.name,
label: `${item.name} (${item.dial_code})`,
value: item.code,
id: item.dial_code,
};
});
};

export const ISDCodeDropdownOptions = getISDCodeOptions();

export const getSelectedISDCode = (code?: string): DropdownOption => {
let selectedCountry: ISDCodeProps | undefined = code
? ISDCodeOptions.find((item: ISDCodeProps) => {
return item.code === code;
})
: undefined;
if (!selectedCountry) {
selectedCountry = {
name: "United States",
dial_code: "+1",
code: "US",
};
}
return {
label: `${selectedCountry.name} (${selectedCountry.dial_code})`,
searchText: selectedCountry.name,
value: selectedCountry.code,
id: selectedCountry.dial_code,
};
};

interface ISDCodeDropdownProps {
onISDCodeChange: (code?: string) => void;
options: Array<DropdownOption>;
selected: DropdownOption;
allowCountryCodeChange?: boolean;
disabled: boolean;
}

export default function ISDCodeDropdown(props: ISDCodeDropdownProps) {
const selectedCountry = getSelectedISDCode(props.selected.value);
const dropdownTrigger = (
<DropdownTriggerIconWrapper
className="t--input-country-code-change"
disabled={props.disabled}
>
<div className="icon-dropdown">
{selectedCountry.value && countryToFlag(selectedCountry.value)}
<Icon name="downArrow" size={IconSize.XXS} />
</div>
<div className="code">{selectedCountry.id && selectedCountry.id}</div>
</DropdownTriggerIconWrapper>
);
if (props.disabled) {
return dropdownTrigger;
}
return (
<Dropdown
containerClassName="country-type-filter"
dropdownHeight="195px"
dropdownTriggerIcon={dropdownTrigger}
enableSearch
height="32px"
onSelect={props.onISDCodeChange}
optionWidth="260px"
options={props.options}
searchPlaceholder="Search by ISD code or country"
selected={props.selected}
showLabelOnly
/>
);
}
Loading