Skip to content

Instantly share code, notes, and snippets.

@bcameron1231
Created August 23, 2019 04:16
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save bcameron1231/8b16ad064fcf0a8213f5e788381fbc28 to your computer and use it in GitHub Desktop.
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "CustomFormatter JSON",
"description": "CustomFormatter renderer for SharePoint lists",
"definitions": {
"customAction": {
"type": "object",
"additionalProperties": false,
"title": "Action object",
"description": "Action object for a custom action button",
"properties": {
"action": {
"description": "Name of the action that the custom action button will execute",
"enum": [
"defaultClick",
"executeFlow",
"share",
"delete",
"editProps"
]
},
"actionParams": {
"description": "Parameters for the custom action",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
}
}
},
"expression": {
"type": "object",
"additionalProperties": false,
"title": "Expression object JSON",
"description": "Expression object for CustomFormatter JSON",
"properties": {
"operator": {
"description": "Operator for this expression",
"enum": [
"+",
"-",
"*",
"/",
"%",
"==",
"!=",
">",
"<",
">=",
"<=",
"||",
"&&",
"?",
":",
"toString()",
"Number()",
"Date()",
"cos",
"sin",
"abs",
"floor",
"ceiling",
"pow",
"substring",
"getDate",
"getMonth",
"getYear",
"length",
"join",
"loopIndex",
"toLowerCase",
"indexOf",
"toDateString()",
"toLocaleString()",
"toLocaleDateString()",
"toLocaleTimeString()"
]
},
"operands": {
"description": "Operands for this expression",
"type": "array",
"items": {
"anyOf": [
{
"type": "string"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "object",
"$ref": "#/definitions/expression"
}
]
}
}
},
"required": [
"operator",
"operands"
]
},
"elm": {
"type": "object",
"additionalProperties": false,
"properties": {
"$schema": {
"description": "schema of the JSON",
"type": "string"
},
"debugMode": {
"description": "Is this JSON in debug mode?",
"type": "boolean"
},
"elmType": {
"description": "The type of element to create",
"enum": [
"div",
"button",
"span",
"a",
"img",
"svg",
"path"
]
},
"children": {
"description": "Children elements",
"type": "array",
"items": {
"type": "object",
"$ref": "#/definitions/elm"
}
},
"txtContent": {
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"style": {
"description": "Specifies the style object for this element",
"patternProperties": {
"^[a-z]+(?:-[a-z]+)?$": {
"description": "Specifies style attributes for this element",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
}
}
},
"customRowAction": {
"anyOf": [
{
"$ref": "#/definitions/customAction"
}
]
},
"attributes": {
"type": "object",
"description": "Additional attributes to be added to elmType",
"properties": {
"href": {
"description": "Specifies the href attribute",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"src": {
"description": "Specifies the src attribute",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"class": {
"description": "Specifies the class attribute",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"target": {
"description": "Specifies the target attribute, used primarily for <a> element types.",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"role": {
"description": "Specifies the role attribute, used accessibility.",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"iconName": {
"description": "Specifies the Fabric icon to display before this element",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"d": {
"description": "Specifies the d attribute. Used primarily for svg path elements",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"title": {
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"alt": {
"description": "Specifies the alt attribute",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
},
"dangerouslySetInnerHTML":{
"description": "Specifies the dangerously attribute",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
}
},
"patternProperties": {
"^aria\\-[a-z]+$": {
"description": "Specifies aria- attributes for the element",
"anyOf": [
{
"$ref": "#/definitions/expression"
},
{
"type": "string"
}
]
}
},
"additionalProperties": false
},
"forEach": {
"type": "string",
"description": "For loop properties. The element will be rendered repeatedly based on an array.",
"pattern": "^[^\\]\\$@\\. ]+ in (\\@currentField|\\[\\$.+\\])$"
}
},
"required": [
"elmType"
]
}
},
"$ref": "#/definitions/elm"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment