Skip to content

Commit

Permalink
feat(core): Add code type for inputFields (#439)
Browse files Browse the repository at this point in the history
* Add code inputfield type and some docs

* remove newlines
  • Loading branch information
xavdid authored Oct 28, 2021
1 parent 161eb87 commit 208e0a6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/schema/docs/build/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -920,7 +920,7 @@ Key | Required | Type | Description
`key` | **yes** | `string` | A unique machine readable key for this value (IE: "fname").
`label` | no | `string` | A human readable label for this value (IE: "First Name").
`helpText` | no | `string` | A human readable description of this value (IE: "The first part of a full name."). You can use Markdown.
`type` | no | `string` in (`'string'`, `'text'`, `'integer'`, `'number'`, `'boolean'`, `'datetime'`, `'file'`, `'password'`, `'copy'`) | The type of this value.
`type` | no | `string` in (`'string'`, `'text'`, `'integer'`, `'number'`, `'boolean'`, `'datetime'`, `'file'`, `'password'`, `'copy'`, `'code'`) | The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.
`required` | no | `boolean` | If this value is required or not.
`placeholder` | no | `string` | An example value that is not saved.
`default` | no | `string` | A default value that is saved the first time a Zap is created.
Expand Down
5 changes: 3 additions & 2 deletions packages/schema/exported-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
"maxLength": 1000
},
"type": {
"description": "The type of this value.",
"description": "The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.",
"type": "string",
"enum": [
"string",
Expand All @@ -175,7 +175,8 @@
"datetime",
"file",
"password",
"copy"
"copy",
"code"
]
},
"required": {
Expand Down
9 changes: 5 additions & 4 deletions packages/schema/lib/schemas/FieldSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ const { INCOMPATIBLE_FIELD_SCHEMA_KEYS } = require('../constants');
// ... etc
const wrapInBackticks = (s) => `\`${s}\``;
const formatBullet = (f) => `* ${f.map(wrapInBackticks).join(' & ')}`;
const incompatibleFieldsList = INCOMPATIBLE_FIELD_SCHEMA_KEYS.map(
formatBullet
).join('\n');
const incompatibleFieldsList =
INCOMPATIBLE_FIELD_SCHEMA_KEYS.map(formatBullet).join('\n');

module.exports = makeSchema(
{
Expand Down Expand Up @@ -45,7 +44,8 @@ module.exports = makeSchema(
maxLength: 1000,
},
type: {
description: 'The type of this value.',
description:
'The type of this value. Use `string` for basic text input, `text` for a large, `<textarea>` style box, and `code` for a `<textarea>` with a fixed-width font.',
type: 'string',
// string == unicode
// text == a long textarea string
Expand All @@ -61,6 +61,7 @@ module.exports = makeSchema(
'file',
'password',
'copy',
'code',
],
},
required: {
Expand Down

0 comments on commit 208e0a6

Please sign in to comment.