Merge branch 'feature/lightning-menu' of gitlab.com:theappsmith/internal-tools-client into feature/lightning-menu
This commit is contained in:
commit
3ef6edf282
|
|
@ -532,10 +532,12 @@ class DynamicAutocompleteInput extends Component<Props, State> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
updatePropertyValue(value: string, cursor: number) {
|
updatePropertyValue(value: string, cursor?: number) {
|
||||||
this.editor.setValue(value);
|
this.editor.setValue(value);
|
||||||
this.editor.focus();
|
this.editor.focus();
|
||||||
console.log(value, cursor);
|
if (cursor === undefined) {
|
||||||
|
cursor = value.length - 2;
|
||||||
|
}
|
||||||
this.editor.setCursor({
|
this.editor.setCursor({
|
||||||
line: 0,
|
line: 0,
|
||||||
ch: cursor,
|
ch: cursor,
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ import { mergeWith } from "lodash";
|
||||||
const getApiOptions = (
|
const getApiOptions = (
|
||||||
themeType: string,
|
themeType: string,
|
||||||
apis: RestAction[],
|
apis: RestAction[],
|
||||||
updatePropertyValue: (value: string, cursor: number) => void,
|
updatePropertyValue: (value: string, cursor?: number) => void,
|
||||||
) => ({
|
) => ({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
|
|
@ -26,6 +26,7 @@ const getApiOptions = (
|
||||||
icon="plus"
|
icon="plus"
|
||||||
iconAlignment="left"
|
iconAlignment="left"
|
||||||
themeType={themeType}
|
themeType={themeType}
|
||||||
|
type="button"
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
@ -35,8 +36,7 @@ const getApiOptions = (
|
||||||
options: apis.map(api => ({
|
options: apis.map(api => ({
|
||||||
content: api.name,
|
content: api.name,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
const value = `{{${api.name}.data}}`;
|
updatePropertyValue(`{{${api.name}.data}}`);
|
||||||
updatePropertyValue(value, value.length + 1);
|
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
|
@ -52,7 +52,7 @@ const getApiOptions = (
|
||||||
const getQueryOptions = (
|
const getQueryOptions = (
|
||||||
themeType: string,
|
themeType: string,
|
||||||
queries: RestAction[],
|
queries: RestAction[],
|
||||||
updatePropertyValue: (value: string, cursor: number) => void,
|
updatePropertyValue: (value: string, cursor?: number) => void,
|
||||||
) => ({
|
) => ({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
|
|
@ -65,6 +65,7 @@ const getQueryOptions = (
|
||||||
icon="plus"
|
icon="plus"
|
||||||
iconAlignment="left"
|
iconAlignment="left"
|
||||||
themeType={themeType}
|
themeType={themeType}
|
||||||
|
type="button"
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
@ -74,8 +75,7 @@ const getQueryOptions = (
|
||||||
options: queries.map(query => ({
|
options: queries.map(query => ({
|
||||||
content: query.name,
|
content: query.name,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
const value = `{{${query.name}.data}}`;
|
updatePropertyValue(`{{${query.name}.data}}`);
|
||||||
updatePropertyValue(value, value.length + 1);
|
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
|
@ -91,7 +91,7 @@ const getQueryOptions = (
|
||||||
const getWidgetOptions = (
|
const getWidgetOptions = (
|
||||||
themeType: string,
|
themeType: string,
|
||||||
widgets: WidgetProps[],
|
widgets: WidgetProps[],
|
||||||
updatePropertyValue: (value: string, cursor: number) => void,
|
updatePropertyValue: (value: string, cursor?: number) => void,
|
||||||
) => ({
|
) => ({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
|
|
@ -117,15 +117,14 @@ const getWidgetOptions = (
|
||||||
const getWidgetData = (
|
const getWidgetData = (
|
||||||
themeType: string,
|
themeType: string,
|
||||||
widget: WidgetProps,
|
widget: WidgetProps,
|
||||||
updatePropertyValue: (value: string, cursor: number) => void,
|
updatePropertyValue: (value: string, cursor?: number) => void,
|
||||||
) => ({
|
) => ({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
options: Object.keys(widget).map(widgetProp => ({
|
options: Object.keys(widget).map(widgetProp => ({
|
||||||
content: widgetProp,
|
content: widgetProp,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
const value = `{{${widget.widgetName}.${widgetProp}}}`;
|
updatePropertyValue(`{{${widget.widgetName}.${widgetProp}}}`);
|
||||||
updatePropertyValue(value, value.length);
|
|
||||||
},
|
},
|
||||||
})),
|
})),
|
||||||
},
|
},
|
||||||
|
|
@ -143,7 +142,7 @@ const lightningMenuOptions = (
|
||||||
apis: RestAction[],
|
apis: RestAction[],
|
||||||
queries: RestAction[],
|
queries: RestAction[],
|
||||||
widgets: WidgetProps[],
|
widgets: WidgetProps[],
|
||||||
updatePropertyValue: (value: string, cursor: number) => void,
|
updatePropertyValue: (value: string, cursor?: number) => void,
|
||||||
): CustomizedDropdownProps => ({
|
): CustomizedDropdownProps => ({
|
||||||
sections: [
|
sections: [
|
||||||
{
|
{
|
||||||
|
|
@ -153,7 +152,7 @@ const lightningMenuOptions = (
|
||||||
disabled: false,
|
disabled: false,
|
||||||
shouldCloseDropdown: true,
|
shouldCloseDropdown: true,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
updatePropertyValue("", 0);
|
updatePropertyValue("");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -188,7 +187,7 @@ const lightningMenuOptions = (
|
||||||
disabled: false,
|
disabled: false,
|
||||||
shouldCloseDropdown: true,
|
shouldCloseDropdown: true,
|
||||||
onSelect: () => {
|
onSelect: () => {
|
||||||
updatePropertyValue("{{}}", 2);
|
updatePropertyValue("{{}}");
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -212,7 +211,7 @@ const lightningMenuOptions = (
|
||||||
|
|
||||||
type LightningMenuProps = {
|
type LightningMenuProps = {
|
||||||
onSelect?: (value: string) => void;
|
onSelect?: (value: string) => void;
|
||||||
updatePropertyValue: (value: string, cursor: number) => void;
|
updatePropertyValue: (value: string, cursor?: number) => void;
|
||||||
themeType: string;
|
themeType: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user