@steedos-widgets/amis-lib 6.3.13-beta.6 → 6.3.13-beta.8
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +8 -4
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -4
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -167,7 +167,7 @@ isNode=!!(window&&window.nw&&window.nw.require);if(!((field.is_name||field.name=
|
|
|
167
167
|
// },
|
|
168
168
|
{"args":{},"actionType":"custom","script":previewFileScript,// "expression": "!!window?.nw?.require" //PC客户端预览附件
|
|
169
169
|
"expression":"!!(window && window.nw && window.nw.require)"//PC客户端预览附件
|
|
170
|
-
}]}}},fieldAmis);_context61.next=72;break;case 31:if(!(field.type==='toggle')){_context61.next=35;break;}columnItem=Object.assign({},{type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},fieldAmis,{name:field.name});_context61.next=72;break;case 35:if(!(field.type==='avatar'||field.type==='image'||field.type==='file')){_context61.next=48;break;}_context61.t1=Object;_context61.t2={};_context61.t3=_objectSpread;_context61.t4={type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className};_context61.next=42;return getAmisFileReadonlySchema(field);case 42:_context61.t5=_context61.sent;_context61.t6=(0,_context61.t3)(_context61.t4,_context61.t5);_context61.t7=fieldAmis;columnItem=_context61.t1.assign.call(_context61.t1,_context61.t2,_context61.t6,_context61.t7);_context61.next=72;break;case 48:if(!(field.type==='select')){_context61.next=53;break;}map=getSelectMap(field.options);columnItem=Object.assign({},{type:"static-mapping",name:field.name,label:field.label,map:map,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,inputClassName:"inline","static":true},fieldAmis,{name:field.name});_context61.next=72;break;case 53:if(!(field.type==='lookup'||field.type==='master_detail')){_context61.next=57;break;}columnItem=Object.assign({},{type:"static-wrapper",name:field.name,label:field.label,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,size:"none",inputClassName:"inline",body:{type:"steedos-field","static":true,tableObjectName:options.objectName,config:{type:"lookup",reference_to:field.reference_to,name:field.name,label:null,multiple:field.multiple,amis:Object.assign({},fieldAmis,{label:null})}}},fieldAmis,{name:field.name});_context61.next=72;break;case 57:_context61.next=59;return getFieldTpl(field,options);case 59:tpl=_context61.sent;type='static-text';if(tpl){type='static';}else if(field.type==='html'){type='static-markdown';}else if(field.type==='url'){if(field.show_as_qr){type='static-qr-code';}else{type='input-url';}}if(field.type==='textarea'){className+='min-w-56';}// if(field.type === 'date'){
|
|
170
|
+
}]}}},fieldAmis);_context61.next=72;break;case 31:if(!(field.type==='toggle')){_context61.next=35;break;}columnItem=Object.assign({},{type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className},fieldAmis,{name:field.name});_context61.next=72;break;case 35:if(!(field.type==='avatar'||field.type==='image'||field.type==='file')){_context61.next=48;break;}_context61.t1=Object;_context61.t2={};_context61.t3=_objectSpread;_context61.t4={type:"switch",name:field.name,label:field.label,width:getFieldWidth(field.width),toggled:field.toggled,"static":true,className:className};_context61.next=42;return getAmisFileReadonlySchema(field);case 42:_context61.t5=_context61.sent;_context61.t6=(0,_context61.t3)(_context61.t4,_context61.t5);_context61.t7=fieldAmis;columnItem=_context61.t1.assign.call(_context61.t1,_context61.t2,_context61.t6,_context61.t7);_context61.next=72;break;case 48:if(!(field.type==='select')){_context61.next=53;break;}map=getSelectMap(field.options);columnItem=Object.assign({},{type:"static-mapping",name:field.name,label:field.label,map:map,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,inputClassName:"inline","static":true},fieldAmis,{name:field.name});_context61.next=72;break;case 53:if(!(field.type==='lookup'||field.type==='master_detail')){_context61.next=57;break;}columnItem=Object.assign({},{type:"static-wrapper",name:field.name,label:field.label,sortable:field.sortable,width:getFieldWidth(field.width),toggled:field.toggled,className:className,size:"none",inputClassName:"inline",body:{type:"steedos-field","static":true,tableObjectName:options.objectName,config:{type:"lookup",reference_to:field.reference_to,name:field.name,is_name:field.is_name,label:null,multiple:field.multiple,amis:Object.assign({},fieldAmis,{label:null})}}},fieldAmis,{name:field.name});_context61.next=72;break;case 57:_context61.next=59;return getFieldTpl(field,options);case 59:tpl=_context61.sent;type='static-text';if(tpl){type='static';}else if(field.type==='html'){type='static-markdown';}else if(field.type==='url'){if(field.show_as_qr){type='static-qr-code';}else{type='input-url';}}if(field.type==='textarea'){className+='min-w-56';}// if(field.type === 'date'){
|
|
171
171
|
// className += 'date-min-w';
|
|
172
172
|
// }
|
|
173
173
|
// if(field.type === 'datetime'){
|
|
@@ -804,7 +804,7 @@ keywordsSearchBoxName="__keywords_lookup__".concat(field.name.replace(/\./g,"_")
|
|
|
804
804
|
if(refObjectConfig.name==='organizations'){labelFieldName='name';}_context113.next=47;return getTableSchema$1(refObjectConfig,tableFields,_objectSpread({labelFieldName:labelFieldName,top:top,isLookup:true,enable_tree:refObjectConfig.enable_tree},ctx));case 47:pickerSchema=_context113.sent;pickerSchema.affixHeader=false;pickerSchema.headerToolbar=getObjectHeaderToolbar(refObjectConfig,fieldsArr,ctx.formFactor,{isLookup:true,keywordsSearchBoxName:keywordsSearchBoxName});if(referenceTo.objectName==="space_users"&&field.reference_to_field==="user"&&showLeftFilter){pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));pickerSchema.className=pickerSchema.className||""+" steedos-select-user";}isAllowCreate=refObjectConfig.permissions.allowCreate;isCreate=___namespace.isBoolean(field.create)?field.create:true;// lookup字段配置过滤条件就强制不显示新建按钮
|
|
805
805
|
hasFilters=!___namespace.isEmpty(field.filters)||!!field.filtersFunction||!!field._filtersFunction;if(!(isAllowCreate&&isCreate&&!hasFilters)){_context113.next=60;break;}_context113.next=57;return getSchema$5(refObjectConfig,{appId:ctx.appId,objectName:refObjectConfig.name,formFactor:ctx.formFactor});case 57:new_button=_context113.sent;new_button.align="right";// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
806
806
|
pickerSchema.headerToolbar.splice(pickerSchema.headerToolbar.length-1,0,new_button);case 60:pickerSchema.footerToolbar=refObjectConfig.enable_tree?[]:getObjectFooterToolbar(refObjectConfig,ctx.formFactor,{isLookup:true});if(!(ctx.filterVisible!==false)){_context113.next=65;break;}_context113.next=64;return getObjectFilter(refObjectConfig,fields,_objectSpread(_objectSpread({},ctx),{},{isLookup:true,keywordsSearchBoxName:keywordsSearchBoxName,searchable_fields:field.searchable_fields,auto_open_filter:field.auto_open_filter,show_left_filter:field.show_left_filter,filter_form_data:field.filter_form_data}));case 64:pickerSchema.filter=_context113.sent;case 65:pickerSchema.data=Object.assign({},pickerSchema.data,{"&":"$$","objectName":refObjectConfig.name,"uiSchema":refObjectConfig,"listName":listName,// 需要按视图取可搜索项
|
|
807
|
-
"isLookup":true,"__lookupField":{"name":field.name,"reference_to":refObjectConfig.name,"reference_to_field":field.reference_to_field}});if(!pickerSchema.onEvent){pickerSchema.onEvent={};}pickerSchema.onEvent["@data.changed.".concat(refObjectConfig.name)]={"actions":[{"actionType":"reload"},{"actionType":"custom","script":"\n const masterRecord = event.data._master && event.data._master.record;\n const fieldConfig = ".concat(JSON.stringify(field),";\n let reference_to = fieldConfig.reference_to;\n let saveValue;\n const newRecord = {\n _id: event.data.result.data.recordId,\n ...event.data.__super.__super\n }\n const saveField = fieldConfig.reference_to_field || '_id';\n const saveFieldValue = newRecord[saveField];\n
|
|
807
|
+
"isLookup":true,"__lookupField":{"name":field.name,"reference_to":refObjectConfig.name,"reference_to_field":field.reference_to_field}});if(!pickerSchema.onEvent){pickerSchema.onEvent={};}pickerSchema.onEvent["@data.changed.".concat(refObjectConfig.name)]={"actions":[{"actionType":"reload"},{"actionType":"custom","script":"\n // lookup\u5B57\u6BB5\u5F39\u51FA\u5217\u8868\uFF0C\u70B9\u51FB\u65B0\u5EFA\u6309\u94AE\uFF0C\u65B0\u5EFA\u8BB0\u5F55\u6210\u529F\u540E\uFF0C\u89E6\u53D1@data.changed.xxx\uFF0C\n // \u6B64\u65F6context.props.data\u503C\u662Flookup\u5B57\u6BB5\u6240\u5728\u8868\u5355\u6570\u636E\uFF0C\u7ECF\u6D4B\u8BD5\u591A\u5C42lookup\u5F39\u51FA\u5217\u8868\u65B0\u5EFA\u8BB0\u5F55\u6210\u529F\u540Econtext.props.data\u59CB\u7EC8\u53D6\u7684\u662F\u6700\u8FD1\u4E00\u5C42\u7684lookup\u5B57\u6BB5\u6240\u5728\u8868\u5355\u6570\u636E\uFF0C\u7B26\u5408\u9884\u671F\n const masterRecord = context.props.data;//event.data._master && event.data._master.record;\n const fieldConfig = ".concat(JSON.stringify(field),";\n let reference_to = fieldConfig.reference_to;\n let saveValue;\n const newRecord = {\n _id: event.data.result.data.recordId,\n ...event.data.__super.__super\n }\n const saveField = fieldConfig.reference_to_field || '_id';\n const saveFieldValue = newRecord[saveField];\n if( fieldConfig._reference_to && (_.isArray(fieldConfig._reference_to) || _.isFunction(fieldConfig._reference_to) || fieldConfig._reference_to.startsWith('function') ) ){\n \n const fieldValue = masterRecord ? masterRecord[fieldConfig.name] : {o: reference_to, ids: []};\n const baseSaveValue = {\n o: reference_to,\n ids: [saveFieldValue]\n };\n if(fieldValue && fieldValue.o){\n if(fieldValue.o === reference_to){\n saveValue = fieldConfig.multiple ? { o: reference_to, ids: fieldValue.ids.concat(saveFieldValue)} : baseSaveValue;\n }else{\n saveValue = baseSaveValue;\n }\n }else{\n saveValue = baseSaveValue;\n }\n\n }else{\n if(fieldConfig.multiple){\n // const fieldValue = (masterRecord && masterRecord[fieldConfig.name]) || [];\n // \u8FDE\u7EED\u65B0\u5EFA\u591A\u4E2A\u8BB0\u5F55\u65F6\uFF0C\u56E0\u4E3AmasterRecord\u83B7\u53D6\u7684\u4E3B\u8BB0\u5F55\u4E0D\u662F\u5B9E\u65F6\u7684\uFF0C\u6240\u4EE5\u53EA\u4F1A\u52FE\u9009\u6700\u540E\u4E00\u4E2A\u65B0\u5EFA\u7684\u8BB0\u5F55\n // \u800C\u4E0B\u9762context.context.component\u6307\u5411\u7684\u662Flookup picker\u7EC4\u4EF6\uFF0C\u53EF\u4EE5\u76F4\u63A5\u53D6\u5230\u7528\u6237\u5B9E\u65F6\u52FE\u9009\u7684\u8BB0\u5F55\u3002\n const fieldValue = context.context.component.props.store.toJSON().selectedItems\n saveValue = fieldValue.concat(saveFieldValue);\n }else{\n saveValue = saveFieldValue;\n }\n }\n \n const ctx = ").concat(JSON.stringify(ctx),";\n const componentId = ctx.defaults && ctx.defaults.formSchema && ctx.defaults.formSchema.id;\n doAction({\n actionType: 'setValue',\n componentId: componentId, \n args: {\n value: { [fieldConfig.name]: saveValue }\n }\n });\n ")}]};if(field.pickerSchema){pickerSchema=Object.assign({},pickerSchema,field.pickerSchema);}if(referenceTo.objectName==="space_users"&&field.reference_to_field==="user"&&isMobile){//手机端选人控件只保留部分toolbar
|
|
808
808
|
pickerSchema.headerToolbar=pickerSchema.headerToolbar&&pickerSchema.headerToolbar.filter(function(item){if(["steedos_crud_toolbar_quick_search","steedos_crud_toolbar_filter","steedos_crud_toolbar_select_user_tree","steedos_crud_toolbar_organization_button"].indexOf(item.id)>-1){return true;}else{return false;}});pickerSchema.footerToolbar=["pagination"];}if(field.inlineHelpText){pickerSchema.toolbarClassName="hasHelpText";pickerSchema.headerToolbar=[{"type":"tpl","tpl":field.inlineHelpText,"className":"text-secondary"}].concat(_toConsumableArray(pickerSchema.headerToolbar));}pickerSchema.className=(pickerSchema.className||"")+" steedos-lookup-crud";data={type:getAmisStaticFieldType('picker',readonly),className:ctx.className||'',modalTitle:i18next__default["default"].t('frontend_form_please_select')+" "+refObjectConfig.label,labelField:referenceTo.labelField.name,valueField:referenceTo.valueField.name,// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段,多选字段可以编辑。
|
|
809
809
|
disabledOn:"".concat(readonly," || ( (this._master && (this._master.relatedKey ==='").concat(field.name,"')) || ((this.relatedKey ==='").concat(field.name,"') && (").concat(field.multiple," != true)) )"),modalMode:'dialog',//TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
810
810
|
source:source,size:"lg",pickerSchema:pickerSchema,joinValues:false,extractValue:true};if(field.multiple){data.multiple=true;data.extractValue=true;}if(!readonly){_context113.next=78;break;}_context113.next=77;return getLookupTpl(field,ctx);case 77:data.tpl=_context113.sent;case 78:return _context113.abrupt("return",data);case 79:case"end":return _context113.stop();}}},_callee113);}));return _lookupToAmisPicker.apply(this,arguments);}function lookupToAmisSelect(_x194,_x195,_x196){return _lookupToAmisSelect.apply(this,arguments);}function _lookupToAmisSelect(){_lookupToAmisSelect=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee114(field,readonly,ctx){var _referenceTo$valueFie;var referenceTo,isMobile,valueFieldKey,apiInfo,defaultValueOptionsQueryData,refObjectConfig,queryFields,autoFillMapping,listView,listviewFilter,listviewFiltersFunction,sort,depend_on,sendOn,data,amisVersion,select_menuTpl,menuTpl;return _regeneratorRuntime().wrap(function _callee114$(_context114){while(1){switch(_context114.prev=_context114.next){case 0:_context114.next=2;return getReferenceTo(field);case 2:referenceTo=_context114.sent;isMobile=window.innerWidth<=768;valueFieldKey=referenceTo&&((_referenceTo$valueFie=referenceTo.valueField)===null||_referenceTo$valueFie===void 0?void 0:_referenceTo$valueFie.name)||'_id';// const labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';
|