mirror of
https://github.com/google/blockly.git
synced 2026-01-06 16:40:07 +01:00
fix: export Field-related types from Blockly (#6877)
* chore: re-exported Field config types from Blockly * mark `@internal` types, export field error, and add validator comments
This commit is contained in:
committed by
GitHub
parent
3a7ac3be1b
commit
9e5bfc243e
@@ -18,8 +18,6 @@ import {FieldInput, FieldInputConfig, FieldInputValidator} from './field_input.j
|
||||
import * as aria from './utils/aria.js';
|
||||
import type {Sentinel} from './utils/sentinel.js';
|
||||
|
||||
export type FieldNumberValidator = FieldInputValidator<number>;
|
||||
|
||||
/**
|
||||
* Class for an editable number field.
|
||||
*/
|
||||
@@ -342,3 +340,20 @@ export interface FieldNumberConfig extends FieldInputConfig {
|
||||
export interface FieldNumberFromJsonConfig extends FieldNumberConfig {
|
||||
value?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* A function that is called to validate changes to the field's value before
|
||||
* they are set.
|
||||
*
|
||||
* @see {@link https://developers.google.com/blockly/guides/create-custom-blocks/fields/validators#return_values}
|
||||
* @param newValue The value to be validated.
|
||||
* @returns One of three instructions for setting the new value: `T`, `null`,
|
||||
* or `undefined`.
|
||||
*
|
||||
* - `T` to set this function's returned value instead of `newValue`.
|
||||
*
|
||||
* - `null` to invoke `doValueInvalid_` and not set a value.
|
||||
*
|
||||
* - `undefined` to set `newValue` as is.
|
||||
*/
|
||||
export type FieldNumberValidator = FieldInputValidator<number>;
|
||||
|
||||
Reference in New Issue
Block a user