Skip to content

Commit

Permalink
Merge pull request #54 from phillipivan/master
Browse files Browse the repository at this point in the history
v2.6.2
  • Loading branch information
phillipivan authored Jan 24, 2025
2 parents 95e757c + 61cc161 commit ce90865
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generic-emberplus",
"version": "2.6.1",
"version": "2.6.2",
"main": "dist/index.js",
"scripts": {
"prepare": "husky",
Expand Down
36 changes: 28 additions & 8 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ const relative: CompanionInputFieldCheckbox = {
label: 'Relative',
id: 'relative',
default: false,
tooltip: 'Adjust value by this amount',
tooltip: 'Adjust value by this amount. Variable will be auto-created.',
}

const createVariable: CompanionInputFieldCheckbox = {
type: 'checkbox',
label: 'Auto Create Variable',
id: 'variable',
default: false,
tooltip: 'Will not pickup variable change in path field',
}

const useVariable: CompanionInputFieldCheckbox = {
Expand Down Expand Up @@ -145,7 +144,7 @@ const setValue =
) =>
async (action: CompanionActionEvent, context: CompanionActionContext): Promise<void> => {
const path = await resolvePath(context, action.options['path']?.toString() ?? '')
if (action.options.variable) {
if (action.options.variable || action.options.toggle || action.options.relative) {
await self.registerNewParameter(path)
}
await queue
Expand Down Expand Up @@ -272,7 +271,7 @@ const setValue =
const registerParameter =
(self: EmberPlusInstance) =>
async (action: CompanionActionInfo, context: CompanionActionContext): Promise<void> => {
if (action.options.variable) {
if (action.options.variable || action.options.toggle || action.options.relative) {
await self.registerNewParameter(await resolvePath(context, action.options['path']?.toString() ?? ''))
}
}
Expand Down Expand Up @@ -504,7 +503,12 @@ export function GetActionsList(
},
},
useVariable,
createVariable,
{
...createVariable,
isVisible: (options) => {
return !options.relative
},
},
relative,
{
...minLimit,
Expand Down Expand Up @@ -550,7 +554,12 @@ export function GetActionsList(
},
},
useVariable,
createVariable,
{
...createVariable,
isVisible: (options) => {
return !options.relative
},
},
relative,
{
...minLimit,
Expand All @@ -577,6 +586,7 @@ export function GetActionsList(
label: 'Toggle',
id: 'toggle',
default: false,
tooltip: 'Variable will be auto-created.',
},
{
type: 'checkbox',
Expand All @@ -603,7 +613,12 @@ export function GetActionsList(
return !options.toggle
},
},
createVariable,
{
...createVariable,
isVisible: (options) => {
return !options.toggle
},
},
],
callback: setValue(self, emberClient, EmberModel.ParameterType.Boolean, state, queue),
subscribe: async (action, context) => {
Expand Down Expand Up @@ -642,7 +657,12 @@ export function GetActionsList(
},
},
useVariable,
createVariable,
{
...createVariable,
isVisible: (options) => {
return !options.relative
},
},
relative,
{
...minLimit,
Expand Down

0 comments on commit ce90865

Please sign in to comment.