@steedos-widgets/amis-object 3.6.2-beta.9 → 3.6.2

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.
@@ -3488,14 +3488,13 @@ const getSteedosAuth = () => {
3488
3488
  /*
3489
3489
  * @Author: baozhoutao@steedos.com
3490
3490
  * @Date: 2022-08-16 17:02:08
3491
- * @LastEditors: baozhoutao@steedos.com
3492
- * @LastEditTime: 2023-06-20 13:50:15
3491
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3492
+ * @LastEditTime: 2024-02-02 10:15:00
3493
3493
  * @Description:
3494
3494
  */
3495
3495
 
3496
3496
  const Router$1 = {
3497
- getTabDisplayAs(tab_id){
3498
- const uiSchema = getUISchemaSync$1(tab_id, false);
3497
+ getTabDisplayAs(tab_id, defaultEnableSplit){
3499
3498
  var urlSearch = new URLSearchParams(document.location.search);
3500
3499
  if(urlSearch.has('display')){
3501
3500
  return urlSearch.get('display')
@@ -3504,9 +3503,12 @@ const Router$1 = {
3504
3503
  // const key = `page_display`;
3505
3504
  const value = sessionStorage.getItem(key);
3506
3505
  let defaultDisplay = "grid";
3507
- if(uiSchema.enable_split){
3506
+ if(defaultEnableSplit === true){
3508
3507
  defaultDisplay = "split";
3509
3508
  }
3509
+ if(window.innerWidth <= 768){
3510
+ return "grid";
3511
+ }
3510
3512
  return value ? value : defaultDisplay;
3511
3513
  },
3512
3514
 
@@ -3539,8 +3541,8 @@ const Router$1 = {
3539
3541
  /*
3540
3542
  * @Author: baozhoutao@steedos.com
3541
3543
  * @Date: 2022-07-20 16:29:22
3542
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
3543
- * @LastEditTime: 2023-12-28 14:59:08
3544
+ * @LastEditors: liaodaxue
3545
+ * @LastEditTime: 2024-01-25 14:44:17
3544
3546
  * @Description:
3545
3547
  */
3546
3548
 
@@ -3612,6 +3614,25 @@ function getComparableAmisVersion() {
3612
3614
  }
3613
3615
  }
3614
3616
 
3617
+ /**
3618
+ * 判断浏览器类型
3619
+ * @returns 按需返回浏览器类型;
3620
+ */
3621
+ function getBowserType() {
3622
+ const userAgent = navigator.userAgent;
3623
+ if (userAgent.indexOf("Chrome")!== -1 && userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Edg") === -1) {
3624
+ return "Chrome";
3625
+ } else if (userAgent.indexOf("Firefox") !== -1) {
3626
+ return "Firefox";
3627
+ } else if (userAgent.indexOf("Safari") !== -1 && userAgent.indexOf("Chrome") === -1 && userAgent.indexOf("Edge") === -1) {
3628
+ return "Safari";
3629
+ } else if (userAgent.indexOf("Edg") !== -1) {
3630
+ return "Edge";
3631
+ } else {
3632
+ return "Unknown browser"; // 其他浏览器...(可根据自己需要确定是否新增其他浏览器的判断)
3633
+ }
3634
+ }
3635
+
3615
3636
  /*
3616
3637
  * @Author: baozhoutao@steedos.com
3617
3638
  * @Date: 2022-05-23 09:53:08
@@ -3674,7 +3695,7 @@ function getSelectMap(selectOptions){
3674
3695
  forEach(selectOptions,(option)=>{
3675
3696
  const optionValue = option.value + '';
3676
3697
  const optionColor = option.color + '';
3677
- if(optionColor){
3698
+ if(optionColor && optionColor != "undefined"){
3678
3699
  const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
3679
3700
  const color = getContrastColor(background);
3680
3701
  const optionColorStyle = 'background:'+background+';color:'+color+';line-height:1.5rem';
@@ -4290,7 +4311,31 @@ const getAmisFileReadonlySchema = (steedosField)=>{
4290
4311
  }
4291
4312
  }
4292
4313
  if(type === 'file'){
4293
- return {
4314
+ return window.Meteor?.isCordova ? {
4315
+ "type": "control",
4316
+ "body": {
4317
+ "type": "each",
4318
+ "name": "_display." + steedosField.name,
4319
+ "items": {
4320
+ "type": "tpl",
4321
+ "tpl": "${name}",
4322
+ "className": "antd-Button--link inline-block",
4323
+ "onEvent": {
4324
+ "click": {
4325
+ "actions": [
4326
+ {
4327
+ "script": `
4328
+ Steedos.cordovaDownload(encodeURI(event.data.url), event.data.name);
4329
+ `,
4330
+ "actionType": "custom"
4331
+ }
4332
+ ],
4333
+ "weight": 0
4334
+ }
4335
+ }
4336
+ }
4337
+ }
4338
+ } : {
4294
4339
  type: amisFieldType,
4295
4340
  tpl: `
4296
4341
  <% let fileData = data._display.${steedosField.name}; if (fileData) { %>
@@ -4434,6 +4479,7 @@ var frontend_notifications$1 = "Notifications";
4434
4479
  var frontend_notifications_allread$1 = "Mark all as read";
4435
4480
  var frontend_notifications_allread_message$1 = "All marked as read";
4436
4481
  var frontend_profile$1 = "Profile";
4482
+ var switch_space$1 = "Switch Space";
4437
4483
  var frontend_about$1 = "About";
4438
4484
  var frontend_log_out$1 = "Log out";
4439
4485
  var frontend_listview_warning_start$1 = "The current ";
@@ -4521,6 +4567,7 @@ var en_us = {
4521
4567
  frontend_notifications_allread: frontend_notifications_allread$1,
4522
4568
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
4523
4569
  frontend_profile: frontend_profile$1,
4570
+ switch_space: switch_space$1,
4524
4571
  frontend_about: frontend_about$1,
4525
4572
  frontend_log_out: frontend_log_out$1,
4526
4573
  frontend_listview_warning_start: frontend_listview_warning_start$1,
@@ -4576,7 +4623,7 @@ var frontend_listview_control_delete_label = "删除";
4576
4623
  var frontend_listview_control_delete_confirm_text = "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?";
4577
4624
  var frontend_listview_control_delete_message_success = "删除成功";
4578
4625
  var frontend_listview_control_filters = "过滤设置";
4579
- var frontend_listview_control_filters_fields_extend = "条件组件1";
4626
+ var frontend_listview_control_filters_fields_extend = "条件组件";
4580
4627
  var frontend_listview_control_new_label = "新建";
4581
4628
  var frontend_listview_control_new_title = "新建 列表视图";
4582
4629
  var frontend_listview_control_new_message_success = "成功";
@@ -4610,6 +4657,7 @@ var frontend_notifications = "通知";
4610
4657
  var frontend_notifications_allread = "全部标记为已读";
4611
4658
  var frontend_notifications_allread_message = "已全部标记为已读";
4612
4659
  var frontend_profile = "个人资料";
4660
+ var switch_space = "切换工作区";
4613
4661
  var frontend_about = "关于";
4614
4662
  var frontend_log_out = "注销";
4615
4663
  var frontend_listview_warning_start = "当前";
@@ -4698,6 +4746,7 @@ var zh_cn = {
4698
4746
  frontend_notifications_allread: frontend_notifications_allread,
4699
4747
  frontend_notifications_allread_message: frontend_notifications_allread_message,
4700
4748
  frontend_profile: frontend_profile,
4749
+ switch_space: switch_space,
4701
4750
  frontend_about: frontend_about,
4702
4751
  frontend_log_out: frontend_log_out,
4703
4752
  frontend_listview_warning_start: frontend_listview_warning_start,
@@ -4752,7 +4801,7 @@ async function getQuickEditSchema(field, options){
4752
4801
  isAmisVersionforBatchEdit = window.Amis.version[0] >= 3 && window.Amis.version[2] >= 2;
4753
4802
  }
4754
4803
  const quickEditId = options.objectName + "_" + field.name + "_quickEdit";//定义快速编辑的表单id,用于setvalue传值
4755
- var quickEditSchema = { body: [], id: quickEditId };
4804
+ var quickEditSchema = { body: [], id: quickEditId, className: "steedos-table-quickEdit" };
4756
4805
  //select,avatar,image,file等组件无法行记录字段赋值,暂不支持批量编辑;
4757
4806
  if(field.type != 'avatar' && field.type != 'image' && field.type != 'file' && isAmisVersionforBatchEdit){
4758
4807
  const submitEvent = {
@@ -5011,7 +5060,8 @@ async function getQuickEditSchema(field, options){
5011
5060
  "failed": "失败了呢。。"
5012
5061
  }
5013
5062
  }
5014
- }
5063
+ },
5064
+ "expression": "${!recordPermissions.modifyAllRecords}"
5015
5065
  },
5016
5066
  {
5017
5067
  "actionType": "setValue",
@@ -5027,7 +5077,7 @@ async function getQuickEditSchema(field, options){
5027
5077
  "componentId": quickEditId,
5028
5078
  "args": {
5029
5079
  "value":{
5030
- "quickedit_record_permissions": "${event.data}"
5080
+ "quickedit_record_permissions": "${recordPermissions.modifyAllRecords ? {'allowEdit': true} : event.data}"
5031
5081
  }
5032
5082
  }
5033
5083
  }
@@ -5091,7 +5141,7 @@ async function getQuickEditSchema(field, options){
5091
5141
  `
5092
5142
  }
5093
5143
  },
5094
- "expression":"${event.data.value}"
5144
+ "expression":"${event.data.value && !recordPermissions.modifyAllRecords}"
5095
5145
  },
5096
5146
  {
5097
5147
  "actionType": "setValue",
@@ -5122,10 +5172,20 @@ async function getQuickEditSchema(field, options){
5122
5172
  "script": `
5123
5173
  const noPermission = event.data.noPermission;
5124
5174
  const crudComponent = event.context.scoped.getComponentById("${options.crudId}");
5125
- const selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
5175
+ let selectedItems = crudComponent && crudComponent.props.store.selectedItems.concat();
5126
5176
  noPermission.forEach(function (item) {
5127
5177
  crudComponent && crudComponent.unSelectItem(_.find(selectedItems,{_id:item}));
5178
+ _.remove(selectedItems, (selected) => selected._id === item);
5128
5179
  })
5180
+ doAction({
5181
+ "componentId": "${quickEditId}",
5182
+ "actionType": "setValue",
5183
+ "args": {
5184
+ "value": {
5185
+ selectedItems
5186
+ }
5187
+ }
5188
+ });
5129
5189
  `
5130
5190
  },
5131
5191
  {
@@ -5186,7 +5246,7 @@ async function getQuickEditSchema(field, options){
5186
5246
  }
5187
5247
 
5188
5248
  function getFieldWidth(width){
5189
- const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
5249
+ const defaultWidth = null;
5190
5250
  if(typeof width == 'string'){
5191
5251
  if(isNaN(width)){
5192
5252
  return width || defaultWidth;
@@ -5216,22 +5276,35 @@ async function getTableColumns$1(fields, options){
5216
5276
  //增加quickEdit属性,实现快速编辑
5217
5277
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
5218
5278
  let className = "";
5219
- if(field.wrap != true){
5220
- if(field.wrap != false && field.is_wide){
5221
- className += " break-words ";
5222
- }else {
5279
+ const bowserType = getBowserType();
5280
+ if(bowserType === "Safari"){
5281
+ className += " whitespace-nowrap ";
5282
+ }else {
5283
+ if(field.wrap != true){
5223
5284
  className += " whitespace-nowrap ";
5285
+ }else {
5286
+ className += " break-words ";
5224
5287
  }
5225
- }else {
5226
- className += " break-words ";
5227
5288
  }
5289
+
5290
+ if (typeof field.amis?.className == "object") {
5291
+ className = {
5292
+ [className]: "true",
5293
+ ...field.amis.className
5294
+ };
5295
+ } else if (typeof field.amis?.className == "string") {
5296
+ className = `${className} ${field.amis.className} `;
5297
+ }
5298
+ let fieldAmis = _$1.clone(field.amis);
5299
+ delete fieldAmis?.className;
5300
+
5228
5301
  let columnItem;
5229
5302
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
5230
5303
  const previewFileScript = `
5231
5304
  var data = event.data;
5232
5305
  var file_name = data.versions ? data.name : "${field.label}";
5233
- var file_id = data._id;
5234
- SteedosUI.previewFile && SteedosUI.previewFile({file_name, file_id});
5306
+ var file_id = data.versions && data.versions[0] && data.versions[0]._id;
5307
+ window.previewFile && window.previewFile({file_name, file_id});
5235
5308
  `;
5236
5309
  columnItem = {
5237
5310
  "type": "button",
@@ -5256,11 +5329,11 @@ async function getTableColumns$1(fields, options){
5256
5329
  "expression": "!!!(window && window.nw && window.nw.require)"//浏览器上直接下载
5257
5330
  },
5258
5331
  {
5259
- "args": {},
5260
- "actionType": "custom",
5261
- "script": previewFileScript,
5262
- // "expression": "!!window?.nw?.require" //PC客户端预览附件
5263
- "expression": "!!!(window && window.nw && window.nw.require)"//PC客户端预览附件
5332
+ "args": {},
5333
+ "actionType": "custom",
5334
+ "script": previewFileScript,
5335
+ // "expression": "!!window?.nw?.require" //PC客户端预览附件
5336
+ "expression": "!!(window && window.nw && window.nw.require)"//PC客户端预览附件
5264
5337
  }
5265
5338
  ]
5266
5339
  }
@@ -5275,7 +5348,7 @@ async function getTableColumns$1(fields, options){
5275
5348
  toggled: field.toggled,
5276
5349
  static: true,
5277
5350
  className,
5278
- }, field.amis, {name: field.name});
5351
+ }, fieldAmis, {name: field.name});
5279
5352
  }else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
5280
5353
  columnItem = Object.assign({}, {
5281
5354
  type: "switch",
@@ -5286,7 +5359,7 @@ async function getTableColumns$1(fields, options){
5286
5359
  static: true,
5287
5360
  className,
5288
5361
  ...getAmisFileReadonlySchema(field)
5289
- }, field.amis, {name: field.name});
5362
+ }, fieldAmis, {name: field.name});
5290
5363
  }
5291
5364
  else if(field.type === 'select'){
5292
5365
  const map = getSelectMap(field.options);
@@ -5301,7 +5374,7 @@ async function getTableColumns$1(fields, options){
5301
5374
  className,
5302
5375
  inputClassName: "inline",
5303
5376
  static: true,
5304
- }, field.amis, {name: field.name});
5377
+ }, fieldAmis, {name: field.name});
5305
5378
  }
5306
5379
  else {
5307
5380
  const tpl = await getFieldTpl(field, options);
@@ -5328,15 +5401,6 @@ async function getTableColumns$1(fields, options){
5328
5401
  // }
5329
5402
 
5330
5403
  //field上的amis属性里的clssname需要单独判断类型合并
5331
- if (typeof field.amis?.className == "object") {
5332
- className = {
5333
- [className]: "true",
5334
- ...field.amis.className
5335
- };
5336
- } else if (typeof field.amis?.className == "string") {
5337
- className = `${className} ${field.amis.className} `;
5338
- }
5339
- delete field.amis?.className;
5340
5404
 
5341
5405
  if(!field.hidden && !field.extra){
5342
5406
  columnItem = Object.assign({}, {
@@ -5353,7 +5417,7 @@ async function getTableColumns$1(fields, options){
5353
5417
  static: true,
5354
5418
  options: field.type === 'html' ? {html: true} : null
5355
5419
  // toggled: true
5356
- }, field.amis, {name: field.name});
5420
+ }, fieldAmis, {name: field.name});
5357
5421
 
5358
5422
  if(field.type === 'color'){
5359
5423
  columnItem.type = 'color';
@@ -5549,10 +5613,10 @@ async function getMobileTableColumns(fields, options){
5549
5613
  if(value.url){
5550
5614
  cms_url = value.url;
5551
5615
  }else{
5552
- cms_url = "/api/files/files/"+value+"?download=true"
5616
+ cms_url = Steedos.absoluteUrl("/api/files/files/"+value+"?download=true");
5553
5617
  }
5554
5618
  }
5555
- Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
5619
+ Steedos.cordovaDownload(encodeURI(cms_url), event.data.name);
5556
5620
  `,
5557
5621
  "actionType": "custom"
5558
5622
  }
@@ -6052,6 +6116,21 @@ async function getTableApi(mainObject, fields, options){
6052
6116
  return api;
6053
6117
  `;
6054
6118
  api.adaptor = `
6119
+ let fields = ${JSON.stringify(_$1.map(fields, 'name'))};
6120
+ // 这里把行数据中所有为空的字段值配置为空字符串,是因为amis有bug:crud的columns中的列如果type为static-前缀的话,行数据中该字段为空的话会显示为父作用域中同名变量值,见:https://github.com/baidu/amis/issues/9556
6121
+ (payload.data.rows || []).forEach((itemRow) => {
6122
+ (fields || []).forEach((itemField) => {
6123
+ if(itemField && itemField.indexOf(".") > -1){
6124
+ return;
6125
+ }
6126
+ if(itemField && (itemRow[itemField] === undefined || itemRow[itemField] === null)){
6127
+ // 这里itemRow中不存在 itemField 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
6128
+ // 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
6129
+ itemRow[itemField] = "";
6130
+ }
6131
+ });
6132
+ });
6133
+
6055
6134
  if(api.body.listName == "recent"){
6056
6135
  payload.data.rows = _.sortBy(payload.data.rows, function(item){
6057
6136
  return _.indexOf(api.body._ids, item._id)
@@ -6076,7 +6155,13 @@ async function getTableApi(mainObject, fields, options){
6076
6155
  value = [value]
6077
6156
  };
6078
6157
  if(field.type === 'file'){
6079
- item[key] = value
6158
+ // item[key] = value
6159
+ // PC客户端附件子表列表点击标题预览附件功能依赖了_id,所以这里拼出来
6160
+ let itemKeyValue = item[key];
6161
+ item[key] = value.map(function(item, index){
6162
+ item._id = itemKeyValue[index];
6163
+ return item;
6164
+ });
6080
6165
  }else{
6081
6166
  item[key] = _.map(value, (item)=>{
6082
6167
  if(field.type === 'image'){
@@ -6118,15 +6203,8 @@ async function getTableApi(mainObject, fields, options){
6118
6203
  }
6119
6204
  });
6120
6205
  };
6121
- let isTreeOptionsComputed = false;
6122
- if(records.length === 1 && records[0].children){
6123
- isTreeOptionsComputed = true;
6124
- }
6125
- if(!isTreeOptionsComputed){
6126
- // 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
6127
- payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
6128
- assignIndexToTreeRecords(payload.data.rows, '');
6129
- }
6206
+ payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
6207
+ assignIndexToTreeRecords(payload.data.rows, '');
6130
6208
  }
6131
6209
 
6132
6210
 
@@ -6185,11 +6263,10 @@ async function getTableApi(mainObject, fields, options){
6185
6263
  };
6186
6264
  let formFactor = "${options.formFactor}";
6187
6265
  if(formFactor !== "SMALL"){
6188
- const listviewComponent = $(".steedos-object-listview .antd-Table-table");
6189
- const firstListviewComponent = listviewComponent && listviewComponent[0];
6190
- if(firstListviewComponent){
6266
+ const lisviewDom = document.querySelector(".steedos-object-listview .antd-Table-table");
6267
+ if(lisviewDom){
6191
6268
  setTimeout(()=>{
6192
- firstListviewComponent.scrollIntoView();
6269
+ lisviewDom.scrollIntoView();
6193
6270
  }, 600);
6194
6271
  }
6195
6272
  }
@@ -8022,9 +8099,16 @@ const getSchema$2 = (uiSchema) => {
8022
8099
  "form": {
8023
8100
  debug: false,
8024
8101
  resetAfterSubmit: false,
8102
+ data: {
8103
+ editFormInited: true,
8104
+ },
8025
8105
  initApi: {
8106
+ method: 'GET',
8026
8107
  url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
8027
8108
  sendOn: 'this.recordId',
8109
+ data: null,
8110
+ requestAdaptor: "return api;",
8111
+ adaptor: "return payload;",
8028
8112
  responseData: {
8029
8113
  importState: "${state}"
8030
8114
  }
@@ -8896,7 +8980,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
8896
8980
  const formSchema = {
8897
8981
  "type": "service",
8898
8982
  "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
8899
- "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-2 sm:grid-cols-4 mb-2",
8983
+ "className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
8900
8984
  "style":{
8901
8985
  "max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
8902
8986
  },
@@ -9483,7 +9567,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
9483
9567
  "className": "slds-filters"
9484
9568
  },
9485
9569
  "size": "xs",
9486
- "className": `border-gray-300 border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
9570
+ "className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
9487
9571
  "visibleOn": "this.showFieldsFilter",
9488
9572
  },
9489
9573
  "className": "bg-white"
@@ -9671,7 +9755,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
9671
9755
  "icon": "fa fa-refresh",
9672
9756
  "actionType": "reload",
9673
9757
  "target": amisListViewId,
9674
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
9758
+ "className": "bg-white p-2 rounded text-gray-500"
9675
9759
  },
9676
9760
  fieldsFilterButtonSchema,
9677
9761
  // {
@@ -9679,7 +9763,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
9679
9763
  // "label": "",
9680
9764
  // "icon": "fa fa-filter",
9681
9765
  // "actionType": "custom",
9682
- // "className": "bg-transparent p-2 rounded border-gray-300 text-gray-500",
9766
+ // "className": "bg-transparent p-2 rounded text-gray-500",
9683
9767
  // "id": "u:c20cb87d96c9",
9684
9768
  // "onEvent": {
9685
9769
  // "click": {
@@ -9727,7 +9811,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
9727
9811
  let headerSchema = [{
9728
9812
  "type": "wrapper",
9729
9813
  "body": body,
9730
- "className": `bg-gray-100 sm:rounded-tl sm:rounded-tr p-4 -mb-4`
9814
+ "className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
9731
9815
  }];
9732
9816
  return headerSchema;
9733
9817
  }
@@ -9862,7 +9946,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9862
9946
  let body = [
9863
9947
  {
9864
9948
  "type": "wrapper",
9865
- "className": "p-4 bg-gray-100 border-b",
9949
+ "className": "p-4 border-b",
9866
9950
  "body": [
9867
9951
  {
9868
9952
  "type": "grid",
@@ -9927,25 +10011,25 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9927
10011
  });
9928
10012
 
9929
10013
  // 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
9930
- // xl:grid-cols-1
9931
- // xl:grid-cols-2
9932
- // xl:grid-cols-3
9933
- // xl:grid-cols-4
9934
- // xl:grid-cols-5
9935
- // xl:grid-cols-6
9936
- // xl:grid-cols-7
9937
- // xl:grid-cols-8
9938
- // xl:grid-cols-9
9939
- // xl:grid-cols-10
9940
- // xl:grid-cols-11
9941
- // xl:grid-cols-12
10014
+ // lg:grid-cols-1
10015
+ // lg:grid-cols-2
10016
+ // lg:grid-cols-3
10017
+ // lg:grid-cols-4
10018
+ // lg:grid-cols-5
10019
+ // lg:grid-cols-6
10020
+ // lg:grid-cols-7
10021
+ // lg:grid-cols-8
10022
+ // lg:grid-cols-9
10023
+ // lg:grid-cols-10
10024
+ // lg:grid-cols-11
10025
+ // lg:grid-cols-12
9942
10026
 
9943
10027
  body.push({
9944
10028
  "type": "wrapper",
9945
10029
  "body": {
9946
10030
  "type": "form",
9947
10031
  // "className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
9948
- "className": `gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-${max}`,
10032
+ "className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
9949
10033
  "wrapWithPanel": false,
9950
10034
  "actions": [],
9951
10035
  "body": details,
@@ -10030,7 +10114,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
10030
10114
  "className": "flex justify-between"
10031
10115
  }
10032
10116
  ],
10033
- "className": "steedos-record-related-header py-2 px-0"
10117
+ "className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
10034
10118
  };
10035
10119
  return recordRelatedListHeader;
10036
10120
  }
@@ -10073,6 +10157,7 @@ const getNewListviewButtonSchema = ()=>{
10073
10157
  "objectApiName": "object_listviews",
10074
10158
  "recordId": "",
10075
10159
  "mode": "edit",
10160
+ "layout": "normal",
10076
10161
  "defaultData": {
10077
10162
  "&": "${list_view}",
10078
10163
  "name":"",
@@ -10080,8 +10165,16 @@ const getNewListviewButtonSchema = ()=>{
10080
10165
  "filters":"",
10081
10166
  "shared":false,
10082
10167
  "object_name": "${targetObjectName}",
10168
+ "_id":"",
10169
+ "shared_to": null,
10170
+ "shared_to_organizations": null,
10171
+ "locked": false,
10172
+ "owner": null,
10173
+ "company_id": null,
10174
+ "company_ids": null,
10175
+ "is_system": false
10083
10176
  },
10084
- "fieldsExtend": fieldsExtend$4(),
10177
+ "fieldsExtend": fieldsExtend$5(),
10085
10178
  "fields": fields$1(),
10086
10179
  "onEvent": {
10087
10180
  "submitSucc": {
@@ -10132,14 +10225,17 @@ function fields$1(){
10132
10225
  "mobile_columns",
10133
10226
  "searchable_fields",
10134
10227
  "is_system",
10135
- "shared"
10228
+ "shared",
10229
+ "shared_to",
10230
+ "shared_to_organizations"
10136
10231
  ]
10137
10232
  }
10138
10233
 
10139
- function fieldsExtend$4(){
10234
+ function fieldsExtend$5(){
10140
10235
  return {
10141
10236
  "group": "",
10142
10237
  "label": {
10238
+ "group": "",
10143
10239
  "is_wide": true
10144
10240
  },
10145
10241
  "name": {
@@ -10221,9 +10317,19 @@ function fieldsExtend$4(){
10221
10317
  "shared": {
10222
10318
  "group": "",
10223
10319
  "amis": {
10224
- "visibleOn": "${global.user.is_space_admin}"
10320
+ "visibleOn": "${false}"
10321
+ }
10322
+ },
10323
+ "shared_to": {
10324
+ "group": "",
10325
+ "amis":{
10326
+ "type": "radios",
10327
+ "inline": false
10225
10328
  }
10226
10329
  },
10330
+ "shared_to_organizations": {
10331
+ "group": ""
10332
+ },
10227
10333
  "filters": {
10228
10334
  "group": "",
10229
10335
  "amis": {
@@ -10261,14 +10367,23 @@ const getCopyListviewButtonSchema = ()=>{
10261
10367
  "objectApiName": "object_listviews",
10262
10368
  "recordId": "",
10263
10369
  "mode": "edit",
10370
+ "layout": "normal",
10264
10371
  "defaultData": {
10265
10372
  "&": "${list_view}",
10266
10373
  "name":"",
10267
10374
  "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
10268
10375
  "shared":false,
10269
10376
  "object_name": "${targetObjectName}",
10377
+ "_id":"",
10378
+ "shared_to": null,
10379
+ "shared_to_organizations": null,
10380
+ "locked": false,
10381
+ "owner": null,
10382
+ "company_id": null,
10383
+ "company_ids": null,
10384
+ "is_system": false
10270
10385
  },
10271
- "fieldsExtend": fieldsExtend$3(),
10386
+ "fieldsExtend": fieldsExtend$4(),
10272
10387
  "fields": fields(),
10273
10388
  "onEvent": {
10274
10389
  "submitSucc": {
@@ -10316,13 +10431,16 @@ function fields(){
10316
10431
  "mobile_columns.$.field",
10317
10432
  "searchable_fields.$.field",
10318
10433
  "is_system",
10319
- "shared"
10434
+ "shared",
10435
+ "shared_to",
10436
+ "shared_to_organizations"
10320
10437
  ]
10321
10438
  }
10322
10439
 
10323
- function fieldsExtend$3(){
10440
+ function fieldsExtend$4(){
10324
10441
  return {
10325
10442
  "label": {
10443
+ "group": "",
10326
10444
  "is_wide": true
10327
10445
  },
10328
10446
  "name": {
@@ -10372,10 +10490,21 @@ function fieldsExtend$3(){
10372
10490
  }
10373
10491
  },
10374
10492
  "shared": {
10493
+ "group": "",
10375
10494
  "amis": {
10376
- "visibleOn": "${global.user.is_space_admin}"
10495
+ "visibleOn": "${false}"
10496
+ }
10497
+ },
10498
+ "shared_to": {
10499
+ "group": "",
10500
+ "amis":{
10501
+ "type": "radios",
10502
+ "inline": false
10377
10503
  }
10378
10504
  },
10505
+ "shared_to_organizations": {
10506
+ "group": ""
10507
+ },
10379
10508
  "filters": {
10380
10509
  "group": "",
10381
10510
  "amis": {
@@ -10385,6 +10514,12 @@ function fieldsExtend$3(){
10385
10514
  }
10386
10515
  }
10387
10516
 
10517
+ /*
10518
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
10519
+ * @Date: 2023-06-13 13:51:19
10520
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10521
+ * @LastEditTime: 2024-02-05 11:25:09
10522
+ */
10388
10523
  const getRenameListviewButtonSchema = ()=>{
10389
10524
  return {
10390
10525
  "type": "button",
@@ -10410,6 +10545,7 @@ const getRenameListviewButtonSchema = ()=>{
10410
10545
  "label": "对象表单",
10411
10546
  "objectApiName": "object_listviews",
10412
10547
  "recordId": "${recordId}",
10548
+ "layout": "normal",
10413
10549
  "mode": "edit",
10414
10550
  "fields": [
10415
10551
  "label"
@@ -10444,6 +10580,12 @@ const getRenameListviewButtonSchema = ()=>{
10444
10580
  }
10445
10581
  };
10446
10582
 
10583
+ /*
10584
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
10585
+ * @Date: 2023-06-13 13:51:19
10586
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
10587
+ * @LastEditTime: 2024-02-06 15:38:49
10588
+ */
10447
10589
  const getSetListviewShareButtonSchema = ()=>{
10448
10590
  return {
10449
10591
  "type": "button",
@@ -10459,6 +10601,8 @@ const getSetListviewShareButtonSchema = ()=>{
10459
10601
  "title": instance.t('frontend_listview_control_share'),
10460
10602
  "data": {
10461
10603
  "recordId": "${uiSchema.list_views[listName]._id}",
10604
+ "appId": "${appId}",
10605
+ "global": "${global}",
10462
10606
  "context": "${context}"
10463
10607
  },
10464
10608
  "body": [
@@ -10468,9 +10612,12 @@ const getSetListviewShareButtonSchema = ()=>{
10468
10612
  "objectApiName": "object_listviews",
10469
10613
  "recordId": "${recordId}",
10470
10614
  "mode": "edit",
10615
+ "layout": "normal",
10471
10616
  "fields": [
10472
- "shared"
10473
- ]
10617
+ "shared_to",
10618
+ "shared_to_organizations"
10619
+ ],
10620
+ "fieldsExtend": fieldsExtend$3(),
10474
10621
  }
10475
10622
  ],
10476
10623
  "showCloseButton": true,
@@ -10488,6 +10635,21 @@ const getSetListviewShareButtonSchema = ()=>{
10488
10635
  }
10489
10636
  };
10490
10637
 
10638
+ function fieldsExtend$3(){
10639
+ return {
10640
+ "shared_to": {
10641
+ "group": "",
10642
+ "amis":{
10643
+ "type": "radios",
10644
+ "inline": false
10645
+ }
10646
+ },
10647
+ "shared_to_organizations": {
10648
+ "group": ""
10649
+ }
10650
+ }
10651
+ }
10652
+
10491
10653
  const getSetListviewFiltersButtonSchema = ()=>{
10492
10654
  return {
10493
10655
  "type": "button",
@@ -10619,10 +10781,12 @@ function apiRequestAdaptor$2(){
10619
10781
  function fieldsExtend$2(){
10620
10782
  return {
10621
10783
  "filters": {
10784
+ "label": "",
10785
+ "group": "",
10622
10786
  "visible_on": "true",
10623
10787
  "amis": {
10624
10788
  "type": "condition-builder",
10625
- "label": instance.t('frontend_listview_control_filters_fields_extend'),
10789
+ // "label": i18next.t('frontend_listview_control_filters_fields_extend'),
10626
10790
  "source": {
10627
10791
  "method": "get",
10628
10792
  "url": "${context.rootUrl}/service/api/amis-metadata-listviews/getFilterFields?objectName=${targetObjectName}",
@@ -10665,6 +10829,7 @@ const getSetListviewColumnsButtonSchema = ()=>{
10665
10829
  "objectApiName": "object_listviews",
10666
10830
  "recordId": "${recordId}",
10667
10831
  "mode": "edit",
10832
+ "layout": "normal",
10668
10833
  "fieldsExtend": fieldsExtend$1(),
10669
10834
  "initApiAdaptor": initApiAdaptor$1(),
10670
10835
  "apiRequestAdaptor": apiRequestAdaptor$1(),
@@ -10861,6 +11026,8 @@ const getSetListviewSortButtonSchema = ()=>{
10861
11026
  function fieldsExtend(){
10862
11027
  return {
10863
11028
  "sort": {
11029
+ "label": "",
11030
+ "group": "",
10864
11031
  "amis": {
10865
11032
  "type": "tabs-transfer",
10866
11033
  "sortable": true,
@@ -10988,7 +11155,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
10988
11155
  "icon": "fa fa-cog",
10989
11156
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
10990
11157
  // "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
10991
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
11158
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
10992
11159
  "align": "right",
10993
11160
  "visibleOn": "${!isLookup}",
10994
11161
  "buttons": [
@@ -11009,8 +11176,8 @@ const getSettingListviewToolbarButtonSchema = ()=>{
11009
11176
  }
11010
11177
  };
11011
11178
 
11012
- const getDisplayAsButton = function(objectName, showDisplayAs){
11013
- let displayAs = Router$1.getTabDisplayAs(objectName);
11179
+ const getDisplayAsButton = function(objectName, defaultEnableSplit){
11180
+ let displayAs = Router$1.getTabDisplayAs(objectName, defaultEnableSplit);
11014
11181
  let buttons = [
11015
11182
  {
11016
11183
  "type": "button",
@@ -11033,7 +11200,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
11033
11200
  "icon": "fa fa-table-columns",
11034
11201
  //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11035
11202
  // "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
11036
- "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
11203
+ "btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
11037
11204
  "align": "right",
11038
11205
  "visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
11039
11206
  "buttons": [
@@ -11226,7 +11393,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11226
11393
  // //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
11227
11394
  // // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11228
11395
  // "tooltipPlacement": "top",
11229
- // "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
11396
+ // "className": "bg-white p-2 rounded text-gray-500",
11230
11397
  // "label": "",
11231
11398
  // "icon": "fa fa-sync",
11232
11399
  // "visibleOn": "${!showFieldsFilter}",
@@ -11250,7 +11417,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11250
11417
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11251
11418
  "tooltip":"",
11252
11419
  "tooltipPlacement": "top",
11253
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
11420
+ "className": "bg-white p-2 rounded text-gray-500"
11254
11421
  };
11255
11422
  }
11256
11423
  else {
@@ -11261,7 +11428,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11261
11428
  // "tooltip": i18next.t('frontend_button_reload_tooltip'),
11262
11429
  "tooltip":"",
11263
11430
  "tooltipPlacement": "top",
11264
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500"
11431
+ "className": "bg-white p-2 rounded text-gray-500"
11265
11432
  };
11266
11433
  }
11267
11434
  let toolbarFilter;
@@ -11283,7 +11450,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11283
11450
  "visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
11284
11451
  },
11285
11452
  "align": "right",
11286
- "className": "bg-white p-2 rounded border-gray-300 text-gray-500",
11453
+ "className": "bg-white p-2 rounded text-gray-500",
11287
11454
  "onEvent": {
11288
11455
  "click": {
11289
11456
  "actions": [
@@ -11297,7 +11464,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
11297
11464
  "id": "steedos_crud_toolbar_filter"
11298
11465
  };
11299
11466
  }
11300
- let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name);
11467
+ let toolbarDisplayAsButton = getDisplayAsButton(mainObject?.name, mainObject?.enable_split);
11301
11468
  let toolbarDQuickSearchBox = getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLookup, keywordsSearchBoxName });
11302
11469
 
11303
11470
  // toolbars返回的数组元素不可以是空对象{},比如hiddenCount ? {} : {"type": "tpl",...},因为空对象最终还是会生成一个空的.antd-Crud-toolbar-item dom
@@ -11443,7 +11610,6 @@ async function getObjectFilter(objectSchema, fields, options) {
11443
11610
  "timeOut": 1000
11444
11611
  }
11445
11612
  });
11446
- resizeWindow();
11447
11613
  const scope = event.context.scoped;
11448
11614
  // let filterFormValues = event.data;
11449
11615
  let filterForm = SteedosUI.getClosestAmisComponentByType(scope, "form");
@@ -11610,7 +11776,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11610
11776
  const bodyProps = {
11611
11777
  // toolbar: getToolbar(),
11612
11778
  // headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
11613
- headerToolbarClassName: "px-4 py-2 border-gray-300 bg-gray-100 border-solid border-b",
11779
+ headerToolbarClassName: "px-4 py-2 border-b",
11614
11780
  footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
11615
11781
  ...options,
11616
11782
  disableStatistics: options.queryCount === false
@@ -11757,14 +11923,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11757
11923
  headers: {
11758
11924
  Authorization: "Bearer ${context.tenantId},${context.authToken}",
11759
11925
  },
11760
- requestAdaptor: quickSaveApiRequestAdaptor,
11761
- adaptor: `
11762
- if(payload.errors){
11763
- payload.status = 2;
11764
- payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
11765
- }
11766
- return payload;
11767
- `
11926
+ requestAdaptor: quickSaveApiRequestAdaptor
11768
11927
  },
11769
11928
  // 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
11770
11929
  // 使用表达式给tr添加初始选中状态
@@ -11781,6 +11940,20 @@ async function getObjectCRUD(objectSchema, fields, options){
11781
11940
  crudModeClassName = `steedos-crud-mode-${body.mode}`;
11782
11941
  }
11783
11942
 
11943
+ body.quickSaveApi.adaptor = `
11944
+ if(payload.errors){
11945
+ payload.status = 2;
11946
+ payload.msg = window.t ? window.t(payload.errors[0].message) : payload.errors[0].message;
11947
+ }
11948
+ var scope = SteedosUI.getRef(context.scopeId);
11949
+ var scopeParent = scope && scope.parent;
11950
+ var crudScoped = scopeParent.getComponentById('${body.id}');
11951
+ setTimeout(()=>{
11952
+ crudScoped && crudScoped.control.updateAutoFillHeight();
11953
+ }, 500);
11954
+ return payload;
11955
+ `;
11956
+
11784
11957
  if(body.columns && options.formFactor != 'SMALL'){
11785
11958
  //将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
11786
11959
  body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
@@ -12146,7 +12319,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
12146
12319
  * @Author: baozhoutao@steedos.com
12147
12320
  * @Date: 2022-07-05 15:55:39
12148
12321
  * @LastEditors: baozhoutao@steedos.com
12149
- * @LastEditTime: 2024-01-15 10:34:46
12322
+ * @LastEditTime: 2024-01-24 10:18:17
12150
12323
  * @Description:
12151
12324
  */
12152
12325
 
@@ -12245,7 +12418,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12245
12418
  const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
12246
12419
  mainRelated[arr[0]] = foreign_key_value;
12247
12420
  }
12248
- }else {
12421
+ }
12422
+ // 防止related_lists中没有相关子表,但是details中有相关子表的情况
12423
+ if(!mainRelated[relatedObjectName]){
12249
12424
  const details = union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
12250
12425
  for (const detail of details) {
12251
12426
  const arr = detail.split(".");
@@ -12334,7 +12509,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12334
12509
  amisSchema: {
12335
12510
  type: "service",
12336
12511
  id: componentId,
12337
- className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
12512
+ className: `steedos-record-related-list mb-4 last:mb-0 ${componentId} ${className}`,
12338
12513
  data: {
12339
12514
  relatedKey: relatedKey,
12340
12515
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
@@ -12562,8 +12737,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
12562
12737
  /*
12563
12738
  * @Author: baozhoutao@steedos.com
12564
12739
  * @Date: 2022-07-05 15:55:39
12565
- * @LastEditors: baozhoutao@steedos.com
12566
- * @LastEditTime: 2024-01-16 11:14:34
12740
+ * @LastEditors: liaodaxue
12741
+ * @LastEditTime: 2024-02-05 17:56:27
12567
12742
  * @Description:
12568
12743
  */
12569
12744
 
@@ -12919,6 +13094,8 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
12919
13094
  const rfUiSchema = await getUISchema(filedInfo.reference_to);
12920
13095
  const rfFieldInfo = rfUiSchema.fields[displayName];
12921
13096
  fields.push(Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx));
13097
+ }else if(filedInfo && filedInfo.type === 'object'){
13098
+ fields.push(uiSchema.fields[column]);
12922
13099
  }
12923
13100
  } else {
12924
13101
  if (uiSchema.fields[column]) {
@@ -13080,7 +13257,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
13080
13257
  };
13081
13258
  const content = {
13082
13259
  "type": "tabs",
13083
- "className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
13260
+ "className": "steedos-record-tabs bg-white p-4 mt-3 border-y",
13084
13261
  "contentClassName": "bg-none",
13085
13262
  "tabs": [
13086
13263
  detailed
@@ -13781,17 +13958,13 @@ function getReferenceToSync(field) {
13781
13958
 
13782
13959
  function getLookupSapceUserTreeSchema(isMobile){
13783
13960
  let apiAdaptor = `
13784
- // console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
13785
13961
  const records = payload.data.options;
13786
- let isTreeOptionsComputed = false;
13787
- if(records.length === 1 && records[0].children){
13788
- isTreeOptionsComputed = true;
13789
- }
13790
- if(isTreeOptionsComputed){
13791
- return payload;
13792
- }
13793
13962
  const treeRecords = [];
13794
- const getChildren = (records, childrenIds) => {
13963
+ const getChildren = (currentRecord, records, childrenIds) => {
13964
+ if (currentRecord.children && typeof currentRecord.children[0] === "object") {
13965
+ // 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
13966
+ return currentRecord.children;
13967
+ }
13795
13968
  if (!childrenIds) {
13796
13969
  return;
13797
13970
  }
@@ -13800,7 +13973,7 @@ function getLookupSapceUserTreeSchema(isMobile){
13800
13973
  });
13801
13974
  _.each(children, (item) => {
13802
13975
  if (item.children) {
13803
- item.children = getChildren(records, item.children)
13976
+ item.children = getChildren(item, records, item.children)
13804
13977
  }else{
13805
13978
  item.children = [];
13806
13979
  }
@@ -13826,7 +13999,7 @@ function getLookupSapceUserTreeSchema(isMobile){
13826
13999
 
13827
14000
  _.each(records, (record) => {
13828
14001
  if (record.noParent == 1) {
13829
- treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
14002
+ treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
13830
14003
  }
13831
14004
  });
13832
14005
  console.log(treeRecords)
@@ -13876,6 +14049,7 @@ function getLookupSapceUserTreeSchema(isMobile){
13876
14049
  }
13877
14050
  },
13878
14051
  "label": "",
14052
+ "mode": "normal",
13879
14053
  "name": "organizations",
13880
14054
  "multiple": false,
13881
14055
  "joinValues": false,
@@ -14018,6 +14192,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
14018
14192
  }
14019
14193
  });
14020
14194
 
14195
+ let listviewFilter = getListViewFilter(listView);
14196
+ let listviewFiltersFunction = listView && listView._filters;
14197
+
14021
14198
  let sort = "";
14022
14199
  if(listView){
14023
14200
  sort = getListViewSort(listView);
@@ -14064,7 +14241,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
14064
14241
  Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
14065
14242
  }
14066
14243
  const selfData = JSON.parse(JSON.stringify(api.data.$self));
14067
- var filters = [];
14244
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
14068
14245
  var pageSize = api.data.pageSize || 10;
14069
14246
  var pageNo = api.data.pageNo || 1;
14070
14247
  var skip = (pageNo - 1) * pageSize;
@@ -14126,6 +14303,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
14126
14303
  }
14127
14304
 
14128
14305
  const inFilterForm = ${ctx.inFilterForm};
14306
+
14307
+ const listviewFiltersFunction = ${listviewFiltersFunction};
14308
+
14309
+ if(listviewFiltersFunction && !inFilterForm){
14310
+ const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
14311
+ if(_filters0 && _filters0.length){
14312
+ filters.push(_filters0);
14313
+ }
14314
+ }
14315
+
14129
14316
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
14130
14317
 
14131
14318
  if(filtersFunction && !inFilterForm){
@@ -14213,6 +14400,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
14213
14400
  });
14214
14401
  payload.data.rows = treeRecords;
14215
14402
  }
14403
+ const result = payload.data.rows;
14404
+ if(result && result.length){
14405
+ const updatedResult = _.map(result, (element) => {
14406
+ const data = { ...element };
14407
+ // image字段值添加URL前缀
14408
+ ${getScriptForAddUrlPrefixForImgFields(_$1.values(refObjectConfig.fields))}
14409
+ return data;
14410
+ });
14411
+ payload.data.rows = updatedResult;
14412
+ }
14216
14413
  return payload;
14217
14414
  `;
14218
14415
  if(field.optionsFunction || field._optionsFunction){
@@ -14244,13 +14441,15 @@ async function lookupToAmisPicker(field, readonly, ctx){
14244
14441
 
14245
14442
  pickerSchema.affixHeader = false;
14246
14443
 
14247
- var headerToolbarItems = [];
14444
+
14445
+
14446
+ pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { isLookup: true, keywordsSearchBoxName });
14447
+
14248
14448
  if(referenceTo.objectName === "space_users" && field.reference_to_field === "user"){
14249
- headerToolbarItems = getLookupSapceUserTreeSchema(isMobile);
14449
+ pickerSchema.headerToolbar.push(getLookupSapceUserTreeSchema(isMobile));
14250
14450
  pickerSchema.className = pickerSchema.className || "" + " steedos-select-user";
14251
14451
  }
14252
-
14253
- pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
14452
+
14254
14453
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
14255
14454
  const isCreate = _$1.isBoolean(field.create) ? field.create : true;
14256
14455
  // lookup字段配置过滤条件就强制不显示新建按钮
@@ -14363,8 +14562,19 @@ async function lookupToAmisPicker(field, readonly, ctx){
14363
14562
  pickerSchema.footerToolbar = ["pagination"];
14364
14563
  }
14365
14564
 
14565
+ if(field.inlineHelpText){
14566
+ pickerSchema.toolbarClassName = "hasHelpText";
14567
+ pickerSchema.headerToolbar = [{
14568
+ "type": "tpl",
14569
+ "tpl": field.inlineHelpText,
14570
+ "className": "text-secondary"
14571
+ }, ...pickerSchema.headerToolbar];
14572
+ }
14573
+ pickerSchema.className = (pickerSchema.className || "") + " steedos-lookup-crud";
14574
+
14366
14575
  const data = {
14367
14576
  type: getAmisStaticFieldType$1('picker', readonly),
14577
+ className: ctx.className || '',
14368
14578
  modalTitle: instance.t('frontend_form_please_select') + " " + refObjectConfig.label,
14369
14579
  labelField: referenceTo.labelField.name,
14370
14580
  valueField: referenceTo.valueField.name,
@@ -14438,6 +14648,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
14438
14648
  const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
14439
14649
  let listView = getLookupListView(refObjectConfig);
14440
14650
 
14651
+ let listviewFilter = getListViewFilter(listView);
14652
+ let listviewFiltersFunction = listView && listView._filters;
14653
+
14441
14654
  let sort = "";
14442
14655
  if(listView){
14443
14656
  sort = getListViewSort(listView);
@@ -14467,7 +14680,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
14467
14680
  apiInfo.data['rfield'] = `\${object_name}`;
14468
14681
  // [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
14469
14682
  apiInfo.requestAdaptor = `
14470
- var filters = [];
14683
+ ${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
14471
14684
  var top = 200;
14472
14685
  if(api.data.$term){
14473
14686
  filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
@@ -14490,6 +14703,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
14490
14703
  }
14491
14704
 
14492
14705
  const inFilterForm = ${ctx.inFilterForm};
14706
+
14707
+ const listviewFiltersFunction = ${listviewFiltersFunction};
14708
+
14709
+ if(listviewFiltersFunction && !inFilterForm){
14710
+ const _filters0 = listviewFiltersFunction(filters, api.data.$);
14711
+ if(_filters0 && _filters0.length){
14712
+ filters.push(_filters0);
14713
+ }
14714
+ }
14715
+
14493
14716
  const filtersFunction = ${field.filtersFunction || field._filtersFunction};
14494
14717
 
14495
14718
  if(filtersFunction && !inFilterForm){
@@ -14566,6 +14789,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
14566
14789
  // 但是同时配置autoComplete和source会多请求一次接口
14567
14790
  // TODO:应该想办法把是否字段在子表组件内,即ctx.isInputTable,如果不在子表组件内不需要加source
14568
14791
  data.source = apiInfo;
14792
+ delete data.autoComplete;
14569
14793
  }
14570
14794
  //删除xlink:href中的rootUrl前缀,解决客户端svg为空的问题
14571
14795
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
@@ -14612,7 +14836,8 @@ async function lookupToAmis(field, readonly, ctx){
14612
14836
  }
14613
14837
  // console.log(`lookupToAmis====`, field, readonly, ctx)
14614
14838
  if(readonly){
14615
- if(field.reference_to){
14839
+ if(field.reference_to && !field.isTableField){
14840
+ //isTableField只在grid字段内存在
14616
14841
  return {
14617
14842
  type: 'steedos-field',
14618
14843
  config: field,
@@ -14827,8 +15052,8 @@ if(typeof window != 'undefined'){
14827
15052
  /*
14828
15053
  * @Author: baozhoutao@steedos.com
14829
15054
  * @Date: 2023-01-13 17:27:54
14830
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
14831
- * @LastEditTime: 2023-08-28 17:45:38
15055
+ * @LastEditors: liaodaxue
15056
+ * @LastEditTime: 2024-02-04 17:29:54
14832
15057
  * @Description:
14833
15058
  */
14834
15059
 
@@ -14929,7 +15154,8 @@ const getHtmlFieldSchema = (field, readonly, ctx)=>{
14929
15154
  "title": "Insert",
14930
15155
  "items": "image link media addcomment pageembed codesample inserttable | charmap emoticons hr | pagebreak nonbreaking anchor tableofcontents | insertdatetime"
14931
15156
  }
14932
- }
15157
+ },
15158
+ "statusbar": false
14933
15159
  },
14934
15160
  "name": field.name
14935
15161
  }
@@ -15274,13 +15500,31 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15274
15500
  };
15275
15501
  break;
15276
15502
  case 'input-datetime-range':
15503
+ // convertData = {
15504
+ // type: "input-datetime-range",
15505
+ // inputFormat: 'YYYY-MM-DD HH:mm',
15506
+ // format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
15507
+ // tpl: readonly ? Tpl.getDateTimeTpl(field) : null,
15508
+ // utc: true,
15509
+ // joinValues: false
15510
+ // }
15511
+ // 日期时间字段,按日期方式展现显示控件,用户不用关心小时分钟
15277
15512
  convertData = {
15278
- type: "input-datetime-range",
15279
- inputFormat: 'YYYY-MM-DD HH:mm',
15513
+ type: "input-date-range",
15514
+ inputFormat: "YYYY-MM-DD HH:mm",
15280
15515
  format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
15281
15516
  tpl: readonly ? getDateTimeTpl(field) : null,
15282
15517
  utc: true,
15283
- joinValues: false
15518
+ joinValues: false,
15519
+ "shortcuts": [
15520
+ "thismonth",
15521
+ "2monthsago",
15522
+ "3monthslater",
15523
+ "prevquarter",
15524
+ "thisquarter",
15525
+ "thisyear",
15526
+ "lastYear"
15527
+ ]
15284
15528
  };
15285
15529
  break;
15286
15530
  case 'datetime':
@@ -15331,7 +15575,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15331
15575
  convertData = {
15332
15576
  type: getAmisStaticFieldType$1('datetime', readonly),
15333
15577
  inputFormat: 'YYYY-MM-DD HH:mm',
15334
- format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
15578
+ format: 'YYYY-MM-DDTHH:mm:00.000Z',
15335
15579
  tpl: readonly ? getDateTimeTpl(field) : null,
15336
15580
  utc: true,
15337
15581
  };
@@ -15462,6 +15706,36 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15462
15706
  convertData = {
15463
15707
  type: 'static-text'
15464
15708
  };
15709
+ }else if(field.autonumber_enable_modify){
15710
+ convertData = {
15711
+ "type": "input-group",
15712
+ "body": [
15713
+ {
15714
+ "type": "input-text",
15715
+ "name": field.name
15716
+ },
15717
+ {
15718
+ "type": "button",
15719
+ "label": "自动获取",
15720
+ "actionType": "ajax",
15721
+ "api": {
15722
+ "url": `\${context.rootUrl}/api/autonumber/generator/\${objectName}/${field.name}`,
15723
+ "method": "post",
15724
+ "headers": {
15725
+ "Authorization": "Bearer ${context.tenantId},${context.authToken}"
15726
+ },
15727
+ "adaptor": `
15728
+ payload.data["${field.name}"] = payload.data && payload.data.autonumber;
15729
+ delete payload.data.autonumber;
15730
+ return payload;
15731
+ `
15732
+ },
15733
+ "messages": {
15734
+ "success": "获取成功"
15735
+ }
15736
+ }
15737
+ ]
15738
+ };
15465
15739
  }
15466
15740
  break;
15467
15741
  case 'url':
@@ -15667,12 +15941,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15667
15941
  break;
15668
15942
  }
15669
15943
  if(!_$1.isEmpty(convertData)){
15944
+ const className = convertData.className;
15670
15945
  if(field.is_wide || convertData.type === 'group'){
15671
- convertData.className = 'col-span-2 m-0';
15946
+ convertData.className = className ? 'col-span-2 m-0 ' + className : 'col-span-2 m-0';
15672
15947
  }else {
15673
- convertData.className = 'm-0';
15948
+ convertData.className = className ? 'm-0 ' + className : 'm-0';
15674
15949
  }
15675
- if(readonly){
15950
+ if(readonly && ctx.mode !== 'edit'){
15676
15951
  convertData.className = `${convertData.className} border-b`;
15677
15952
  }
15678
15953
  if(readonly){
@@ -15680,11 +15955,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15680
15955
  }
15681
15956
 
15682
15957
  let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
15683
- if (convertData.className) {
15684
- convertData.className = convertData.className + fieldTypeClassName;
15685
- } else {
15686
- convertData.className = fieldTypeClassName;
15687
- }
15958
+ convertData.className = convertData.className + fieldTypeClassName;
15688
15959
 
15689
15960
  if(field.visible_on && !ctx.inFilterForm){
15690
15961
  // convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
@@ -15767,8 +16038,9 @@ async function getFieldSearchable(perField, permissionFields, ctx){
15767
16038
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15768
16039
  }
15769
16040
  if(_field.type === 'datetime'){
15770
- // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
15771
- _field.type = 'input-date-range';
16041
+ // 这里如果想把搜索范围展示效果改为日期范围,不可以直接改为input-date-range,因为它们规则不一样,包括时区规则和小时分秒的存值规则都不一样
16042
+ // 所以想改为展示日期范围效果,只能改input-datetime-range类型本身的属性来实现
16043
+ _field.type = 'input-datetime-range';
15772
16044
  _field.is_wide = true;
15773
16045
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15774
16046
  }
@@ -15954,6 +16226,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
15954
16226
  }
15955
16227
  }
15956
16228
 
16229
+ fieldSetBody.forEach((field)=>{
16230
+ //判断label是否存在,不存在时将label的空占位元素隐藏
16231
+ if(!field.label){
16232
+ field.labelClassName = "none";
16233
+ }
16234
+ });
16235
+
15957
16236
  // fieldSet 已支持显隐控制
15958
16237
  const sectionFieldsVisibleOn = _$1.map(_$1.compact(_$1.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
15959
16238
  let visible = visibleOn;
@@ -16076,12 +16355,130 @@ async function getFormBody(permissionFields, formFields, ctx){
16076
16355
  return await getSections(permissionFields, formFields, ctx);
16077
16356
  }
16078
16357
 
16358
+ /*
16359
+ * @Author: 殷亮辉 yinlianghui@hotoa.com
16360
+ * @Date: 2024-01-18 15:12:41
16361
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
16362
+ * @LastEditTime: 2024-01-18 15:12:49
16363
+ */
16364
+ /**
16365
+ * 生成符合标准uuid格式的36位满足唯一性的随机串
16366
+ * @returns uuid
16367
+ */
16368
+ function uuidv4() {
16369
+ return "10000000-1000-4000-8000-100000000000".replace(/[018]/g, c =>
16370
+ (c ^ window.crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16)
16371
+ );
16372
+ }
16373
+
16079
16374
  /*
16080
16375
  * @Author: 殷亮辉 yinlianghui@hotoa.com
16081
16376
  * @Date: 2023-11-15 09:50:22
16082
16377
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
16083
- * @LastEditTime: 2024-01-18 10:29:57
16378
+ * @LastEditTime: 2024-01-26 17:47:16
16379
+ */
16380
+
16381
+ /**
16382
+ * 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
16383
+ * amis #9520修正后此函数及相关代码可以移除
16384
+ * @param {*} value 子表组件字段值,数组
16385
+ * @param {*} fields 子表组件fields属性,数组
16386
+ * @returns 转换后的子表组件字段值
16387
+ */
16388
+ function getTableValueWithEmptyValue(value, fields) {
16389
+ return (value || []).map((itemValue) => {
16390
+ //这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
16391
+ const newItemValue = clone(itemValue);
16392
+ (fields || []).forEach((itemField) => {
16393
+ if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
16394
+ // 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
16395
+ // 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
16396
+ newItemValue[itemField.name] = "";
16397
+ }
16398
+ if (newItemValue.children) {
16399
+ newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
16400
+ }
16401
+ });
16402
+ return newItemValue;
16403
+ });
16404
+ }
16405
+
16406
+ /**
16407
+ * 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
16408
+ * amis #9520修正后此函数及相关代码可以移除
16409
+ * @param {*} value 子表组件字段值,数组
16410
+ * @param {*} fields 子表组件fields属性,数组
16411
+ * @returns 转换后的子表组件字段值
16084
16412
  */
16413
+ function getTableValueWithoutEmptyValue(value, fields) {
16414
+ return (value || []).map((itemValue) => {
16415
+ const newItemValue = clone(itemValue);
16416
+ (fields || []).forEach((itemField) => {
16417
+ if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
16418
+ // 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
16419
+ delete newItemValue[itemField.name];
16420
+ }
16421
+ if (newItemValue.children) {
16422
+ newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
16423
+ }
16424
+ });
16425
+ return newItemValue;
16426
+ });
16427
+ }
16428
+
16429
+ function getTablePrimaryKey(props) {
16430
+ return props.primaryKey || "_id";
16431
+ }
16432
+
16433
+ /**
16434
+ * 子表组件字段值中每行数据的补上唯一标识字段值,其值为随机uuid
16435
+ * @param {*} value 子表组件字段值,数组
16436
+ * @param {*} primaryKey 主键字段名,一般为_id
16437
+ * @returns 转换后的子表组件字段值
16438
+ */
16439
+ function getTableValueWithPrimaryKeyValue(value, primaryKey) {
16440
+ if (!primaryKey) {
16441
+ return value;
16442
+ }
16443
+ return (value || []).map((itemValue) => {
16444
+ //这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
16445
+ const newItemValue = clone(itemValue);
16446
+ if (newItemValue[primaryKey]) {
16447
+ if (newItemValue.children) {
16448
+ newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
16449
+ }
16450
+ return newItemValue;
16451
+ }
16452
+ else {
16453
+ newItemValue[primaryKey] = uuidv4();
16454
+ if (newItemValue.children) {
16455
+ newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
16456
+ }
16457
+ return newItemValue;
16458
+ }
16459
+ });
16460
+ }
16461
+
16462
+ /**
16463
+ * 子表组件字段值中每行数据的移除唯一标识字段值,因为该字段值一般只作临时标记,不存库
16464
+ * @param {*} value 子表组件字段值,数组
16465
+ * @param {*} primaryKey 主键字段名,一般为_id
16466
+ * @returns 转换后的子表组件字段值
16467
+ */
16468
+ function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
16469
+ if (!primaryKey) {
16470
+ return value;
16471
+ }
16472
+ return (value || []).map((itemValue) => {
16473
+ //这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
16474
+ const newItemValue = clone(itemValue);
16475
+ if (newItemValue.children) {
16476
+ newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
16477
+ }
16478
+ delete newItemValue[primaryKey];
16479
+ return newItemValue;
16480
+ });
16481
+ }
16085
16482
 
16086
16483
  /**
16087
16484
  * 子表组件字段值中每行数据的键值key移除指定前缀
@@ -16089,12 +16486,14 @@ async function getFormBody(permissionFields, formFields, ctx){
16089
16486
  * @param {*} fieldPrefix 字段前缀
16090
16487
  * @returns 转换后的子表组件字段值
16091
16488
  */
16092
- function getTableValueWithoutFieldPrefix(value, fieldPrefix){
16489
+ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
16093
16490
  let convertedValue = [];
16094
- (value || []).forEach((itemValue)=>{
16491
+ (value || []).forEach((itemValue) => {
16095
16492
  var newItemValue = {};
16096
- for(let n in itemValue){
16097
- newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
16493
+ for (let n in itemValue) {
16494
+ if (itemValue.hasOwnProperty(n)) {
16495
+ newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
16496
+ }
16098
16497
  }
16099
16498
  convertedValue.push(newItemValue);
16100
16499
  });
@@ -16105,17 +16504,21 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
16105
16504
  * 子表组件字段值中每行数据的键值key补上指定前缀
16106
16505
  * @param {*} value 子表组件字段值,数组
16107
16506
  * @param {*} fieldPrefix 字段前缀
16507
+ * @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
16108
16508
  * @returns 转换后的子表组件字段值
16109
16509
  */
16110
- function getTableValuePrependFieldPrefix(value, fieldPrefix){
16510
+ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
16111
16511
  let convertedValue = [];
16112
- (value || []).forEach((itemValue)=>{
16512
+ (value || []).forEach((itemValue) => {
16113
16513
  var newItemValue = {};
16114
- for(let n in itemValue){
16115
- if(typeof itemValue[n] !== undefined){
16514
+ for (let n in itemValue) {
16515
+ if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
16116
16516
  newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
16117
16517
  }
16118
16518
  }
16519
+ if (primaryKey && itemValue[primaryKey]) {
16520
+ newItemValue[primaryKey] = itemValue[primaryKey];
16521
+ }
16119
16522
  convertedValue.push(newItemValue);
16120
16523
  });
16121
16524
  return convertedValue;
@@ -16127,7 +16530,7 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix){
16127
16530
  * @param {*} fieldPrefix 字段前缀
16128
16531
  * @returns 转换后的子表组件字段值
16129
16532
  */
16130
- function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
16533
+ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
16131
16534
  return (fields || []).map((item) => {
16132
16535
  const newItem = clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
16133
16536
  newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
@@ -16140,7 +16543,12 @@ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
16140
16543
  * @param {*} mode edit/new/readonly
16141
16544
  */
16142
16545
  function getFormFields(props, mode = "edit") {
16143
- return (props.fields || []).map(function (item) {
16546
+ let fieldPrefix = props.fieldPrefix;
16547
+ let fields = props.fields || [];
16548
+ if (fieldPrefix) {
16549
+ fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
16550
+ }
16551
+ return (fields || []).map(function (item) {
16144
16552
  let formItem = {
16145
16553
  "type": "steedos-field",
16146
16554
  "name": item.name,
@@ -16160,6 +16568,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
16160
16568
  name: field.name,
16161
16569
  quickEdit: {
16162
16570
  "type": "steedos-field",
16571
+ "mode": "inline",
16163
16572
  "config": Object.assign({}, field, {
16164
16573
  label: false
16165
16574
  })
@@ -16212,7 +16621,12 @@ async function getInputTableColumns(props) {
16212
16621
  let inlineEditMode = props.inlineEditMode;
16213
16622
  let showAsInlineEditMode = inlineEditMode && props.editable;
16214
16623
  // 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
16215
- let fields = props.fields;
16624
+
16625
+ let fieldPrefix = props.fieldPrefix;
16626
+ let fields = props.fields || [];
16627
+ if (fieldPrefix) {
16628
+ fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
16629
+ }
16216
16630
  if (columns && columns.length) {
16217
16631
  return columns.map(function (column) {
16218
16632
  let field, extendColumnProps = {};
@@ -16234,8 +16648,26 @@ async function getInputTableColumns(props) {
16234
16648
  }
16235
16649
  }
16236
16650
  if (field) {
16237
- let tableCell = getInputTableCell(field, showAsInlineEditMode);
16238
- return Object.assign({}, tableCell, extendColumnProps);
16651
+ let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
16652
+ extendColumnProps.inlineEditMode : showAsInlineEditMode;
16653
+ let tableCell = getInputTableCell(field, mode);
16654
+ let className = "";
16655
+ //判断是否换行,目前规则默认换行
16656
+ if(extendColumnProps.wrap != true){
16657
+ className += " whitespace-nowrap ";
16658
+ }else {
16659
+ className += " break-words ";
16660
+ }
16661
+ //合并classname
16662
+ if (typeof extendColumnProps.className == "object") {
16663
+ className = {
16664
+ [className]: "true",
16665
+ ...extendColumnProps.className
16666
+ };
16667
+ } else if (typeof extendColumnProps.className == "string") {
16668
+ className = `${className} ${extendColumnProps.className} `;
16669
+ }
16670
+ return Object.assign({}, tableCell, extendColumnProps, {className});
16239
16671
  }
16240
16672
  else {
16241
16673
  return column;
@@ -16245,6 +16677,7 @@ async function getInputTableColumns(props) {
16245
16677
  else {
16246
16678
  return fields.map(function (field) {
16247
16679
  let tableCell = getInputTableCell(field, showAsInlineEditMode);
16680
+ tableCell.className = " whitespace-nowrap ";
16248
16681
  return tableCell;
16249
16682
  }) || [];
16250
16683
  }
@@ -16257,7 +16690,7 @@ async function getInputTableColumns(props) {
16257
16690
  */
16258
16691
  function getFormPagination(props, mode) {
16259
16692
  let showPagination = true;
16260
- if(mode === "new" && !!!props.editable){
16693
+ if (mode === "new" && !!!props.editable) {
16261
16694
  //不允许编辑只允许新建时不应该让用户操作翻页
16262
16695
  showPagination = false;
16263
16696
  }
@@ -16273,35 +16706,41 @@ function getFormPagination(props, mode) {
16273
16706
  let __formId = "${formId}";
16274
16707
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16275
16708
  let pageChangeDirection = context.props.pageChangeDirection;
16709
+ let mode = "${mode}";
16276
16710
  // event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
16277
16711
  // 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
16278
16712
  // 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
16279
16713
  // let currentPage = currentIndex + 1;
16280
16714
  let currentPage = event.data.__page;
16281
16715
  let currentIndex = event.data.index;
16282
- // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
16283
- let currentFormValues = scope.getComponentById(__formId).getValues();
16284
- var parent = event.data.parent;
16285
- var __parentIndex = event.data.__parentIndex;
16286
- if(parent){
16287
- fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
16288
- // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
16289
- fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
16290
- children: fieldValue[__parentIndex].children,
16291
- __fix_rerender_after_children_modified_tag: new Date().getTime()
16716
+ if(mode !== "readonly"){
16717
+ // 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
16718
+ // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
16719
+ let currentFormValues = scope.getComponentById(__formId).getValues();
16720
+ // 这里不clone的话,其值会带上__super属性
16721
+ currentFormValues = _.clone(currentFormValues);
16722
+ var parent = event.data.parent;
16723
+ var __parentIndex = event.data.__parentIndex;
16724
+ if(parent){
16725
+ fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
16726
+ // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
16727
+ fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
16728
+ children: fieldValue[__parentIndex].children,
16729
+ __fix_rerender_after_children_modified_tag: new Date().getTime()
16730
+ });
16731
+ }
16732
+ else{
16733
+ fieldValue[currentIndex] = currentFormValues;
16734
+ }
16735
+ // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
16736
+ doAction({
16737
+ "componentId": "${props.id}",
16738
+ "actionType": "setValue",
16739
+ "args": {
16740
+ "value": fieldValue
16741
+ }
16292
16742
  });
16293
16743
  }
16294
- else{
16295
- fieldValue[currentIndex] = currentFormValues;
16296
- }
16297
- // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
16298
- doAction({
16299
- "componentId": "${props.id}",
16300
- "actionType": "setValue",
16301
- "args": {
16302
- "value": fieldValue
16303
- }
16304
- });
16305
16744
 
16306
16745
  // 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
16307
16746
  let targetPage;
@@ -16350,9 +16789,14 @@ function getFormPagination(props, mode) {
16350
16789
  "onEvent": {
16351
16790
  "click": {
16352
16791
  "actions": [
16792
+ {
16793
+ "actionType": "validate",
16794
+ "componentId": formId
16795
+ },
16353
16796
  {
16354
16797
  "actionType": "custom",
16355
- "script": onPageChangeScript
16798
+ "script": onPageChangeScript,
16799
+ "expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16356
16800
  }
16357
16801
  ]
16358
16802
  }
@@ -16361,7 +16805,7 @@ function getFormPagination(props, mode) {
16361
16805
  {
16362
16806
  "type": "tpl",
16363
16807
  // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
16364
- "tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
16808
+ "tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
16365
16809
  },
16366
16810
  {
16367
16811
  "type": "button",
@@ -16371,15 +16815,20 @@ function getFormPagination(props, mode) {
16371
16815
  "pageChangeDirection": "next",
16372
16816
  // "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
16373
16817
  // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
16374
- "disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
16818
+ "disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
16375
16819
  "size": "sm",
16376
16820
  "id": buttonNextId,
16377
16821
  "onEvent": {
16378
16822
  "click": {
16379
16823
  "actions": [
16824
+ {
16825
+ "actionType": "validate",
16826
+ "componentId": formId
16827
+ },
16380
16828
  {
16381
16829
  "actionType": "custom",
16382
- "script": onPageChangeScript
16830
+ "script": onPageChangeScript,
16831
+ "expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16383
16832
  }
16384
16833
  ]
16385
16834
  }
@@ -16400,6 +16849,7 @@ function getFormPaginationWrapper(props, form, mode) {
16400
16849
  // console.log("==getFormPaginationWrapper===", props, mode);
16401
16850
  let serviceId = getComponentId("form_pagination", props.id);
16402
16851
  let tableServiceId = getComponentId("table_service", props.id);
16852
+ let primaryKey = getTablePrimaryKey(props);
16403
16853
  let innerForm = Object.assign({}, form, {
16404
16854
  "data": {
16405
16855
  // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
@@ -16427,7 +16877,6 @@ function getFormPaginationWrapper(props, form, mode) {
16427
16877
  }
16428
16878
  ];
16429
16879
  let onServiceInitedScript = `
16430
-
16431
16880
  // 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
16432
16881
  // 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
16433
16882
  // 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
@@ -16441,13 +16890,13 @@ function getFormPaginationWrapper(props, form, mode) {
16441
16890
  // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16442
16891
  // 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
16443
16892
  let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
16444
- let fieldPrefix = "${props.fieldPrefix}";
16893
+ let fieldPrefix = "${props.fieldPrefix || ''}";
16445
16894
  if(fieldPrefix){
16446
16895
  let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
16447
16896
  lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
16448
16897
  }
16449
16898
  //不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
16450
- let mode = "${mode}";
16899
+ let mode = "${mode || ''}";
16451
16900
  if(mode === "new"){
16452
16901
  // 点击子表组件底部新增按钮时新增一条空白行并自动翻页到新增行
16453
16902
  // 注意点击弹出的子表行详细表单中的新增按钮不会进此service init事件函数中
@@ -16473,10 +16922,20 @@ function getFormPaginationWrapper(props, form, mode) {
16473
16922
  var fieldValue = event.data.__tableItems;
16474
16923
  if(parent){
16475
16924
  // 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
16476
- var primaryKey = "${props.primaryKey}";
16925
+ var primaryKey = "${primaryKey}";
16477
16926
  event.data.__parentIndex = _.findIndex(fieldValue, function(item){
16478
16927
  return item[primaryKey] == parent[primaryKey];
16479
16928
  });
16929
+ if(event.data.__parentIndex < 0){
16930
+ let tableId = "${props.id}";
16931
+ let table = scope.getComponentById(tableId)
16932
+ // autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
16933
+ // 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
16934
+ // 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
16935
+ event.data.__parentIndex = _.findIndex(table.props.value, function(item){
16936
+ return item[primaryKey] == parent[primaryKey];
16937
+ });
16938
+ }
16480
16939
  }
16481
16940
  `;
16482
16941
  let schema = {
@@ -16525,6 +16984,7 @@ function getFormPaginationWrapper(props, form, mode) {
16525
16984
  async function getForm(props, mode = "edit", formId) {
16526
16985
  let formFields = getFormFields(props, mode);
16527
16986
  let body = await getFormBody(null, formFields);
16987
+ let primaryKey = getTablePrimaryKey(props);
16528
16988
  if (!formId) {
16529
16989
  formId = getComponentId("form", props.id);
16530
16990
  }
@@ -16543,6 +17003,18 @@ async function getForm(props, mode = "edit", formId) {
16543
17003
  // 新增行弹出编辑行表单,在弹出之前已经不用先增加一行,因为在翻页service初始化的时候会判断mode为new时自动新增一行
16544
17004
  let onEditItemSubmitScript = `
16545
17005
  // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
17006
+ let removeEmptyItems = function(items){
17007
+ let i = _.findIndex(items, function(item){
17008
+ return item === undefined
17009
+ });
17010
+ if(i > -1){
17011
+ items.splice(i, 1);
17012
+ removeEmptyItems(items);
17013
+ }
17014
+ }
17015
+ // 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
17016
+ // 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
17017
+ removeEmptyItems(event.data.__tableItems);
16546
17018
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16547
17019
  //这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
16548
17020
  // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
@@ -16551,6 +17023,8 @@ async function getForm(props, mode = "edit", formId) {
16551
17023
  var currentFormValues = JSON.parse(JSON.stringify(event.data));
16552
17024
  var parent = event.data.__super.__super.parent;
16553
17025
  var __parentIndex = event.data.__super.__super.__parentIndex;
17026
+ let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
17027
+ var primaryKey = "${primaryKey}";
16554
17028
  if(parent){
16555
17029
  fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
16556
17030
  // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
@@ -16560,6 +17034,8 @@ async function getForm(props, mode = "edit", formId) {
16560
17034
  });
16561
17035
  }
16562
17036
  else{
17037
+ // 这里currentFormValues中如果没有primaryKey字段值不用处理,因为组件的pipeIn/pipeOut中会为每行自动生成
17038
+ // 也不用担心复制行时_id会重复,因为点击复制按钮时已经处理过了
16563
17039
  fieldValue[currentIndex] = currentFormValues;
16564
17040
  }
16565
17041
  doAction({
@@ -16657,13 +17133,14 @@ async function getForm(props, mode = "edit", formId) {
16657
17133
  */
16658
17134
  async function getButtonActions(props, mode) {
16659
17135
  let actions = [];
17136
+ let primaryKey = getTablePrimaryKey(props);
16660
17137
  let formId = getComponentId("form", props.id);
16661
17138
  let dialogId = getComponentId("dialog", props.id);
16662
17139
  let buttonNextId = getComponentId("button_next", props.id);
16663
17140
  let formPaginationId = getComponentId("form_pagination", props.id);
16664
17141
  let parentFormData = "${__super.__super.__super.__super || {}}";
16665
17142
  let amisVersion = getComparableAmisVersion();
16666
- if(amisVersion < 3.6){
17143
+ if (amisVersion < 3.6) {
16667
17144
  parentFormData = "${__super.__super || {}}";
16668
17145
  }
16669
17146
  if (mode == "new" || mode == "edit") {
@@ -16699,13 +17176,35 @@ async function getButtonActions(props, mode) {
16699
17176
  // };
16700
17177
  let onSaveAndNewItemScript = `
16701
17178
  let scope = event.context.scoped;
17179
+ let removeEmptyItems = function(items){
17180
+ let i = _.findIndex(items, function(item){
17181
+ return item === undefined
17182
+ });
17183
+ if(i > -1){
17184
+ items.splice(i, 1);
17185
+ removeEmptyItems(items);
17186
+ }
17187
+ }
17188
+ // 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
17189
+ // 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
17190
+ removeEmptyItems(event.data.__tableItems);
16702
17191
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16703
17192
  // 新建一条空白行并保存到子表组件
16704
17193
  var parent = event.data.__super.parent;
16705
- var primaryKey = "${props.primaryKey}";
17194
+ var primaryKey = "${primaryKey}";
16706
17195
  var __parentIndex = parent && _.findIndex(fieldValue, function(item){
16707
17196
  return item[primaryKey] == parent[primaryKey];
16708
17197
  });
17198
+ if(parent && __parentIndex < 0){
17199
+ let tableId = "${props.id}";
17200
+ let table = scope.getComponentById(tableId)
17201
+ // autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
17202
+ // 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
17203
+ // 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
17204
+ __parentIndex = _.findIndex(table.props.value, function(item){
17205
+ return item[primaryKey] == parent[primaryKey];
17206
+ });
17207
+ }
16709
17208
  if(parent){
16710
17209
  fieldValue[__parentIndex].children.push({});
16711
17210
  // 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
@@ -16739,14 +17238,42 @@ async function getButtonActions(props, mode) {
16739
17238
  let __formId = "${formId}";
16740
17239
  // let newItem = JSON.parse(JSON.stringify(event.data));
16741
17240
  let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
17241
+ newItem = _.clone(newItem);
17242
+ let removeEmptyItems = function(items){
17243
+ let i = _.findIndex(items, function(item){
17244
+ return item === undefined
17245
+ });
17246
+ if(i > -1){
17247
+ items.splice(i, 1);
17248
+ removeEmptyItems(items);
17249
+ }
17250
+ }
17251
+ // 因为删除时只是把input-table组件中的行数据删除了,并没有把父层service中的行删除,所以__tableItems会有值为undefined的数据,需要移除掉
17252
+ // 不用event.data.__tableItems = _.compact(event.data.__tableItems)是因为会把__tableItems变量保存到表单中
17253
+ removeEmptyItems(event.data.__tableItems);
16742
17254
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16743
17255
  // 复制当前页数据到新建行并保存到子表组件
16744
17256
  // fieldValue.push(newItem);
16745
17257
  var parent = event.data.__super.parent;
16746
- var primaryKey = "${props.primaryKey}";
17258
+ var primaryKey = "${primaryKey}";
16747
17259
  var __parentIndex = parent && _.findIndex(fieldValue, function(item){
16748
17260
  return item[primaryKey] == parent[primaryKey];
16749
17261
  });
17262
+ if(parent && __parentIndex < 0){
17263
+ let tableId = "${props.id}";
17264
+ let table = scope.getComponentById(tableId)
17265
+ // autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
17266
+ // 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
17267
+ // 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
17268
+ __parentIndex = _.findIndex(table.props.value, function(item){
17269
+ return item[primaryKey] == parent[primaryKey];
17270
+ });
17271
+ }
17272
+ if(newItem[primaryKey]){
17273
+ // 如果newItem已经有主键字段值,则重新生成新的主键值,否则会重复。
17274
+ let uuidv4 = new Function("return (" + ${uuidv4.toString()} + ")()");
17275
+ newItem[primaryKey] = uuidv4();
17276
+ }
16750
17277
  if(parent){
16751
17278
  fieldValue[__parentIndex].children.push(newItem);
16752
17279
  // 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
@@ -16777,13 +17304,13 @@ async function getButtonActions(props, mode) {
16777
17304
  `;
16778
17305
  let dialogButtons = [
16779
17306
  {
16780
- "type": "button",
16781
- "label": "完成",
16782
- "actionType": "confirm",
16783
- "level": "primary"
17307
+ "type": "button",
17308
+ "label": "完成",
17309
+ "actionType": "confirm",
17310
+ "level": "primary"
16784
17311
  }
16785
17312
  ];
16786
- if(props.addable){
17313
+ if (props.addable) {
16787
17314
  // 有新增行权限时额外添加新增和复制按钮
16788
17315
  dialogButtons = [
16789
17316
  {
@@ -16793,9 +17320,14 @@ async function getButtonActions(props, mode) {
16793
17320
  "onEvent": {
16794
17321
  "click": {
16795
17322
  "actions": [
17323
+ {
17324
+ "actionType": "validate",
17325
+ "componentId": formId
17326
+ },
16796
17327
  {
16797
17328
  "actionType": "custom",
16798
- "script": onSaveAndNewItemScript
17329
+ "script": onSaveAndNewItemScript,
17330
+ "expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16799
17331
  }
16800
17332
  ]
16801
17333
  }
@@ -16808,9 +17340,14 @@ async function getButtonActions(props, mode) {
16808
17340
  "onEvent": {
16809
17341
  "click": {
16810
17342
  "actions": [
17343
+ {
17344
+ "actionType": "validate",
17345
+ "componentId": formId
17346
+ },
16811
17347
  {
16812
17348
  "actionType": "custom",
16813
- "script": onSaveAndCopyItemScript
17349
+ "script": onSaveAndCopyItemScript,
17350
+ "expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16814
17351
  }
16815
17352
  ]
16816
17353
  }
@@ -16856,7 +17393,7 @@ async function getButtonActions(props, mode) {
16856
17393
  // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
16857
17394
  // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
16858
17395
  "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
16859
- },
17396
+ },
16860
17397
  "actions": dialogButtons,
16861
17398
  "onEvent": {
16862
17399
  "confirm": {
@@ -16954,7 +17491,10 @@ async function getButtonActions(props, mode) {
16954
17491
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16955
17492
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16956
17493
  // "__tableItems": `\${${props.name}|json|toJson}`
16957
- "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
17494
+ // "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
17495
+ // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
17496
+ // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
17497
+ "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
16958
17498
  },
16959
17499
  }
16960
17500
  }
@@ -16970,13 +17510,24 @@ async function getButtonActions(props, mode) {
16970
17510
  let wrapperServiceData = wrapperService.getData();
16971
17511
  // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16972
17512
  // 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
17513
+ // 也因为这里clone没有直接删除,所以弹出编辑表单提交事件中event.data.__tableItems中取到的值会有被删除的行数据为undefined
16973
17514
  let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
16974
17515
  var currentIndex = event.data.index;
16975
17516
  var parent = event.data.__super.parent;
16976
- var primaryKey = "${props.primaryKey}";
17517
+ var primaryKey = "${primaryKey}";
16977
17518
  var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
16978
17519
  return item[primaryKey] == parent[primaryKey];
16979
17520
  });
17521
+ if(parent && __parentIndex < 0){
17522
+ let tableId = "${props.id}";
17523
+ let table = scope.getComponentById(tableId)
17524
+ // autoGeneratePrimaryKeyValue不为true的情况下,即子表组件input-table的pipeOut函数中会移除表单了子表字段的primaryKey字段值,
17525
+ // 此时行primaryKey字段值为空,但是pipeIn函数中已经为input-table自动生成过primaryKey字段值了,只是没有输出到表单字段值中而已
17526
+ // 所以上面从表单字段值中没找到__parentIndex,是因为此时行primaryKey字段值只经过pipeIn保存到table组件内而没有保存到tableService
17527
+ __parentIndex = _.findIndex(table.props.value, function(item){
17528
+ return item[primaryKey] == parent[primaryKey];
17529
+ });
17530
+ }
16980
17531
  if(parent){
16981
17532
  lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
16982
17533
  // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
@@ -16988,6 +17539,11 @@ async function getButtonActions(props, mode) {
16988
17539
  else{
16989
17540
  lastestFieldValue.splice(currentIndex, 1);
16990
17541
  }
17542
+ let fieldPrefix = "${props.fieldPrefix || ''}";
17543
+ if(fieldPrefix){
17544
+ let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
17545
+ lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
17546
+ }
16991
17547
  doAction({
16992
17548
  "componentId": "${props.id}",
16993
17549
  "actionType": "setValue",
@@ -17057,45 +17613,77 @@ async function getButtonView(props) {
17057
17613
 
17058
17614
  async function getButtonDelete(props) {
17059
17615
  return {
17060
- "type": "button",
17061
- "label": "",
17062
- "icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
17616
+ "type": "dropdown-button",
17063
17617
  "level": "link",
17064
- "onEvent": {
17065
- "click": {
17066
- "actions": await getButtonActions(props, "delete")
17618
+ "icon": "fa fa-trash-alt",
17619
+ "size": "xs",
17620
+ "hideCaret": true,
17621
+ "closeOnClick": true,
17622
+ "body": [
17623
+ {
17624
+ "type": "wrapper",
17625
+ "size": "md",
17626
+ "className": "w-80",
17627
+ "body": [
17628
+ {
17629
+ "tpl": "确定要删除吗?",
17630
+ "type": "tpl"
17631
+ },
17632
+ {
17633
+ "type": "flex",
17634
+ "justify": "flex-end",
17635
+ "className": "mt-3",
17636
+ "items": [
17637
+ {
17638
+ "type": "button",
17639
+ "label": "取消",
17640
+ "className": "mr-2"
17641
+ },
17642
+ {
17643
+ "type": "button",
17644
+ "label": "删除",
17645
+ "level": "danger",
17646
+ "onEvent": {
17647
+ "click": {
17648
+ "actions": await getButtonActions(props, "delete")
17649
+ }
17650
+ }
17651
+ }
17652
+ ]
17653
+ }
17654
+ ]
17067
17655
  }
17068
- }
17069
- };
17656
+ ]
17657
+ }
17070
17658
  }
17071
17659
 
17660
+
17072
17661
  const getAmisInputTableSchema = async (props) => {
17073
17662
  if (!props.id) {
17074
17663
  props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
17075
17664
  }
17076
- if (!props.primaryKey) {
17077
- props.primaryKey = "_id";
17078
- }
17665
+ let primaryKey = getTablePrimaryKey(props);
17079
17666
  let showOperation = props.showOperation;
17080
- if(showOperation !== false){
17667
+ if (showOperation !== false) {
17081
17668
  showOperation = true;
17082
17669
  }
17083
- // props.fieldPrefix = "project_milestone_";
17084
- if (props.fieldPrefix) {
17085
- props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
17670
+ let fieldPrefix = props.fieldPrefix;
17671
+ let fields = props.fields || [];
17672
+ if (fieldPrefix) {
17673
+ fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
17086
17674
  }
17087
17675
  let serviceId = getComponentId("table_service", props.id);
17088
17676
  let buttonsForColumnOperations = [];
17089
17677
  let inlineEditMode = props.inlineEditMode;
17090
17678
  let showAsInlineEditMode = inlineEditMode && props.editable;
17091
- if(showOperation){
17679
+ if (showOperation) {
17092
17680
  if (props.editable) {
17093
17681
  let showEditButton = true;
17094
17682
  if (showAsInlineEditMode) {
17095
17683
  // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
17096
17684
  showEditButton = true;
17097
17685
  // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
17098
- // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
17686
+ // if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
17099
17687
  // showEditButton = true;
17100
17688
  // }
17101
17689
  // else {
@@ -17110,7 +17698,7 @@ const getAmisInputTableSchema = async (props) => {
17110
17698
  }
17111
17699
  else {
17112
17700
  // 只读时显示查看按钮
17113
- // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
17701
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
17114
17702
  let buttonViewSchema = await getButtonView(props);
17115
17703
  buttonsForColumnOperations.push(buttonViewSchema);
17116
17704
  }
@@ -17119,10 +17707,10 @@ const getAmisInputTableSchema = async (props) => {
17119
17707
  buttonsForColumnOperations.push(buttonDeleteSchema);
17120
17708
  }
17121
17709
  }
17122
- let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
17710
+ let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
17123
17711
  let inputTableSchema = {
17124
17712
  "type": "input-table",
17125
- "label": props.label,
17713
+ "mode": "normal",
17126
17714
  "name": props.name,
17127
17715
  //不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
17128
17716
  // "addable": props.addable,
@@ -17138,36 +17726,53 @@ const getAmisInputTableSchema = async (props) => {
17138
17726
  "showTableAddBtn": false,
17139
17727
  "showFooterAddBtn": false,
17140
17728
  "className": props.tableClassName,
17729
+ "pipeIn": (value, data) => {
17730
+ if (fieldPrefix) {
17731
+ value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
17732
+ }
17733
+ value = getTableValueWithEmptyValue(value, fields);
17734
+ if (primaryKey) {
17735
+ // 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
17736
+ // 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
17737
+ // 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
17738
+ value = getTableValueWithPrimaryKeyValue(value, primaryKey);
17739
+ }
17740
+ if (amis.pipeIn) {
17741
+ if (typeof amis.pipeIn === 'function') {
17742
+ return amis.pipeIn(value, data);
17743
+ }
17744
+ }
17745
+ return value;
17746
+ },
17141
17747
  "pipeOut": (value, data) => {
17142
- value = (value || []).map(function(item){
17748
+ value = (value || []).map(function (item) {
17143
17749
  delete item.__fix_rerender_after_children_modified_tag;
17144
17750
  return item;
17145
17751
  });
17146
- if(props.fieldPrefix){
17147
- value = getTableValuePrependFieldPrefix(value, props.fieldPrefix);
17752
+ if (fieldPrefix) {
17753
+ value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
17754
+ }
17755
+ value = getTableValueWithoutEmptyValue(value, fields);
17756
+ if (props.autoGeneratePrimaryKeyValue === true) {
17757
+ // 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
17758
+ // 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
17759
+ value = getTableValueWithPrimaryKeyValue(value, primaryKey);
17760
+ }
17761
+ else {
17762
+ // 默认情况下,也就是没有配置autoGeneratePrimaryKey时,最终输出的字段值要移除行中的primaryKey值
17763
+ // 需要注意如果没有配置autoGeneratePrimaryKey时,因为每次弹出行编辑窗口保存后都会先后进入pipeOut和pipeIn,
17764
+ // 这里删除掉了primaryKey值,所以primaryKey值每次弹出编辑窗口保存后都会给每行重新生成新的primaryKey值
17765
+ // 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
17766
+ value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
17148
17767
  }
17149
- if(amis.pipeOut){
17150
- if(typeof amis.pipeOut === 'function'){
17768
+ if (amis.pipeOut) {
17769
+ if (typeof amis.pipeOut === 'function') {
17151
17770
  return amis.pipeOut(value, data);
17152
17771
  }
17153
17772
  }
17154
17773
  return value;
17155
17774
  }
17156
17775
  };
17157
- if(amis.pipeIn){
17158
- inputTableSchema.pipeIn = amis.pipeIn;
17159
- }
17160
- if(props.fieldPrefix){
17161
- inputTableSchema.pipeIn = (value, data) => {
17162
- value = getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
17163
- if(amis.pipeIn){
17164
- if(typeof amis.pipeIn === 'function'){
17165
- return amis.pipeIn(value, data);
17166
- }
17167
- }
17168
- return value;
17169
- };
17170
- }
17171
17776
  if (buttonsForColumnOperations.length) {
17172
17777
  inputTableSchema.columns.push({
17173
17778
  "name": "__op__",
@@ -17176,9 +17781,10 @@ const getAmisInputTableSchema = async (props) => {
17176
17781
  "width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
17177
17782
  });
17178
17783
  }
17179
- if (showAsInlineEditMode) {
17180
- inputTableSchema.needConfirm = false;
17181
- }
17784
+ // if (showAsInlineEditMode) {
17785
+ // // 因为要支持不同的列上配置inlineEditMode属性,所有不可以把整个子表组件都设置为inlineEditMode
17786
+ // inputTableSchema.needConfirm = false;
17787
+ // }
17182
17788
  if (amis) {
17183
17789
  // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
17184
17790
  delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
@@ -17186,7 +17792,7 @@ const getAmisInputTableSchema = async (props) => {
17186
17792
  delete amis.pipeOut;//该属性在上面合并过了
17187
17793
  Object.assign(inputTableSchema, amis);
17188
17794
  }
17189
- const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
17795
+ const isAnyFieldHasDependOn = (fields || []).find(function (item) {
17190
17796
  return item.depend_on;
17191
17797
  });
17192
17798
  if (isAnyFieldHasDependOn) {
@@ -17219,11 +17825,31 @@ const getAmisInputTableSchema = async (props) => {
17219
17825
  "body": headerToolbar
17220
17826
  });
17221
17827
  }
17828
+ let className = "steedos-input-table";
17829
+
17830
+ if (typeof props.className == "object") {
17831
+ className = {
17832
+ [className]: "true",
17833
+ ...props.className
17834
+ };
17835
+ } else if (typeof props.className == "string") {
17836
+ className = `${className} ${props.className} `;
17837
+ }
17838
+
17222
17839
  let schema = {
17223
- "type": "service",
17224
- "body": schemaBody,
17225
- "className": props.className,
17226
- "id": serviceId
17840
+ "type": "control",
17841
+ "body": {
17842
+ "type": "service",
17843
+ "body": schemaBody,
17844
+ "id": serviceId
17845
+ },
17846
+ "label": props.label,
17847
+ "labelClassName": props.label ? props.labelClassName : "none",
17848
+ "labelRemark": props.labelRemark,
17849
+ "labelAlign": props.labelAlign,
17850
+ //控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
17851
+ "mode": props.mode || null,
17852
+ className
17227
17853
  };
17228
17854
  // console.log("===schema===", schema);
17229
17855
  return schema;
@@ -20122,10 +20748,11 @@ var AmisObjectFieldLookup = function (props) {
20122
20748
  };
20123
20749
 
20124
20750
  var AmisObjectButton = function (props) {
20751
+ var _a;
20125
20752
  // console.log(`AmisObjectButton=====》`, props)
20126
20753
  var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
20127
- var _a = __read(useState(), 2), button = _a[0], setButton = _a[1];
20128
- var _b = __read(useState(), 2), uiSchema = _b[0], setUiSchema = _b[1];
20754
+ var _b = __read(useState(), 2), button = _b[0], setButton = _b[1];
20755
+ var _c = __read(useState(), 2), uiSchema = _c[0], setUiSchema = _c[1];
20129
20756
  //TODO 处理上下文参数
20130
20757
  var appId = data.appId;
20131
20758
  var formFactor = data.formFactor;
@@ -20194,6 +20821,7 @@ var AmisObjectButton = function (props) {
20194
20821
  }
20195
20822
  if (renderData) {
20196
20823
  delete renderData.event;
20824
+ (_a = renderData.record) === null || _a === void 0 ? true : delete _a.event;
20197
20825
  }
20198
20826
  schema.data = defaultsDeep$1({}, renderData, getDefaultRenderData(), schema.data);
20199
20827
  delete schema.data.event;
@@ -20504,7 +21132,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
20504
21132
  }); };
20505
21133
 
20506
21134
  var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20507
- var $schema, top, perPage, _a, showHeader, data, defaultData, _b, className, _c, style, crudClassName, _d, showDisplayAs, sideSchema, _f, filterVisible, headerToolbarItems, rowClassNameExpr, _g, hiddenColumnOperation, columns, crudDataFilter, onCrudDataFilter, env, rebuildOn, crudMode, requestAdaptor, adaptor, headerSchema, ctx, crud, listName, defaults, objectApiName, displayAs, formFactor, isMobile, uiSchema, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, allData, listViewSchemaProps, serviceData;
21135
+ var $schema, top, perPage, _a, showHeader, data, defaultData, _b, className, _c, style, crudClassName, _d, showDisplayAs, sideSchema, _f, filterVisible, headerToolbarItems, rowClassNameExpr, _g, hiddenColumnOperation, columns, crudDataFilter, onCrudDataFilter, env, rebuildOn, crudMode, requestAdaptor, adaptor, headerSchema, ctx, crud, listName, defaults, objectApiName, uiSchema, displayAs, formFactor, isMobile, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, allData, listViewSchemaProps, serviceData;
20508
21136
  var _h;
20509
21137
  return __generator(this, function (_j) {
20510
21138
  switch (_j.label) {
@@ -20519,7 +21147,10 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20519
21147
  if (!ctx) {
20520
21148
  ctx = {};
20521
21149
  }
20522
- displayAs = Router$1.getTabDisplayAs(objectApiName);
21150
+ return [4 /*yield*/, getUISchema(objectApiName, false)];
21151
+ case 1:
21152
+ uiSchema = _j.sent();
21153
+ displayAs = Router$1.getTabDisplayAs(objectApiName, uiSchema.enable_split);
20523
21154
  formFactor = props.formFactor;
20524
21155
  if (!formFactor) {
20525
21156
  isMobile = window.innerWidth < 768;
@@ -20537,9 +21168,6 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20537
21168
  if (!ctx.formFactor) {
20538
21169
  ctx.formFactor = formFactor;
20539
21170
  }
20540
- return [4 /*yield*/, getUISchema(objectApiName, false)];
20541
- case 1:
20542
- uiSchema = _j.sent();
20543
21171
  listView = find(uiSchema.list_views, function (listView, name) {
20544
21172
  // 传入listViewName空值则取第一个
20545
21173
  if (!listName) {
@@ -20640,7 +21268,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20640
21268
  type: "service",
20641
21269
  data: serviceData,
20642
21270
  style: style,
20643
- className: "".concat(className, " sm:bg-gray-100 h-full border-gray-300 steedos-object-listview ").concat(displayAs === 'split' ? 'sm:border-r' : 'sm:border-r'),
21271
+ className: "".concat(className, " sm:bg-gray-50 h-full steedos-object-listview ").concat(displayAs === 'split' ? 'sm:border-r' : 'sm:border-r'),
20644
21272
  body: [{
20645
21273
  "type": "wrapper",
20646
21274
  "size": "none",
@@ -20663,7 +21291,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20663
21291
  {
20664
21292
  "type": "service",
20665
21293
  "id": "service_schema_api_" + objectApiName,
20666
- "className": " steedos-object-listview-content grow",
21294
+ "className": " steedos-object-listview-content md:overflow-auto grow",
20667
21295
  "schemaApi": {
20668
21296
  // 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
20669
21297
  "url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
@@ -20835,7 +21463,7 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
20835
21463
  return __generator(this, function (_d) {
20836
21464
  switch (_d.label) {
20837
21465
  case 0:
20838
- _a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 p-0 bg-gray-100' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
21466
+ _a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 p-0 bg-gray-50' : _a, schemaFilter = props.schemaFilter, showButtons = props.showButtons, showBackButton = props.showBackButton;
20839
21467
  return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
20840
21468
  case 1:
20841
21469
  _d.sent();
@@ -21570,7 +22198,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
21570
22198
  * @Author: baozhoutao@steedos.com
21571
22199
  * @Date: 2022-09-01 14:44:57
21572
22200
  * @LastEditors: baozhoutao@steedos.com
21573
- * @LastEditTime: 2023-09-08 17:54:54
22201
+ * @LastEditTime: 2024-01-31 14:43:14
21574
22202
  * @Description:
21575
22203
  */
21576
22204
  var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -21618,33 +22246,108 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
21618
22246
  "label": instance.t('frontend_help')
21619
22247
  },
21620
22248
  {
21621
- "type": "button",
21622
- "hiddenOn": "window.innerWidth < 768",
21623
- "onEvent": {
21624
- "click": {
21625
- "actions": [
21626
- {
21627
- "componentId": "",
21628
- "args": {
21629
- "url": "/app/admin"
21630
- },
21631
- "actionType": "url"
22249
+ "type": "dropdown-button",
22250
+ "label": false,
22251
+ "trigger": "click",
22252
+ "level": "link",
22253
+ "btnClassName": "p-0 m-0",
22254
+ "icon": "fa fa-cog text-xl slds-button_icon m-0",
22255
+ "align": "right",
22256
+ "hideCaret": true,
22257
+ "buttons": [
22258
+ {
22259
+ "type": "button",
22260
+ "hiddenOn": "window.innerWidth < 768",
22261
+ "onEvent": {
22262
+ "click": {
22263
+ "actions": [
22264
+ {
22265
+ "args": {
22266
+ "url": "/app/admin"
22267
+ },
22268
+ "actionType": "url"
22269
+ }
22270
+ ]
21632
22271
  }
21633
- ]
21634
- }
21635
- },
21636
- "id": "u:b5d0ab3a32b5",
21637
- "body": [
22272
+ },
22273
+ "id": "u:b5d0ab3a32b5",
22274
+ "level": "link",
22275
+ "label": instance.t('frontend_setup')
22276
+ },
22277
+ // {
22278
+ // "type": "divider",
22279
+ // "className": "m-0",
22280
+ // "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true}"
22281
+ // },
21638
22282
  {
21639
- "type": "steedos-icon",
21640
- "category": "utility",
21641
- "name": "setup",
21642
- "colorVariant": "default",
21643
- "id": "u:793a86f8a9e4",
21644
- "className": "slds-button_icon slds-global-header__icon"
22283
+ "type": "button",
22284
+ "label": "编辑对象",
22285
+ "className": "flex",
22286
+ "onEvent": {
22287
+ "click": {
22288
+ "actions": [
22289
+ {
22290
+ "actionType": "ajax",
22291
+ "outputVar": "responseResult",
22292
+ "args": {
22293
+ "api": {
22294
+ "url": "/api/v1/objects/search",
22295
+ "data": {
22296
+ "filters": ["name", "=", "${window:FlowRouter|routerParams|pick:object_name}"],
22297
+ "fields": ["_id"]
22298
+ },
22299
+ "method": "post",
22300
+ "messages": {}
22301
+ }
22302
+ }
22303
+ },
22304
+ {
22305
+ "args": {
22306
+ "url": "/app/admin/objects/view/${responseResult.items[0]._id}",
22307
+ },
22308
+ "actionType": "url"
22309
+ }
22310
+ ]
22311
+ }
22312
+ },
22313
+ "level": "link",
22314
+ "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isObjectRouter}"
22315
+ },
22316
+ {
22317
+ "type": "button",
22318
+ "label": "编辑页面",
22319
+ "className": "flex",
22320
+ "onEvent": {
22321
+ "click": {
22322
+ "actions": [
22323
+ {
22324
+ "actionType": "ajax",
22325
+ "outputVar": "responseResult",
22326
+ "args": {
22327
+ "api": {
22328
+ "url": "/api/v1/pages/search",
22329
+ "data": {
22330
+ "filters": ["name", "=", "${window:FlowRouter|routerParams|pick:page_id}"],
22331
+ "fields": ["_id"]
22332
+ },
22333
+ "method": "post",
22334
+ "messages": {}
22335
+ }
22336
+ }
22337
+ },
22338
+ {
22339
+ "args": {
22340
+ "url": "/app/admin/pages/view/${responseResult.items[0]._id}"
22341
+ },
22342
+ "actionType": "url"
22343
+ }
22344
+ ]
22345
+ }
22346
+ },
22347
+ "level": "link",
22348
+ "visibleOn": "${window:Meteor.settings.public.enable_saas != true && global.user.is_space_admin == true && window:FlowRouter|isPageRouter}"
21645
22349
  }
21646
- ],
21647
- "label": instance.t('frontend_setup')
22350
+ ]
21648
22351
  },
21649
22352
  {
21650
22353
  "type": "steedos-dropdown",
@@ -21901,6 +22604,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
21901
22604
  },
21902
22605
  "level": "link"
21903
22606
  },
22607
+ {
22608
+ "type": "button",
22609
+ "label": instance.t('switch_space'),
22610
+ "className": "flex",
22611
+ "onEvent": {
22612
+ "click": {
22613
+ "actions": [
22614
+ {
22615
+ "args": {
22616
+ "url": "/accounts/a/#/select-space",
22617
+ "blank": false
22618
+ },
22619
+ "actionType": "url"
22620
+ }
22621
+ ]
22622
+ }
22623
+ },
22624
+ "level": "link",
22625
+ "visibleOn": "${window:Meteor.settings.public.enable_saas}"
22626
+ },
21904
22627
  {
21905
22628
  "type": "button",
21906
22629
  "label": instance.t('frontend_about'),
@@ -22186,14 +22909,17 @@ function getAmisStaticFieldType(type, data_type, options) {
22186
22909
  }
22187
22910
  return "static-image";
22188
22911
  }
22912
+ else if (type === 'textarea') {
22913
+ return 'static';
22914
+ }
22189
22915
  return type;
22190
22916
  }
22191
22917
  var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22192
- var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, defaultSource, source, fieldBaseProps, referenceTo_1, fieldRefObject, disPlayValue, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
22918
+ var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, className, defaultSource, source, fieldBaseProps, referenceTo_1, fieldValue, fieldRefObject, disPlayValue, res, valueOptions_1, fieldValue, values, disPlayValue_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
22193
22919
  var _e, e_1, _f;
22194
- var _g, _h, _j, _k, _l;
22195
- return __generator(this, function (_m) {
22196
- switch (_m.label) {
22920
+ var _g, _h, _j, _k, _l, _m;
22921
+ return __generator(this, function (_o) {
22922
+ switch (_o.label) {
22197
22923
  case 0:
22198
22924
  steedosField = null;
22199
22925
  field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, props.$schema, fStatic = props.static, env = props.env, inInputTable = props.inInputTable, className = props.className;
@@ -22224,9 +22950,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22224
22950
  // 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
22225
22951
  fStatic = true;
22226
22952
  }
22227
- _m.label = 1;
22953
+ _o.label = 1;
22228
22954
  case 1:
22229
- _m.trys.push([1, 24, , 25]);
22955
+ _o.trys.push([1, 24, , 25]);
22230
22956
  if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
22231
22957
  defaultSource = {
22232
22958
  "method": "post",
@@ -22254,6 +22980,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22254
22980
  name: steedosField.name,
22255
22981
  label: steedosField.label,
22256
22982
  static: true,
22983
+ required: steedosField.required,
22257
22984
  className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
22258
22985
  };
22259
22986
  if (!inInputTable) return [3 /*break*/, 2];
@@ -22262,15 +22989,24 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22262
22989
  case 2:
22263
22990
  referenceTo_1 = steedosField.reference_to;
22264
22991
  if (!referenceTo_1) return [3 /*break*/, 6];
22992
+ if (isArray(referenceTo_1)) {
22993
+ fieldValue = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
22994
+ if (fieldValue && fieldValue.o) {
22995
+ referenceTo_1 = fieldValue.o;
22996
+ }
22997
+ else {
22998
+ referenceTo_1 = referenceTo_1[0];
22999
+ }
23000
+ }
22265
23001
  steedosField.reference_to_field;
22266
23002
  if (referenceTo_1 === 'users') {
22267
23003
  referenceTo_1 = 'space_users';
22268
23004
  }
22269
23005
  return [4 /*yield*/, getUISchema(referenceTo_1)];
22270
23006
  case 3:
22271
- fieldRefObject = _m.sent();
23007
+ fieldRefObject = _o.sent();
22272
23008
  if (!(props.data._display && has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
22273
- disPlayValue = props.data._display[steedosField.name];
23009
+ disPlayValue = get$1(props.data._display, steedosField.name);
22274
23010
  if (disPlayValue) {
22275
23011
  if (!isArray(disPlayValue) && isObject$1(disPlayValue)) {
22276
23012
  disPlayValue = [disPlayValue];
@@ -22286,6 +23022,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22286
23022
  body: [
22287
23023
  {
22288
23024
  type: 'each',
23025
+ placeholder: "",
22289
23026
  className: "steedos-field-lookup-each flex flex-wrap gap-2",
22290
23027
  source: "${_display.".concat(steedosField.name, "|asArray}"),
22291
23028
  items: {
@@ -22330,9 +23067,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22330
23067
  return [3 /*break*/, 6];
22331
23068
  case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
22332
23069
  case 5:
22333
- res = _m.sent();
22334
- valueOptions_1 = ((_k = res === null || res === void 0 ? void 0 : res.data) === null || _k === void 0 ? void 0 : _k.options) || [];
22335
- fieldValue = (_l = props.data) === null || _l === void 0 ? void 0 : _l[steedosField.name];
23070
+ res = _o.sent();
23071
+ valueOptions_1 = ((_l = res === null || res === void 0 ? void 0 : res.data) === null || _l === void 0 ? void 0 : _l.options) || [];
23072
+ fieldValue = (_m = props.data) === null || _m === void 0 ? void 0 : _m[steedosField.name];
22336
23073
  values = fieldValue;
22337
23074
  if (isString(values)) {
22338
23075
  values = [values];
@@ -22360,6 +23097,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22360
23097
  body: [
22361
23098
  {
22362
23099
  type: 'each',
23100
+ placeholder: "",
22363
23101
  className: "steedos-field-lookup-each flex flex-wrap gap-2",
22364
23102
  source: "${".concat(steedosField.name, "}"),
22365
23103
  items: {
@@ -22398,7 +23136,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22398
23136
  else {
22399
23137
  fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
22400
23138
  }
22401
- _m.label = 6;
23139
+ _o.label = 6;
22402
23140
  case 6:
22403
23141
  schema = Object.assign({}, fieldBaseProps, pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
22404
23142
  schema.placeholder = "";
@@ -22409,7 +23147,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22409
23147
  if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
22410
23148
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22411
23149
  case 8:
22412
- fieldSchema = _m.sent();
23150
+ fieldSchema = _o.sent();
22413
23151
  if (steedosField.type === 'file' && fieldSchema.disabled) {
22414
23152
  fieldValue = fieldSchema.value;
22415
23153
  if (fieldValue && fieldValue.length) {
@@ -22562,7 +23300,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22562
23300
  case 18:
22563
23301
  // 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
22564
23302
  // convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
22565
- return [2 /*return*/, _m.sent()];
23303
+ return [2 /*return*/, _o.sent()];
22566
23304
  case 19:
22567
23305
  if (steedosField.type === 'formula' || steedosField.type === 'summary') {
22568
23306
  if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
@@ -22571,11 +23309,19 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22571
23309
  });
22572
23310
  }
22573
23311
  }
22574
- _m.label = 20;
23312
+ else if (steedosField.type === 'textarea') {
23313
+ Object.assign(schema, {
23314
+ tpl: "<%=(data.".concat(steedosField.name, " || \"\").split(\"\\n\").join('<br>')%>")
23315
+ });
23316
+ }
23317
+ _o.label = 20;
22575
23318
  case 20:
22576
23319
  Object.assign(schema, steedosField.amis || {});
22577
23320
  return [2 /*return*/, schema];
22578
23321
  case 21:
23322
+ if (!ctx.className) {
23323
+ ctx.className = className;
23324
+ }
22579
23325
  fieldAmis = steedosField.amis || {};
22580
23326
  if (!props.data.hasOwnProperty("_display")) {
22581
23327
  // 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
@@ -22634,12 +23380,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22634
23380
  }
22635
23381
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22636
23382
  case 22:
22637
- schema = _m.sent();
23383
+ schema = _o.sent();
22638
23384
  // console.log(`AmisSteedosField return schema`, schema)
22639
23385
  return [2 /*return*/, schema];
22640
23386
  case 23: return [3 /*break*/, 25];
22641
23387
  case 24:
22642
- error_1 = _m.sent();
23388
+ error_1 = _o.sent();
22643
23389
  console.log("error", error_1);
22644
23390
  return [3 /*break*/, 25];
22645
23391
  case 25: return [2 /*return*/, null];
@@ -22885,7 +23631,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
22885
23631
  return __generator(this, function (_a) {
22886
23632
  switch (_a.label) {
22887
23633
  case 0:
22888
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix;
23634
+ props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.headerToolbar, props.footerToolbar, props.inlineEditMode, props.strictMode, props.dialog, props.primaryKey, props.showOperation, props.fieldPrefix, props.autoGeneratePrimaryKeyValue, props.mode;
22889
23635
  return [4 /*yield*/, getAmisInputTableSchema(props)];
22890
23636
  case 1:
22891
23637
  amisSchema = _a.sent();
@@ -23129,7 +23875,7 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
23129
23875
  });
23130
23876
  }); };
23131
23877
 
23132
- var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);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 s=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){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}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=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...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 o,s;if(n&&Object.assign(n,getGlobalNowData()),s=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;o="__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,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),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 o=e.data_type||"text";!r||n||e.multiple||("text"!==o||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(t,r,n)=>{var e;if(r)return e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(t,e.children,n-1))):e.children&&(e.children=s(t,e.children,n));}),e};for(var a=t,i=0;i<a.length;i++)if(a[i].noParent=0,a[i].unfolded=!1,a[i].parent){let e=1;for(var l=0;l<a.length;l++)a[i].parent==a[l][o]&&(e=0);1==e&&(a[i].noParent=1);}else a[i].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}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:message,notification:notification,components:{Button:Button,Space: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 o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.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]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});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);
23878
+ var __assign=function(){return (__assign=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);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 s=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){s=e;},error:function(e,t,r){var n,o;e.responseJSON&&e.responseJSON.error?(n=e.responseJSON.error,o=void(s={error:n}),o=n.reason||n.message||n,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},n,t)),s}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=o=>e=>{const[t,r]=useState(!0);var n=()=>{r(!1);};return has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{r(!0);},close:n}),React.createElement(o,_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.createElement(newFunctionComponent(n),e);createRoot(t).render(e);},Modal=assign(newComponentRender("modal",Modal$1),{info:Modal$1.info,success:Modal$1.success,error:Modal$1.error,warning:Modal$1.warning,confirm:Modal$1.confirm}),Drawer=newComponentRender("drawer",Drawer$1),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),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):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:o}){return `/app/${e}/${t}/${r}/${n}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return createElement(t,e)}},render=function(e,t,r,n){e=withModalWrap(e),e=createElement(e,__assign({},t));return ReactDOM.render(e,r)};const safeRunFunction=(t,r,n,o)=>{try{var s=window.Creator;if(!!(!s||!s.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return isNil(r)||(e=isArray(r)?r:[r]),t.bind(o||{})(...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 o,s;if(n&&Object.assign(n,getGlobalNowData()),s=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;o="__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,o)).replace(/\bglobal\b/g,JSON.stringify(n)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(s));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})`)),isFunction(r)&&(r=safeRunFunction(r,[],null,{name:e.name})),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 o=e.data_type||"text";!r||n||e.multiple||("text"!==o||isString(r)?"number"===o&&isString(r)?r=Number(r):"boolean"===o&&isString(r)&&(r="true"===r.toLowerCase()||"1"===r):r=String(r));break;case"number":isString(r)&&(r=Number(r));break;case"boolean":isString(r)?r="true"===r.toLowerCase()||"1"===r:isBoolean(r)||(r=!1);}return r};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const r=e?.unfoldedNum||1,n=[],s=(e,t,r,n)=>{return e.children&&"object"==typeof e.children[0]?e.children:r?(e=_.filter(t,e=>_.includes(r,e[o])),_.each(e,e=>{1<=n?(e.unfolded=!0,e.children&&(e.children=s(e,t,e.children,n-1))):e.children&&(e.children=s(e,t,e.children,n));}),e):void 0};for(var i=t,a=0;a<i.length;a++)if(i[a].noParent=0,i[a].unfolded=!1,i[a].parent){let e=1;for(var l=0;l<i.length;l++)i[a].parent==i[l][o]&&(e=0);1==e&&(i[a].noParent=1);}else i[a].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=r?(e.unfolded=!0,n.push(Object.assign({},e,{children:s(e,t,e.children,r-1)}))):n.push(Object.assign({},e,{children:s(e,t,e.children,r)})));}),n}function getClosestAmisComponentByType(t,r,n){let o=(n=n||{}).name;var e=n.direction||"up";let s=t.getComponents().find(function(e){return e.props.type===r&&(!o||e.props.name===o)});if(s)return s;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(s=getClosestAmisComponentByType(t.children[e],r,n));e++);return s}}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:message,notification:notification,components:{Button:Button,Space: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 o=[];return _.each(e,(e,t)=>{var r,n;_.isEmpty(e)&&!_.isBoolean(e)||(_.startsWith(t,"__searchable__between__")?o.push([""+t.replace("__searchable__between__",""),"between",e]):_.startsWith(t,"__searchable__")&&(_.isString(e)?o.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]),o.push(n)):o.push([""+t.replace("__searchable__",""),"=",e])));}),o},getKeywordsSearchFilter:(e,t)=>{const o=[];var s;return e&&t&&(s=e.split(/\s+/),s=compact(s),t.forEach(function(r,e){let n=[];1==s.length?n=[r,"contains",s[0]]:s.forEach(function(e,t){n.push([r,"contains",e]),t<s.length-1&&n.push("or");}),n.length&&(o.push(n),e<t.length-1&&o.push("or"));})),o}});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);
23133
23879
 
23134
23880
  var index_esm = /*#__PURE__*/Object.freeze({
23135
23881
  __proto__: null,