@tinacms/core
Advanced tools
Comparing version 0.1.0-alpha.9 to 0.1.0-alpha.10
/// <reference types="react" /> | ||
import { FormApi, Config } from 'final-form'; | ||
import { FormApi, Config, Unsubscribe } from 'final-form'; | ||
interface FieldSubscription { | ||
path: string; | ||
field: Field; | ||
unsubscribe: Unsubscribe; | ||
} | ||
export declare class Form<S = any> { | ||
@@ -9,3 +14,7 @@ id: any; | ||
actions: any[]; | ||
fieldSubscriptions: { | ||
[key: string]: FieldSubscription; | ||
}; | ||
constructor({ id, label, fields, actions, ...options }: FormOptions<S>); | ||
private registerFields; | ||
subscribe: FormApi<S>['subscribe']; | ||
@@ -25,5 +34,8 @@ submit: FormApi<S>['submit']; | ||
description?: string; | ||
component: React.FC<any> | string; | ||
component: React.FC<any> | string | null; | ||
parse?: (value: string, name: string) => any; | ||
format?: (value: string, name: string) => any; | ||
defaultValue?: any; | ||
fields?: Field[]; | ||
} | ||
export {}; |
@@ -1,1 +0,1 @@ | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form"],r):r((t=t||self)["@tinacms/core"]={},t.finalForm)}(this,function(t,u){"use strict";var n=function(t,r){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function r(t,r){function e(){this.constructor=t}n(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var e=(i.prototype.subscribe=function(t){var r=this;return this.__subscribers.push(t),function(){return r.unsubscribe(t)}},i.prototype.unsubscribe=function(t){var r=this.__subscribers.indexOf(t);this.__subscribers.splice(r,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 e=this,r=t.id,n=t.label,i=t.fields,o=t.actions,s=function(t,r){var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&r.indexOf(n)<0&&(e[n]=t[n]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(t);i<n.length;i++)r.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(e[n[i]]=t[n[i]])}return e}(t,["id","label","fields","actions"]);this.subscribe=function(t,r){return e.finalForm.subscribe(t,r)},this.submit=function(){return e.finalForm.submit()},this.id=r,this.label=n,this.fields=i,this.finalForm=u.createForm(s),this.actions=o||[]}var f,p=(r(c,f=e),c.prototype.findForm=function(t){return this.__forms[t]},c.prototype.all=function(){var r=this;return Object.keys(this.__forms).map(function(t){return r.__forms[t]})},c);function c(){var e=null!==f&&f.apply(this,arguments)||this;return e.__forms={},e.createForm=function(t){var r=new o(t);return e.__forms[t.id]=r,e.notifiySubscribers(),r},e.removeForm=function(t){delete e.__forms[t],e.notifiySubscribers()},e}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=(r(y,_=e),y.prototype.add=function(t){var r=t;r.__type||(r.__type=this.__type),this.__plugins[r.name]=r,this.notifiySubscribers()},y.prototype.all=function(){var r=this;return Object.keys(this.__plugins).map(function(t){return r.__plugins[t]})},y.prototype.find=function(t){return this.__plugins[t]},y.prototype.remove=function(t){var r="string"==typeof t?t:t.name,e=this.__plugins[r];return delete this.__plugins[r],this.notifiySubscribers(),e},y);function y(t){var r=_.call(this)||this;return r.__type=t,r.__plugins={},r}var h=(m.prototype.registerApi=function(t,r){this.api[t]=r},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=e,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("final-form-arrays"),require("final-form")):"function"==typeof define&&define.amd?define(["exports","final-form-arrays","final-form"],r):r((t=t||self)["@tinacms/core"]={},t.arrayMutators,t.finalForm)}(this,function(t,u,f){"use strict";u=u&&u.hasOwnProperty("default")?u.default:u;var i=function(t,r){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var e in r)r.hasOwnProperty(e)&&(t[e]=r[e])})(t,r)};function r(t,r){function e(){this.constructor=t}i(t,r),t.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}var a=function(){return(a=Object.assign||function(t){for(var r,e=1,i=arguments.length;e<i;e++)for(var n in r=arguments[e])Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n]);return t}).apply(this,arguments)};var e=(n.prototype.subscribe=function(t){var r=this;return this.__subscribers.push(t),function(){return r.unsubscribe(t)}},n.prototype.unsubscribe=function(t){var r=this.__subscribers.indexOf(t);this.__subscribers.splice(r,1)},n.prototype.notifiySubscribers=function(){this.__subscribers.forEach(function(t){return t()})},n);function n(){this.__subscribers=[]}var o=(s.prototype.registerFields=function(t,n){var o=this;t.forEach(function(t){var r=n?n+"."+t.name:t.name,e=["group"].includes(t.component);if(["group-list","blocks"].includes(t.component)){var i=t.fields||[];o.registerFields(i,r+".INDEX")}else e?(i=t.fields||[],o.registerFields(i,r)):o.fieldSubscriptions[r]={path:r,field:t,unsubscribe:o.finalForm.registerField(r,function(){},{})}})},Object.defineProperty(s.prototype,"values",{get:function(){return this.finalForm.getState().values},enumerable:!0,configurable:!0}),s);function s(t){var e=this,r=t.id,i=t.label,n=t.fields,o=t.actions,s=function(t,r){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&r.indexOf(i)<0&&(e[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)r.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(e[i[n]]=t[i[n]])}return e}(t,["id","label","fields","actions"]);this.fieldSubscriptions={},this.subscribe=function(t,r){return e.finalForm.subscribe(t,r)},this.submit=function(){return e.finalForm.submit()},this.id=r,this.label=i,this.fields=n,this.finalForm=f.createForm(a({},s,{mutators:a({},u,s.mutators)})),this.registerFields(this.fields),this.actions=o||[]}var p,c=(r(l,p=e),l.prototype.findForm=function(t){return this.__forms[t]},l.prototype.all=function(){var r=this;return Object.keys(this.__forms).map(function(t){return r.__forms[t]})},l);function l(){var e=null!==p&&p.apply(this,arguments)||this;return e.__forms={},e.createForm=function(t){var r=new o(t);return e.__forms[t.id]=r,e.notifiySubscribers(),r},e.removeForm=function(t){delete e.__forms[t],e.notifiySubscribers()},e}var b=(y.prototype.findOrCreateMap=function(t){return this.plugins[t]=this.plugins[t]||new _(t)},y.prototype.add=function(t){this.findOrCreateMap(t.__type).add(t)},y.prototype.remove=function(t){this.findOrCreateMap(t.__type).remove(t)},y.prototype.all=function(t){return this.findOrCreateMap(t).all()},y);function y(){this.plugins={}}var h,_=(r(d,h=e),d.prototype.add=function(t){var r=t;r.__type||(r.__type=this.__type),this.__plugins[r.name]=r,this.notifiySubscribers()},d.prototype.all=function(){var r=this;return Object.keys(this.__plugins).map(function(t){return r.__plugins[t]})},d.prototype.find=function(t){return this.__plugins[t]},d.prototype.remove=function(t){var r="string"==typeof t?t:t.name,e=this.__plugins[r];return delete this.__plugins[r],this.notifiySubscribers(),e},d);function d(t){var r=h.call(this)||this;return r.__type=t,r.__plugins={},r}var m=(v.prototype.registerApi=function(t,r){this.api[t]=r},v);function v(){this.api={},this.forms=new c,this.plugins=new b}t.CMS=m,t.Form=o,t.FormManager=c,t.PluginManager=b,t.PluginType=_,t.Subscribable=e,Object.defineProperty(t,"__esModule",{value:!0})}); |
@@ -6,2 +6,20 @@ # Change Log | ||
# [0.1.0-alpha.10](https://github.com/tinacms/tinacms/compare/@tinacms/core@0.1.0-alpha.9...@tinacms/core@0.1.0-alpha.10) (2019-10-02) | ||
### Bug Fixes | ||
* sync first-level group-list items ([49550a5](https://github.com/tinacms/tinacms/commit/49550a5)) | ||
* updating groups from disk ([a56b127](https://github.com/tinacms/tinacms/commit/a56b127)) | ||
### Features | ||
* field.component can be null ([385c137](https://github.com/tinacms/tinacms/commit/385c137)) | ||
* fields can have default values ([54c8602](https://github.com/tinacms/tinacms/commit/54c8602)) | ||
# [0.1.0-alpha.9](https://github.com/tinacms/tinacms/compare/@tinacms/core@0.1.0-alpha.8...@tinacms/core@0.1.0-alpha.9) (2019-09-25) | ||
@@ -8,0 +26,0 @@ |
{ | ||
"name": "@tinacms/core", | ||
"version": "0.1.0-alpha.9", | ||
"version": "0.1.0-alpha.10", | ||
"main": "build/index.js", | ||
@@ -10,2 +10,15 @@ "types": "build/index.d.ts", | ||
], | ||
"keywords": [ | ||
"tinacms", | ||
"cms", | ||
"react" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/tinacms/tinacms/issues" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/tinacms/tinacms.git", | ||
"directory": "packages/core/core" | ||
}, | ||
"scripts": { | ||
@@ -21,5 +34,8 @@ "prepublish": "npm run build", | ||
"@types/react": "^16.8.23", | ||
"cms-scripts": "^0.1.0-alpha.3", | ||
"cms-scripts": "^0.1.0-alpha.4", | ||
"final-form": "^4.18.2", | ||
"final-form-arrays": "^3.0.1", | ||
"jest": "^24.8.0", | ||
"react": "^16.8.6", | ||
"react-final-form": "^6.3.0", | ||
"ts-jest": "^24.0.2" | ||
@@ -30,3 +46,3 @@ }, | ||
}, | ||
"gitHead": "a3211f8fecd0eaad6045fb5a0ac4fe12f2a35000" | ||
"gitHead": "9da03feec208a3b84d0def32e643d7e7ec2f88c5" | ||
} |
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
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
11037
117
1
0
9
13