@tinacms/core
Advanced tools
Comparing version 0.1.0-alpha.5 to 0.1.0-alpha.6
@@ -8,4 +8,4 @@ import * as React from 'react'; | ||
createForm: <S>(options: FormOptions<S>) => Form<S>; | ||
findForm(name: string): Form | null; | ||
removeForm: (name: string) => void; | ||
findForm(id: string): Form | null; | ||
removeForm: (id: string) => void; | ||
all(): Form<any>[]; | ||
@@ -19,2 +19,3 @@ } | ||
validate?(value: any, allValues: any, meta: any, field: Field): string | object | undefined; | ||
parse?: (value: string, name: string) => any; | ||
} |
/// <reference types="react" /> | ||
import { FormApi, Config } from 'final-form'; | ||
export declare class Form<S = any> { | ||
name: string; | ||
id: any; | ||
label: string; | ||
fields: Field[]; | ||
finalForm: FormApi<S>; | ||
actions: any[]; | ||
constructor({ name, fields, actions, ...options }: FormOptions<S>); | ||
constructor({ id, label, fields, actions, ...options }: FormOptions<S>); | ||
subscribe: FormApi<S>['subscribe']; | ||
@@ -14,3 +15,4 @@ submit: FormApi<S>['submit']; | ||
export interface FormOptions<S> extends Config<S> { | ||
name: string; | ||
id: any; | ||
label: string; | ||
fields: Field[]; | ||
@@ -17,0 +19,0 @@ actions?: any[]; |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form"],e):e((t=t||self)["@tinacms/core"]={},t.finalForm)}(this,function(t,s){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var r=(i.prototype.subscribe=function(t){var e=this;return this.__subscribers.push(t),function(){return e.unsubscribe(t)}},i.prototype.unsubscribe=function(t){var e=this.__subscribers.indexOf(t);this.__subscribers.splice(e,1)},i.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},i);function i(){this.__subscribers=[]}var o=(Object.defineProperty(u.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),u);function u(t){var r=this,e=t.name,n=t.fields,i=t.actions,o=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["name","fields","actions"]);this.subscribe=function(t,e){return r.finalForm.subscribe(t,e)},this.submit=function(){return r.finalForm.submit()},this.name=e,this.fields=n,this.finalForm=s.createForm(o),this.actions=i||[]}var f,p=(e(c,f=r),c.prototype.findForm=function(t){return this.__forms[t]},c.prototype.all=function(){var e=this;return Object.keys(this.__forms).map(function(t){return e.__forms[t]})},c);function c(){var r=null!==f&&f.apply(this,arguments)||this;return r.__forms={},r.__fields={},r.createForm=function(t){var e=new o(t);return r.__forms[t.name]=e,r.notifiySubscribers(),e},r.removeForm=function(t){delete r.__forms[t],r.notifiySubscribers()},r}var a=(l.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new b(t)},l.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},l.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},l.prototype.all=function(t){return this.findOrCreateMap(t).all()},l);function l(){this.plugins={}}var _,b=(e(y,_=r),y.prototype.add=function(t){var e=t;e.__type||(e.__type=this.__type),this.__plugins[e.name]=e,this.notifiySubscribers()},y.prototype.all=function(){var e=this;return Object.keys(this.__plugins).map(function(t){return e.__plugins[t]})},y.prototype.find=function(t){return this.__plugins[t]},y.prototype.remove=function(t){var e="string"==typeof t?t:t.name,r=this.__plugins[e];return delete this.__plugins[e],this.notifiySubscribers(),r},y);function y(t){var e=_.call(this)||this;return e.__type=t,e.__plugins={},e}var h=(Object.defineProperty(m.prototype,"fields",{get:function(){return this.plugins.findOrCreateMap("field")},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"screens",{get:function(){return this.plugins.findOrCreateMap("screen")},enumerable:!0,configurable:!0}),m.prototype.registerApi=function(t,e){this.api[t]=e},m);function m(){this.api={},this.forms=new p,this.plugins=new a}t.CMS=h,t.Form=o,t.FormManager=p,t.PluginManager=a,t.PluginType=b,t.Subscribable=r,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form"],e):e((t=t||self)["@tinacms/core"]={},t.finalForm)}(this,function(t,u){"use strict";var n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])})(t,e)};function e(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var r=(i.prototype.subscribe=function(t){var e=this;return this.__subscribers.push(t),function(){return e.unsubscribe(t)}},i.prototype.unsubscribe=function(t){var e=this.__subscribers.indexOf(t);this.__subscribers.splice(e,1)},i.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},i);function i(){this.__subscribers=[]}var o=(Object.defineProperty(s.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),s);function s(t){var r=this,e=t.id,n=t.label,i=t.fields,o=t.actions,s=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]])}return r}(t,["id","label","fields","actions"]);this.subscribe=function(t,e){return r.finalForm.subscribe(t,e)},this.submit=function(){return r.finalForm.submit()},this.id=e,this.label=n,this.fields=i,this.finalForm=u.createForm(s),this.actions=o||[]}var f,p=(e(c,f=r),c.prototype.findForm=function(t){return this.__forms[t]},c.prototype.all=function(){var e=this;return Object.keys(this.__forms).map(function(t){return e.__forms[t]})},c);function c(){var r=null!==f&&f.apply(this,arguments)||this;return r.__forms={},r.__fields={},r.createForm=function(t){var e=new o(t);return r.__forms[t.id]=e,r.notifiySubscribers(),e},r.removeForm=function(t){delete r.__forms[t],r.notifiySubscribers()},r}var a=(l.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new _(t)},l.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},l.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},l.prototype.all=function(t){return this.findOrCreateMap(t).all()},l);function l(){this.plugins={}}var b,_=(e(y,b=r),y.prototype.add=function(t){var e=t;e.__type||(e.__type=this.__type),this.__plugins[e.name]=e,this.notifiySubscribers()},y.prototype.all=function(){var e=this;return Object.keys(this.__plugins).map(function(t){return e.__plugins[t]})},y.prototype.find=function(t){return this.__plugins[t]},y.prototype.remove=function(t){var e="string"==typeof t?t:t.name,r=this.__plugins[e];return delete this.__plugins[e],this.notifiySubscribers(),r},y);function y(t){var e=b.call(this)||this;return e.__type=t,e.__plugins={},e}var h=(Object.defineProperty(d.prototype,"fields",{get:function(){return this.plugins.findOrCreateMap("field")},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"screens",{get:function(){return this.plugins.findOrCreateMap("screen")},enumerable:!0,configurable:!0}),d.prototype.registerApi=function(t,e){this.api[t]=e},d);function d(){this.api={},this.forms=new p,this.plugins=new a}t.CMS=h,t.Form=o,t.FormManager=p,t.PluginManager=a,t.PluginType=_,t.Subscribable=r,Object.defineProperty(t,"__esModule",{value:!0})}); |
{ | ||
"name": "@tinacms/core", | ||
"version": "0.1.0-alpha.5", | ||
"version": "0.1.0-alpha.6", | ||
"main": "build/index.js", | ||
@@ -26,4 +26,3 @@ "types": "build/index.d.ts", | ||
"react": "^16.8.6" | ||
}, | ||
"gitHead": "e78938eaf9976ccc2191902b06d2a292ded008af" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10038
14
129