mirror of
https://github.com/google/blockly.git
synced 2026-01-06 16:40:07 +01:00
chore: add validator and field value types (#6603)
* chore: add validator and field value types * chore/clean up unused default and unnecessary field type setting * chore: removed IRegisterableField and updated various Field instances * fix: remove unused field image validator function * chore: added pass-through constructor to field_textinput
This commit is contained in:
committed by
GitHub
parent
0532b5d1c0
commit
79f620647f
@@ -16,17 +16,18 @@ goog.declareModuleId('Blockly.FieldCheckbox');
|
||||
import './events/events_block_change.js';
|
||||
|
||||
import * as dom from './utils/dom.js';
|
||||
import {FieldConfig, Field} from './field.js';
|
||||
import {Field, FieldConfig, FieldValidator} from './field.js';
|
||||
import * as fieldRegistry from './field_registry.js';
|
||||
import type {Sentinel} from './utils/sentinel.js';
|
||||
|
||||
export type FieldCheckboxValidator = FieldValidator<boolean>;
|
||||
|
||||
/**
|
||||
* Class for a checkbox field.
|
||||
*
|
||||
* @alias Blockly.FieldCheckbox
|
||||
*/
|
||||
export class FieldCheckbox extends Field {
|
||||
export class FieldCheckbox extends Field<boolean> {
|
||||
/** Default character for the checkmark. */
|
||||
static readonly CHECK_CHAR = '✓';
|
||||
private checkChar_: string;
|
||||
@@ -58,7 +59,8 @@ export class FieldCheckbox extends Field {
|
||||
* for a list of properties this parameter supports.
|
||||
*/
|
||||
constructor(
|
||||
opt_value?: string|boolean|Sentinel, opt_validator?: Function,
|
||||
opt_value?: string|boolean|Sentinel,
|
||||
opt_validator?: FieldCheckboxValidator,
|
||||
opt_config?: FieldCheckboxConfig) {
|
||||
super(Field.SKIP_SETUP);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user