@steedos-widgets/amis-object 3.6.11-beta.3 → 3.6.11-beta.5
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/amis-object.cjs.js +17 -16
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +17 -16
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +17 -5
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/package.json +3 -3
package/dist/amis-object.cjs.js
CHANGED
|
@@ -15317,8 +15317,8 @@ if(typeof window != 'undefined'){
|
|
|
15317
15317
|
/*
|
|
15318
15318
|
* @Author: baozhoutao@steedos.com
|
|
15319
15319
|
* @Date: 2023-01-13 17:27:54
|
|
15320
|
-
* @LastEditors:
|
|
15321
|
-
* @LastEditTime: 2024-
|
|
15320
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
15321
|
+
* @LastEditTime: 2024-04-11 14:14:43
|
|
15322
15322
|
* @Description:
|
|
15323
15323
|
*/
|
|
15324
15324
|
|
|
@@ -15394,12 +15394,12 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
15394
15394
|
"receiver": "${context.rootUrl}/s3/images",
|
|
15395
15395
|
"name": field.name,
|
|
15396
15396
|
"options": {
|
|
15397
|
-
"menu": {
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
},
|
|
15397
|
+
// "menu": {
|
|
15398
|
+
// "insert": {
|
|
15399
|
+
// "title": "Insert",
|
|
15400
|
+
// "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
15401
|
+
// }
|
|
15402
|
+
// },
|
|
15403
15403
|
"plugins": [
|
|
15404
15404
|
"autoresize"
|
|
15405
15405
|
],
|
|
@@ -15415,13 +15415,14 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
|
|
|
15415
15415
|
"type": "input-rich-text",
|
|
15416
15416
|
"receiver": "${context.rootUrl}/s3/images",
|
|
15417
15417
|
"options":{
|
|
15418
|
-
"menu": {
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
},
|
|
15424
|
-
"statusbar": false
|
|
15418
|
+
// "menu": {
|
|
15419
|
+
// "insert": {
|
|
15420
|
+
// "title": "Insert",
|
|
15421
|
+
// "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
|
|
15422
|
+
// }
|
|
15423
|
+
// },
|
|
15424
|
+
"statusbar": false,
|
|
15425
|
+
"menubar": false
|
|
15425
15426
|
},
|
|
15426
15427
|
"name": field.name
|
|
15427
15428
|
}
|
|
@@ -24415,7 +24416,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
|
|
|
24415
24416
|
});
|
|
24416
24417
|
}); };
|
|
24417
24418
|
|
|
24418
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var o=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){o=e;},error:function(e,t,r){var n,a;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,a=void(o={error:n}),a=n.reason||n.message||n,console.error(a)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),o}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=a=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(a,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:a}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+a}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,a)=>{try{var o=window.Creator;if(!!(!o||!o.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(a||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var a,o;if(n&&Object.assign(n,getGlobalNowData()),o=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{},"string"!=typeof t)return t;a="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,a)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+a+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(o));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var a=e.data_type||"text";!r||n||e.multiple||("text"!==a||_$1.isString(r)?"number"===a&&_$1.isString(r)?r=Number(r):"boolean"===a&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);break;case"time":if(_$1.isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDTHH:mm:00.000Z")}return r};function getTreeOptions(t,e){const a=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],o=(e,t,r,n)=>{return e.children&&"object"==typeof e.children[0]?e.children:r?(e=_.filter(t,e=>_.includes(r,e[a])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=o(e,t,e.children,n-1))):e.children&&(e.children=o(e,t,e.children,n));}),e):void 0};for(var s=t,i=0;i<s.length;i++)if(s[i].noParent=0,s[i].unfolded=!1,s[i].parent){let e=1;for(var l=0;l<s.length;l++)s[i].parent==s[l][a]&&(e=0);1==e&&(s[i].noParent=1);}else s[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:o(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:o(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let a=(n=n||{}).name;var e=n.direction||"up";let o=t.getComponents().find(function(e){return e.props.type===r&&(!a||e.props.name===a)});if(o)return o;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(o=getClosestAmisComponentByType(t.children[e],r,n));e++);return o}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var a=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?a.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?a.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),a.push(n)):a.push([""+t.replace("__searchable__",""),"=",e])));}),a},getKeywordsSearchFilter:(e,t)=>{const a=[];var o;return e&&t&&(o=e.split(/\s+/),o=_$1.compact(o),t.forEach(function(r,e){let n=[];1==o.length?n=[r,"contains",o[0]]:o.forEach(function(e,t){n.push([r,"contains",e]),t<o.length-1&&n.push("or");}),n.length&&(a.push(n),e<t.length-1&&a.push("or"));})),a},getFormulaVariables:(e,t=!0)=>{const r=[];return _$1.isEmpty(e)||(r.push({label:"表单字段",children:[]}),lodash.forEach(e,function(e){r[0].children.push({label:e.label,value:e.name});})),t&&r.push({label:"全局变量",children:[{label:"用户ID",value:"global['userId']"},{label:"工作区ID",value:"global['spaceId']"},{label:"只读/编辑模式",value:"global['mode']"},{label:"用户",children:[{label:"姓名",value:"global['user']['name']"},{label:"邮件",value:"global['user']['email']"},{label:"语言",value:"global['user']['language']"},{label:"简档",value:"global['user']['profile']"},{label:"权限集",value:"global['user']['roles']"},{label:"主部门ID",value:"global['user']['organization']['_id']"},{label:"部门(多选)",value:"global['user']['organizations']"},{label:"部门(含上级)",value:"global['user']['organizations_parents']"},{label:"主分部ID",value:"global['user']['company_id']"},{label:"分部(多选)",value:"global['user']['company_ids']"},{label:"人员ID",value:"global['user']['spaceUserId']"},{label:"是否是工作区管理员",value:"global['user']['is_space_admin']"}]}]}),r}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
24419
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var a in t=arguments[r])Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,r){return !1}},standard_new:{visible:function(e,t,r){return "cms_files"!==e&&"instances"!==e&&(r?r.allowCreate:void 0)}},standard_edit:{visible:function(e,t,r){if(r)return r.allowEdit}},standard_delete:{visible:function(e,t,r){if(r)return r.allowDelete}},standard_import_data:{visible:function(e,t,r){var n=this.object;if(r)return r.allowCreate&&n.hasImportTemplates}},standard_approve:{visible:function(e,t,r){return !1}},standard_view_instance:{visible:function(e,t,r){return !1}},standard_submit_for_approval:{visible:function(e,t,r){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,r){return !1}},standard_delete_many:{visible:function(e,t,r){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(r?r.allowDelete:void 0)}},standard_export_excel:{visible:function(e,t,r){return !1}}}}},authRequest=function(e,t){var o=null;e=Steedos.absoluteUrl(e);try{var r=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],n={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(r&&r.length)return r.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){o=e;},error:function(e,t,r){var n,a;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,a=void(o={error:n}),a=n.reason||n.message||n,console.error(a)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),o}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r,n=arguments[t];for(r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r]);}return e}).apply(this,arguments)}const newFunctionComponent=a=>e=>{const[t,r]=React.useState(!0);var n=()=>{r(!1);};return _$1.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React__default["default"].createElement(a,_extends({visible:t,onCancel:n,onClose:n},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(r,n)=>(e,t)=>{e.name||(e.name=r+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${r}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${r}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(n),e);ReactDOM.createRoot(t).render(e);},Modal=_$1.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),_$1.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,r)=>{e=e.replace(/\./g,"_");r=getGraphqlFieldsQuery(r);let n="";t=[`id: "${t}"`];return `{record:${e}__findOne${n=0<t.length?`(${t.join(",")})`:n}{${r}}}`},SObject={getRecord:async(e,t,r)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,r)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:r})=>{canSaveFilter(t);r.filters&&(r.filters=filtersToConditions(r.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):_$1.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:r}){return `/app/${e}/${t}/grid/`+r},getObjectDetailPath({appId:e,objectName:t,recordId:r}){return `/app/${e}/${t}/view/`+r},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:r,objectName:n,foreignKey:a}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+a}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,r)};const safeRunFunction=(t,r,n,a)=>{try{var o=window.Creator;if(!!(!o||!o.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return _$1.isNil(r)||(e=_$1.isArray(r)?r:[r]),t.bind(a||{})(...e)}catch(e){return console.log(e),n}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,r;return "string"==typeof e&&(t=/^{{(function.+)}}$/,r=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(r)))},getMoment=()=>window.amisRequire?window.amisRequire("moment"):window.moment||void 0,getGlobalNowData=()=>{var e=new Date,t=getMoment();let r=t().utc(),n=(r.set("hours",0),r.set("minutes",0),r.set("seconds",0),r.set("milliseconds",0),r=r.toDate(),t());return n.set("year",1970),n.set("month",0),n.set("date",1),n.set("hours",n.hours()+n.utcOffset()/60),n.set("seconds",0),n.set("milliseconds",0),n=n.toDate(),{now:e,today:r,timeNow:n}},parseSingleExpression=function(t,e,r,n){var a,o;if(n&&Object.assign(n,getGlobalNowData()),o=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(r))||{},"string"!=typeof t)return t;a="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,a)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+a+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(o));try{return Function(e)()}catch(e){return console.log(e,t,r),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,getGlobalNowData:getGlobalNowData,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(express,multiple)=>{const reg=/^\{\w+(\.*\w+)*\}$/,reg2=/^{{[\s\S]*}}$/;let result=express;if(reg.test(express)&&(result=-1<express.indexOf("userId")||-1<express.indexOf("spaceId")||-1<express.indexOf("user.")||-1<express.indexOf("now")||-1<express.indexOf("today")||-1<express.indexOf("timeNow")?`{${express}}`.replace("{{","{{global."):`{${express}}`.replace("{{","{{formData."),multiple&&(result=result.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),reg2.test(express)&&(-1<express.indexOf("function")||-1<express.indexOf("=>"))){let regex=/\{\{([\s\S]*)\}\}/,matches=regex.exec(express);if(matches&&1<matches.length){let functionCode=matches[1];result=eval("("+functionCode+")")();}}return result},getFieldDefaultValue=(e,t)=>{if(!e)return null;let r=e.defaultValue;e._defaultValue&&(r=safeEval(`(${e._defaultValue})`)),_$1.isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),_$1.isString(r)&&(r=getCompatibleDefaultValueExpression(r,e.multiple));var n=isExpression(r);switch(n&&("date"===e.type?r=r.replace(/\bglobal.now\b/g,"global.today"):"time"===e.type&&(r=r.replace(/\bglobal.now\b/g,"global.timeNow")),r=parseSingleExpression(r,{},"#",t)),e.type){case"select":var a=e.data_type||"text";!r||n||e.multiple||("text"!==a||_$1.isString(r)?"number"===a&&_$1.isString(r)?r=Number(r):"boolean"===a&&_$1.isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":_$1.isString(r)&&(r=Number(r));break;case"boolean":_$1.isString(r)?r="true"===r.toLowerCase()||"1"===r:_$1.isBoolean(r)||(r=!1);break;case"time":if(_$1.isDate(r))return moment(r).format("1970-01-01THH:mm:00.000[Z]");case"date":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDT00:00:00.000[Z]");case"datetime":if(_$1.isDate(r))return moment(r).format("YYYY-MM-DDTHH:mm:00.000Z")}return r};function getTreeOptions(t,e){const a=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],o=(e,t,r,n)=>{return e.children&&"object"==typeof e.children[0]?e.children:r?(e=_.filter(t,e=>_.includes(r,e[a])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=o(e,t,e.children,n-1))):e.children&&(e.children=o(e,t,e.children,n));}),e):void 0};for(var s=t,i=0;i<s.length;i++)if(s[i].noParent=0,s[i].unfolded=!1,s[i].parent){let e=1;for(var l=0;l<s.length;l++)s[i].parent==s[l][a]&&(e=0);1==e&&(s[i].noParent=1);}else s[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:o(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:o(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let a=(n=n||{}).name;var e=n.direction||"up";let o=t.getComponents().find(function(e){return e.props.type===r&&(!a||e.props.name===a)});if(o)return o;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(o=getClosestAmisComponentByType(t.children[e],r,n));e++);return o}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,r,n)}function isFilterFormValuesEmpty(e){let t=!0;var e=_.pickBy(e,function(e,t){return /^__searchable__/g.test(t)});return _.isEmpty(e)||(e=_.omitBy(e,function(e){return _.isNil(e)||_.isObject(e)&&_.isEmpty(e)||_.isArray(e)&&_.isEmpty(e.filter(function(e){return !_.isNil(e)}))||_.isString(e)&&0===e.length}),_.isEmpty(e)||(t=!1)),t}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var r=window.FlowRouter;if(t)return r?r.go(t):window.open(t);r?r.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:r})=>{switch(e){case"listview":return `amis-${t}-${r}-listview`;case"form":return `amis-${t}-${r}-form`;case"detail":return `amis-${t}-${r}-detail`;default:return `amis-${t}-${r}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType,isFilterFormValuesEmpty:isFilterFormValuesEmpty,getSearchFilter:e=>{var a=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?a.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?a.push([""+t.replace("__searchable__",""),"contains",e]):_.isObject(e)&&e.o?(n=[[(r=""+t.replace("__searchable__",""))+"/o","=",e.o]],e.ids.length&&n.push([r+"/ids","=",e.ids]),a.push(n)):a.push([""+t.replace("__searchable__",""),"=",e])));}),a},getKeywordsSearchFilter:(e,t)=>{const a=[];var o;return e&&t&&(o=e.split(/\s+/),o=_$1.compact(o),t.forEach(function(r,e){let n=[];1==o.length?n=[r,"contains",o[0]]:o.forEach(function(e,t){n.push([r,"contains",e]),t<o.length-1&&n.push("or");}),n.length&&(a.push(n),e<t.length-1&&a.push("or"));})),a},getFormulaVariables:(e,t=!0)=>{const r=[];return _$1.isEmpty(e)||(r.push({label:"表单字段",children:[]}),lodash.forEach(e,function(e){r[0].children.push({label:e.label,value:e.value});})),t&&r.push({label:"全局变量",children:[{label:"用户ID",value:"global['userId']"},{label:"工作区ID",value:"global['spaceId']"},{label:"只读/编辑模式",value:"global['mode']"},{label:"用户",children:[{label:"姓名",value:"global['user']['name']"},{label:"邮件",value:"global['user']['email']"},{label:"语言",value:"global['user']['language']"},{label:"简档",value:"global['user']['profile']"},{label:"权限集",value:"global['user']['roles']"},{label:"主部门ID",value:"global['user']['organization']['_id']"},{label:"部门(多选)",value:"global['user']['organizations']"},{label:"部门(含上级)",value:"global['user']['organizations_parents']"},{label:"主分部ID",value:"global['user']['company_id']"},{label:"分部(多选)",value:"global['user']['company_ids']"},{label:"人员ID",value:"global['user']['spaceUserId']"},{label:"是否是工作区管理员",value:"global['user']['is_space_admin']"}]}]}),r}});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,r=e.authToken;return t&&r?"Bearer ".concat(t,",").concat(r):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
24419
24420
|
|
|
24420
24421
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
24421
24422
|
__proto__: null,
|