MCPcopy Create free account
hub / github.com/eclipsesource/jsonforms / TextCell

Function TextCell

packages/vanilla-renderers/src/cells/TextCell.tsx:37–67  ·  view source on GitHub ↗
(props: CellProps & VanillaRendererProps)

Source from the content-addressed store, hash-verified

35import merge from 'lodash/merge';
36
37export const TextCell = (props: CellProps & VanillaRendererProps) => {
38 const {
39 config,
40 data,
41 className,
42 id,
43 enabled,
44 uischema,
45 schema,
46 path,
47 handleChange,
48 } = props;
49 const maxLength = schema.maxLength;
50 const appliedUiSchemaOptions = merge({}, config, uischema.options);
51 return (
52 <input
53 type={appliedUiSchemaOptions.format === 'password' ? 'password' : 'text'}
54 value={data || ''}
55 onChange={(ev) =>
56 handleChange(path, ev.target.value === '' ? undefined : ev.target.value)
57 }
58 className={className}
59 id={id}
60 disabled={!enabled}
61 autoFocus={appliedUiSchemaOptions.focus}
62 placeholder={appliedUiSchemaOptions.placeholder}
63 maxLength={appliedUiSchemaOptions.restrict ? maxLength : undefined}
64 size={appliedUiSchemaOptions.trim ? maxLength : undefined}
65 />
66 );
67};
68
69/**
70 * Default tester for text-based/string controls.

Callers

nothing calls this directly

Calls 1

handleChangeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…