* Scaffolding for undo-redo * undo redo working Poc commit * memory performance improvements by diffing * dont run update on undo/redo" * merging widget postion update and canvas bottom row update into one dsl update. * fix tabs widget * Visible updates per undo redo action (#6838) Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> * resize atomic operation * fix switch control state issue * disallow undo/redo for snipping and comment mode * disallow undo/redo for snipping and comment mode * fix color picker issue in undo/redo * add test for replayDSL * option control fix, adding logs * minor position change undo redo updates * add test cases for replayHelpers * property Upade visual change * remove unused code * global hot key jest test for undo redo * Fixing batch updates on property change.. * add tests for toggle control in property pane * unwanted utils. * add tests for text control * add tests for deletion * add tests for dropping a new widget * adding jest test for replayUtils * add move widget tests * add tests for color picker control * add analytics for undo/redo * add analytics for undo/redo * tab addition atomic * cypress tests for propertyPane, toasts and radiowidget optionControl * replayDSL end of redo stack fix * property update changes * menu option control debounce input * color picker empty undo fix * fix cypress tests * widget add/remove atomic * revert alternative approach to handle atomic operations * update replayDSL test * add some comments * addressing review comments * flash color for property pane controls * Fixing adding of tabs widget as well. * code review comments. * merging widget postion update and canvas bottom row update into one dsl update. * fix ordering of tabs property control * meta property update canvas min height. * fixing failed specs. * Fixing entity explorer update on deleting tab from entity explorer. * address review comments and minor property update changes * fixing failing tests * merge conflicts * changes to cater widget api. * fix suggested widget table issue * draggable list for undo redo * fix widget name focus * excluding canvas updates. * fixing codeEditor update on propertySection collapse * fixed failing test case Co-authored-by: Abhinav Jha <abhinav@appsmith.com> Co-authored-by: Rahul R <rahulramesha@Rahuls-MacBook-Pro.local> Co-authored-by: root <root@DESKTOP-9GENCK0.localdomain> Co-authored-by: Ashok Kumar M <35134347+marks0351@users.noreply.github.com> Co-authored-by: Pawan Kumar <pawankumar@Pawans-MacBook-Pro.local>
101 lines
3.2 KiB
TypeScript
101 lines
3.2 KiB
TypeScript
import { getPropertyControlTypes } from "components/propertyControls";
|
|
import {
|
|
ValidationResponse,
|
|
ValidationTypes,
|
|
} from "constants/WidgetValidation";
|
|
import { EvaluationSubstitutionType } from "entities/DataTree/dataTreeFactory";
|
|
import { CodeEditorExpected } from "components/editorComponents/CodeEditor";
|
|
import { UpdateWidgetPropertyPayload } from "actions/controlActions";
|
|
const ControlTypes = getPropertyControlTypes();
|
|
export type ControlType = typeof ControlTypes[keyof typeof ControlTypes];
|
|
|
|
export type PropertyPaneSectionConfig = {
|
|
sectionName: string;
|
|
id?: string;
|
|
children: PropertyPaneConfig[];
|
|
hidden?: (props: any, propertyPath: string) => boolean;
|
|
propertySectionPath?: string;
|
|
};
|
|
|
|
export type PanelConfig = {
|
|
editableTitle: boolean;
|
|
titlePropertyName: string;
|
|
panelIdPropertyName: string;
|
|
children: PropertyPaneConfig[];
|
|
updateHook: (
|
|
props: any,
|
|
propertyPath: string,
|
|
propertyValue: any,
|
|
) => Array<{ propertyPath: string; propertyValue: any }> | undefined;
|
|
};
|
|
|
|
export type PropertyPaneControlConfig = {
|
|
id?: string;
|
|
label: string;
|
|
propertyName: string;
|
|
helpText?: string;
|
|
isJSConvertible?: boolean;
|
|
customJSControl?: string;
|
|
controlType: ControlType;
|
|
validationMessage?: string;
|
|
dataTreePath?: string;
|
|
children?: PropertyPaneConfig[];
|
|
panelConfig?: PanelConfig;
|
|
updateRelatedWidgetProperties?: (
|
|
propertyName: string,
|
|
propertyValue: any,
|
|
props: any,
|
|
) => UpdateWidgetPropertyPayload[];
|
|
updateHook?: (
|
|
props: any,
|
|
propertyName: string,
|
|
propertyValue: any,
|
|
) => Array<{ propertyPath: string; propertyValue: any }> | undefined;
|
|
hidden?: (props: any, propertyPath: string) => boolean;
|
|
isBindProperty: boolean;
|
|
isTriggerProperty: boolean;
|
|
validation?: ValidationConfig;
|
|
useValidationMessage?: boolean;
|
|
additionalAutoComplete?: (
|
|
props: any,
|
|
) => Record<string, Record<string, unknown>>;
|
|
evaluationSubstitutionType?: EvaluationSubstitutionType;
|
|
dependencies?: string[];
|
|
expected?: CodeEditorExpected;
|
|
};
|
|
|
|
type ValidationConfigParams = {
|
|
min?: number; // min allowed for a number
|
|
max?: number; // max allowed for a number
|
|
natural?: boolean; // is a positive integer
|
|
default?: unknown; // default for any type
|
|
unique?: boolean | string[]; // unique in an array (string if a particular path is unique)
|
|
required?: boolean; // required type
|
|
regex?: RegExp; // validator regex for text type
|
|
allowedKeys?: Array<{
|
|
// Allowed keys in an object type
|
|
name: string;
|
|
type: ValidationTypes;
|
|
params?: ValidationConfigParams;
|
|
}>;
|
|
allowedValues?: unknown[]; // Allowed values in a string and array type
|
|
children?: ValidationConfig; // Children configurations in an ARRAY or OBJECT_ARRAY type
|
|
fn?: (
|
|
value: unknown,
|
|
props: any,
|
|
_?: any,
|
|
moment?: any,
|
|
) => ValidationResponse; // Function in a FUNCTION type
|
|
fnString?: string; // AUTO GENERATED, SHOULD NOT BE SET BY WIDGET DEVELOPER
|
|
expected?: CodeEditorExpected; // FUNCTION type expected type and example
|
|
};
|
|
|
|
export type ValidationConfig = {
|
|
type: ValidationTypes;
|
|
params?: ValidationConfigParams;
|
|
};
|
|
|
|
export type PropertyPaneConfig =
|
|
| PropertyPaneSectionConfig
|
|
| PropertyPaneControlConfig;
|