2022-01-18 07:52:24 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import { WidgetState } from "widgets/BaseWidget";
|
2022-04-08 17:39:05 +00:00
|
|
|
import { WidgetType } from "constants/WidgetConstants";
|
2022-01-18 07:52:24 +00:00
|
|
|
import PhoneInputComponent, { PhoneInputComponentProps } from "../component";
|
|
|
|
|
import { EventType } from "constants/AppsmithActionConstants/ActionConstants";
|
|
|
|
|
import {
|
|
|
|
|
ValidationTypes,
|
|
|
|
|
ValidationResponse,
|
|
|
|
|
} from "constants/WidgetValidation";
|
2022-02-11 18:08:46 +00:00
|
|
|
import {
|
|
|
|
|
createMessage,
|
|
|
|
|
FIELD_REQUIRED_ERROR,
|
|
|
|
|
} from "@appsmith/constants/messages";
|
2022-01-18 07:52:24 +00:00
|
|
|
import { DerivedPropertiesMap } from "utils/WidgetFactory";
|
|
|
|
|
import {
|
|
|
|
|
getCountryCode,
|
|
|
|
|
ISDCodeDropdownOptions,
|
|
|
|
|
} from "../component/ISDCodeDropdown";
|
2022-11-27 06:11:01 +00:00
|
|
|
import { AutocompleteDataType } from "utils/autocomplete/CodemirrorTernService";
|
2022-01-18 07:52:24 +00:00
|
|
|
import _ from "lodash";
|
|
|
|
|
import BaseInputWidget from "widgets/BaseInputWidget";
|
|
|
|
|
import derivedProperties from "./parsedDerivedProperties";
|
|
|
|
|
import { BaseInputWidgetProps } from "widgets/BaseInputWidget/widget";
|
|
|
|
|
import { mergeWidgetConfig } from "utils/helpers";
|
2022-02-11 10:09:38 +00:00
|
|
|
import {
|
|
|
|
|
AsYouType,
|
|
|
|
|
CountryCode,
|
|
|
|
|
parseIncompletePhoneNumber,
|
|
|
|
|
} from "libphonenumber-js";
|
2022-01-18 07:52:24 +00:00
|
|
|
import * as Sentry from "@sentry/react";
|
|
|
|
|
import log from "loglevel";
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
import { GRID_DENSITY_MIGRATION_V1 } from "widgets/constants";
|
2022-11-23 09:48:23 +00:00
|
|
|
import { isAutoHeightEnabledForWidget } from "widgets/WidgetUtils";
|
2022-01-18 07:52:24 +00:00
|
|
|
|
|
|
|
|
export function defaultValueValidation(
|
|
|
|
|
value: any,
|
|
|
|
|
props: PhoneInputWidgetProps,
|
|
|
|
|
_?: any,
|
|
|
|
|
): ValidationResponse {
|
|
|
|
|
const STRING_ERROR_MESSAGE = "This value must be string";
|
|
|
|
|
const EMPTY_ERROR_MESSAGE = "";
|
|
|
|
|
if (_.isObject(value)) {
|
|
|
|
|
return {
|
|
|
|
|
isValid: false,
|
|
|
|
|
parsed: JSON.stringify(value, null, 2),
|
|
|
|
|
messages: [STRING_ERROR_MESSAGE],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
let parsed = value;
|
|
|
|
|
if (!_.isString(value)) {
|
|
|
|
|
try {
|
|
|
|
|
parsed = _.toString(value);
|
|
|
|
|
} catch (e) {
|
|
|
|
|
return {
|
|
|
|
|
isValid: false,
|
|
|
|
|
parsed: "",
|
|
|
|
|
messages: [STRING_ERROR_MESSAGE],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
isValid: _.isString(parsed),
|
|
|
|
|
parsed: parsed,
|
|
|
|
|
messages: [EMPTY_ERROR_MESSAGE],
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class PhoneInputWidget extends BaseInputWidget<
|
|
|
|
|
PhoneInputWidgetProps,
|
|
|
|
|
WidgetState
|
|
|
|
|
> {
|
2022-08-11 11:20:09 +00:00
|
|
|
static getPropertyPaneContentConfig() {
|
|
|
|
|
return mergeWidgetConfig(
|
|
|
|
|
[
|
|
|
|
|
{
|
|
|
|
|
sectionName: "Data",
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
helpText:
|
|
|
|
|
"Sets the default text of the widget. The text is updated if the default text changes",
|
|
|
|
|
propertyName: "defaultText",
|
|
|
|
|
label: "Default Value",
|
|
|
|
|
controlType: "INPUT_TEXT",
|
|
|
|
|
placeholderText: "(000) 000-0000",
|
|
|
|
|
isBindProperty: true,
|
|
|
|
|
isTriggerProperty: false,
|
|
|
|
|
validation: {
|
|
|
|
|
type: ValidationTypes.FUNCTION,
|
|
|
|
|
params: {
|
|
|
|
|
fn: defaultValueValidation,
|
|
|
|
|
expected: {
|
|
|
|
|
type: "string",
|
|
|
|
|
example: `(000) 000-0000`,
|
|
|
|
|
autocompleteDataType: AutocompleteDataType.STRING,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
helpText: "Changes the country code",
|
|
|
|
|
propertyName: "defaultDialCode",
|
|
|
|
|
label: "Default Country Code",
|
|
|
|
|
enableSearch: true,
|
|
|
|
|
dropdownHeight: "156px",
|
|
|
|
|
controlType: "DROP_DOWN",
|
|
|
|
|
searchPlaceholderText: "Search by code or country name",
|
|
|
|
|
options: ISDCodeDropdownOptions,
|
|
|
|
|
isJSConvertible: true,
|
|
|
|
|
isBindProperty: true,
|
|
|
|
|
isTriggerProperty: false,
|
|
|
|
|
validation: {
|
|
|
|
|
type: ValidationTypes.TEXT,
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
propertyName: "allowDialCodeChange",
|
2022-11-17 12:15:06 +00:00
|
|
|
label: "Change Country Code",
|
2022-08-11 11:20:09 +00:00
|
|
|
helpText: "Search by country",
|
|
|
|
|
controlType: "SWITCH",
|
2022-11-01 08:29:19 +00:00
|
|
|
isJSConvertible: true,
|
2022-08-11 11:20:09 +00:00
|
|
|
isBindProperty: true,
|
|
|
|
|
isTriggerProperty: false,
|
|
|
|
|
validation: { type: ValidationTypes.BOOLEAN },
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sectionName: "Label",
|
|
|
|
|
children: [],
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
sectionName: "Validation",
|
|
|
|
|
children: [
|
|
|
|
|
{
|
|
|
|
|
propertyName: "isRequired",
|
|
|
|
|
label: "Required",
|
|
|
|
|
helpText: "Makes input to the widget mandatory",
|
|
|
|
|
controlType: "SWITCH",
|
|
|
|
|
isJSConvertible: true,
|
|
|
|
|
isBindProperty: true,
|
|
|
|
|
isTriggerProperty: false,
|
|
|
|
|
validation: { type: ValidationTypes.BOOLEAN },
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
},
|
|
|
|
|
// {
|
|
|
|
|
// sectionName: "General",
|
|
|
|
|
// children: [
|
|
|
|
|
// {
|
|
|
|
|
// propertyName: "allowFormatting",
|
|
|
|
|
// label: "Enable Formatting",
|
|
|
|
|
// helpText: "Formats the phone number as per the country selected",
|
|
|
|
|
// controlType: "SWITCH",
|
|
|
|
|
// isJSConvertible: true,
|
|
|
|
|
// isBindProperty: true,
|
|
|
|
|
// isTriggerProperty: false,
|
|
|
|
|
// validation: { type: ValidationTypes.BOOLEAN },
|
|
|
|
|
// },
|
|
|
|
|
// ],
|
|
|
|
|
// },
|
|
|
|
|
],
|
|
|
|
|
super.getPropertyPaneContentConfig(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getPropertyPaneStyleConfig() {
|
|
|
|
|
return super.getPropertyPaneStyleConfig();
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-18 07:52:24 +00:00
|
|
|
static getDerivedPropertiesMap(): DerivedPropertiesMap {
|
2022-02-11 10:09:38 +00:00
|
|
|
return {
|
2022-01-18 07:52:24 +00:00
|
|
|
isValid: `{{(() => {${derivedProperties.isValid}})()}}`,
|
2022-02-11 10:09:38 +00:00
|
|
|
};
|
2022-01-18 07:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getMetaPropertiesMap(): Record<string, any> {
|
2022-02-11 10:09:38 +00:00
|
|
|
return _.merge(super.getMetaPropertiesMap(), {
|
2022-04-08 13:07:10 +00:00
|
|
|
value: "",
|
2022-04-08 17:39:05 +00:00
|
|
|
dialCode: undefined,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getDefaultPropertiesMap(): Record<string, string> {
|
|
|
|
|
return _.merge(super.getDefaultPropertiesMap(), {
|
|
|
|
|
dialCode: "defaultDialCode",
|
2022-02-11 10:09:38 +00:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getFormattedPhoneNumber(value: string) {
|
|
|
|
|
const countryCode = getCountryCode(this.props.dialCode);
|
|
|
|
|
let formattedValue;
|
|
|
|
|
|
|
|
|
|
if (!value) {
|
|
|
|
|
formattedValue = value;
|
|
|
|
|
} else if (this.props.allowFormatting) {
|
|
|
|
|
formattedValue = new AsYouType(countryCode as CountryCode).input(value);
|
|
|
|
|
} else {
|
|
|
|
|
formattedValue = parseIncompletePhoneNumber(value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return formattedValue;
|
2022-01-18 07:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidMount() {
|
|
|
|
|
//format the defaultText and store it in text
|
|
|
|
|
if (!!this.props.text) {
|
|
|
|
|
try {
|
2022-02-11 10:09:38 +00:00
|
|
|
const formattedValue = this.getFormattedPhoneNumber(this.props.text);
|
|
|
|
|
|
|
|
|
|
this.props.updateWidgetMetaProperty("value", this.props.text);
|
|
|
|
|
this.props.updateWidgetMetaProperty("text", formattedValue);
|
2022-01-18 07:52:24 +00:00
|
|
|
} catch (e) {
|
|
|
|
|
log.error(e);
|
|
|
|
|
Sentry.captureException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
componentDidUpdate(prevProps: PhoneInputWidgetProps) {
|
2022-04-08 17:39:05 +00:00
|
|
|
if (prevProps.dialCode !== this.props.dialCode) {
|
2022-01-18 07:52:24 +00:00
|
|
|
this.onISDCodeChange(this.props.dialCode);
|
|
|
|
|
}
|
2022-02-11 10:09:38 +00:00
|
|
|
|
|
|
|
|
if (prevProps.allowFormatting !== this.props.allowFormatting) {
|
|
|
|
|
const formattedValue = this.getFormattedPhoneNumber(this.props.value);
|
|
|
|
|
|
|
|
|
|
this.props.updateWidgetMetaProperty("text", formattedValue);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// When the default text changes
|
|
|
|
|
if (
|
|
|
|
|
prevProps.text !== this.props.text &&
|
|
|
|
|
this.props.text === this.props.defaultText
|
|
|
|
|
) {
|
|
|
|
|
const formattedValue = this.getFormattedPhoneNumber(this.props.text);
|
|
|
|
|
|
|
|
|
|
this.props.updateWidgetMetaProperty(
|
|
|
|
|
"value",
|
|
|
|
|
parseIncompletePhoneNumber(formattedValue),
|
|
|
|
|
);
|
|
|
|
|
this.props.updateWidgetMetaProperty("text", formattedValue);
|
2022-03-30 15:15:44 +00:00
|
|
|
}
|
2022-03-01 19:02:10 +00:00
|
|
|
|
2022-03-30 15:15:44 +00:00
|
|
|
// If defaultText property has changed, reset isDirty to false
|
|
|
|
|
if (this.props.defaultText !== prevProps.defaultText) {
|
2022-03-01 19:02:10 +00:00
|
|
|
if (this.props.isDirty) {
|
|
|
|
|
this.props.updateWidgetMetaProperty("isDirty", false);
|
|
|
|
|
}
|
2022-02-11 10:09:38 +00:00
|
|
|
}
|
2022-01-18 07:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onISDCodeChange = (dialCode?: string) => {
|
|
|
|
|
const countryCode = getCountryCode(dialCode);
|
|
|
|
|
|
2022-04-08 17:39:05 +00:00
|
|
|
this.props.updateWidgetMetaProperty("dialCode", dialCode);
|
|
|
|
|
this.props.updateWidgetMetaProperty("countryCode", countryCode);
|
2022-01-18 07:52:24 +00:00
|
|
|
|
2022-02-11 10:09:38 +00:00
|
|
|
if (this.props.value && this.props.allowFormatting) {
|
|
|
|
|
const formattedValue = this.getFormattedPhoneNumber(this.props.value);
|
|
|
|
|
|
|
|
|
|
this.props.updateWidgetMetaProperty("text", formattedValue);
|
2022-01-18 07:52:24 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
onValueChange = (value: string) => {
|
2022-02-11 10:09:38 +00:00
|
|
|
let formattedValue;
|
2022-01-18 07:52:24 +00:00
|
|
|
|
2022-02-11 10:09:38 +00:00
|
|
|
// Don't format, as value is typed, when user is deleting
|
|
|
|
|
if (value && value.length > this.props.text.length) {
|
|
|
|
|
formattedValue = this.getFormattedPhoneNumber(value);
|
2022-01-18 07:52:24 +00:00
|
|
|
} else {
|
2022-02-11 10:09:38 +00:00
|
|
|
formattedValue = value;
|
2022-01-18 07:52:24 +00:00
|
|
|
}
|
|
|
|
|
|
2022-02-11 10:09:38 +00:00
|
|
|
this.props.updateWidgetMetaProperty(
|
|
|
|
|
"value",
|
|
|
|
|
parseIncompletePhoneNumber(formattedValue),
|
|
|
|
|
);
|
|
|
|
|
this.props.updateWidgetMetaProperty("text", formattedValue, {
|
2022-01-18 07:52:24 +00:00
|
|
|
triggerPropertyName: "onTextChanged",
|
|
|
|
|
dynamicString: this.props.onTextChanged,
|
|
|
|
|
event: {
|
|
|
|
|
type: EventType.ON_TEXT_CHANGE,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
if (!this.props.isDirty) {
|
|
|
|
|
this.props.updateWidgetMetaProperty("isDirty", true);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleFocusChange = (focusState: boolean) => {
|
|
|
|
|
super.handleFocusChange(focusState);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
handleKeyDown = (
|
|
|
|
|
e:
|
|
|
|
|
| React.KeyboardEvent<HTMLTextAreaElement>
|
|
|
|
|
| React.KeyboardEvent<HTMLInputElement>,
|
|
|
|
|
) => {
|
|
|
|
|
super.handleKeyDown(e);
|
|
|
|
|
};
|
|
|
|
|
|
2022-03-18 16:48:16 +00:00
|
|
|
resetWidgetText = () => {
|
|
|
|
|
super.resetWidgetText();
|
|
|
|
|
this.props.updateWidgetMetaProperty("value", undefined);
|
|
|
|
|
};
|
|
|
|
|
|
2022-01-18 07:52:24 +00:00
|
|
|
getPageView() {
|
|
|
|
|
const value = this.props.text ?? "";
|
|
|
|
|
const isInvalid =
|
|
|
|
|
"isValid" in this.props && !this.props.isValid && !!this.props.isDirty;
|
|
|
|
|
const countryCode = this.props.countryCode;
|
|
|
|
|
const conditionalProps: Partial<PhoneInputComponentProps> = {};
|
|
|
|
|
conditionalProps.errorMessage = this.props.errorMessage;
|
|
|
|
|
if (this.props.isRequired && value.length === 0) {
|
|
|
|
|
conditionalProps.errorMessage = createMessage(FIELD_REQUIRED_ERROR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<PhoneInputComponent
|
2022-05-04 09:45:57 +00:00
|
|
|
accentColor={this.props.accentColor}
|
2022-01-18 07:52:24 +00:00
|
|
|
allowDialCodeChange={this.props.allowDialCodeChange}
|
|
|
|
|
autoFocus={this.props.autoFocus}
|
2022-05-04 09:45:57 +00:00
|
|
|
borderRadius={this.props.borderRadius}
|
|
|
|
|
boxShadow={this.props.boxShadow}
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
compactMode={
|
|
|
|
|
!(
|
|
|
|
|
(this.props.bottomRow - this.props.topRow) /
|
|
|
|
|
GRID_DENSITY_MIGRATION_V1 >
|
|
|
|
|
1
|
|
|
|
|
)
|
|
|
|
|
}
|
2022-01-18 07:52:24 +00:00
|
|
|
countryCode={countryCode}
|
|
|
|
|
defaultValue={this.props.defaultText}
|
|
|
|
|
dialCode={this.props.dialCode}
|
|
|
|
|
disableNewLineOnPressEnterKey={!!this.props.onSubmit}
|
|
|
|
|
disabled={this.props.isDisabled}
|
|
|
|
|
iconAlign={this.props.iconAlign}
|
|
|
|
|
iconName={this.props.iconName}
|
|
|
|
|
inputType={this.props.inputType}
|
2022-11-23 09:48:23 +00:00
|
|
|
isDynamicHeightEnabled={isAutoHeightEnabledForWidget(this.props)}
|
2022-01-18 07:52:24 +00:00
|
|
|
isInvalid={isInvalid}
|
|
|
|
|
isLoading={this.props.isLoading}
|
|
|
|
|
label={this.props.label}
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
labelAlignment={this.props.labelAlignment}
|
|
|
|
|
labelPosition={this.props.labelPosition}
|
2022-01-18 07:52:24 +00:00
|
|
|
labelStyle={this.props.labelStyle}
|
|
|
|
|
labelTextColor={this.props.labelTextColor}
|
|
|
|
|
labelTextSize={this.props.labelTextSize}
|
feat: Controls for labels in widgets to align the widgets in forms and other places (#10600)
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Create a new property control for a label position
-- Create a new property control for a label alignment
-- Prototype a label section for Input widget
* feat: When there are multiple input widgets with different label lengths then the input box looks misaligned
-- Add a property, labelWidth in the property pane
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Input widget: Implement all the requirements in case its type is Text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adapt the functionalty on other types of the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into DropdownWidget
-- Clean up for the input widget and DRY
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectWidget
-- Eliminate unnecessary component prop, columns
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalties into Tree Select widget
-- Add styles for alignment between lable and input control over the widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add label functionalities into MultiSelectTreeWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Introduce label functionalities into DatePickerWidget2
-- Use width instead of columns prop in InputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RichTextEditorWidget
-- Eliminate compactMode from StyledLabel
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into CheckboxGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement switch group for the correct meaning of right alignment
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply label functionalities into RadioGroupWidget
-- Add new properties, alignment and inline for consistency
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Adjust cols and rows for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused StyledRadioProps
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete first MVP of enhanced SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Complete the first MVP of enhanced RadioGroupWidget
-- Eliminate unused StyledSwitch component for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add min-height, align-self rules for LabelContainer
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Use original label property for RadioGroupWidget
-- Add a migration for adding isInline and alignment properties for RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Update version to latest one in DSLMigrationsUtils.test.ts
* fix failing jest test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement label functionalities on BaseInputWidget, InputWidgetV2, CurrencyInputWidget, PhoneInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DSLMigrationsUtils
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the label related test case which is failed in Input_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on #10119: The label text truncates on resizing the input widget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix scroll issue when shrink with MultiSelectWidget and MultiSelectTreeWidget
* fix: Widget Popup test
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement width and alginment features on the level of label element
-- Prevent actual inputs from DropdownWidget, MultiSelectWidget, SingleSelectTreeWidget, MultiSelectTreeWidget from overflow when resizing
-- Enable label feature on a RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set label container's default width to 33% when width is not set
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix crash issue when labelWidth is filled by non-numeric value, eliminating passing NaN as its value
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set flex-grow to zero on input types other than TEXT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label features on newly created MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate LabelPositionTypes, directly using enum LabelPosition
-- Add a comment for a constant LABEL_MAX_WIDTH_RATE
-- Directly import React for LabelAlignmentOptionsControl
-- Remove unnecessary constructor for LabelAlignmentOptionsControl
-- Define handleAlign instance method as a higher-order function
-- Only migrate alignment property for RadioGroupWidget
-- Use Object.hasOwnProperty instead of in operator
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Migrate alignment property of RadioGroupWidget in case of currentDSL.version is 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Revert currentDSL.version to 52
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a Jest test case for RadioGroupWidget's alignment property migration
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Replace all nested ternary operators with if statements
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Implement label feature on new version of SelectWidget
-- Add Cypress tests for widgets' label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor code for BaseInputWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change CSS selector for step buttons for Numeric BaseInputWidget
-- Directly use migrateRadioGroupAlignmentProperty migration function without using transformDSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on typo about migrateRadioGroupAlignmentProperty
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add data-testid attributes for Cypress selectors
* feat: Deprecate form button widget
-- Assert flex-direction to row in CheckboxGroup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add a missing data-testid for SelectWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on failed test cases: CheckboxGroup_spec, DatePicker_2_spec, MultiSelectWidgetV2
* fix: Select popup DSL
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new property control, NumericInputControl
-- Replace all the label properties with the newly created controls
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Create a new Cypress command, checkLabelWidth and apply to all related test cases
-- Increase width in checkboxgroupDsl.json
-- Rename className for label in MultiSelectWidgetV2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Reimplement the tooltip feature for labels
-- Add missing props for labels in DateField, MultiSelectField, RadioGroupField, SelectField fields for JSONFormWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor property controls, including LabelPositionOptionsControl, LabelAlignmentOptionsControl, NumericInputControl to keep consistency
-- Apply default values into label section
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract the label related parts from the various widgets as an independent component
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate TypeScript any type from BaseInputComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change labelPosition property type to DROP_DOWN
-- Modify LabelAlignmentOptionsControl to use ButtonTabComponent
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Define getLabelWidth method into BaseWidget
-- Extract the common CSS rules for the widget containers
-- Revert rows and columns for SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed test case in DSLMigrationsUtils.test.ts
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on overflow issue on CheckboxGroupWidget
-- Create a distinctive spec file for label feature
-- Eliminate the redundant label specs with the relevant widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Delete unnecessary files, including Select_spec.js, LabelButton.tsx and LabelPositionOptionsControl.tsx
-- Revise wrong comment for checkLabelForWidget Cypress command
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Do not set the label width only if its value is 0
-- Clean up the component for DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused imports in DatePickerWidget2
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Make RadioGroupWidget's layout flexible in all modes
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on Cypress test case for RadioGroupWidget in Widgets_Labels_spec
-- Change Cypress commands, including addAction, addSuccessMessage, enterActionValue to accept parentSelector
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Change getLabelWidth method to not have any argument
-- Define some constants for label numbers
-- Extract the common styles for SwitchGroupWidget and RadioGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Refactor some constants
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate unused width prop from RadioGroupWidget
-- Get labelWidth from getLabelWidth
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Eliminate the min-height restriction on a label
-- Eliminate the scroll on the earlier InputWidgetV2 which was not in compact mode
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add one more condition checking if the current input type is text
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Extract common code base for MultiSelectTreeWidget and MultiSelectWidgetV2
-- Apply a few CSS fixes on the scrollbar issue select related widgets
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Apply some tweaks for earlier widgets with labels so as not to be broken UX
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Fix on the failed Cypress test case in Widget_Popup_spec.js
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Add constants, LABEL_DEFAULT_WIDTH_RATE, SELECT_DEFAULT_HEIGHT, LABEL_MARGIN_OLD_SELECT
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Increase the widths of CheckboxGroupWidget and SwitchGroupWidget
* feat: Controls for labels in widgets to align the widgets in forms and other places
-- Set the font size to 14px for NumericInputControl
Co-authored-by: ohansFavour <fohanekwu@gmail.com>
Co-authored-by: Tolulope Adetula <31691737+Tooluloope@users.noreply.github.com>
2022-04-14 08:47:25 +00:00
|
|
|
labelWidth={this.getLabelWidth()}
|
2022-01-18 07:52:24 +00:00
|
|
|
onFocusChange={this.handleFocusChange}
|
|
|
|
|
onISDCodeChange={this.onISDCodeChange}
|
|
|
|
|
onKeyDown={this.handleKeyDown}
|
|
|
|
|
onValueChange={this.onValueChange}
|
|
|
|
|
placeholder={this.props.placeholderText}
|
|
|
|
|
showError={!!this.props.isFocused}
|
|
|
|
|
tooltip={this.props.tooltip}
|
|
|
|
|
value={value}
|
|
|
|
|
widgetId={this.props.widgetId}
|
|
|
|
|
{...conditionalProps}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static getWidgetType(): WidgetType {
|
|
|
|
|
return "PHONE_INPUT_WIDGET";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export interface PhoneInputWidgetProps extends BaseInputWidgetProps {
|
|
|
|
|
dialCode?: string;
|
|
|
|
|
countryCode?: CountryCode;
|
|
|
|
|
defaultText?: string;
|
|
|
|
|
allowDialCodeChange: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default PhoneInputWidget;
|