sass-references/angular-material/material/select/select-errors.ts

39 lines
1.3 KiB
TypeScript
Raw Permalink Normal View History

2024-12-06 10:42:08 +08:00
/**
* @license
* Copyright Google LLC All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
// Note that these have been copied over verbatim from
// `material/select` so that we don't have to expose them publicly.
/**
* Returns an exception to be thrown when attempting to change a select's `multiple` option
* after initialization.
* @docs-private
*/
export function getMatSelectDynamicMultipleError(): Error {
return Error('Cannot change `multiple` mode of select after initialization.');
}
/**
* Returns an exception to be thrown when attempting to assign a non-array value to a select
* in `multiple` mode. Note that `undefined` and `null` are still valid values to allow for
* resetting the value.
* @docs-private
*/
export function getMatSelectNonArrayValueError(): Error {
return Error('Value must be an array in multiple-selection mode.');
}
/**
* Returns an exception to be thrown when assigning a non-function value to the comparator
* used to determine if a value corresponds to an option. Note that whether the function
* actually takes two values and returns a boolean is not checked.
*/
export function getMatSelectNonFunctionValueError(): Error {
return Error('`compareWith` must be a function.');
}