@wibetter/json-utils 5.0.6 → 5.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,1764 @@
1
1
  /*! For license information please see index.js.LICENSE.txt */
2
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JSONUtils=t():e.JSONUtils=t()}(this,(function(){return function(){"use strict";var e={d:function(t,r){for(var i in r)e.o(r,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:r[i]})},o:function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r:function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{DataSourceTypeList:function(){return h},EventTypeDataList:function(){return g},KeyWordList:function(){return ce},TypeDataList:function(){return v},dataRoute2dataPath:function(){return oe},dynamicDataAnalyzer:function(){return ne},getCurPosition:function(){return Y},getDefaultOptionVal:function(){return G},getExpectType:function(){return L},getJsonDataByKeyRoute:function(){return l},getNextIndexRoute:function(){return Z},getParentIndexRoute:function(){return W},getParentIndexRoute_CurIndex:function(){return z},getParentKeyRoute:function(){return pe},getParentKeyRoute_CurKey:function(){return ue},getSchemaByIndexRoute:function(){return p},getSchemaByKeyRoute:function(){return u},hasProperties:function(){return n},indexRoute2keyRoute:function(){return c},isArray:function(){return D},isBoolean:function(){return x},isColor:function(){return q},isContainerSchema:function(){return K},isDateStr:function(){return T},isDateTimeStr:function(){return N},isEmptySchema:function(){return V},isEqual:function(){return a},isFunction:function(){return F},isNewSchemaData:function(){return J},isNumber:function(){return C},isObject:function(){return R},isQuantity:function(){return k},isSameParent:function(){return X},isSelect:function(){return E},isString:function(){return j},isStructuredSchema:function(){return U},isTimeStr:function(){return S},isURL:function(){return O},json2schema:function(){return w},json2treeData:function(){return le},keyRoute2indexRoute:function(){return s},metaElemAnalyzer:function(){return M},moveBackward:function(){return Q},moveForward:function(){return H},objClone:function(){return i},oldSchemaToNewSchema:function(){return _},oldSchemaToNewSchemaV1:function(){return P},registerExpectType:function(){return A},schema2json:function(){return ie},schemaMetaList:function(){return ae},truncate:function(){return o}});var r=require("lodash");function i(e){return(0,r.cloneDeep)(e)}function a(e,t){return(0,r.isEqual)(e,t)}function n(e){var t=!1;return null!=e&&(t=!0),t}function o(e,t){return(0,r.truncate)(e,t)}function l(e,t,r){var a=t;if(r&&(a=i(t)),e)for(var n=e.split("-"),o=0,l=n.length;o<l;o++){var p=n[o];p&&(a=a&&a[p])}return a}function p(e,t,r){var a=t;if(r&&(a=i(t)),e)for(var n=e.split("-"),o=0,l=n.length;o<l;o++){var p=n[o];if("0"!==p||"array"!==a.type&&"radio"!==a.type&&"select"!==a.type&&"checkboxes"!==a.type||!a.options&&!a.items){if(p){var u="0";a.propertyOrder?u=a.propertyOrder[p]:a.properties&&(u=Object.keys(a.properties)[p]),a=a.properties[u]}}else a=a.options||a.items}return a}function u(e,t,r){var a=t;if(r&&(a=i(t)),e&&a)for(var n=e.split("-"),o=0,l=n.length;o<l;o++){var p=n[o];p&&a.properties&&(a=a.properties[p])}return a}function c(e,t){for(var r=t,i="",a=e.split("-"),n=0,o=a.length;n<o;n++){var l=a[n];if("0"===l&&r.items)r=r.items,i=i?i+"-items":"items";else if("0"===l&&r.options)r=r.options,i=i?i+"-options":"options";else if(l){var p="0";r.propertyOrder?p=r.propertyOrder[l]:r.properties&&(p=Object.keys(r.properties)[l]),r=r.properties[p],i=i?i+"-"+p:p}}return i}function s(e,t){for(var r=t,i="",a=e.split("-"),n=0,o=a.length;n<o;n++){var l=a[n];if(l){var p=-1;r.propertyOrder?(p=r.propertyOrder.indexOf(l),r=r.properties[l]):r.properties?(p=Object.keys(r.properties).indexOf(l),r=r.properties[l]):r.items?(p=0,r=r.items):r.options&&(p=0,r=r.options),i=i?i+"-"+p:p.toString()}}return i}var d,f={type:"event",title:"事件",isContainer:!1,properties:{type:{default:"emit",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},trigger:{type:"input",default:"eventName",title:"触发事件",description:"用于输入触发事件的名称",placeholder:"请输入触发事件的名称"},eventData:{title:"事件数据",type:"json",default:"{}",description:"传递给触发事件的数据对象"}},propertyOrder:["type","trigger","eventData"]},y={type:"datasource",title:"数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{title:"本地json数据",placeholder:"请输入静态json数据",type:"json",default:"{}",description:"用于设置本地的静态json数据",isRequired:!0},filter:{title:"过滤器",type:"codearea",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},propertyOrder:["type","data","filter"]},m=((d={type:"object"}).type="datasource",d.title="数据源",d.isContainer=!1,d.properties={type:{type:"select",default:"remote",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据源类型"},data:{type:"url",title:"远程json数据",placeholder:"请输入远程json数据源地址",default:"http://xxx",isRequired:!0,description:"用于设置获取元素数据的请求地址"},filter:{type:"codearea",title:"过滤器",default:"() => {}",description:"用于定义过滤当前数据的函数",isRequired:!0}},d.propertyOrder=["type","data","filter"],d),b={type:"local",config:{dataName:"",body:{},filter:"return data;"},data:"{}",localFilter:"return data;"},v={jsonschema:{type:"object",title:"jsonSchemaObject",properties:{func:{type:"object",title:"功能设置",isContainer:!1,properties:{a:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["a"]},style:{type:"object",title:"样式设置",isContainer:!1,properties:{b:{title:"单文本框",type:"input",default:"",description:"",placeholder:""}},propertyOrder:["b"]},data:{type:"data",title:"数据设置",isContainer:!1,properties:{c:{title:"单文本框",type:"input",default:"",description:"",placeholder:"",isRequired:!1}},propertyOrder:["c"]}},propertyOrder:["func","style","data"]},input:{title:"单文本框",type:"input",default:"",description:"",placeholder:""},boolean:{type:"boolean",title:"布尔值",default:!1,description:""},object:{type:"object",title:"对象Object",description:"",properties:{a:{type:"input",title:"单文本框",default:"",description:"",placeholder:""}},propertyOrder:["a"]},array:{type:"array",title:"数组Array",description:"",default:[],items:{type:"object",title:"数组项",description:"",properties:{name:{type:"input",title:"名字",default:"",description:"",placeholder:""}},propertyOrder:["name"]}},"empty-array":{type:"array",title:"数组Array",description:"",default:[],items:{type:"object",title:"数组项",description:"",properties:{}}},"empty-object":{type:"object",title:"对象Object",description:"",properties:{}},url:{type:"url",title:"链接地址url",default:"",description:"",placeholder:""},textarea:{type:"textarea",title:"多行文本框",default:"",description:"",placeholder:""},color:{type:"color",title:"颜色color",default:"#ffffff",description:""},image:{title:"图片",type:"image",default:"",description:"上传图片",imgWidth:200,imgHeight:200,imgRatioReadOnly:!0},number:{type:"number",title:"数量number",default:1,minimum:0,maximum:1e3,description:""},json:{title:"json数据",type:"json",default:"{}",description:""},codearea:{type:"codearea",title:"函数类型",placeholder:"请输入函数方法",default:'function func() { console.log("hello, world!"); }',description:"用于定义函数方法"},htmlarea:{title:"富文本",type:"htmlarea",placeholder:"请输入html代码片段",default:"<p>hello,world!</p>",description:"用于放置html代码片段"},"text-editor":{type:"text-editor",title:"富文本",default:"",description:"",placeholder:""},date:{type:"date",title:"日期Date",default:"",description:"",placeholder:""},"date-time":{type:"date-time",title:"日期时间",default:"",description:"",placeholder:""},time:{type:"time",title:"时间Time",default:"",description:"",placeholder:""},quantity:{type:"quantity",title:"单位计量",isContainer:!1,properties:{unit:{type:"number",title:"单位数值",default:50,minimum:0,maximum:1e3,description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},"box-style":{type:"box-style",title:"盒子模型",isContainer:!1,properties:{unit:{title:"单位数值",type:"input",default:"0",description:""},quantity:{type:"select",default:"px",options:[{label:"px",value:"px"},{label:"rem",value:"rem"},{label:"em",value:"em"},{label:"%",value:"%"}],title:"单位类型"}},propertyOrder:["unit","quantity"]},radio:{type:"radio",title:"单选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],default:"a",description:""},select:{type:"select",title:"下拉选择",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],default:"a",description:""},checkboxes:{type:"checkboxes",title:"多选",options:[{label:"选项a",value:"a"},{label:"选项b",value:"b"},{label:"选项c",value:"c"}],default:["a"],description:""},"dynamic-data":{type:"dynamic-data",title:"动态数据源",isContainer:!1,properties:{type:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据类型"},config:{title:"接口配置",type:"object",description:"用于存放接口的配置数据(url、请求参数等)",isRequired:!0,properties:{dataName:{default:"local",type:"select",options:[{label:"本地数据",value:"local"},{label:"接口数据",value:"remote"}],title:"数据类型"},body:{type:"object",title:"请求参数配置",description:"用于配置当前接口的请求参数数值",isRequired:!0},filter:{title:"过滤器函数体",type:"codearea",default:"return data;",description:"用于定义过滤接口数据",isRequired:!0}},propertyOrder:["dataName","body","filter"]},data:{title:"数据内容",type:"json",default:"{}",description:"用于存放DynamicData的数据内容",isRequired:!0},localFilter:{title:"过滤器",type:"codearea",default:"return data;",description:"用于定义过滤本地数据",isRequired:!0}},propertyOrder:["type","config","data","localFilter"]},datasource:y,event:f,"dynamic-config":{type:"dynamic-config",title:"动态配置",description:"",isContainer:!1,properties:{type:{type:"select",title:"数据来源",options:[{label:"模板直接设置",value:"DevDefaults"},{label:"mp后台配置",value:"ContentStaticConfig"},{label:"内容Meta数据",value:"Content"},{label:"全局配置数据",value:"RuntimeConst"},{label:"资源中心配置",value:"ResourceCenter"}],default:"DevDefaults",isConditionProp:!0,description:"目前支持的数据来源包括: 1)模版直接设置:在模版配置直接生效,支持直接输入或图片上传。 2)mp后台配置:选择mp后台配置后,属性会出现在mp后台中,支持属性描述的输入。 3)内容meta数据:支持内容meta数据的获取,页面meta数据。 4)全局配置数据:目前支持的全局配置包括:全局Tab配置及主题包配置。相关属性会挂载至:window.globalConst"},value:{title:"数据值",type:"input",default:"",description:"",placeholder:""},description:{title:"属性名称",type:"input",default:"",description:"",placeholder:""},valueType:{type:"radio",title:"配置方式",options:[{label:"填写",value:"string"},{label:"选择",value:"select"}],default:"string",isConditionProp:!0,description:""},range:{type:"select",title:"可选项",multiple:!0,options:[],description:"这里会使用value中的配置选项作为options"}},propertyOrder:["type","value","description","valueType","range"],showCodeViewBtn:!1},"sohu-source":{type:"sohu-source",title:"组件动态数据",description:"",isContainer:!1,properties:{mainConfig:{type:"object",title:"主要配置",description:"",isContainer:!1,properties:{type:{type:"select",title:"数据来源",isConditionProp:!0,options:[{label:"模板直接配置",value:"RuntimeDataSelfDefine"},{label:"mp后台配置",value:"ContentStaticConfig"},{label:"请求当前页面数据",value:"RuntimeDataSelfContent"},{label:"资源中心配置",value:"ResourceCenter"}],default:"ContentStaticConfig",description:""},description:{title:"数据源名称",type:"input",default:"",description:"",placeholder:""},dataType:{type:"radio",title:"请求方式",options:[{label:"批量请求",value:"FROMCIS"},{label:"组件内部请求",value:"FROMCOMPCIS"},{label:"不请求",value:"false"}],description:""},CONTENTID:{title:"数据源ID",type:"input",default:"",description:"",placeholder:""},CONTENTTYPE:{type:"select",title:"数据源类型",options:[{label:"channle",value:"channle"},{label:"topic",value:"topic"},{label:"block",value:"block"}],description:""}},propertyOrder:["type","description","dataType","CONTENTID","CONTENTTYPE"],showCodeViewBtn:!1},outConfig:{type:"object",title:"出流配置",description:"",isContainer:!1,properties:{PRO:{type:"select",title:"内容类型",options:[{label:"置顶+加精",value:"4"},{label:"长效置顶",value:"5"}],description:""},FEEDTYPE:{type:"select",title:"排序类型",options:[{label:"综合",value:"XTOPIC_SYNTHETICAL"},{label:"最新",value:"XTOPIC_LATEST"},{label:"相关",value:"XTOPIC_RELATED"}],description:""},VIEW:{type:"select",title:"数据裁剪",options:[{label:"相关推荐模式",value:"articleFeedMode"},{label:"文字链裁剪方式",value:"textMode"},{label:"短内容摘录方式",value:"excerptMode"},{label:"互动(点赞/评论)裁剪方式",value:"interactMode"},{label:"评论文字链裁剪方式",value:"commentTextMode"},{label:"摘录方式(无点赞)",value:"excerptCommentMode"},{label:"无限流卡片模式",value:"dynamicFeedMode"},{label:"时间线模式",value:"timeLineMode"},{label:"复合内容流模式",value:"multiFeedMode"},{label:"搜狐号推荐模式",value:"recommendFeedMode"},{label:"作者页内容流模式",value:"operateFeedMode"},{label:"标签内容流模式",value:"tagsFeedMode"},{label:"评论链裁剪方式",value:"commentMode"},{label:"标签摘录方式",value:"excerptTagsMode"},{label:"内容流模式",value:"feedMode"}],description:""},CONTENTCONTEXT:{type:"select",title:"mKey参数",options:[{label:"作者ID+栏目ID",value:"authorColumnId_${#authorColumnId}"},{label:"账号ID",value:"accountId_${#contentData_account_id}"},{label:"mkeyID",value:"mid_${#mkeyConst_mid}"},{label:"mkey名称",value:"mname_${#mkeyConst_mname}"},{label:"城市Code码",value:"cityCode_${#cityInfo_cityCode}"},{label:"城市名称",value:"cityName_${#cityInfo_cityName}"},{label:"焦点城市Code码",value:"focusCityCode_${#focusCityInfo_cityCode}"}],description:""},CONTENTPARAMS:{title:"动态参数",type:"json",default:"{}",description:"请填写JSON格式的参数",placeholder:""}},propertyOrder:["PRO","FEEDTYPE","VIEW","CONTENTCONTEXT","CONTENTPARAMS"],showCodeViewBtn:!1},otherConfig:{type:"object",title:"选配内容",description:"",isContainer:!1,properties:{SIZE:{type:"number",title:"容量",default:1,minimum:0,maximum:1e3,description:""},TITLE:{title:"标题",type:"input",default:"",description:"",placeholder:""},CODE:{title:"Code参数",type:"input",default:"",description:"",placeholder:""},URL:{type:"url",title:"跳转链接",default:"",description:"",placeholder:""}},propertyOrder:["SIZE","TITLE","URL","CODE"],showCodeViewBtn:!1}},propertyOrder:["mainConfig","otherConfig","outConfig"],showCodeViewBtn:!1},"sohu-event":{type:"sohu-event",title:"sohu组件事件",showCodeViewBtn:!1,isContainer:!1,properties:{globalEventMap:{type:"object",title:"全局事件Map",description:"",properties:{eventCode:{type:"input",title:"事件名称",default:"",description:"",placeholder:"",readOnly:!0}},propertyOrder:["eventCode"],showCodeViewBtn:!1},event:{type:"array",title:"监听事件",description:"当前组件监听事件列表",default:[],items:{type:"object",title:"数组项",description:"",properties:{name:{type:"input",title:"事件",default:"",description:"",placeholder:""},code:{title:"事件code",type:"input",default:"",description:"",placeholder:""},listenName:{title:"事件名称",type:"input",default:"",description:"",placeholder:""},desc:{title:"事件描述",type:"input",default:"",description:"",placeholder:""}},propertyOrder:["name","code","listenName","desc"]},showCodeViewBtn:!1}},propertyOrder:["globalEventMap","event"]}},g={on:{type:"event",title:"事件",isContainer:!1,properties:{type:{default:"on",type:"select",options:[{label:"on",value:"on"},{label:"emit",value:"emit"}],title:"事件类型"},register:{type:"input",default:"eventName",title:"注册事件",description:"用于输入注册事件的名称",placeholder:"请输入注册事件的名称"},actionFunc:{title:"执行函数",type:"codearea",default:"() => {}",description:""}},propertyOrder:["type","register","actionFunc"]},emit:f},h={local:y,remote:m};function O(e){return/^http[s]?:\/\/.*/.test(e)}function j(e){return"String"===Object.prototype.toString.call(e).slice(8,-1)}function C(e){return"number"==typeof e||"[object Number]"===Object.prototype.toString.call(e)}function x(e){return"Boolean"===Object.prototype.toString.call(e).slice(8,-1)}function T(e){return/^\d{4}-\d{2}-\d{2}$/.test(e)}function N(e){return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e)||/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)}function S(e){return/^\d{2}:\d{2}:\d{2}$/.test(e)||/^\d{2}:\d{2}$/.test(e)}function D(e){var t=!1;return"Array"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function E(e){if(!D(e))return!1;for(var t=0,r=e.length;t<r;t++)if(!j(e[t]))return!1;return!0}function R(e){var t=!1;return"Object"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function k(e){var t=!1;return v.quantity.properties.quantity.enum.indexOf(e)>=0&&(t=!0),t}function q(e){return/^#[0-9a-f]{6}$/.test(e)||/^#[0-9a-f]{3}$/.test(e)}function F(e){var t=!1;return"Function"===Object.prototype.toString.call(e).slice(8,-1)&&(t=!0),t}function w(e){var t;return t=e&&R(e)?function(e){var t;if(R(e)){var r=Object.keys(e);e.data&&e.filter&&2===r.length?t=D(e.data)||R(e.data)?i(h.local):i(h.remote):e.trigger&&e.eventData&&2===r.length?t=i(g.emit):e.register&&e.actionFunc&&2===r.length?t=i(g.on):e.quantity&&k(e.quantity)&&2===r.length?t=i(v.quantity):(t=i(v["empty-object"]),Object.keys(e).map((function(r){var i=e[r];t.properties[r]=w(i)})))}return t}(e):e&&D(e)?function(e){var t;if(e&&D(e))if(E(e)){(t=i(v.select)).items.enum=e;var r=t.items.enumextra.length,a=e.length;if(a>r)for(var n=r,o=a;n<o;n++)t.items.enumextra.push("选项"+e(n))}else{t=i(v["empty-array"]);var l=w(e[0]);t.items.properties=l.properties}return t}(e):function(e){var t="";if(x(e))t=i(v.boolean);else if(C(e))t=i(v.number);else if(O(e))t=i(v.url);else if(T(e))t=i(v.date);else if(N(e))t=i(v["date-time"]);else if(S(e))t=i(v.time);else if(q(e))t=i(v.color);else try{t=C(JSON.parse(e))?i(v.input):i(v.json)}catch(r){t=e&&e.length>30?i(v.textarea):i(v.input)}return t}(e),t}function I(e,t){var r=t||{};return R(e)&&"object"===getExpectType(e.type)&&e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map((function(t){var i=e.properties[t];r=M(i,r)})),r}function M(e,t){var r=!t,i=t||{};if(e&&"{}"!==JSON.stringify(e)){var a=e.type;"object"===a||"func"===a||"style"===a||"data"===a?(!r&&i.object?i.object+=1:r||(i.object=1),i=I(e,i)):"array"===a?(!r&&i.array?i.array+=1:r||(i.array=1),i=I(e=e.items,i)):!r&&i[a]?i[a]+=1:r||(i[a]=1)}return i}function P(e){var t=i(e);if(!t.title&&t.description&&(t.title=t.description),t.type||(t.type=t.format),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!n(t.default)||delete t.default,"radio"===t.type&&(t.type="string",t.enum&&t.enumextra&&(t.items={type:"string",enum:i(t.enum),enumextra:i(t.enumextra)},delete t.enum,delete t.enumextra)),"quantity"===t.type){var r=t.properties,a=i(v.quantity);if(r.quantity&&R(r.quantity)&&r.quantity.default){var o=r.quantity.default;a.properties.quantity.default="percent"===o?"%":o}t=a}if("datasource"===t.type){var l=t.properties,p=l.type&&l.type.default,u=l.data&&l.data.default,c=l.filter&&l.filter.default;"local"===p?(t=i(h.local)).properties.data.default=u?i(u):"{}":(t=i(h.remote)).properties.data.default=u?i(u):"http://xxx",t.properties.filter.default=c?i(c):"() => {}"}if("event"===t.type){var s=t.properties,d=s.type&&s.type.default;if("in"===d||"on"===d){var f=s.filter&&s.filter.default||"() => {}";t=i(g.on),s.actionFunc&&R(s.actionFunc)&&(t.properties.actionFunc.default=s.actionFunc.default||i(f))}else{var y=s.filter&&s.filter.default||"{}";t=i(g.emit),s.eventData&&R(s.eventData)&&(t.properties.eventData.default=s.eventData.default||i(y))}}return t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map((function(e){t.properties[e]=_(t.properties[e])}))),t.items&&(t.items=_(t.items)),t}function _(e){var t=i(e);return t.required||delete t.required,t.type&&t.type&&(t.type=t.type),"quantity"!==t.type&&"array"!==t.type&&"datasource"!==t.type&&"event"!==t.type&&"object"!==t.type||!n(t.default)||delete t.default,"radio"!==t.type&&"checkboxes"!==t.type&&"select"!==t.type||t.items&&t.items.enum&&t.items.enumextra&&(t.options=[],t.items.enum.forEach((function(e,r){t.options.push({label:t.items.enumextra[r]||e,value:e})})),delete t.items),t.properties&&(t.propertyOrder||(t.propertyOrder=Object.keys(t.properties)),t.propertyOrder.map((function(e){t.properties[e]=_(t.properties[e])}))),"array"===t.type&&t.items&&(t.items=_(t.items)),t}require("mobx");var $,B=(($={array:"array",boolean:"boolean","box-style":"object",codearea:"string",color:"string",datasource:"object",date:"string","date-time":"string","dynamic-data":"object",event:"object","func-body":"string",htmlarea:"string",image:"string",input:"string",json:"string",number:"number",object:"object",quantity:"object",radio:"string",select:"array"}).select="string",$.textarea="string",$["text-editor"]="string",$.time="string",$.url="string",$["dynamic-config"]="object",$["sohu-source"]="object",$["sohu-event"]="object",$);function L(e){return B[e]||e}function A(e,t){B[e]?console.warn("当前已经存在"+e+"("+B[e]+"),暂时不支持覆盖。"):B[e]=t}function V(e){var t=!0;if(!e)return t;var r=e.type;return("object"===r&&e.properties&&e.propertyOrder&&e.propertyOrder.length>0||"array"===r&&e.items&&e.items.properties&&e.items.propertyOrder&&e.items.propertyOrder.length>0||e.type&&"array"!==e.type&&"object"!==e.type||e.type)&&(t=!1),t}function J(e){var t=!1,r=e.lastUpdateTime,i=new Date("2024-10-05T00:01:00.691Z").getTime();return r&&new Date(r).getTime()>=i&&(t=!0),t}function K(e){var t=!1,r=L(e.type),i=void 0===e.isContainer||e.isContainer;return"object"===r&&i&&(t=!0),t}function U(e){var t=!0;return"object"===e.type&&e.propertyOrder&&e.properties?e.propertyOrder.map((function(r){var i=e.properties[r];"object"===e.type&&i.propertyOrder&&i.properties||(t=!1)})):t=!1,t}function X(e,t){var r=e.split("-"),i=t.split("-");return r.pop(),i.pop(),r.join("-")===i.join("-")}function Y(e,t){for(var r=e.split("-"),i=t.split("-"),a="before",n=0,o=(r.length>i.length?i:r).length;n<o;n+=1)Number(r[n])>Number(i[n])&&(a="after");return a}function W(e){var t=e.split("-");return t.pop(),t.join("-")}function Z(e){var t=e.split("-"),r=t.pop(),i=Number(r)+1;return t.push(""+i),t.join("-")}function z(e){var t=e.split("-"),r=t.pop();return[t.join("-"),r]}function H(e){var t=e.split("-"),r=t.pop();return t.push(Number(r)-1),t.join("-")}function Q(e){var t=e.split("-"),r=t.pop();return t.push(Number(r)+1),t.join("-")}function G(e,t){var r="",i=!1;return e.options&&e.options[0]&&(r=e.options[0].value,i=!0),(t||e.multiple)&&(r=i?[r]:[]),r}function ee(e,t){var r="",i=t;n(i)&&n(e.default)&&typeof i!=typeof e.default&&(i=void 0);var a=n(i)?i:e.default;switch(e.type){case"select":case"radio":r=a||G(e);break;case"checkboxes":r=a||G(e,!0);break;case"color":"#fff"!==a&&"#FFF"!==a||(a="#ffffff"),r=n(a)?a:"#ffffff";break;case"boolean":r=!!n(a)&&a;break;case"number":r=n(a)?a:1;break;case"json":var o="";if(R(a)||D(a))o=a;else if(F(a)||""===a)o={};else try{o=JSON.parse(a)}catch(e){o={}}r=o;break;default:r="input"===e.type&&"0"===e.default?a||e.default:n(a)?a:""}return r}function te(e,t){var r={},a=e.type;if(R(e)&&"object"===L(e.type)){var o=e,l=t;n(l)&&n(o.default)&&typeof l!=typeof o.default&&(l=void 0);var p=n(l)?l:o.default;"dynamic-data"===a?(r=i(b),p&&R(p)&&"{}"!==JSON.stringify(p)&&(r=Object.assign(r,p))):"datasource"===a?o.properties&&o.properties.type&&o.properties.type.default&&"local"===o.properties.type.default?(r={data:"{}",filter:"() => {}"},p&&p.data&&(r.data=p.data),p&&p.filter&&(r.filter=p.filter),"http://xxx"===r.data&&(r.data="{}")):(r={data:"http://xxx",filter:"() => {}"},p&&p.data&&(r.data=p.data),p&&p.filter&&(r.filter=p.filter),"{}"===r.data&&(r.data="http://xxx")):"event"===a?o.properties&&o.properties.type&&o.properties.type.default&&"emit"===o.properties.type.default?p&&"out"===p.type?r={trigger:p&&p.filter||"eventName",eventData:"{}"}:(r={trigger:"eventName",eventData:"{}"},p&&p.trigger&&(r.trigger=p.trigger),p&&p.eventData&&(r.eventData=p.eventData)):p&&"in"===p.type?r={register:"eventName",actionFunc:p&&p.filter||"() => {}"}:(r={register:"eventName",actionFunc:"() => {}"},p&&p.register&&(r.register=p.register),p&&p.actionFunc&&(r.actionFunc=p.actionFunc)):!1===e.isContainer&&p&&R(p)&&"{}"!==JSON.stringify(p)?r=Object.assign(r,p):e.properties&&(e.propertyOrder?e.propertyOrder:Object.keys(e.properties)).map((function(i){var a=e.properties[i],n=t&&t[i];switch(L(a.type)){case"array":r[i]=re(a,n);break;case"object":r[i]=te(a,n);break;default:r[i]=ee(a,n)}}))}return r}function re(e,t){var r=[];if(e&&"array"===L(e.type)){var i=t;n(i)&&n(e.default)&&typeof i!=typeof e.default&&(i=void 0);var a=n(i)?i:e.default;if("array"===L(e.type))if(D(a))a.map((function(t){r.push(te(e.items,t))}));else if(a)r=a;else{var o=te(e.items,a);r.push(o)}else r=n(a)?a:[]}return r}function ie(e,t){return"object"===L(e.type)?te(e,t):"array"===L(e.type)?re(e,t):ee(e,t)}var ae=v;function ne(e,t){var r=t||[];if(e&&"{}"!==JSON.stringify(e))if(R(e))if(e.type&&"remote"===e.type&&e.config&&R(e.config)&&e.config.dataName&&n(e.localFilter)&&n(e.data)){var i=e.config.body;if(i&&!R(i))try{i=JSON.parse(i)}catch(e){i={}}r.push({id:e.config.id,dataName:e.config.dataName,body:i})}else Object.keys(e).map((function(t){ne(e[t],r)}));else D(e)&&e.map((function(e){ne(e,r)}));return r}function oe(e,t){var r=t||"data";return e.split("-").map((function(e){r=/^\d+$/.test(e)?r+"["+e+"]":r+"."+e})),r}function le(e,t){var r=[];return R(e)?Object.keys(e).map((function(i){var a=e[i],n=t?t+"-"+i:i;R(a)||D(a)?r.push({title:i,value:n,key:n,children:le(a,n)}):r.push({title:i,value:n,key:n})})):D(e)&&e.map((function(e,i){var a=i.toString(),n=t?t+"-"+i:a;R(e)||D(e)?r.push({title:a,value:n,key:n,children:le(e,n)}):r.push({title:a,value:n,key:n})})),r}function pe(e){var t=e.split("-");return t.pop(),t.join("-")}function ue(e){var t=e.split("-"),r=t.pop();return[t.join("-"),r]}var ce=["key","enum","enumextra","items","input","boolean","number","color","url","textarea","text-editor","radio","select","checkboxes","date","date-time","time","json","codearea","htmlarea","quantity","box-style","dynamic-data","datasource","event","array","object"];return t}()}));
2
+ !(function (e, t) {
3
+ 'object' == typeof exports && 'object' == typeof module
4
+ ? (module.exports = t())
5
+ : 'function' == typeof define && define.amd
6
+ ? define([], t)
7
+ : 'object' == typeof exports
8
+ ? (exports.JSONUtils = t())
9
+ : (e.JSONUtils = t());
10
+ })(this, function () {
11
+ return (function () {
12
+ 'use strict';
13
+ var e = {
14
+ d: function (t, r) {
15
+ for (var i in r)
16
+ e.o(r, i) &&
17
+ !e.o(t, i) &&
18
+ Object.defineProperty(t, i, { enumerable: !0, get: r[i] });
19
+ },
20
+ o: function (e, t) {
21
+ return Object.prototype.hasOwnProperty.call(e, t);
22
+ },
23
+ r: function (e) {
24
+ 'undefined' != typeof Symbol &&
25
+ Symbol.toStringTag &&
26
+ Object.defineProperty(e, Symbol.toStringTag, { value: 'Module' }),
27
+ Object.defineProperty(e, '__esModule', { value: !0 });
28
+ },
29
+ },
30
+ t = {};
31
+ e.r(t),
32
+ e.d(t, {
33
+ DataSourceTypeList: function () {
34
+ return h;
35
+ },
36
+ EventTypeDataList: function () {
37
+ return g;
38
+ },
39
+ KeyWordList: function () {
40
+ return ce;
41
+ },
42
+ TypeDataList: function () {
43
+ return v;
44
+ },
45
+ dataRoute2dataPath: function () {
46
+ return oe;
47
+ },
48
+ dynamicDataAnalyzer: function () {
49
+ return ne;
50
+ },
51
+ getCurPosition: function () {
52
+ return Y;
53
+ },
54
+ getDefaultOptionVal: function () {
55
+ return G;
56
+ },
57
+ getExpectType: function () {
58
+ return L;
59
+ },
60
+ getJsonDataByKeyRoute: function () {
61
+ return l;
62
+ },
63
+ getNextIndexRoute: function () {
64
+ return Z;
65
+ },
66
+ getParentIndexRoute: function () {
67
+ return W;
68
+ },
69
+ getParentIndexRoute_CurIndex: function () {
70
+ return z;
71
+ },
72
+ getParentKeyRoute: function () {
73
+ return pe;
74
+ },
75
+ getParentKeyRoute_CurKey: function () {
76
+ return ue;
77
+ },
78
+ getSchemaByIndexRoute: function () {
79
+ return p;
80
+ },
81
+ getSchemaByKeyRoute: function () {
82
+ return u;
83
+ },
84
+ hasProperties: function () {
85
+ return n;
86
+ },
87
+ indexRoute2keyRoute: function () {
88
+ return c;
89
+ },
90
+ isArray: function () {
91
+ return D;
92
+ },
93
+ isBoolean: function () {
94
+ return x;
95
+ },
96
+ isColor: function () {
97
+ return q;
98
+ },
99
+ isContainerSchema: function () {
100
+ return K;
101
+ },
102
+ isDateStr: function () {
103
+ return T;
104
+ },
105
+ isDateTimeStr: function () {
106
+ return N;
107
+ },
108
+ isEmptySchema: function () {
109
+ return V;
110
+ },
111
+ isEqual: function () {
112
+ return a;
113
+ },
114
+ isFunction: function () {
115
+ return F;
116
+ },
117
+ isNewSchemaData: function () {
118
+ return J;
119
+ },
120
+ isNumber: function () {
121
+ return C;
122
+ },
123
+ isObject: function () {
124
+ return R;
125
+ },
126
+ isQuantity: function () {
127
+ return k;
128
+ },
129
+ isSameParent: function () {
130
+ return X;
131
+ },
132
+ isSelect: function () {
133
+ return E;
134
+ },
135
+ isString: function () {
136
+ return j;
137
+ },
138
+ isStructuredSchema: function () {
139
+ return U;
140
+ },
141
+ isTimeStr: function () {
142
+ return S;
143
+ },
144
+ isURL: function () {
145
+ return O;
146
+ },
147
+ json2schema: function () {
148
+ return w;
149
+ },
150
+ json2treeData: function () {
151
+ return le;
152
+ },
153
+ keyRoute2indexRoute: function () {
154
+ return s;
155
+ },
156
+ metaElemAnalyzer: function () {
157
+ return M;
158
+ },
159
+ moveBackward: function () {
160
+ return Q;
161
+ },
162
+ moveForward: function () {
163
+ return H;
164
+ },
165
+ objClone: function () {
166
+ return i;
167
+ },
168
+ oldSchemaToNewSchema: function () {
169
+ return _;
170
+ },
171
+ oldSchemaToNewSchemaV1: function () {
172
+ return P;
173
+ },
174
+ registerExpectType: function () {
175
+ return A;
176
+ },
177
+ schema2json: function () {
178
+ return ie;
179
+ },
180
+ schemaMetaList: function () {
181
+ return ae;
182
+ },
183
+ truncate: function () {
184
+ return o;
185
+ },
186
+ });
187
+ var r = require('lodash');
188
+ function i(e) {
189
+ return (0, r.cloneDeep)(e);
190
+ }
191
+ function a(e, t) {
192
+ return (0, r.isEqual)(e, t);
193
+ }
194
+ function n(e) {
195
+ var t = !1;
196
+ return null != e && (t = !0), t;
197
+ }
198
+ function o(e, t) {
199
+ return (0, r.truncate)(e, t);
200
+ }
201
+ function l(e, t, r) {
202
+ var a = t;
203
+ if ((r && (a = i(t)), e))
204
+ for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
205
+ var p = n[o];
206
+ p && (a = a && a[p]);
207
+ }
208
+ return a;
209
+ }
210
+ function p(e, t, r) {
211
+ var a = t;
212
+ if ((r && (a = i(t)), e))
213
+ for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
214
+ var p = n[o];
215
+ if (
216
+ '0' !== p ||
217
+ ('array' !== a.type &&
218
+ 'radio' !== a.type &&
219
+ 'select' !== a.type &&
220
+ 'checkboxes' !== a.type) ||
221
+ (!a.options && !a.items)
222
+ ) {
223
+ if (p) {
224
+ var u = '0';
225
+ a.propertyOrder
226
+ ? (u = a.propertyOrder[p])
227
+ : a.properties && (u = Object.keys(a.properties)[p]),
228
+ (a = a.properties[u]);
229
+ }
230
+ } else a = a.options || a.items;
231
+ }
232
+ return a;
233
+ }
234
+ function u(e, t, r) {
235
+ var a = t;
236
+ if ((r && (a = i(t)), e && a))
237
+ for (var n = e.split('-'), o = 0, l = n.length; o < l; o++) {
238
+ var p = n[o];
239
+ p && a.properties && (a = a.properties[p]);
240
+ }
241
+ return a;
242
+ }
243
+ function c(e, t) {
244
+ for (
245
+ var r = t, i = '', a = e.split('-'), n = 0, o = a.length;
246
+ n < o;
247
+ n++
248
+ ) {
249
+ var l = a[n];
250
+ if ('0' === l && r.items)
251
+ (r = r.items), (i = i ? i + '-items' : 'items');
252
+ else if ('0' === l && r.options)
253
+ (r = r.options), (i = i ? i + '-options' : 'options');
254
+ else if (l) {
255
+ var p = '0';
256
+ r.propertyOrder
257
+ ? (p = r.propertyOrder[l])
258
+ : r.properties && (p = Object.keys(r.properties)[l]),
259
+ (r = r.properties[p]),
260
+ (i = i ? i + '-' + p : p);
261
+ }
262
+ }
263
+ return i;
264
+ }
265
+ function s(e, t) {
266
+ for (
267
+ var r = t, i = '', a = e.split('-'), n = 0, o = a.length;
268
+ n < o;
269
+ n++
270
+ ) {
271
+ var l = a[n];
272
+ if (l) {
273
+ var p = -1;
274
+ r.propertyOrder
275
+ ? ((p = r.propertyOrder.indexOf(l)), (r = r.properties[l]))
276
+ : r.properties
277
+ ? ((p = Object.keys(r.properties).indexOf(l)),
278
+ (r = r.properties[l]))
279
+ : r.items
280
+ ? ((p = 0), (r = r.items))
281
+ : r.options && ((p = 0), (r = r.options)),
282
+ (i = i ? i + '-' + p : p.toString());
283
+ }
284
+ }
285
+ return i;
286
+ }
287
+ var d,
288
+ f = {
289
+ type: 'event',
290
+ title: '事件',
291
+ isContainer: !1,
292
+ properties: {
293
+ type: {
294
+ default: 'emit',
295
+ type: 'select',
296
+ options: [
297
+ { label: 'on', value: 'on' },
298
+ { label: 'emit', value: 'emit' },
299
+ ],
300
+ title: '事件类型',
301
+ },
302
+ trigger: {
303
+ type: 'input',
304
+ default: 'eventName',
305
+ title: '触发事件',
306
+ description: '用于输入触发事件的名称',
307
+ placeholder: '请输入触发事件的名称',
308
+ },
309
+ eventData: {
310
+ title: '事件数据',
311
+ type: 'json',
312
+ default: '{}',
313
+ description: '传递给触发事件的数据对象',
314
+ },
315
+ },
316
+ propertyOrder: ['type', 'trigger', 'eventData'],
317
+ },
318
+ y = {
319
+ type: 'datasource',
320
+ title: '数据源',
321
+ isContainer: !1,
322
+ properties: {
323
+ type: {
324
+ default: 'local',
325
+ type: 'select',
326
+ options: [
327
+ { label: '本地数据', value: 'local' },
328
+ { label: '接口数据', value: 'remote' },
329
+ ],
330
+ title: '数据源类型',
331
+ },
332
+ data: {
333
+ title: '本地json数据',
334
+ placeholder: '请输入静态json数据',
335
+ type: 'json',
336
+ default: '{}',
337
+ description: '用于设置本地的静态json数据',
338
+ isRequired: !0,
339
+ },
340
+ filter: {
341
+ title: '过滤器',
342
+ type: 'codearea',
343
+ default: '() => {}',
344
+ description: '用于定义过滤当前数据的函数',
345
+ isRequired: !0,
346
+ },
347
+ },
348
+ propertyOrder: ['type', 'data', 'filter'],
349
+ },
350
+ m =
351
+ (((d = { type: 'object' }).type = 'datasource'),
352
+ (d.title = '数据源'),
353
+ (d.isContainer = !1),
354
+ (d.properties = {
355
+ type: {
356
+ type: 'select',
357
+ default: 'remote',
358
+ options: [
359
+ { label: '本地数据', value: 'local' },
360
+ { label: '接口数据', value: 'remote' },
361
+ ],
362
+ title: '数据源类型',
363
+ },
364
+ data: {
365
+ type: 'url',
366
+ title: '远程json数据',
367
+ placeholder: '请输入远程json数据源地址',
368
+ default: 'http://xxx',
369
+ isRequired: !0,
370
+ description: '用于设置获取元素数据的请求地址',
371
+ },
372
+ filter: {
373
+ type: 'codearea',
374
+ title: '过滤器',
375
+ default: '() => {}',
376
+ description: '用于定义过滤当前数据的函数',
377
+ isRequired: !0,
378
+ },
379
+ }),
380
+ (d.propertyOrder = ['type', 'data', 'filter']),
381
+ d),
382
+ b = {
383
+ type: 'local',
384
+ config: { dataName: '', body: {}, filter: 'return data;' },
385
+ data: '{}',
386
+ localFilter: 'return data;',
387
+ },
388
+ v = {
389
+ jsonschema: {
390
+ type: 'object',
391
+ title: 'jsonSchemaObject',
392
+ properties: {
393
+ func: {
394
+ type: 'object',
395
+ title: '功能设置',
396
+ isContainer: !1,
397
+ properties: {
398
+ a: {
399
+ title: '单文本框',
400
+ type: 'input',
401
+ default: '',
402
+ description: '',
403
+ placeholder: '',
404
+ isRequired: !1,
405
+ },
406
+ },
407
+ propertyOrder: ['a'],
408
+ },
409
+ style: {
410
+ type: 'object',
411
+ title: '样式设置',
412
+ isContainer: !1,
413
+ properties: {
414
+ b: {
415
+ title: '单文本框',
416
+ type: 'input',
417
+ default: '',
418
+ description: '',
419
+ placeholder: '',
420
+ },
421
+ },
422
+ propertyOrder: ['b'],
423
+ },
424
+ data: {
425
+ type: 'data',
426
+ title: '数据设置',
427
+ isContainer: !1,
428
+ properties: {
429
+ c: {
430
+ title: '单文本框',
431
+ type: 'input',
432
+ default: '',
433
+ description: '',
434
+ placeholder: '',
435
+ isRequired: !1,
436
+ },
437
+ },
438
+ propertyOrder: ['c'],
439
+ },
440
+ },
441
+ propertyOrder: ['func', 'style', 'data'],
442
+ },
443
+ input: {
444
+ title: '单文本框',
445
+ type: 'input',
446
+ default: '',
447
+ description: '',
448
+ placeholder: '',
449
+ },
450
+ boolean: {
451
+ type: 'boolean',
452
+ title: '布尔值',
453
+ default: !1,
454
+ description: '',
455
+ },
456
+ object: {
457
+ type: 'object',
458
+ title: '对象Object',
459
+ description: '',
460
+ properties: {
461
+ a: {
462
+ type: 'input',
463
+ title: '单文本框',
464
+ default: '',
465
+ description: '',
466
+ placeholder: '',
467
+ },
468
+ },
469
+ propertyOrder: ['a'],
470
+ },
471
+ array: {
472
+ type: 'array',
473
+ title: '数组Array',
474
+ description: '',
475
+ default: [],
476
+ items: {
477
+ type: 'object',
478
+ title: '数组项',
479
+ description: '',
480
+ properties: {
481
+ name: {
482
+ type: 'input',
483
+ title: '名字',
484
+ default: '',
485
+ description: '',
486
+ placeholder: '',
487
+ },
488
+ },
489
+ propertyOrder: ['name'],
490
+ },
491
+ },
492
+ 'empty-array': {
493
+ type: 'array',
494
+ title: '数组Array',
495
+ description: '',
496
+ default: [],
497
+ items: {
498
+ type: 'object',
499
+ title: '数组项',
500
+ description: '',
501
+ properties: {},
502
+ },
503
+ },
504
+ 'empty-object': {
505
+ type: 'object',
506
+ title: '对象Object',
507
+ description: '',
508
+ properties: {},
509
+ },
510
+ url: {
511
+ type: 'url',
512
+ title: '链接地址url',
513
+ default: '',
514
+ description: '',
515
+ placeholder: '',
516
+ },
517
+ textarea: {
518
+ type: 'textarea',
519
+ title: '多行文本框',
520
+ default: '',
521
+ description: '',
522
+ placeholder: '',
523
+ },
524
+ color: {
525
+ type: 'color',
526
+ title: '颜色color',
527
+ default: '#ffffff',
528
+ description: '',
529
+ },
530
+ image: {
531
+ title: '图片',
532
+ type: 'image',
533
+ default: '',
534
+ description: '上传图片',
535
+ imgWidth: 200,
536
+ imgHeight: 200,
537
+ imgRatioReadOnly: !0,
538
+ },
539
+ number: {
540
+ type: 'number',
541
+ title: '数量number',
542
+ default: 1,
543
+ minimum: 0,
544
+ maximum: 1e3,
545
+ description: '',
546
+ },
547
+ json: {
548
+ title: 'json数据',
549
+ type: 'json',
550
+ default: '{}',
551
+ description: '',
552
+ },
553
+ codearea: {
554
+ type: 'codearea',
555
+ title: '函数类型',
556
+ placeholder: '请输入函数方法',
557
+ default: 'function func() { console.log("hello, world!"); }',
558
+ description: '用于定义函数方法',
559
+ },
560
+ htmlarea: {
561
+ title: '富文本',
562
+ type: 'htmlarea',
563
+ placeholder: '请输入html代码片段',
564
+ default: '<p>hello,world!</p>',
565
+ description: '用于放置html代码片段',
566
+ },
567
+ 'text-editor': {
568
+ type: 'text-editor',
569
+ title: '富文本',
570
+ default: '',
571
+ description: '',
572
+ placeholder: '',
573
+ },
574
+ date: {
575
+ type: 'date',
576
+ title: '日期Date',
577
+ default: '',
578
+ description: '',
579
+ placeholder: '',
580
+ },
581
+ 'date-time': {
582
+ type: 'date-time',
583
+ title: '日期时间',
584
+ default: '',
585
+ description: '',
586
+ placeholder: '',
587
+ },
588
+ time: {
589
+ type: 'time',
590
+ title: '时间Time',
591
+ default: '',
592
+ description: '',
593
+ placeholder: '',
594
+ },
595
+ quantity: {
596
+ type: 'quantity',
597
+ title: '单位计量',
598
+ isContainer: !1,
599
+ properties: {
600
+ unit: {
601
+ type: 'number',
602
+ title: '单位数值',
603
+ default: 50,
604
+ minimum: 0,
605
+ maximum: 1e3,
606
+ description: '',
607
+ },
608
+ quantity: {
609
+ type: 'select',
610
+ default: 'px',
611
+ options: [
612
+ { label: 'px', value: 'px' },
613
+ { label: 'rem', value: 'rem' },
614
+ { label: 'em', value: 'em' },
615
+ { label: '%', value: '%' },
616
+ ],
617
+ title: '单位类型',
618
+ },
619
+ },
620
+ propertyOrder: ['unit', 'quantity'],
621
+ },
622
+ 'box-style': {
623
+ type: 'box-style',
624
+ title: '盒子模型',
625
+ isContainer: !1,
626
+ properties: {
627
+ unit: {
628
+ title: '单位数值',
629
+ type: 'input',
630
+ default: '0',
631
+ description: '',
632
+ },
633
+ quantity: {
634
+ type: 'select',
635
+ default: 'px',
636
+ options: [
637
+ { label: 'px', value: 'px' },
638
+ { label: 'rem', value: 'rem' },
639
+ { label: 'em', value: 'em' },
640
+ { label: '%', value: '%' },
641
+ ],
642
+ title: '单位类型',
643
+ },
644
+ },
645
+ propertyOrder: ['unit', 'quantity'],
646
+ },
647
+ radio: {
648
+ type: 'radio',
649
+ title: '单选',
650
+ options: [
651
+ { label: '选项a', value: 'a' },
652
+ { label: '选项b', value: 'b' },
653
+ { label: '选项c', value: 'c' },
654
+ ],
655
+ default: 'a',
656
+ description: '',
657
+ },
658
+ select: {
659
+ type: 'select',
660
+ title: '下拉选择',
661
+ options: [
662
+ { label: '选项a', value: 'a' },
663
+ { label: '选项b', value: 'b' },
664
+ { label: '选项c', value: 'c' },
665
+ ],
666
+ default: 'a',
667
+ description: '',
668
+ },
669
+ checkboxes: {
670
+ type: 'checkboxes',
671
+ title: '多选',
672
+ options: [
673
+ { label: '选项a', value: 'a' },
674
+ { label: '选项b', value: 'b' },
675
+ { label: '选项c', value: 'c' },
676
+ ],
677
+ default: ['a'],
678
+ description: '',
679
+ },
680
+ 'dynamic-data': {
681
+ type: 'dynamic-data',
682
+ title: '动态数据源',
683
+ isContainer: !1,
684
+ properties: {
685
+ type: {
686
+ default: 'local',
687
+ type: 'select',
688
+ options: [
689
+ { label: '本地数据', value: 'local' },
690
+ { label: '接口数据', value: 'remote' },
691
+ ],
692
+ title: '数据类型',
693
+ },
694
+ config: {
695
+ title: '接口配置',
696
+ type: 'object',
697
+ description: '用于存放接口的配置数据(url、请求参数等)',
698
+ isRequired: !0,
699
+ properties: {
700
+ dataName: {
701
+ default: 'local',
702
+ type: 'select',
703
+ options: [
704
+ { label: '本地数据', value: 'local' },
705
+ { label: '接口数据', value: 'remote' },
706
+ ],
707
+ title: '数据类型',
708
+ },
709
+ body: {
710
+ type: 'object',
711
+ title: '请求参数配置',
712
+ description: '用于配置当前接口的请求参数数值',
713
+ isRequired: !0,
714
+ },
715
+ filter: {
716
+ title: '过滤器函数体',
717
+ type: 'codearea',
718
+ default: 'return data;',
719
+ description: '用于定义过滤接口数据',
720
+ isRequired: !0,
721
+ },
722
+ },
723
+ propertyOrder: ['dataName', 'body', 'filter'],
724
+ },
725
+ data: {
726
+ title: '数据内容',
727
+ type: 'json',
728
+ default: '{}',
729
+ description: '用于存放DynamicData的数据内容',
730
+ isRequired: !0,
731
+ },
732
+ localFilter: {
733
+ title: '过滤器',
734
+ type: 'codearea',
735
+ default: 'return data;',
736
+ description: '用于定义过滤本地数据',
737
+ isRequired: !0,
738
+ },
739
+ },
740
+ propertyOrder: ['type', 'config', 'data', 'localFilter'],
741
+ },
742
+ datasource: y,
743
+ event: f,
744
+ 'dynamic-config': {
745
+ type: 'dynamic-config',
746
+ title: '动态配置',
747
+ description: '',
748
+ isContainer: !1,
749
+ properties: {
750
+ type: {
751
+ type: 'select',
752
+ title: '数据来源',
753
+ options: [
754
+ { label: '模板直接设置', value: 'DevDefaults' },
755
+ { label: 'mp后台配置', value: 'ContentStaticConfig' },
756
+ { label: '内容Meta数据', value: 'Content' },
757
+ { label: '全局配置数据', value: 'RuntimeConst' },
758
+ { label: '资源中心配置', value: 'ResourceCenter' },
759
+ ],
760
+ default: 'DevDefaults',
761
+ isConditionProp: !0,
762
+ description:
763
+ '目前支持的数据来源包括: 1)模版直接设置:在模版配置直接生效,支持直接输入或图片上传。 2)mp后台配置:选择mp后台配置后,属性会出现在mp后台中,支持属性描述的输入。 3)内容meta数据:支持内容meta数据的获取,页面meta数据。 4)全局配置数据:目前支持的全局配置包括:全局Tab配置及主题包配置。相关属性会挂载至:window.globalConst',
764
+ },
765
+ value: {
766
+ title: '数据值',
767
+ type: 'input',
768
+ default: '',
769
+ description: '',
770
+ placeholder: '',
771
+ },
772
+ description: {
773
+ title: '属性名称',
774
+ type: 'input',
775
+ default: '',
776
+ description: '',
777
+ placeholder: '',
778
+ },
779
+ valueType: {
780
+ type: 'radio',
781
+ title: '配置方式',
782
+ options: [
783
+ { label: '填写', value: 'string' },
784
+ { label: '选择', value: 'select' },
785
+ ],
786
+ default: 'string',
787
+ isConditionProp: !0,
788
+ description: '',
789
+ },
790
+ range: {
791
+ type: 'select',
792
+ title: '可选项',
793
+ multiple: !0,
794
+ options: [],
795
+ description: '这里会使用value中的配置选项作为options',
796
+ },
797
+ },
798
+ propertyOrder: ['type', 'value', 'description', 'valueType', 'range'],
799
+ showCodeViewBtn: !1,
800
+ },
801
+ 'sohu-source': {
802
+ type: 'sohu-source',
803
+ title: '组件动态数据',
804
+ description: '',
805
+ isContainer: !1,
806
+ properties: {
807
+ mainConfig: {
808
+ type: 'object',
809
+ title: '主要配置',
810
+ description: '',
811
+ isContainer: !1,
812
+ properties: {
813
+ type: {
814
+ type: 'select',
815
+ title: '数据来源',
816
+ isConditionProp: !0,
817
+ options: [
818
+ { label: '模板直接配置', value: 'RuntimeDataSelfDefine' },
819
+ { label: 'mp后台配置', value: 'ContentStaticConfig' },
820
+ {
821
+ label: '请求当前页面数据',
822
+ value: 'RuntimeDataSelfContent',
823
+ },
824
+ { label: '资源中心配置', value: 'ResourceCenter' },
825
+ ],
826
+ default: 'ContentStaticConfig',
827
+ description: '',
828
+ },
829
+ description: {
830
+ title: '数据源名称',
831
+ type: 'input',
832
+ default: '',
833
+ description: '',
834
+ placeholder: '',
835
+ },
836
+ dataType: {
837
+ type: 'radio',
838
+ title: '请求方式',
839
+ options: [
840
+ { label: '批量请求', value: 'FROMCIS' },
841
+ { label: '组件内部请求', value: 'FROMCOMPCIS' },
842
+ { label: '不请求', value: 'false' },
843
+ ],
844
+ description: '',
845
+ },
846
+ CONTENTID: {
847
+ title: '数据源ID',
848
+ type: 'input',
849
+ default: '',
850
+ description: '',
851
+ placeholder: '',
852
+ },
853
+ CONTENTTYPE: {
854
+ type: 'select',
855
+ title: '数据源类型',
856
+ options: [
857
+ { label: 'channle', value: 'channle' },
858
+ { label: 'topic', value: 'topic' },
859
+ { label: 'block', value: 'block' },
860
+ ],
861
+ description: '',
862
+ },
863
+ },
864
+ propertyOrder: [
865
+ 'type',
866
+ 'description',
867
+ 'dataType',
868
+ 'CONTENTID',
869
+ 'CONTENTTYPE',
870
+ ],
871
+ showCodeViewBtn: !1,
872
+ },
873
+ outConfig: {
874
+ type: 'object',
875
+ title: '出流配置',
876
+ description: '',
877
+ isContainer: !1,
878
+ properties: {
879
+ PRO: {
880
+ type: 'select',
881
+ title: '内容类型',
882
+ options: [
883
+ { label: '置顶+加精', value: '4' },
884
+ { label: '长效置顶', value: '5' },
885
+ ],
886
+ description: '',
887
+ },
888
+ FEEDTYPE: {
889
+ type: 'select',
890
+ title: '排序类型',
891
+ options: [
892
+ { label: '综合', value: 'XTOPIC_SYNTHETICAL' },
893
+ { label: '最新', value: 'XTOPIC_LATEST' },
894
+ { label: '相关', value: 'XTOPIC_RELATED' },
895
+ ],
896
+ description: '',
897
+ },
898
+ VIEW: {
899
+ type: 'select',
900
+ title: '数据裁剪',
901
+ options: [
902
+ { label: '相关推荐模式', value: 'articleFeedMode' },
903
+ { label: '文字链裁剪方式', value: 'textMode' },
904
+ { label: '短内容摘录方式', value: 'excerptMode' },
905
+ {
906
+ label: '互动(点赞/评论)裁剪方式',
907
+ value: 'interactMode',
908
+ },
909
+ { label: '评论文字链裁剪方式', value: 'commentTextMode' },
910
+ {
911
+ label: '摘录方式(无点赞)',
912
+ value: 'excerptCommentMode',
913
+ },
914
+ { label: '无限流卡片模式', value: 'dynamicFeedMode' },
915
+ { label: '时间线模式', value: 'timeLineMode' },
916
+ { label: '复合内容流模式', value: 'multiFeedMode' },
917
+ { label: '搜狐号推荐模式', value: 'recommendFeedMode' },
918
+ { label: '作者页内容流模式', value: 'operateFeedMode' },
919
+ { label: '标签内容流模式', value: 'tagsFeedMode' },
920
+ { label: '评论链裁剪方式', value: 'commentMode' },
921
+ { label: '标签摘录方式', value: 'excerptTagsMode' },
922
+ { label: '内容流模式', value: 'feedMode' },
923
+ ],
924
+ description: '',
925
+ },
926
+ CONTENTCONTEXT: {
927
+ type: 'select',
928
+ title: 'mKey参数',
929
+ options: [
930
+ {
931
+ label: '作者ID+栏目ID',
932
+ value: 'authorColumnId_${#authorColumnId}',
933
+ },
934
+ {
935
+ label: '账号ID',
936
+ value: 'accountId_${#contentData_account_id}',
937
+ },
938
+ { label: 'mkeyID', value: 'mid_${#mkeyConst_mid}' },
939
+ { label: 'mkey名称', value: 'mname_${#mkeyConst_mname}' },
940
+ {
941
+ label: '城市Code码',
942
+ value: 'cityCode_${#cityInfo_cityCode}',
943
+ },
944
+ {
945
+ label: '城市名称',
946
+ value: 'cityName_${#cityInfo_cityName}',
947
+ },
948
+ {
949
+ label: '焦点城市Code码',
950
+ value: 'focusCityCode_${#focusCityInfo_cityCode}',
951
+ },
952
+ ],
953
+ description: '',
954
+ },
955
+ CONTENTPARAMS: {
956
+ title: '动态参数',
957
+ type: 'json',
958
+ default: '{}',
959
+ description: '请填写JSON格式的参数',
960
+ placeholder: '',
961
+ },
962
+ },
963
+ propertyOrder: [
964
+ 'PRO',
965
+ 'FEEDTYPE',
966
+ 'VIEW',
967
+ 'CONTENTCONTEXT',
968
+ 'CONTENTPARAMS',
969
+ ],
970
+ showCodeViewBtn: !1,
971
+ },
972
+ otherConfig: {
973
+ type: 'object',
974
+ title: '选配内容',
975
+ description: '',
976
+ isContainer: !1,
977
+ properties: {
978
+ SIZE: {
979
+ type: 'number',
980
+ title: '容量',
981
+ default: 1,
982
+ minimum: 0,
983
+ maximum: 1e3,
984
+ description: '',
985
+ },
986
+ TITLE: {
987
+ title: '标题',
988
+ type: 'input',
989
+ default: '',
990
+ description: '',
991
+ placeholder: '',
992
+ },
993
+ CODE: {
994
+ title: 'Code参数',
995
+ type: 'input',
996
+ default: '',
997
+ description: '',
998
+ placeholder: '',
999
+ },
1000
+ URL: {
1001
+ type: 'url',
1002
+ title: '跳转链接',
1003
+ default: '',
1004
+ description: '',
1005
+ placeholder: '',
1006
+ },
1007
+ },
1008
+ propertyOrder: ['SIZE', 'TITLE', 'URL', 'CODE'],
1009
+ showCodeViewBtn: !1,
1010
+ },
1011
+ },
1012
+ propertyOrder: ['mainConfig', 'otherConfig', 'outConfig'],
1013
+ showCodeViewBtn: !1,
1014
+ },
1015
+ 'sohu-event': {
1016
+ type: 'sohu-event',
1017
+ title: 'sohu组件事件',
1018
+ showCodeViewBtn: !1,
1019
+ isContainer: !1,
1020
+ properties: {
1021
+ globalEventMap: {
1022
+ type: 'object',
1023
+ title: '全局事件Map',
1024
+ description: '',
1025
+ properties: {
1026
+ eventCode: {
1027
+ type: 'input',
1028
+ title: '事件名称',
1029
+ default: '',
1030
+ description: '',
1031
+ placeholder: '',
1032
+ readOnly: !0,
1033
+ },
1034
+ },
1035
+ propertyOrder: ['eventCode'],
1036
+ showCodeViewBtn: !1,
1037
+ },
1038
+ event: {
1039
+ type: 'array',
1040
+ title: '监听事件',
1041
+ description: '当前组件监听事件列表',
1042
+ default: [],
1043
+ items: {
1044
+ type: 'object',
1045
+ title: '数组项',
1046
+ description: '',
1047
+ properties: {
1048
+ name: {
1049
+ type: 'input',
1050
+ title: '事件',
1051
+ default: '',
1052
+ description: '',
1053
+ placeholder: '',
1054
+ },
1055
+ code: {
1056
+ title: '事件code',
1057
+ type: 'input',
1058
+ default: '',
1059
+ description: '',
1060
+ placeholder: '',
1061
+ },
1062
+ listenName: {
1063
+ title: '事件名称',
1064
+ type: 'input',
1065
+ default: '',
1066
+ description: '',
1067
+ placeholder: '',
1068
+ },
1069
+ desc: {
1070
+ title: '事件描述',
1071
+ type: 'input',
1072
+ default: '',
1073
+ description: '',
1074
+ placeholder: '',
1075
+ },
1076
+ },
1077
+ propertyOrder: ['name', 'code', 'listenName', 'desc'],
1078
+ },
1079
+ showCodeViewBtn: !1,
1080
+ },
1081
+ },
1082
+ propertyOrder: ['globalEventMap', 'event'],
1083
+ },
1084
+ },
1085
+ g = {
1086
+ on: {
1087
+ type: 'event',
1088
+ title: '事件',
1089
+ isContainer: !1,
1090
+ properties: {
1091
+ type: {
1092
+ default: 'on',
1093
+ type: 'select',
1094
+ options: [
1095
+ { label: 'on', value: 'on' },
1096
+ { label: 'emit', value: 'emit' },
1097
+ ],
1098
+ title: '事件类型',
1099
+ },
1100
+ register: {
1101
+ type: 'input',
1102
+ default: 'eventName',
1103
+ title: '注册事件',
1104
+ description: '用于输入注册事件的名称',
1105
+ placeholder: '请输入注册事件的名称',
1106
+ },
1107
+ actionFunc: {
1108
+ title: '执行函数',
1109
+ type: 'codearea',
1110
+ default: '() => {}',
1111
+ description: '',
1112
+ },
1113
+ },
1114
+ propertyOrder: ['type', 'register', 'actionFunc'],
1115
+ },
1116
+ emit: f,
1117
+ },
1118
+ h = { local: y, remote: m };
1119
+ function O(e) {
1120
+ return /^http[s]?:\/\/.*/.test(e);
1121
+ }
1122
+ function j(e) {
1123
+ return 'String' === Object.prototype.toString.call(e).slice(8, -1);
1124
+ }
1125
+ function C(e) {
1126
+ return (
1127
+ 'number' == typeof e ||
1128
+ '[object Number]' === Object.prototype.toString.call(e)
1129
+ );
1130
+ }
1131
+ function x(e) {
1132
+ return 'Boolean' === Object.prototype.toString.call(e).slice(8, -1);
1133
+ }
1134
+ function T(e) {
1135
+ return /^\d{4}-\d{2}-\d{2}$/.test(e);
1136
+ }
1137
+ function N(e) {
1138
+ return (
1139
+ /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}$/.test(e) ||
1140
+ /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/.test(e)
1141
+ );
1142
+ }
1143
+ function S(e) {
1144
+ return /^\d{2}:\d{2}:\d{2}$/.test(e) || /^\d{2}:\d{2}$/.test(e);
1145
+ }
1146
+ function D(e) {
1147
+ var t = !1;
1148
+ return (
1149
+ 'Array' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0),
1150
+ t
1151
+ );
1152
+ }
1153
+ function E(e) {
1154
+ if (!D(e)) return !1;
1155
+ for (var t = 0, r = e.length; t < r; t++) if (!j(e[t])) return !1;
1156
+ return !0;
1157
+ }
1158
+ function R(e) {
1159
+ var t = !1;
1160
+ return (
1161
+ 'Object' === Object.prototype.toString.call(e).slice(8, -1) && (t = !0),
1162
+ t
1163
+ );
1164
+ }
1165
+ function k(e) {
1166
+ var t = !1;
1167
+ return v.quantity.properties.quantity.enum.indexOf(e) >= 0 && (t = !0), t;
1168
+ }
1169
+ function q(e) {
1170
+ return /^#[0-9a-f]{6}$/.test(e) || /^#[0-9a-f]{3}$/.test(e);
1171
+ }
1172
+ function F(e) {
1173
+ var t = !1;
1174
+ return (
1175
+ 'Function' === Object.prototype.toString.call(e).slice(8, -1) &&
1176
+ (t = !0),
1177
+ t
1178
+ );
1179
+ }
1180
+ function w(e) {
1181
+ var t;
1182
+ return (
1183
+ (t =
1184
+ e && R(e)
1185
+ ? (function (e) {
1186
+ var t;
1187
+ if (R(e)) {
1188
+ var r = Object.keys(e);
1189
+ e.data && e.filter && 2 === r.length
1190
+ ? (t = D(e.data) || R(e.data) ? i(h.local) : i(h.remote))
1191
+ : e.trigger && e.eventData && 2 === r.length
1192
+ ? (t = i(g.emit))
1193
+ : e.register && e.actionFunc && 2 === r.length
1194
+ ? (t = i(g.on))
1195
+ : e.quantity && k(e.quantity) && 2 === r.length
1196
+ ? (t = i(v.quantity))
1197
+ : ((t = i(v['empty-object'])),
1198
+ Object.keys(e).map(function (r) {
1199
+ var i = e[r];
1200
+ t.properties[r] = w(i);
1201
+ }));
1202
+ }
1203
+ return t;
1204
+ })(e)
1205
+ : e && D(e)
1206
+ ? (function (e) {
1207
+ var t;
1208
+ if (e && D(e))
1209
+ if (E(e)) {
1210
+ (t = i(v.select)).items.enum = e;
1211
+ var r = t.items.enumextra.length,
1212
+ a = e.length;
1213
+ if (a > r)
1214
+ for (var n = r, o = a; n < o; n++)
1215
+ t.items.enumextra.push('选项' + e(n));
1216
+ } else {
1217
+ t = i(v['empty-array']);
1218
+ var l = w(e[0]);
1219
+ t.items.properties = l.properties;
1220
+ }
1221
+ return t;
1222
+ })(e)
1223
+ : (function (e) {
1224
+ var t = '';
1225
+ if (x(e)) t = i(v.boolean);
1226
+ else if (C(e)) t = i(v.number);
1227
+ else if (O(e)) t = i(v.url);
1228
+ else if (T(e)) t = i(v.date);
1229
+ else if (N(e)) t = i(v['date-time']);
1230
+ else if (S(e)) t = i(v.time);
1231
+ else if (q(e)) t = i(v.color);
1232
+ else
1233
+ try {
1234
+ t = C(JSON.parse(e)) ? i(v.input) : i(v.json);
1235
+ } catch (r) {
1236
+ t = e && e.length > 30 ? i(v.textarea) : i(v.input);
1237
+ }
1238
+ return t;
1239
+ })(e)),
1240
+ t
1241
+ );
1242
+ }
1243
+ function I(e, t) {
1244
+ var r = t || {};
1245
+ return (
1246
+ R(e) &&
1247
+ 'object' === getExpectType(e.type) &&
1248
+ e.properties &&
1249
+ (e.propertyOrder ? e.propertyOrder : Object.keys(e.properties)).map(
1250
+ function (t) {
1251
+ var i = e.properties[t];
1252
+ r = M(i, r);
1253
+ },
1254
+ ),
1255
+ r
1256
+ );
1257
+ }
1258
+ function M(e, t) {
1259
+ var r = !t,
1260
+ i = t || {};
1261
+ if (e && '{}' !== JSON.stringify(e)) {
1262
+ var a = e.type;
1263
+ 'object' === a || 'func' === a || 'style' === a || 'data' === a
1264
+ ? (!r && i.object ? (i.object += 1) : r || (i.object = 1),
1265
+ (i = I(e, i)))
1266
+ : 'array' === a
1267
+ ? (!r && i.array ? (i.array += 1) : r || (i.array = 1),
1268
+ (i = I((e = e.items), i)))
1269
+ : !r && i[a]
1270
+ ? (i[a] += 1)
1271
+ : r || (i[a] = 1);
1272
+ }
1273
+ return i;
1274
+ }
1275
+ function P(e) {
1276
+ var t = i(e);
1277
+ if (
1278
+ (!t.title && t.description && (t.title = t.description),
1279
+ t.type || (t.type = t.format),
1280
+ ('quantity' !== t.type &&
1281
+ 'array' !== t.type &&
1282
+ 'datasource' !== t.type &&
1283
+ 'event' !== t.type &&
1284
+ 'object' !== t.type) ||
1285
+ !n(t.default) ||
1286
+ delete t.default,
1287
+ 'radio' === t.type &&
1288
+ ((t.type = 'string'),
1289
+ t.enum &&
1290
+ t.enumextra &&
1291
+ ((t.items = {
1292
+ type: 'string',
1293
+ enum: i(t.enum),
1294
+ enumextra: i(t.enumextra),
1295
+ }),
1296
+ delete t.enum,
1297
+ delete t.enumextra)),
1298
+ 'quantity' === t.type)
1299
+ ) {
1300
+ var r = t.properties,
1301
+ a = i(v.quantity);
1302
+ if (r.quantity && R(r.quantity) && r.quantity.default) {
1303
+ var o = r.quantity.default;
1304
+ a.properties.quantity.default = 'percent' === o ? '%' : o;
1305
+ }
1306
+ t = a;
1307
+ }
1308
+ if ('datasource' === t.type) {
1309
+ var l = t.properties,
1310
+ p = l.type && l.type.default,
1311
+ u = l.data && l.data.default,
1312
+ c = l.filter && l.filter.default;
1313
+ 'local' === p
1314
+ ? ((t = i(h.local)).properties.data.default = u ? i(u) : '{}')
1315
+ : ((t = i(h.remote)).properties.data.default = u
1316
+ ? i(u)
1317
+ : 'http://xxx'),
1318
+ (t.properties.filter.default = c ? i(c) : '() => {}');
1319
+ }
1320
+ if ('event' === t.type) {
1321
+ var s = t.properties,
1322
+ d = s.type && s.type.default;
1323
+ if ('in' === d || 'on' === d) {
1324
+ var f = (s.filter && s.filter.default) || '() => {}';
1325
+ (t = i(g.on)),
1326
+ s.actionFunc &&
1327
+ R(s.actionFunc) &&
1328
+ (t.properties.actionFunc.default = s.actionFunc.default || i(f));
1329
+ } else {
1330
+ var y = (s.filter && s.filter.default) || '{}';
1331
+ (t = i(g.emit)),
1332
+ s.eventData &&
1333
+ R(s.eventData) &&
1334
+ (t.properties.eventData.default = s.eventData.default || i(y));
1335
+ }
1336
+ }
1337
+ return (
1338
+ t.properties &&
1339
+ (t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
1340
+ t.propertyOrder.map(function (e) {
1341
+ t.properties[e] = _(t.properties[e]);
1342
+ })),
1343
+ t.items && (t.items = _(t.items)),
1344
+ t
1345
+ );
1346
+ }
1347
+ function _(e) {
1348
+ var t = i(e);
1349
+ return (
1350
+ t.required || delete t.required,
1351
+ t.type && t.type && (t.type = t.type),
1352
+ ('quantity' !== t.type &&
1353
+ 'array' !== t.type &&
1354
+ 'datasource' !== t.type &&
1355
+ 'event' !== t.type &&
1356
+ 'object' !== t.type) ||
1357
+ !n(t.default) ||
1358
+ delete t.default,
1359
+ ('radio' !== t.type &&
1360
+ 'checkboxes' !== t.type &&
1361
+ 'select' !== t.type) ||
1362
+ (t.items &&
1363
+ t.items.enum &&
1364
+ t.items.enumextra &&
1365
+ ((t.options = []),
1366
+ t.items.enum.forEach(function (e, r) {
1367
+ t.options.push({ label: t.items.enumextra[r] || e, value: e });
1368
+ }),
1369
+ delete t.items)),
1370
+ t.properties &&
1371
+ (t.propertyOrder || (t.propertyOrder = Object.keys(t.properties)),
1372
+ t.propertyOrder.map(function (e) {
1373
+ t.properties[e] = _(t.properties[e]);
1374
+ })),
1375
+ 'array' === t.type && t.items && (t.items = _(t.items)),
1376
+ t
1377
+ );
1378
+ }
1379
+ require('mobx');
1380
+ var $,
1381
+ B =
1382
+ ((($ = {
1383
+ array: 'array',
1384
+ boolean: 'boolean',
1385
+ 'box-style': 'object',
1386
+ codearea: 'string',
1387
+ color: 'string',
1388
+ datasource: 'object',
1389
+ date: 'string',
1390
+ 'date-time': 'string',
1391
+ 'dynamic-data': 'object',
1392
+ event: 'object',
1393
+ 'func-body': 'string',
1394
+ htmlarea: 'string',
1395
+ image: 'string',
1396
+ input: 'string',
1397
+ json: 'string',
1398
+ number: 'number',
1399
+ object: 'object',
1400
+ quantity: 'object',
1401
+ radio: 'string',
1402
+ select: 'array',
1403
+ }).select = 'string'),
1404
+ ($.textarea = 'string'),
1405
+ ($['text-editor'] = 'string'),
1406
+ ($.time = 'string'),
1407
+ ($.url = 'string'),
1408
+ ($['dynamic-config'] = 'object'),
1409
+ ($['sohu-source'] = 'object'),
1410
+ ($['sohu-event'] = 'object'),
1411
+ $);
1412
+ function L(e) {
1413
+ return B[e] || e;
1414
+ }
1415
+ function A(e, t) {
1416
+ B[e]
1417
+ ? console.warn('当前已经存在' + e + '(' + B[e] + '),暂时不支持覆盖。')
1418
+ : (B[e] = t);
1419
+ }
1420
+ function V(e) {
1421
+ var t = !0;
1422
+ if (!e) return t;
1423
+ var r = e.type;
1424
+ return (
1425
+ (('object' === r &&
1426
+ e.properties &&
1427
+ e.propertyOrder &&
1428
+ e.propertyOrder.length > 0) ||
1429
+ ('array' === r &&
1430
+ e.items &&
1431
+ e.items.properties &&
1432
+ e.items.propertyOrder &&
1433
+ e.items.propertyOrder.length > 0) ||
1434
+ (e.type && 'array' !== e.type && 'object' !== e.type) ||
1435
+ e.type) &&
1436
+ (t = !1),
1437
+ t
1438
+ );
1439
+ }
1440
+ function J(e) {
1441
+ var t = !1,
1442
+ r = e.lastUpdateTime,
1443
+ i = new Date('2024-10-05T00:01:00.691Z').getTime();
1444
+ return r && new Date(r).getTime() >= i && (t = !0), t;
1445
+ }
1446
+ function K(e) {
1447
+ var t = !1,
1448
+ r = L(e.type),
1449
+ i = void 0 === e.isContainer || e.isContainer;
1450
+ return 'object' === r && i && (t = !0), t;
1451
+ }
1452
+ function U(e) {
1453
+ var t = !0;
1454
+ return (
1455
+ 'object' === e.type && e.propertyOrder && e.properties
1456
+ ? e.propertyOrder.map(function (r) {
1457
+ var i = e.properties[r];
1458
+ ('object' === e.type && i.propertyOrder && i.properties) ||
1459
+ (t = !1);
1460
+ })
1461
+ : (t = !1),
1462
+ t
1463
+ );
1464
+ }
1465
+ function X(e, t) {
1466
+ var r = e.split('-'),
1467
+ i = t.split('-');
1468
+ return r.pop(), i.pop(), r.join('-') === i.join('-');
1469
+ }
1470
+ function Y(e, t) {
1471
+ for (
1472
+ var r = e.split('-'),
1473
+ i = t.split('-'),
1474
+ a = 'before',
1475
+ n = 0,
1476
+ o = (r.length > i.length ? i : r).length;
1477
+ n < o;
1478
+ n += 1
1479
+ )
1480
+ Number(r[n]) > Number(i[n]) && (a = 'after');
1481
+ return a;
1482
+ }
1483
+ function W(e) {
1484
+ var t = e.split('-');
1485
+ return t.pop(), t.join('-');
1486
+ }
1487
+ function Z(e) {
1488
+ var t = e.split('-'),
1489
+ r = t.pop(),
1490
+ i = Number(r) + 1;
1491
+ return t.push('' + i), t.join('-');
1492
+ }
1493
+ function z(e) {
1494
+ var t = e.split('-'),
1495
+ r = t.pop();
1496
+ return [t.join('-'), r];
1497
+ }
1498
+ function H(e) {
1499
+ var t = e.split('-'),
1500
+ r = t.pop();
1501
+ return t.push(Number(r) - 1), t.join('-');
1502
+ }
1503
+ function Q(e) {
1504
+ var t = e.split('-'),
1505
+ r = t.pop();
1506
+ return t.push(Number(r) + 1), t.join('-');
1507
+ }
1508
+ function G(e, t) {
1509
+ var r = '',
1510
+ i = !1;
1511
+ return (
1512
+ e.options && e.options[0] && ((r = e.options[0].value), (i = !0)),
1513
+ (t || e.multiple) && (r = i ? [r] : []),
1514
+ r
1515
+ );
1516
+ }
1517
+ function ee(e, t) {
1518
+ var r = '',
1519
+ i = t;
1520
+ n(i) && n(e.default) && typeof i != typeof e.default && (i = void 0);
1521
+ var a = n(i) ? i : e.default;
1522
+ switch (e.type) {
1523
+ case 'select':
1524
+ case 'radio':
1525
+ r = a || G(e);
1526
+ break;
1527
+ case 'checkboxes':
1528
+ r = a || G(e, !0);
1529
+ break;
1530
+ case 'color':
1531
+ ('#fff' !== a && '#FFF' !== a) || (a = '#ffffff'),
1532
+ (r = n(a) ? a : '#ffffff');
1533
+ break;
1534
+ case 'boolean':
1535
+ r = !!n(a) && a;
1536
+ break;
1537
+ case 'number':
1538
+ r = n(a) ? a : void 0;
1539
+ break;
1540
+ case 'json':
1541
+ var o = '';
1542
+ if (R(a) || D(a)) o = a;
1543
+ else if (F(a) || '' === a) o = {};
1544
+ else
1545
+ try {
1546
+ o = JSON.parse(a);
1547
+ } catch (e) {
1548
+ o = {};
1549
+ }
1550
+ r = o;
1551
+ break;
1552
+ default:
1553
+ r =
1554
+ 'input' === e.type && '0' === e.default
1555
+ ? a || e.default
1556
+ : n(a)
1557
+ ? a
1558
+ : void 0;
1559
+ }
1560
+ return r;
1561
+ }
1562
+ function te(e, t) {
1563
+ var r = {},
1564
+ a = e.type;
1565
+ if (R(e) && 'object' === L(e.type)) {
1566
+ var o = e,
1567
+ l = t;
1568
+ n(l) && n(o.default) && typeof l != typeof o.default && (l = void 0);
1569
+ var p = n(l) ? l : o.default;
1570
+ 'dynamic-data' === a
1571
+ ? ((r = i(b)),
1572
+ p &&
1573
+ R(p) &&
1574
+ '{}' !== JSON.stringify(p) &&
1575
+ (r = Object.assign(r, p)))
1576
+ : 'datasource' === a
1577
+ ? o.properties &&
1578
+ o.properties.type &&
1579
+ o.properties.type.default &&
1580
+ 'local' === o.properties.type.default
1581
+ ? ((r = { data: '{}', filter: '() => {}' }),
1582
+ p && p.data && (r.data = p.data),
1583
+ p && p.filter && (r.filter = p.filter),
1584
+ 'http://xxx' === r.data && (r.data = '{}'))
1585
+ : ((r = { data: 'http://xxx', filter: '() => {}' }),
1586
+ p && p.data && (r.data = p.data),
1587
+ p && p.filter && (r.filter = p.filter),
1588
+ '{}' === r.data && (r.data = 'http://xxx'))
1589
+ : 'event' === a
1590
+ ? o.properties &&
1591
+ o.properties.type &&
1592
+ o.properties.type.default &&
1593
+ 'emit' === o.properties.type.default
1594
+ ? p && 'out' === p.type
1595
+ ? (r = {
1596
+ trigger: (p && p.filter) || 'eventName',
1597
+ eventData: '{}',
1598
+ })
1599
+ : ((r = { trigger: 'eventName', eventData: '{}' }),
1600
+ p && p.trigger && (r.trigger = p.trigger),
1601
+ p && p.eventData && (r.eventData = p.eventData))
1602
+ : p && 'in' === p.type
1603
+ ? (r = {
1604
+ register: 'eventName',
1605
+ actionFunc: (p && p.filter) || '() => {}',
1606
+ })
1607
+ : ((r = { register: 'eventName', actionFunc: '() => {}' }),
1608
+ p && p.register && (r.register = p.register),
1609
+ p && p.actionFunc && (r.actionFunc = p.actionFunc))
1610
+ : !1 === e.isContainer && p && R(p) && '{}' !== JSON.stringify(p)
1611
+ ? (r = Object.assign(r, p))
1612
+ : e.properties &&
1613
+ (e.propertyOrder
1614
+ ? e.propertyOrder
1615
+ : Object.keys(e.properties)
1616
+ ).map(function (i) {
1617
+ var a = e.properties[i],
1618
+ n = t && t[i];
1619
+ switch (L(a.type)) {
1620
+ case 'array':
1621
+ r[i] = re(a, n);
1622
+ break;
1623
+ case 'object':
1624
+ r[i] = te(a, n);
1625
+ break;
1626
+ default:
1627
+ r[i] = ee(a, n);
1628
+ }
1629
+ });
1630
+ }
1631
+ return r;
1632
+ }
1633
+ function re(e, t) {
1634
+ var r = [];
1635
+ if (e && 'array' === L(e.type)) {
1636
+ var i = t;
1637
+ n(i) && n(e.default) && typeof i != typeof e.default && (i = void 0);
1638
+ var a = n(i) ? i : e.default;
1639
+ if ('array' === L(e.type))
1640
+ if (D(a))
1641
+ a.map(function (t) {
1642
+ r.push(te(e.items, t));
1643
+ });
1644
+ else if (a) r = a;
1645
+ else {
1646
+ var o = te(e.items, a);
1647
+ r.push(o);
1648
+ }
1649
+ else r = n(a) ? a : [];
1650
+ }
1651
+ return r;
1652
+ }
1653
+ function ie(e, t) {
1654
+ return 'object' === L(e.type)
1655
+ ? te(e, t)
1656
+ : 'array' === L(e.type)
1657
+ ? re(e, t)
1658
+ : ee(e, t);
1659
+ }
1660
+ var ae = v;
1661
+ function ne(e, t) {
1662
+ var r = t || [];
1663
+ if (e && '{}' !== JSON.stringify(e))
1664
+ if (R(e))
1665
+ if (
1666
+ e.type &&
1667
+ 'remote' === e.type &&
1668
+ e.config &&
1669
+ R(e.config) &&
1670
+ e.config.dataName &&
1671
+ n(e.localFilter) &&
1672
+ n(e.data)
1673
+ ) {
1674
+ var i = e.config.body;
1675
+ if (i && !R(i))
1676
+ try {
1677
+ i = JSON.parse(i);
1678
+ } catch (e) {
1679
+ i = {};
1680
+ }
1681
+ r.push({ id: e.config.id, dataName: e.config.dataName, body: i });
1682
+ } else
1683
+ Object.keys(e).map(function (t) {
1684
+ ne(e[t], r);
1685
+ });
1686
+ else
1687
+ D(e) &&
1688
+ e.map(function (e) {
1689
+ ne(e, r);
1690
+ });
1691
+ return r;
1692
+ }
1693
+ function oe(e, t) {
1694
+ var r = t || 'data';
1695
+ return (
1696
+ e.split('-').map(function (e) {
1697
+ r = /^\d+$/.test(e) ? r + '[' + e + ']' : r + '.' + e;
1698
+ }),
1699
+ r
1700
+ );
1701
+ }
1702
+ function le(e, t) {
1703
+ var r = [];
1704
+ return (
1705
+ R(e)
1706
+ ? Object.keys(e).map(function (i) {
1707
+ var a = e[i],
1708
+ n = t ? t + '-' + i : i;
1709
+ R(a) || D(a)
1710
+ ? r.push({ title: i, value: n, key: n, children: le(a, n) })
1711
+ : r.push({ title: i, value: n, key: n });
1712
+ })
1713
+ : D(e) &&
1714
+ e.map(function (e, i) {
1715
+ var a = i.toString(),
1716
+ n = t ? t + '-' + i : a;
1717
+ R(e) || D(e)
1718
+ ? r.push({ title: a, value: n, key: n, children: le(e, n) })
1719
+ : r.push({ title: a, value: n, key: n });
1720
+ }),
1721
+ r
1722
+ );
1723
+ }
1724
+ function pe(e) {
1725
+ var t = e.split('-');
1726
+ return t.pop(), t.join('-');
1727
+ }
1728
+ function ue(e) {
1729
+ var t = e.split('-'),
1730
+ r = t.pop();
1731
+ return [t.join('-'), r];
1732
+ }
1733
+ var ce = [
1734
+ 'key',
1735
+ 'enum',
1736
+ 'enumextra',
1737
+ 'items',
1738
+ 'input',
1739
+ 'boolean',
1740
+ 'number',
1741
+ 'color',
1742
+ 'url',
1743
+ 'textarea',
1744
+ 'text-editor',
1745
+ 'radio',
1746
+ 'select',
1747
+ 'checkboxes',
1748
+ 'date',
1749
+ 'date-time',
1750
+ 'time',
1751
+ 'json',
1752
+ 'codearea',
1753
+ 'htmlarea',
1754
+ 'quantity',
1755
+ 'box-style',
1756
+ 'dynamic-data',
1757
+ 'datasource',
1758
+ 'event',
1759
+ 'array',
1760
+ 'object',
1761
+ ];
1762
+ return t;
1763
+ })();
1764
+ });