3.1.0 • Published 4 months ago

@ti-platform/aide-vue v3.1.0

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

@ti-platform/aide-vue

This package contains utility functions that can be used with Vue to enhance the development of Vue components.

Contents

API Docs

Type Aliases

ReactiveExecuteTasksRet\

ReactiveExecuteTasksRet<T>: {activeWorkers: ComputedRef<number>;completedTasks: ComputedRef<number>;isAllTasksCompleted: ComputedRef<boolean>;results: ComputedRef<T[]>;totalTasks: ComputedRef<number>; }

The return value for the function reactiveExecuteTasks.

Type Parameters

Type ParameterDescription
TThe type of the result.

Type declaration

NameTypeDescription
activeWorkersComputedRef<number>The current active number of workers.
completedTasksComputedRef<number>The current number of completed tasks.
isAllTasksCompletedComputedRef<boolean>True if all the tasks have completed running, false otherwise.
resultsComputedRef<T[]>The array storing the results as it is returned. Note that this can be a sparsed array with missing indexes as it is filled with the results only when it is available. You should check for undefined before using it.
totalTasksComputedRef<number>The total number of tasks that was queued.

Defined in

queue.ts:10


ValueTypes

ValueTypes: string | number | string[] | number[]

Defined in

validators.ts:3

Functions

asComputed()

asComputed<T>(ref): ComputedRef<T>

Shorthand method to simply convert a Ref to a ComputedRef.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
refRef<T, T>The Ref to convert.

Returns

ComputedRef<T>

The ComputedRef that simply returns the value of the given Ref.

Defined in

reactivity.ts:9


asRef()

asRef<T>(value): Ref<T>

Basically remove the "UnwrapSimpleRef" from the inner type so things work better with arrays and objects.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
valueTThe value for the ref.

Returns

Ref<T>

The ref.

Defined in

reactivity.ts:19


injectRefs()

injectRefs<T>(key): ToRefs<NonNullable<T>>

Inject the data from the provided key (we are assuming the data exists) but return the results as refs.

Type Parameters

Type Parameter
T

Parameters

ParameterTypeDescription
keyInjectionKey<T>The key to retrieve the data to inject.

Returns

ToRefs<NonNullable<T>>

Defined in

reactivity.ts:29


isRequiredField()

isRequiredField(invalidMessage): (value) => string | true

Given a field, make sure it is not empty. If it is, return a proper error message. This validator is meant to be used with QForm.

Parameters

ParameterTypeDefault valueDescription
invalidMessagestringDEFAULT_REQUIRED_INVALID_MESSAGEThe message to show when validation failed.

Returns

Function

Parameters
ParameterType
valueValueTypes
Returns

string | true

Defined in

validators.ts:14


isRequiredFieldWhen()

isRequiredFieldWhen(when, invalidMessage): (value) => string | true

Returns a function that before checking to see if a required field is filled out, validate against some other condition.

Parameters

ParameterTypeDefault valueDescription
when() => booleanundefinedFunction to execute to see if the required validation field is necessary. It should return true when the field is required, false otherwise.
invalidMessagestringDEFAULT_REQUIRED_INVALID_MESSAGEThe message to show when validation failed.

Returns

Function

Parameters
ParameterType
valueValueTypes
Returns

string | true

Defined in

validators.ts:26


isUniqueField()

isUniqueField(existingValues, invalidMessage): (value) => string | true

Given a reference to a list of values, check when a value is given that it isn't in the list twice.

Parameters

ParameterTypeDefault valueDescription
existingValuesRef<(string | number)[], (string | number)[]>undefinedA reference to the list of existing values. The list should update when new values are added.
invalidMessagestringDEFAULT_UNIQUE_INVALID_MESSAGEThe message to show when validation failed.

Returns

Function

Parameters
ParameterType
valuestring | number
Returns

string | true

Defined in

validators.ts:38


provideAndReturnRefs()

provideAndReturnRefs<T>(key, data): ToRefs<Reactive<T>>

Provide the given data to child components and return the data as refs.

Type Parameters

Type Parameter
T extends object

Parameters

ParameterTypeDescription
keyInjectionKey<T>The key to store the data as.
dataTThe data to store.

Returns

ToRefs<Reactive<T>>

Defined in

reactivity.ts:41


reactiveExecuteTasks()

reactiveExecuteTasks<T>(tasks, maxNumOfWorkers): ReactiveExecuteTasksRet<T>

Reactive version of @ti-platform/aide#xecuteTasks.

Type Parameters

Type ParameterDescription
TThe type of the result of each task.

Parameters

ParameterTypeDefault valueDescription
tasksreadonly () => Promise<T>[]undefinedThe tasks to run.
maxNumOfWorkersnumber10The maximum number of tasks ot run at once.

Returns

ReactiveExecuteTasksRet<T>

Defined in

queue.ts:45

3.1.0

4 months ago

3.0.1

7 months ago

3.0.0

7 months ago

2.0.9

9 months ago

2.0.10

9 months ago

2.0.8

11 months ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

1.3.1

2 years ago

2.0.2

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.3.0

3 years ago

0.2.4

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago