silverstripe-framework/admin/client/dist/js/bundle-framework.js

7 lines
131 KiB
JavaScript
Raw Normal View History

!function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a="function"==typeof require&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}for(var i="function"==typeof require&&require,o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj["default"]=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function getBasePath(){var a=document.createElement("a");a.href=document.getElementsByTagName("base")[0].href;var basePath=a.pathname;return basePath=basePath.replace(/\/$/,""),basePath.match(/^[^\/]/)&&(basePath="/"+basePath),basePath}function appBoot(){_ReducerRegister2["default"].add("config",_ConfigReducer2["default"]),_ReducerRegister2["default"].add("form",_FormReducer2["default"]),_ReducerRegister2["default"].add("schemas",_SchemaReducer2["default"]),_ReducerRegister2["default"].add("records",_RecordsReducer2["default"]),_ReducerRegister2["default"].add("campaign",_CampaignReducer2["default"]),_ReducerRegister2["default"].add("breadcrumbs",_BreadcrumbsReducer2["default"]);var initialState={},rootReducer=(0,_redux.combineReducers)(_ReducerRegister2["default"].getAll()),middleware=[_reduxThunk2["default"]];"dev"===_Config2["default"].get("environment")&&_Config2["default"].get("debugging")&&middleware.push((0,_reduxLogger2["default"])());var createStoreWithMiddleware=_redux.applyMiddleware.apply(void 0,middleware)(_redux.createStore),store=createStoreWithMiddleware(rootReducer,initialState);store.dispatch(configActions.setConfig(_Config2["default"].getAll())),_Router2["default"].base(getBasePath()),(0,_Router2["default"])("*",function(ctx,next){ctx.store=store,next()}),_Router2["default"].exit("*",function(ctx,next){_reactDom2["default"].unmountComponentAtNode(document.getElementsByClassName("cms-content")[0]),next()});var sections=_Config2["default"].get("sections");Object.keys(sections).forEach(function(key){var sectionConfig=sections[key];if(!sectionConfig.reactRoute){var route=sectionConfig.route;route=route.replace(/\/$/,""),route="/"+route+"(/*?)?",_RouteRegister2["default"].add(route,function(ctx,next){return"complete"!==document.readyState||ctx.init?void next():void(0,_jQuery2["default"])(".cms-container").entwine("ss").handleStateChange(null,ctx.state).done(next)})}});var registeredRoutes=_RouteRegister2["default"].getAll();for(var route in registeredRoutes)registeredRoutes.hasOwnProperty(route)&&(0,_Router2["default"])(route,registeredRoutes[route]);_Router2["default"].start()}var _jQuery=require("jQuery"),_jQuery2=_interopRequireDefault(_jQuery),_reactDom=require("react-dom"),_reactDom2=_interopRequireDefault(_reactDom),_redux=require("redux"),_reduxThunk=require("redux-thunk"),_reduxThunk2=_interopRequireDefault(_reduxThunk),_reduxLogger=require("redux-logger"),_reduxLogger2=_interopRequireDefault(_reduxLogger),_Config=require("lib/Config"),_Config2=_interopRequireDefault(_Config),_Router=require("lib/Router"),_Router2=_interopRequireDefault(_Router),_RouteRegister=require("lib/RouteRegister"),_RouteRegister2=_interopRequireDefault(_RouteRegister),_ReducerRegister=require("lib/ReducerRegister"),_ReducerRegister2=_interopRequireDefault(_ReducerRegister),_ConfigActions=require("state/config/ConfigActions"),configActions=_interopRequireWildcard(_ConfigActions),_ConfigReducer=require("state/config/ConfigReducer"),_ConfigReducer2=_interopRequireDefault(_ConfigReducer),_FormReducer=require("state/form/FormReducer"),_FormReducer2=_interopRequireDefault(_FormReducer),_SchemaReducer=require("state/schema/SchemaReducer"),_SchemaReducer2=_interopRequireDefault(_SchemaReducer),_RecordsReducer=require("state/records/RecordsReducer"),_R
break;case"none":default:badge.className="label label-success list-group-item__status",badge.Title=_i18n2["default"]._t("CampaignItem.NO_CHANGES","No changes")}var links=_react2["default"].createElement("span",{className:"list-group-item__info campaign-admin__item-links--has-links font-icon-link"},"3 linked items");return item.Thumbnail&&(thumbnail=_react2["default"].createElement("span",{className:"list-group-item__thumbnail"},_react2["default"].createElement("img",{alt:item.Title,src:item.Thumbnail}))),_react2["default"].createElement("div",null,thumbnail,_react2["default"].createElement("h4",{className:"list-group-item-heading"},item.Title),_react2["default"].createElement("span",{className:"list-group-item__info campaign-admin__item-links--is-linked font-icon-link"}),links,badge.className&&badge.Title&&_react2["default"].createElement("span",{className:badge.className},badge.Title))},CampaignAdminItem}(_SilverStripeComponent2["default"]);CampaignAdminItem.propTypes={campaign:_react2["default"].PropTypes.object.isRequired,item:_react2["default"].PropTypes.object.isRequired},exports["default"]=CampaignAdminItem},{i18n:"i18n","lib/SilverStripeComponent":"lib/SilverStripeComponent",react:"react"}],9:[function(require,module,exports){"use strict";function _interopRequireWildcard(obj){if(obj&&obj.__esModule)return obj;var newObj={};if(null!=obj)for(var key in obj)Object.prototype.hasOwnProperty.call(obj,key)&&(newObj[key]=obj[key]);return newObj["default"]=obj,newObj}function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function _defaults(obj,defaults){for(var keys=Object.getOwnPropertyNames(defaults),i=0;i<keys.length;i++){var key=keys[i],value=Object.getOwnPropertyDescriptor(defaults,key);value&&value.configurable&&void 0===obj[key]&&Object.defineProperty(obj,key,value)}return obj}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor))throw new TypeError("Cannot call a class as a function")}function _possibleConstructorReturn(self,call){if(!self)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!call||"object"!=typeof call&&"function"!=typeof call?self:call}function _inherits(subClass,superClass){if("function"!=typeof superClass&&null!==superClass)throw new TypeError("Super expression must either be null or a function, not "+typeof superClass);subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,enumerable:!1,writable:!0,configurable:!0}}),superClass&&(Object.setPrototypeOf?Object.setPrototypeOf(subClass,superClass):_defaults(subClass,superClass))}function mapStateToProps(state,ownProps){var record=null,treeClass=ownProps.sectionConfig.treeClass;return state.records&&state.records[treeClass]&&ownProps.campaignId&&(record=state.records[treeClass][parseInt(ownProps.campaignId,10)]),{config:state.config,record:record||{},campaign:state.campaign,treeClass:treeClass,breadcrumbs:state.breadcrumbs}}function mapDispatchToProps(dispatch){return{breadcrumbsActions:(0,_redux.bindActionCreators)(breadcrumbsActions,dispatch),recordActions:(0,_redux.bindActionCreators)(recordActions,dispatch),campaignActions:(0,_redux.bindActionCreators)(campaignActions,dispatch)}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_react=require("react"),_react2=_interopRequireDefault(_react),_redux=require("redux"),_reactRedux=require("react-redux"),_BreadcrumbsActions=require("state/breadcrumbs/BreadcrumbsActions"),breadcrumbsActions=_interopRequireWildcard(_BreadcrumbsActions),_RecordsActions=require("state/records/RecordsActions"),recordActions=_interopRequireWildcard(_RecordsActions),_CampaignActions=require("state/campaign/CampaignActions"),campaignActions=_interopRequireWildcard(_CampaignActions),_SilverStripeComponent=require("lib/SilverStripeComponent"),_SilverStripeComponent2=_inte
})));case _FormActionTypes.ACTION_TYPES.REMOVE_FORM:return(0,_deepFreezeStrict2["default"])(Object.keys(state).reduce(function(previous,current){return current===action.payload.formId?previous:_extends({},previous,_defineProperty({},current,state[current]))},{}));case _FormActionTypes.ACTION_TYPES.ADD_FORM:return(0,_deepFreezeStrict2["default"])(_extends({},state,_defineProperty({},action.payload.formState.id,{fields:action.payload.formState.fields,submitting:!1})));case _FormActionTypes.ACTION_TYPES.UPDATE_FIELD:return(0,_deepFreezeStrict2["default"])(_extends({},state,_defineProperty({},action.payload.formId,_extends({},state[action.payload.formId],{fields:state[action.payload.formId].fields.map(function(field){return field.id===action.payload.updates.id?_extends({},field,action.payload.updates):field})}))));case _FormActionTypes.ACTION_TYPES.SUBMIT_FORM_SUCCESS:return(0,_deepFreezeStrict2["default"])(_extends({},state,_defineProperty({},action.payload.response.id,{fields:action.payload.response.state.fields,messages:action.payload.response.state.messages,submitting:!1})));case _FormActionTypes.ACTION_TYPES.SUBMIT_FORM_FAILURE:return(0,_deepFreezeStrict2["default"])(_extends({},state,_defineProperty({},action.payload.formId,{submitting:!1})));default:return state}}Object.defineProperty(exports,"__esModule",{value:!0});var _extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source)Object.prototype.hasOwnProperty.call(source,key)&&(target[key]=source[key])}return target},_deepFreezeStrict=require("deep-freeze-strict"),_deepFreezeStrict2=_interopRequireDefault(_deepFreezeStrict),_FormActionTypes=require("./FormActionTypes"),initialState=(0,_deepFreezeStrict2["default"])({});exports["default"]=formReducer},{"./FormActionTypes":24,"deep-freeze-strict":"deep-freeze-strict"}],26:[function(require,module,exports){"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports["default"]={CREATE_RECORD:"CREATE_RECORD",UPDATE_RECORD:"UPDATE_RECORD",DELETE_RECORD:"DELETE_RECORD",FETCH_RECORDS_REQUEST:"FETCH_RECORDS_REQUEST",FETCH_RECORDS_FAILURE:"FETCH_RECORDS_FAILURE",FETCH_RECORDS_SUCCESS:"FETCH_RECORDS_SUCCESS",FETCH_RECORD_REQUEST:"FETCH_RECORD_REQUEST",FETCH_RECORD_FAILURE:"FETCH_RECORD_FAILURE",FETCH_RECORD_SUCCESS:"FETCH_RECORD_SUCCESS",DELETE_RECORD_REQUEST:"DELETE_RECORD_REQUEST",DELETE_RECORD_FAILURE:"DELETE_RECORD_FAILURE",DELETE_RECORD_SUCCESS:"DELETE_RECORD_SUCCESS"}},{}],27:[function(require,module,exports){"use strict";function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{"default":obj}}function populate(str,params){var names=["id"];return names.reduce(function(acc,name){return acc.replace(":"+name,params[name])},str)}function fetchRecords(recordType,method,url){var payload={recordType:recordType},headers={Accept:"text/json"},methodToLowerCase=method.toLowerCase();return function(dispatch){dispatch({type:_RecordsActionTypes2["default"].FETCH_RECORDS_REQUEST,payload:payload});var args="get"===methodToLowerCase?[populate(url,payload),headers]:[populate(url,payload),{},headers];return _Backend2["default"][methodToLowerCase].apply(_Backend2["default"],args).then(function(response){return response.json()}).then(function(json){dispatch({type:_RecordsActionTypes2["default"].FETCH_RECORDS_SUCCESS,payload:{recordType:recordType,data:json}})})["catch"](function(err){dispatch({type:_RecordsActionTypes2["default"].FETCH_RECORDS_FAILURE,payload:{error:err,recordType:recordType}})})}}function fetchRecord(recordType,method,url){var payload={recordType:recordType},headers={Accept:"text/json"},methodToLowerCase=method.toLowerCase();return function(dispatch){dispatch({type:_RecordsActionTypes2["default"].FETCH_RECORD_REQUEST,payload:payload});var args="get"===methodToLowerCase?[populate(url,payload),headers]:[populate(url,payload),{},headers];return _Backend2["default"][methodToLowerCase].apply(_Backend2["default"],args).then(function(response){return response.json()}).then(function(json){dispatch({type:_RecordsActionTypes2["default"].FETCH_R
lib$es6$promise$promise$$Promise.all=lib$es6$promise$promise$all$$default,lib$es6$promise$promise$$Promise.race=lib$es6$promise$promise$race$$default,lib$es6$promise$promise$$Promise.resolve=lib$es6$promise$promise$resolve$$default,lib$es6$promise$promise$$Promise.reject=lib$es6$promise$promise$reject$$default,lib$es6$promise$promise$$Promise._setScheduler=lib$es6$promise$asap$$setScheduler,lib$es6$promise$promise$$Promise._setAsap=lib$es6$promise$asap$$setAsap,lib$es6$promise$promise$$Promise._asap=lib$es6$promise$asap$$asap,lib$es6$promise$promise$$Promise.prototype={constructor:lib$es6$promise$promise$$Promise,then:lib$es6$promise$then$$default,"catch":function(onRejection){return this.then(null,onRejection)}};var lib$es6$promise$enumerator$$default=lib$es6$promise$enumerator$$Enumerator;lib$es6$promise$enumerator$$Enumerator.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},lib$es6$promise$enumerator$$Enumerator.prototype._enumerate=function(){for(var length=this.length,input=this._input,i=0;this._state===lib$es6$promise$$internal$$PENDING&&length>i;i++)this._eachEntry(input[i],i)},lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry=function(entry,i){var c=this._instanceConstructor,resolve=c.resolve;if(resolve===lib$es6$promise$promise$resolve$$default){var then=lib$es6$promise$$internal$$getThen(entry);if(then===lib$es6$promise$then$$default&&entry._state!==lib$es6$promise$$internal$$PENDING)this._settledAt(entry._state,i,entry._result);else if("function"!=typeof then)this._remaining--,this._result[i]=entry;else if(c===lib$es6$promise$promise$$default){var promise=new c(lib$es6$promise$$internal$$noop);lib$es6$promise$$internal$$handleMaybeThenable(promise,entry,then),this._willSettleAt(promise,i)}else this._willSettleAt(new c(function(resolve){resolve(entry)}),i)}else this._willSettleAt(resolve(entry),i)},lib$es6$promise$enumerator$$Enumerator.prototype._settledAt=function(state,i,value){var promise=this.promise;promise._state===lib$es6$promise$$internal$$PENDING&&(this._remaining--,state===lib$es6$promise$$internal$$REJECTED?lib$es6$promise$$internal$$reject(promise,value):this._result[i]=value),0===this._remaining&&lib$es6$promise$$internal$$fulfill(promise,this._result)},lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt=function(promise,i){var enumerator=this;lib$es6$promise$$internal$$subscribe(promise,void 0,function(value){enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED,i,value)},function(reason){enumerator._settledAt(lib$es6$promise$$internal$$REJECTED,i,reason)})};var lib$es6$promise$polyfill$$default=lib$es6$promise$polyfill$$polyfill,lib$es6$promise$umd$$ES6Promise={Promise:lib$es6$promise$promise$$default,polyfill:lib$es6$promise$polyfill$$default};"function"==typeof define&&define.amd?define(function(){return lib$es6$promise$umd$$ES6Promise}):"undefined"!=typeof module&&module.exports?module.exports=lib$es6$promise$umd$$ES6Promise:"undefined"!=typeof this&&(this.ES6Promise=lib$es6$promise$umd$$ES6Promise),lib$es6$promise$polyfill$$default()}).call(this)}).call(this,require("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:31}],37:[function(require,module,exports){require("whatwg-fetch"),module.exports=self.fetch.bind(self)},{"whatwg-fetch":46}],38:[function(require,module,exports){!function(isNode){function merge_recursive(base,extend){if("object"!==typeOf(base))return extend;for(var key in extend)"object"===typeOf(base[key])&&"object"===typeOf(extend[key])?base[key]=merge_recursive(base[key],extend[key]):base[key]=extend[key];return base}function merge(clone,recursive,argv){var result=argv[0],size=argv.length;(clone||"object"!==typeOf(result))&&(result={});for(var index=0;size>index;++index){var item=argv[index],type=typeOf(item);if("object"===type)for(var key in item){var sitem=clone?Public.clone(item[key]):item[key];recursive?result[key]=merge_recursive(result[key],sitem):result[key]=sitem}}return result}function typeOf(input){return{}.toString.c
this.headers.get("content-type")||("string"==typeof body?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type&&this.headers.set("content-type",this._bodyBlob.type))},support.blob?(this.blob=function(){var rejected=consumed(this);if(rejected)return rejected;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this.blob().then(readBlobAsArrayBuffer)},this.text=function(){var rejected=consumed(this);if(rejected)return rejected;if(this._bodyBlob)return readBlobAsText(this._bodyBlob);if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)}):this.text=function(){var rejected=consumed(this);return rejected?rejected:Promise.resolve(this._bodyText)},support.formData&&(this.formData=function(){return this.text().then(decode)}),this.json=function(){return this.text().then(JSON.parse)},this}function normalizeMethod(method){var upcased=method.toUpperCase();return methods.indexOf(upcased)>-1?upcased:method}function Request(input,options){options=options||{};var body=options.body;if(Request.prototype.isPrototypeOf(input)){if(input.bodyUsed)throw new TypeError("Already read");this.url=input.url,this.credentials=input.credentials,options.headers||(this.headers=new Headers(input.headers)),this.method=input.method,this.mode=input.mode,body||(body=input._bodyInit,input.bodyUsed=!0)}else this.url=input;if(this.credentials=options.credentials||this.credentials||"omit",!options.headers&&this.headers||(this.headers=new Headers(options.headers)),this.method=normalizeMethod(options.method||this.method||"GET"),this.mode=options.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&body)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(body)}function decode(body){var form=new FormData;return body.trim().split("&").forEach(function(bytes){if(bytes){var split=bytes.split("="),name=split.shift().replace(/\+/g," "),value=split.join("=").replace(/\+/g," ");form.append(decodeURIComponent(name),decodeURIComponent(value))}}),form}function headers(xhr){var head=new Headers,pairs=xhr.getAllResponseHeaders().trim().split("\n");return pairs.forEach(function(header){var split=header.trim().split(":"),key=split.shift().trim(),value=split.join(":").trim();head.append(key,value)}),head}function Response(bodyInit,options){options||(options={}),this.type="default",this.status=options.status,this.ok=this.status>=200&&this.status<300,this.statusText=options.statusText,this.headers=options.headers instanceof Headers?options.headers:new Headers(options.headers),this.url=options.url||"",this._initBody(bodyInit)}if(!self.fetch){Headers.prototype.append=function(name,value){name=normalizeName(name),value=normalizeValue(value);var list=this.map[name];list||(list=[],this.map[name]=list),list.push(value)},Headers.prototype["delete"]=function(name){delete this.map[normalizeName(name)]},Headers.prototype.get=function(name){var values=this.map[normalizeName(name)];return values?values[0]:null},Headers.prototype.getAll=function(name){return this.map[normalizeName(name)]||[]},Headers.prototype.has=function(name){return this.map.hasOwnProperty(normalizeName(name))},Headers.prototype.set=function(name,value){this.map[normalizeName(name)]=[normalizeValue(value)]},Headers.prototype.forEach=function(callback,thisArg){Object.getOwnPropertyNames(this.map).forEach(function(name){this.map[name].forEach(function(value){callback.call(thisArg,value,name,this)},this)},this)};var support={blob:"FileReader"in self&&"Blob"in self&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in self,arrayBuffer:"ArrayBuffer"in self},methods=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];Request.prototype.clone=function(){return new Request(this)},Body.call(Request.prototype),Body.call(Response.prototype),Response.prototype.clone=function(){return new Res
2016-04-07 13:43:43 +02:00
//# sourceMappingURL=bundle-framework.js.map