aurelia-templating-resources
- Version 1.14.3
- Published
- 1.72 MB
- 9 dependencies
- MIT license
Install
npm i aurelia-templating-resources
yarn add aurelia-templating-resources
pnpm add aurelia-templating-resources
Overview
A standard set of behaviors, converters and other resources for use with the Aurelia templating library.
Index
Functions
Classes
Interfaces
Functions
function configure
configure: (config: any) => void;
function createFullOverrideContext
createFullOverrideContext: ( repeat: any, data: any, index: any, length: any, key?: string) => OverrideContext;
Creates a complete override context.
Parameter data
The item's value.
Parameter index
The item's index.
Parameter length
The collections total length.
Parameter key
The key in a key/value pair.
function getItemsSourceExpression
getItemsSourceExpression: (instruction: any, attrName: any) => any;
Gets a repeat instruction's source expression.
function isOneTime
isOneTime: (expression: any) => boolean;
Returns whether an expression has the OneTimeBindingBehavior applied.
function unwrapExpression
unwrapExpression: (expression: any) => any;
Unwraps an expression to expose the inner, pre-converted / behavior-free expression.
function updateOneTimeBinding
updateOneTimeBinding: (binding: any) => void;
Forces a binding instance to reevaluate.
function updateOverrideContext
updateOverrideContext: (overrideContext: any, index: any, length: any) => void;
Updates the override context.
Parameter context
The context to be updated.
Parameter index
The context's index.
Parameter length
The collection's length.
function viewsRequireLifecycle
viewsRequireLifecycle: (viewFactory: any) => any;
Classes
class AbstractRepeater
class AbstractRepeater {}
An abstract base class for elements and attributes that repeat views.
constructor
constructor(options: any);
method addView
addView: (bindingContext: any, overrideContext: any) => any;
Adds a view to the repeater, binding the view to the provided contexts.
Parameter bindingContext
The binding context to bind the new view to.
Parameter overrideContext
A secondary binding context that can override the primary context.
method insertView
insertView: (index: any, bindingContext: any, overrideContext: any) => any;
Inserts a view to the repeater at a specific index, binding the view to the provided contexts.
Parameter index
The index at which to create the new view at.
Parameter bindingContext
The binding context to bind the new view to.
Parameter overrideContext
A secondary binding context that can override the primary context.
method matcher
matcher: () => Function | null;
Returns the matcher function to be used by the repeater, or null if strict matching is to be performed.
The requested matcher function.
method moveView
moveView: (sourceIndex: any, targetIndex: any) => any;
Moves a view across the repeater.
Parameter sourceIndex
The index of the view to be moved.
Parameter sourceIndex
The index where the view should be placed at.
method removeAllViews
removeAllViews: (returnToCache?: boolean, skipAnimation?: boolean) => any;
Removes all views from the repeater.
Parameter returnToCache
Should the view be returned to the view cache?
Parameter skipAnimation
Should the removal animation be skipped? {Promise|null}
method removeView
removeView: ( index: number, returnToCache?: boolean, skipAnimation?: boolean) => any;
Removes a view from the repeater at a specific index.
Parameter index
The index of the view to be removed.
Parameter returnToCache
Should the view be returned to the view cache?
Parameter skipAnimation
Should the removal animation be skipped?
method removeViews
removeViews: ( viewsToRemove: Array<View>, returnToCache?: boolean, skipAnimation?: boolean) => any;
Removes an array of Views from the repeater.
Parameter viewsToRemove
The array of views to be removed.
Parameter returnToCache
Should the view be returned to the view cache?
Parameter skipAnimation
Should the removal animation be skipped?
method updateBindings
updateBindings: (view: View) => void;
Forces a particular view to update it's bindings, called as part of an in-place processing of items for better performance
Parameter view
the target view for bindings updates
method view
view: (index: number) => any;
Returns a single view from the repeater at the provided index.
Parameter index
The index of the requested view. {View|ViewSlot} The requested view.
method viewCount
viewCount: () => number;
Returns the number of views the repeater knows about.
the number of views.
method views
views: () => any[];
Returns all of the repeaters views as an array.
The repeater's array of views;
class ArrayRepeatStrategy
class ArrayRepeatStrategy {}
A strategy for repeating a template over an array.
method getCollectionObserver
getCollectionObserver: (observerLocator: any, items: any) => any;
Gets an observer for the specified collection.
Parameter observerLocator
The observer locator instance.
Parameter items
The items to be observed.
method instanceChanged
instanceChanged: (repeat: any, items: any) => void;
Handle the repeat's collection instance changing.
Parameter repeat
The repeater instance.
Parameter items
The new array instance.
method instanceMutated
instanceMutated: (repeat: any, array: any, splices: any) => void;
Handle the repeat's collection instance mutating.
Parameter repeat
The repeat instance.
Parameter array
The modified array.
Parameter splices
Records of array changes.
class AttrBindingBehavior
class AttrBindingBehavior {}
class BindingSignaler
class BindingSignaler {}
class Compose
class Compose {}
Used to compose a new view / view-model template or bind to an existing instance.
constructor
constructor( element: any, container: any, compositionEngine: any, viewSlot: any, viewResources: any, taskQueue: any);
Creates an instance of Compose.
Parameter element
The Compose element.
Parameter container
The dependency injection container instance.
Parameter compositionEngine
CompositionEngine instance to compose the element.
Parameter viewSlot
The slot the view is injected in to.
Parameter viewResources
Collection of resources used to compile the the view.
Parameter taskQueue
The TaskQueue instance.
property activationStrategy
activationStrategy: ActivationStrategy;
Strategy to activate the view-model. Default is "invoke-lifecycle". Bind "replace" to recreate the view/view-model when the model changes.
activationStrategy {ActivationStrategy}
property model
model: any;
Model to bind the custom element to.
model {CustomElement}
property swapOrder
swapOrder: any;
SwapOrder to control the swapping order of the custom element's view.
view {String}
property view
view: any;
View to bind the custom element to.
view {HtmlElement}
property viewModel
viewModel: any;
View-model to bind the custom element's template to.
viewModel {Class}
method bind
bind: (bindingContext: any, overrideContext: any) => void;
Used to set the bindingContext.
Parameter bindingContext
The context in which the view model is executed in.
Parameter overrideContext
The context in which the view model is executed in.
method created
created: (owningView: View) => void;
Invoked when the component has been created.
Parameter owningView
The view that this component was created inside of.
method modelChanged
modelChanged: (newValue: any, oldValue: any) => void;
Invoked everytime the bound model changes.
Parameter newValue
The new value.
Parameter oldValue
The old value.
method unbind
unbind: () => void;
Unbinds the Compose.
method viewChanged
viewChanged: (newValue: any, oldValue: any) => void;
Invoked everytime the bound view changes.
Parameter newValue
The new value.
Parameter oldValue
The old value.
method viewModelChanged
viewModelChanged: (newValue: any, oldValue: any) => void;
Invoked everytime the bound view model changes.
Parameter newValue
The new value.
Parameter oldValue
The old value.
class DebounceBindingBehavior
class DebounceBindingBehavior {}
class Else
class Else extends IfCore {}
constructor
constructor(viewFactory: any, viewSlot: any);
method bind
bind: (bindingContext: any, overrideContext: any) => void;
class Focus
class Focus {}
CustomAttribute that binds provided DOM element's focus attribute with a property on the viewmodel.
constructor
constructor(element: any, taskQueue: any);
Creates an instance of Focus. Target element on where attribute is placed on.
Parameter taskQueue
The TaskQueue instance.
method attached
attached: () => void;
Invoked when the attribute is attached to the DOM.
method detached
detached: () => void;
Invoked when the attribute is detached from the DOM.
method handleEvent
handleEvent: (e: any) => void;
method valueChanged
valueChanged: () => void;
Invoked everytime the bound value changes.
class FromViewBindingBehavior
class FromViewBindingBehavior {}
constructor
constructor();
property mode
mode: bindingMode;
class Hide
class Hide {}
Binding to conditionally show markup in the DOM based on the value. - different from "if" in that the markup is still added to the DOM, simply not shown.
constructor
constructor(element: any, animator: any, domBoundary: any);
Creates a new instance of Hide.
Parameter element
Target element to conditionally hide.
Parameter animator
The animator that conditionally adds or removes the aurelia-hide css class.
Parameter domBoundary
The DOM boundary. Used when the behavior appears within a component that utilizes the shadow DOM.
method bind
bind: (bindingContext: any) => void;
Binds the Hide attribute.
method created
created: () => void;
Invoked when the behavior is created.
method value
value: (value: any) => void;
method valueChanged
valueChanged: (newValue: any) => void;
Invoked everytime the bound value changes.
Parameter newValue
The new value.
class HTMLSanitizer
class HTMLSanitizer {}
Default Html Sanitizer to prevent script injection.
method sanitize
sanitize: (input: any) => any;
Sanitizes the provided input.
Parameter input
The input to be sanitized.
class If
class If extends IfCore {}
Binding to conditionally include or not include template logic depending on returned result - value should be Boolean or will be treated as such (truthy / falsey)
property cache
cache: string | boolean;
property condition
condition: any;
property swapOrder
swapOrder: 'before' | 'with' | 'after';
method bind
bind: (bindingContext: any, overrideContext: any) => void;
Binds the if to the binding context and override context
Parameter bindingContext
The binding context
Parameter overrideContext
An override context for binding.
method conditionChanged
conditionChanged: (newValue: any) => void;
Invoked everytime value property changes.
Parameter newValue
The new value
class MapRepeatStrategy
class MapRepeatStrategy {}
A strategy for repeating a template over a Map.
method getCollectionObserver
getCollectionObserver: (observerLocator: any, items: any) => any;
Gets a Map observer.
Parameter items
The items to be observed.
method instanceChanged
instanceChanged: (repeat: any, items: any) => void;
Process the provided Map entries.
Parameter items
The entries to process.
method instanceMutated
instanceMutated: (repeat: any, map: any, records: any) => void;
Handle changes in a Map collection.
Parameter map
The underlying Map collection.
Parameter records
The change records.
class NullRepeatStrategy
class NullRepeatStrategy {}
A strategy for repeating a template over null or undefined (does nothing)
method getCollectionObserver
getCollectionObserver: (observerLocator: any, items: any) => void;
method instanceChanged
instanceChanged: (repeat: any, items: any) => void;
class NumberRepeatStrategy
class NumberRepeatStrategy {}
A strategy for repeating a template over a number.
method getCollectionObserver
getCollectionObserver: () => any;
Return the strategies collection observer. In this case none.
method instanceChanged
instanceChanged: (repeat: any, value: any) => void;
Process the provided Number.
Parameter value
The Number of how many time to iterate.
class OneTimeBindingBehavior
class OneTimeBindingBehavior {}
constructor
constructor();
property mode
mode: bindingMode;
class OneWayBindingBehavior
class OneWayBindingBehavior {}
constructor
constructor();
property mode
mode: bindingMode;
class Repeat
class Repeat extends AbstractRepeater {}
Binding to iterate over iterable objects (Array, Map and Number) to genereate a template for each iteration.
constructor
constructor( viewFactory: any, instruction: any, viewSlot: any, viewResources: any, observerLocator: any, strategyLocator: any);
Creates an instance of Repeat.
Parameter viewFactory
The factory generating the view
Parameter instruction
The instructions for how the element should be enhanced.
Parameter viewResources
Collection of resources used to compile the the views.
Parameter viewSlot
The slot the view is injected in to.
Parameter observerLocator
The observer locator instance.
Parameter collectionStrategyLocator
The strategy locator to locate best strategy to iterate the collection.
property items
items: any;
List of items to bind the repeater to.
items
property key
key: any;
Key when iterating over Maps.
key
property local
local: any;
Local variable which gets assigned on each iteration.
local
property useInnerMatcher
static useInnerMatcher: boolean;
Setting this to
true
to enable legacy behavior, where a repeat would take firstmatcher
binding any where inside its view if there's nomatcher
binding on the repeated element itself.Default value is true to avoid breaking change true
property value
value: any;
Value when iterating over Maps.
value
method addView
addView: (bindingContext: any, overrideContext: any) => void;
method bind
bind: (bindingContext: any, overrideContext: any) => void;
Binds the repeat to the binding context and override context.
Parameter bindingContext
The binding context.
Parameter overrideContext
An override context for binding.
method call
call: (context: any, changes: any) => void;
method handleCollectionMutated
handleCollectionMutated: (collection: any, changes: any) => void;
Invoked when the underlying collection changes.
method handleInnerCollectionMutated
handleInnerCollectionMutated: (collection: any, changes: any) => void;
Invoked when the underlying inner collection changes.
method insertView
insertView: (index: any, bindingContext: any, overrideContext: any) => void;
method itemsChanged
itemsChanged: () => void;
Invoked everytime the item property changes.
method matcher
matcher: () => any;
method moveView
moveView: (sourceIndex: any, targetIndex: any) => void;
method removeAllViews
removeAllViews: (returnToCache: any, skipAnimation: any) => any;
method removeView
removeView: (index: any, returnToCache: any, skipAnimation: any) => any;
method removeViews
removeViews: (viewsToRemove: any, returnToCache: any, skipAnimation: any) => any;
method unbind
unbind: () => void;
Unbinds the repeat
method updateBindings
updateBindings: (view: View) => void;
method view
view: (index: any) => any;
method viewCount
viewCount: () => any;
method views
views: () => any;
class RepeatStrategyLocator
class RepeatStrategyLocator {}
Locates the best strategy to best repeating a template over different types of collections. Custom strategies can be plugged in as well.
constructor
constructor();
Creates a new RepeatStrategyLocator.
method addStrategy
addStrategy: ( matcher: (items: any) => boolean, strategy: RepeatStrategy) => void;
Adds a repeat strategy to be located when repeating a template over different collection types.
Parameter strategy
A repeat strategy that can iterate a specific collection type.
method getStrategy
getStrategy: (items: any) => RepeatStrategy;
Gets the best strategy to handle iteration.
class Replaceable
class Replaceable {}
Marks any part of a view to be replacable by the consumer.
constructor
constructor(viewFactory: ViewFactory, viewSlot: ViewSlot);
Parameter viewFactory
target The factory generating the view.
Parameter viewSlot
viewSlot The slot the view is injected in to.
method bind
bind: (bindingContext: any, overrideContext: any) => void;
Binds the replaceable to the binding context and override context.
Parameter bindingContext
The binding context.
Parameter overrideContext
An override context for binding.
method unbind
unbind: () => void;
Unbinds the replaceable.
class SanitizeHTMLValueConverter
class SanitizeHTMLValueConverter {}
Simple html sanitization converter to preserve whitelisted elements and attributes on a bound property containing html.
constructor
constructor(sanitizer: HTMLSanitizer);
Creates an instanse of the value converter.
Parameter sanitizer
The html sanitizer.
method toView
toView: (untrustedMarkup: any) => any;
Process the provided markup that flows to the view.
Parameter untrustedMarkup
The untrusted markup to be sanitized.
class SelfBindingBehavior
class SelfBindingBehavior {}
class SetRepeatStrategy
class SetRepeatStrategy {}
A strategy for repeating a template over a Set.
method getCollectionObserver
getCollectionObserver: (observerLocator: any, items: any) => any;
Gets a Set observer.
Parameter items
The items to be observed.
method instanceChanged
instanceChanged: (repeat: any, items: any) => void;
Process the provided Set entries.
Parameter items
The entries to process.
method instanceMutated
instanceMutated: (repeat: any, set: any, records: any) => void;
Handle changes in a Set collection.
Parameter repeat
The repeat instance.
Parameter set
The underlying Set collection.
Parameter records
The change records.
class Show
class Show {}
Binding to conditionally show markup in the DOM based on the value. - different from "if" in that the markup is still added to the DOM, simply not shown.
constructor
constructor(element: any, animator: any, domBoundary: any);
Creates a new instance of Show.
Parameter element
Target element to conditionally show.
Parameter animator
The animator that conditionally adds or removes the aurelia-hide css class.
Parameter domBoundary
The DOM boundary. Used when the behavior appears within a component that utilizes the shadow DOM.
property value
value: any;
method bind
bind: (bindingContext: any) => void;
Binds the Show attribute.
method created
created: () => void;
Invoked when the behavior is created.
method valueChanged
valueChanged: (newValue: any) => void;
Invoked everytime the bound value changes.
Parameter newValue
The new value.
class SignalBindingBehavior
class SignalBindingBehavior {}
constructor
constructor(bindingSignaler: any);
property signals
signals: any;
method bind
bind: (binding: any, source: any, ...names: any[]) => void;
method unbind
unbind: (binding: any, source: any) => void;
class ThrottleBindingBehavior
class ThrottleBindingBehavior {}
class ToViewBindingBehavior
class ToViewBindingBehavior {}
constructor
constructor();
property mode
mode: bindingMode;
class TwoWayBindingBehavior
class TwoWayBindingBehavior {}
constructor
constructor();
property mode
mode: bindingMode;
class UpdateTriggerBindingBehavior
class UpdateTriggerBindingBehavior {}
class With
class With {}
Creates a binding context for decandant elements to bind to.
constructor
constructor(viewFactory: ViewFactory, viewSlot: ViewSlot);
Creates an instance of With.
Parameter viewFactory
The factory generating the view.
Parameter viewSlot
The slot the view is injected in to.
property value
value: any;
method bind
bind: (bindingContext: any, overrideContext: any) => void;
Binds the With with provided binding context and override context.
Parameter bindingContext
The binding context.
Parameter overrideContext
An override context for binding.
method unbind
unbind: () => void;
Unbinds With
method valueChanged
valueChanged: (newValue: any) => void;
Invoked everytime the bound value changes.
Parameter newValue
The new value.
Interfaces
interface RepeatStrategy
interface RepeatStrategy {}
A strategy is for repeating a template over an iterable or iterable-like object.
method getCollectionObserver
getCollectionObserver: (observerLocator: any, items: any) => any;
method instanceChanged
instanceChanged: (repeat: Repeat, items: any) => void;
method instanceMutated
instanceMutated: (repeat: Repeat, items: any, changes: any) => void;
Package Files (1)
Dependencies (9)
Dev Dependencies (29)
- @rollup/plugin-typescript
- @types/estree
- @types/jasmine
- @typescript-eslint/eslint-plugin
- @typescript-eslint/parser
- aurelia-bootstrapper
- aurelia-framework
- aurelia-testing
- aurelia-webpack-plugin
- dts-bundle-generator
- eslint
- html-loader
- jasmine-core
- karma
- karma-chrome-launcher
- karma-coverage
- karma-jasmine
- karma-mocha-reporter
- karma-sourcemap-loader
- karma-webpack
- rimraf
- rollup
- standard-version
- ts-loader
- tslib
- typedoc
- typescript
- webpack
- webpack-cli
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/aurelia-templating-resources
.
- Markdown[](https://www.jsdocs.io/package/aurelia-templating-resources)
- HTML<a href="https://www.jsdocs.io/package/aurelia-templating-resources"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 4114 ms. - Missing or incorrect documentation? Open an issue for this package.