diff --git a/src/actions.ts b/src/actions.ts index a1c3489..653e293 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -17,6 +17,11 @@ import ChooseFromMenu from "~/actions/choose-from-menu"; import Math from "~/actions/math"; import Stop from "~/actions/stop"; import Wait from "~/actions/wait"; +import ChooseFromList from "~/actions/choose-from-list"; +import CombineText from "~/actions/combine-text"; +import AskForInput from "~/actions/ask-for-input"; +import SplitText from "~/actions/split-text"; +import GetFromList from "~/actions/get-from-list"; interface ActionDefinitions { [key: string]: ActionDefinition @@ -37,6 +42,10 @@ interface ActionParameterMap { export let actions: ActionDefinitions = { 'gettext': Text, + 'ask': AskForInput, + 'text.combine': CombineText, + 'text.split': SplitText, + 'getitemfromlist': GetFromList, 'comment': Comment, 'setvariable': SetVariable, 'appendvariable': AddToVariable, @@ -49,6 +58,7 @@ export let actions: ActionDefinitions = { 'date': Date, 'count': Count, 'choosefrommenu': ChooseFromMenu, + 'choosefromlist': ChooseFromList, 'conditional': IfElse, 'repeat.count': Repeat, 'repeat.each': RepeatWithEach, diff --git a/src/actions/ask-for-input.ts b/src/actions/ask-for-input.ts new file mode 100644 index 0000000..4225d49 --- /dev/null +++ b/src/actions/ask-for-input.ts @@ -0,0 +1,28 @@ +import {renderActionHeader, renderParameters} from "~/render"; +import {actions, actionText} from "~/actions"; +import {renderValue} from "~/value"; + +interface AskForInputParameters { + WFInputType: string, + WFAskActionPrompt: boolean, + WFAskActionDefaultAnswer: string, + WFAskActionDefaultAnswerNumber: string, +} + +export default { + title: "Ask for", + icon: "plus_bubble_fill", + background: '#55bef0', + render: (container: HTMLElement, params: AskForInputParameters) => { + const action = renderActionHeader(actions['ask'], + renderValue(params['WFInputType'], 'Input Type'), + actionText("with"), + renderValue(params['WFAskActionPrompt'], 'Informational message') + ); + action.appendChild(renderParameters(actions['ask'], { + 'Default Answer': params['WFAskActionDefaultAnswer'] ?? params['WFAskActionDefaultAnswerNumber'], + })); + + return action; + } +} \ No newline at end of file diff --git a/src/actions/choose-from-list.ts b/src/actions/choose-from-list.ts new file mode 100644 index 0000000..3b96e43 --- /dev/null +++ b/src/actions/choose-from-list.ts @@ -0,0 +1,26 @@ +import {renderActionHeader, renderParameters} from "~/render"; +import {actions} from "~/actions"; +import {renderValue} from "~/value"; + +interface ChooseFromListParamteers { + WFInput: string, + WFChooseFromListActionPrompt: string, + WFChooseFromListActionSelectMultiple: boolean, + WFChooseFromListActionSelectAll: boolean, +} + +export default { + title: "Choose from", + icon: "square_list_fill", + background: '#55bef0', + render: (container: HTMLElement, params: ChooseFromListParamteers) => { + const action = renderActionHeader(actions['choosefromlist'], renderValue(params['WFInput'], 'Informational message')); + action.appendChild(renderParameters(actions['choosefromlist'], { + 'Prompt': params['WFChooseFromListActionPrompt'], + 'Select Multiple': params['WFChooseFromListActionSelectMultiple'] ?? true, + 'Select All Initially': params['WFChooseFromListActionSelectMultiple'] ?? true + })); + + return action; + } +} \ No newline at end of file diff --git a/src/actions/combine-text.ts b/src/actions/combine-text.ts new file mode 100644 index 0000000..2ff1977 --- /dev/null +++ b/src/actions/combine-text.ts @@ -0,0 +1,24 @@ +import {renderActionHeader} from "~/render"; +import {actions, actionText} from "~/actions"; +import {renderValue} from "~/value"; + +interface CombineTextParameters { + text: string + WFTextSeparator: string + WFTextCustomSeparator: string +} + +export default { + title: 'Combine', + color: 'white', + background: '#ffc200', + icon: 'icon-text_alignleft', + render: (container: HTMLElement, params: CombineTextParameters) => { + return renderActionHeader(actions['text.combine'], + renderValue(params['text'], 'Text List'), + actionText('with'), + renderValue(params['WFTextSeparator'] ?? null, 'Separator'), + renderValue(params['WFTextCustomSeparator'] ?? null, 'CustomSeparator'), + ); + } +} diff --git a/src/actions/get-from-list.ts b/src/actions/get-from-list.ts new file mode 100644 index 0000000..aaa3532 --- /dev/null +++ b/src/actions/get-from-list.ts @@ -0,0 +1,23 @@ +import {renderActionHeader} from "~/render"; +import {actions, actionText} from "~/actions"; +import {renderValue} from "~/value"; + +interface GetFromListParameters { + WFInput: string | object, + WFItemSpecifier: string +} + + +export default { + title: 'Get', + color: 'white', + background: '#fc880f', + icon: 'list_bullet', + render: (container: HTMLElement, params: GetFromListParameters) => { + return renderActionHeader(actions['getitemfromlist'], + renderValue(params['WFItemSpecifier'], 'Item Specifier'), + actionText('from'), + renderValue(params['WFInput'] ?? null, 'Input'), + ); + } +} diff --git a/src/actions/split-text.ts b/src/actions/split-text.ts new file mode 100644 index 0000000..ff7124b --- /dev/null +++ b/src/actions/split-text.ts @@ -0,0 +1,24 @@ +import {renderActionHeader} from "~/render"; +import {actions, actionText} from "~/actions"; +import {renderValue} from "~/value"; + +interface SplitTextParameters { + text: string + WFTextSeparator: string + WFTextCustomSeparator: string +} + +export default { + title: 'Split', + color: 'white', + background: '#ffc200', + icon: 'icon-text_alignleft', + render: (container: HTMLElement, params: SplitTextParameters) => { + return renderActionHeader(actions['text.split'], + renderValue(params['text'], 'Text List'), + actionText('by'), + renderValue(params['WFTextSeparator'] ?? null, 'Separator'), + renderValue(params['WFTextCustomSeparator'] ?? null, 'Custom Separator'), + ); + } +}