(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["node-modules/@dcloudio/uni-cli-shared/components/unicloud-db"],{3220:function(t,e,n){"use strict";n.r(e);var i=n("e516"),a=n("49df");for(var o in a)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(o);var s=n("828b"),l=Object(s["a"])(a["default"],i["b"],i["c"],!1,null,null,null,!1,i["a"],void 0);e["default"]=l.exports},"49df":function(t,e,n){"use strict";n.r(e);var i=n("da44"),a=n.n(i);for(var o in i)["default"].indexOf(o)<0&&function(t){n.d(e,t,(function(){return i[t]}))}(o);e["default"]=a.a},da44:function(t,e,n){"use strict";(function(t,i){var a=n("47a9");Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var o=a(n("af34")),s=a(n("3b2d")),l=n("d3b4"),r=a(n("48b1")),c=(0,l.initVueI18n)(r.default),d=c.t,u={load:"load",error:"error"},h={add:"add",replace:"replace"},f={auto:"auto",onready:"onready",manual:"manual"},g=["pageCurrent","pageSize","spaceInfo","collection","action","field","getcount","orderby","where","groupby","groupField","distinct"],p={name:"UniClouddb",props:{options:{type:[Object,Array],default:function(){return{}}},spaceInfo:{type:Object,default:function(){return{}}},collection:{type:[String,Array],default:""},action:{type:String,default:""},field:{type:String,default:""},orderby:{type:String,default:""},where:{type:[String,Object],default:""},pageData:{type:String,default:"add"},pageCurrent:{type:Number,default:1},pageSize:{type:Number,default:20},getcount:{type:[Boolean,String],default:!1},getone:{type:[Boolean,String],default:!1},gettree:{type:[Boolean,String,Object],default:!1},gettreepath:{type:[Boolean,String],default:!1},startwith:{type:String,default:""},limitlevel:{type:Number,default:10},groupby:{type:String,default:""},groupField:{type:String,default:""},distinct:{type:[Boolean,String],default:!1},pageIndistinct:{type:[Boolean,String],default:!1},foreignKey:{type:String,default:""},loadtime:{type:String,default:"auto"},manual:{type:Boolean,default:!1}},data:function(){return{loading:!1,hasMore:!1,dataList:this.getone?void 0:[],paginationInternal:{},errorMessage:""}},computed:{collectionArgs:function(){return Array.isArray(this.collection)?this.collection:[this.collection]},isLookup:function(){return Array.isArray(this.collection)&&this.collection.length>1||"string"===typeof this.collection&&this.collection.indexOf(",")>-1}},created:function(){var t=this;this._isEnded=!1,this.paginationInternal={current:this.pageCurrent,size:this.pageSize,count:0},this.$watch((function(){var e=[];return g.forEach((function(n){e.push(t[n])})),e}),(function(e,n){if(t.paginationInternal.size=t.pageSize,e[0]!==n[0]&&(t.paginationInternal.current=t.pageCurrent),t.loadtime!==f.manual){for(var i=!1,a=2;a1&&void 0!==arguments[1]?arguments[1]:{},a=n.action,o=n.showToast,s=void 0===o||o,l=n.toastTitle,r=n.success,c=n.fail,u=n.complete,h=n.needConfirm,f=void 0===h||h,g=n.needLoading,p=void 0===g||g,m=n.loadingTitle,v=void 0===m?"":m;p&&t.showLoading({title:v});var y=i.database(this.spaceInfo);a&&(y=y.action(a)),y.collection(this.getMainCollection()).add(e).then((function(e){r&&r(e),s&&t.showToast({title:l||d("uniCloud.component.add.success")})})).catch((function(e){c&&c(e),f&&t.showModal({content:e.message,showCancel:!1})})).finally((function(){p&&t.hideLoading(),u&&u()}))},remove:function(e){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=i.action,o=i.success,s=i.fail,l=i.complete,r=i.confirmTitle,c=i.confirmContent,u=i.needConfirm,h=void 0===u||u,f=i.needLoading,g=void 0===f||f,p=i.loadingTitle,m=void 0===p?"":p;e&&e.length&&(h?t.showModal({title:r||d("uniCloud.component.remove.showModal.title"),content:c||d("uniCloud.component.remove.showModal.content"),showCancel:!0,success:function(t){t.confirm&&n._execRemove(e,a,o,s,l,h,g,m)}}):this._execRemove(e,a,o,s,l,h,g,m))},update:function(e,n){var i=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},o=Object.assign({action:null,showToast:!0,toastTitle:null,success:null,fail:null,complete:null,confirmTitle:null,confirmContent:null,needConfirm:!0,needLoading:!0,loadingTitle:""},a);a.needConfirm?t.showModal({title:a.confirmTitle||d("uniCloud.component.update.showModal.title"),content:a.confirmContent||d("uniCloud.component.update.showModal.content"),showCancel:!0,success:function(t){t.confirm&&i._doUpdate(e,n,o)}}):this._doUpdate(e,n,o)},_doUpdate:function(e,n,a){var o=a.action,s=a.success,l=a.fail,r=a.complete,c=a.showToast,u=a.toastTitle,h=a.needConfirm,f=a.needLoading,g=a.loadingTitle;f&&t.showLoading({title:g});var p=i.database(this.spaceInfo);o&&(p=p.action(o)),p.collection(this.getMainCollection()).doc(e).update(n).then((function(e){s&&s(e),c&&t.showToast({title:u||d("uniCloud.component.update.success")})})).catch((function(e){l&&l(e),h&&t.showModal({content:e.message,showCancel:!1})})).finally((function(){f&&t.hideLoading(),r&&r()}))},getMainCollection:function(){if("string"===typeof this.collection)return this.collection.split(",")[0];var t=JSON.parse(JSON.stringify(this.collection[0]));return t.$db[0].$param[0]},getTemp:function(){var t,e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=i.database(this.spaceInfo);this.action&&(n=n.action(this.action)),n=(t=n).collection.apply(t,(0,o.default)(this.collectionArgs)),this.foreignKey&&(n=n.foreignKey(this.foreignKey)),this.where&&Object.keys(this.where).length&&(n=n.where(this.where)),this.field&&(n=n.field(this.field)),this.groupby&&(n=n.groupBy(this.groupby)),this.groupField&&(n=n.groupField(this.groupField)),!0===this.distinct&&(n=n.distinct()),this.orderby&&(n=n.orderBy(this.orderby));var a=this.paginationInternal,s=a.current,l=a.size,r={};this.getcount&&(r.getCount=this.getcount);var c={limitLevel:this.limitlevel,startWith:this.startwith};return this.gettree&&(r.getTree=c),this.gettreepath&&(r.getTreePath=c),n=n.skip(l*(s-1)).limit(l),e?(n=n.getTemp(r),n.udb=this):n=n.get(r),n},setResult:function(t){0===t.code?this._execLoadDataSuccess(t):this._execLoadDataFail(new Error(t.message))},_execLoadData:function(t,e){var n=this;this.loading||(this.loading=!0,this.errorMessage="",this._getExec().then((function(i){n.loading=!1,n._execLoadDataSuccess(i.result,t,e)})).catch((function(e){n.loading=!1,n._execLoadDataFail(e,t)})))},_execLoadDataSuccess:function(t,e,n){var i=t.data,a=t.count;this._isEnded=void 0!==a?this.paginationInternal.current*this.paginationInternal.size>=a:i.length=0;i--){var a=e.indexOf(n[i]._id);a>=0&&(n.splice(i,1),e.splice(a,1))}},_dispatchEvent:function(t,e){this._changeDataFunction?this._changeDataFunction(e,this._isEnded,this.paginationInternal):this.$emit(t,e,this._isEnded,this.paginationInternal)}}};e.default=p}).call(this,n("df3c")["default"],n("861b")["uniCloud"])},e516:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"c",(function(){return a})),n.d(e,"a",(function(){}));var i=function(){var t=this,e=t.$createElement;t._self._c;t.$initSSP(),"augmented"===t.$scope.data.scopedSlotsCompiler&&t.$setSSP("default",{options:t.options,data:t.dataList,pagination:t.paginationInternal,loading:t.loading,hasMore:t.hasMore,error:t.errorMessage}),t.$callSSP()},a=[]}}]); ;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([ 'node-modules/@dcloudio/uni-cli-shared/components/unicloud-db-create-component', { 'node-modules/@dcloudio/uni-cli-shared/components/unicloud-db-create-component':(function(module, exports, __webpack_require__){ __webpack_require__('df3c')['createComponent'](__webpack_require__("3220")) }) }, [['node-modules/@dcloudio/uni-cli-shared/components/unicloud-db-create-component']] ]);