@steedos-widgets/amis-object 3.6.2-beta.1 → 3.6.2-beta.10

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.
@@ -3521,22 +3521,26 @@ const getSteedosAuth = () => {
3521
3521
  * @Description:
3522
3522
  */
3523
3523
 
3524
-
3525
3524
  const Router$1 = {
3526
3525
  getTabDisplayAs(tab_id){
3526
+ const uiSchema = getUISchemaSync$1(tab_id, false);
3527
3527
  var urlSearch = new URLSearchParams(document.location.search);
3528
3528
  if(urlSearch.has('display')){
3529
3529
  return urlSearch.get('display')
3530
3530
  }
3531
3531
  const key = `tab_${tab_id}_display`;
3532
3532
  // const key = `page_display`;
3533
- const value = localStorage.getItem(key);
3534
- return value ? value : 'grid'
3533
+ const value = sessionStorage.getItem(key);
3534
+ let defaultDisplay = "grid";
3535
+ if(uiSchema.enable_split){
3536
+ defaultDisplay = "split";
3537
+ }
3538
+ return value ? value : defaultDisplay;
3535
3539
  },
3536
3540
 
3537
3541
  setTabDisplayAs(tab_id, displayAs){
3538
3542
  const key = `tab_${tab_id}_display`;
3539
- localStorage.setItem(key, displayAs);
3543
+ sessionStorage.setItem(key, displayAs);
3540
3544
  },
3541
3545
  getAppPath({formFactor, appId}){
3542
3546
  return `/app/${appId}`;
@@ -3640,7 +3644,7 @@ function getComparableAmisVersion() {
3640
3644
  * @Author: baozhoutao@steedos.com
3641
3645
  * @Date: 2022-05-23 09:53:08
3642
3646
  * @LastEditors: liaodaxue
3643
- * @LastEditTime: 2023-10-11 17:32:17
3647
+ * @LastEditTime: 2024-01-17 16:00:27
3644
3648
  * @Description:
3645
3649
  */
3646
3650
 
@@ -3712,7 +3716,7 @@ function getSelectMap(selectOptions){
3712
3716
 
3713
3717
  function getNameTplUrl(field, ctx){
3714
3718
  if(ctx.objectName === 'cms_files'){
3715
- return `\${context.rootUrl}/api/files/files/\${versions[0]}?download=true`
3719
+ return "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}"
3716
3720
  }
3717
3721
  const href = Router$1.getObjectDetailPath({
3718
3722
  ...ctx, formFactor: ctx.formFactor, appId: "${appId}", objectName: ctx.objectName || "${objectName}", recordId: `\${${ctx.idFieldName}}`
@@ -4584,9 +4588,9 @@ var frontend_display_type_is_split = "分栏视图";
4584
4588
  var frontend_display_as = "显示为";
4585
4589
  var frontend_record_sum = "个项目";
4586
4590
  var frontend_button_reload_tooltip = "刷新";
4587
- var frontend_button_search_tooltip = "筛选";
4591
+ var frontend_button_search_tooltip = "搜索";
4588
4592
  var frontend_fields_filter_button_search = "搜索";
4589
- var frontend_fields_filter_button_settings = "设置搜索项";
4593
+ var frontend_fields_filter_button_settings = "选择搜索项";
4590
4594
  var frontend_button_listview_control_tooltip = "列表视图控制";
4591
4595
  var frontend_button_listview_control_label = "列表视图控制";
4592
4596
  var frontend_listview_control_columns = "显示的列";
@@ -5241,9 +5245,13 @@ async function getTableColumns$1(fields, options){
5241
5245
  const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
5242
5246
  let className = "";
5243
5247
  if(field.wrap != true){
5244
- className += " whitespace-nowrap ";
5248
+ if(field.wrap != false && field.is_wide){
5249
+ className += " break-words ";
5250
+ }else {
5251
+ className += " whitespace-nowrap ";
5252
+ }
5245
5253
  }else {
5246
- className += " break-all ";
5254
+ className += " break-words ";
5247
5255
  }
5248
5256
  let columnItem;
5249
5257
  if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
@@ -5340,12 +5348,24 @@ async function getTableColumns$1(fields, options){
5340
5348
  if(field.type === 'textarea'){
5341
5349
  className += 'min-w-56';
5342
5350
  }
5343
- if(field.type === 'date'){
5344
- className += 'date-min-w';
5345
- }
5346
- if(field.type === 'datetime'){
5347
- className += 'datetime-min-w';
5351
+ // if(field.type === 'date'){
5352
+ // className += 'date-min-w';
5353
+ // }
5354
+ // if(field.type === 'datetime'){
5355
+ // className += 'datetime-min-w';
5356
+ // }
5357
+
5358
+ //field上的amis属性里的clssname需要单独判断类型合并
5359
+ if (typeof field.amis?.className == "object") {
5360
+ className = {
5361
+ [className]: "true",
5362
+ ...field.amis.className
5363
+ };
5364
+ } else if (typeof field.amis?.className == "string") {
5365
+ className = `${className} ${field.amis.className} `;
5348
5366
  }
5367
+ delete field.amis?.className;
5368
+
5349
5369
  if(!field.hidden && !field.extra){
5350
5370
  columnItem = Object.assign({}, {
5351
5371
  name: field.name,
@@ -5428,7 +5448,7 @@ function getMobileLines(tpls){
5428
5448
  }
5429
5449
  if(isLeft){
5430
5450
  // 左侧半行
5431
- lineChildrenClassName = "steedos-listview-item-left truncate";
5451
+ lineChildrenClassName = "steedos-listview-item-left truncate h-5";
5432
5452
  if(item.field.is_wide){
5433
5453
  // 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
5434
5454
  lineChildrenClassName = "steedos-listview-item-wide";
@@ -5440,14 +5460,26 @@ function getMobileLines(tpls){
5440
5460
  }
5441
5461
  else {
5442
5462
  // 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
5443
- lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
5463
+ lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0 h-5";
5464
+ }
5465
+ //支持字段amis属性配置classname,识别classname的类型,与原样式合并
5466
+ var className;
5467
+ if (typeof item.field.amis?.className == "object") {
5468
+ className = {
5469
+ [lineChildrenClassName]: "true",
5470
+ ...item.field.amis.className
5471
+ };
5472
+ } else if (typeof item.field.amis?.className == "string") {
5473
+ className = `${lineChildrenClassName} ${item.field.amis.className} `;
5474
+ } else {
5475
+ className = lineChildrenClassName;
5444
5476
  }
5445
5477
  lineChildren.push({
5446
5478
  "type": "tpl",
5447
5479
  "tpl": item.tpl,
5448
- "className": lineChildrenClassName
5480
+ className
5449
5481
  });
5450
-
5482
+
5451
5483
  if(item.field.is_wide){
5452
5484
  // 宽字段占整行
5453
5485
  isLeft = true;
@@ -5497,8 +5529,7 @@ async function getMobileTableColumns(fields, options){
5497
5529
  tpl = await getFieldTpl(field, options);
5498
5530
  }
5499
5531
  if(!tpl){
5500
- //qhd需求简易处理,加上raw以支持审批王名称字段通过颜色区分缓急,若之后手机端列表支持配置amis,则可以去掉
5501
- tpl = `\${${field.name} | raw}`;
5532
+ tpl = `\${${field.name}}`;
5502
5533
  }
5503
5534
  if(!field.hidden && !field.extra){
5504
5535
  tpls.push({ field, tpl });
@@ -5511,7 +5542,7 @@ async function getMobileTableColumns(fields, options){
5511
5542
 
5512
5543
  let column = {
5513
5544
  name: nameField.name,
5514
- label: nameField.label,
5545
+ label: options.displayAs == 'split' ? '' : nameField.label,
5515
5546
  sortable: nameField.sortable,
5516
5547
  type: "button",
5517
5548
  level: "link",
@@ -5540,7 +5571,15 @@ async function getMobileTableColumns(fields, options){
5540
5571
  "actions": [
5541
5572
  {
5542
5573
  "script": `
5543
- let cms_url = "/api/files/files/"+event.data.versions[0]+"?download=true"
5574
+ let cms_url = '';
5575
+ let value = event.data.versions[0];
5576
+ if(value){
5577
+ if(value.url){
5578
+ cms_url = value.url;
5579
+ }else{
5580
+ cms_url = "/api/files/files/"+value+"?download=true"
5581
+ }
5582
+ }
5544
5583
  Steedos.cordovaDownload(encodeURI(Steedos.absoluteUrl(cms_url)), event.data.name);
5545
5584
  `,
5546
5585
  "actionType": "custom"
@@ -5656,7 +5695,8 @@ async function getTableOperation(ctx){
5656
5695
  label: " ",
5657
5696
  fixed: 'right',
5658
5697
  labelClassName: 'text-center',
5659
- className: 'text-center steedos-listview-operation w-10',
5698
+ //TODO:目前3.6.3-patch.3版本中对于动态classname处理存在问题,简单处理固定列问题,等待amis解决crud的columns不支持动态classname的问题
5699
+ className: 'text-center steedos-listview-operation w-10 is-sticky is-sticky-right is-sticky-first-right',
5660
5700
  buttons: [
5661
5701
  {
5662
5702
  "type": "steedos-dropdown-button",
@@ -5752,7 +5792,7 @@ async function getTableSchema$1(fields, options){
5752
5792
  }
5753
5793
  return {
5754
5794
  mode: "cards",
5755
- perPageAvailable: [5, 10, 20, 50, 100, 500],
5795
+ perPageAvailable: [20, 50, 100, 500],
5756
5796
  name: "thelist",
5757
5797
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
5758
5798
  className: "",
@@ -5785,7 +5825,7 @@ async function getTableSchema$1(fields, options){
5785
5825
 
5786
5826
  return {
5787
5827
  mode: "table",
5788
- perPageAvailable: [5, 10, 20, 50, 100, 500],
5828
+ perPageAvailable: [20, 50, 100, 500],
5789
5829
  name: "thelist",
5790
5830
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
5791
5831
  className: "",
@@ -6171,6 +6211,16 @@ async function getTableApi(mainObject, fields, options){
6171
6211
  }
6172
6212
  // SteedosUI.getRef(api.body.$self.$scopeId)?.parent?.getComponentById(setDataToComponentId)?.setData({$count: payload.data.count})
6173
6213
  };
6214
+ let formFactor = "${options.formFactor}";
6215
+ if(formFactor !== "SMALL"){
6216
+ const listviewComponent = $(".steedos-object-listview .antd-Table-table");
6217
+ const firstListviewComponent = listviewComponent && listviewComponent[0];
6218
+ if(firstListviewComponent){
6219
+ setTimeout(()=>{
6220
+ firstListviewComponent.scrollIntoView();
6221
+ }, 600);
6222
+ }
6223
+ }
6174
6224
  ${options.adaptor || ''}
6175
6225
  return payload;
6176
6226
  `;
@@ -6282,12 +6332,21 @@ function getReadonlyFormAdaptor(object, fields, options){
6282
6332
  }
6283
6333
  payload.data = data;
6284
6334
  payload.data.__objectName = "${object.name}";
6285
- payload.data.__record = record;
6335
+ payload.data.record = record;
6336
+
6337
+ payload.data.NAME_FIELD_VALUE = record.${object.NAME_FIELD_KEY || 'name'};
6338
+ payload.data._master = {
6339
+ record: record,
6340
+ objectName: "${object.name}",
6341
+ recordId: record._id
6342
+ }
6286
6343
  window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
6287
6344
  }
6288
6345
  if(payload.errors){
6289
6346
  payload.status = 2;
6290
6347
  payload.msg = payload.errors[0].message;
6348
+ }else{
6349
+ payload.data.recordLoaded = true;
6291
6350
  }
6292
6351
  ${options && options.initApiAdaptor || ''}
6293
6352
  return payload;
@@ -6430,7 +6489,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
6430
6489
  cache: API_CACHE,
6431
6490
  requestAdaptor: `
6432
6491
  // 所有不想在network请求中发送的数据都应该从data中分离出来,data变量只需要留下query才需要发送出去
6433
- var { recordId, objectName, uiSchema, global, context, ...data} = api.data;
6492
+ var { recordId, objectName, uiSchema, global, context, _master, ...data} = api.data;
6434
6493
  if(!recordId){
6435
6494
  // 新建则不请求任何数据
6436
6495
  data.query = "{data:" + objectName + "(filters: " + JSON.stringify(["_id", "=", null]) + ", top: 1){_id}}";
@@ -6508,10 +6567,11 @@ async function getEditFormInitApi(object, recordId, fields, options){
6508
6567
  ...initialValues
6509
6568
  }
6510
6569
  ${options.initApiAdaptor || ''}
6570
+ // console.log('getEditFormInitApi======>', payload);
6511
6571
  return payload;
6512
6572
  `,
6513
6573
  responseData: {
6514
- initialValues: "$$",
6574
+ "&": "$$",
6515
6575
  editFormInited: true
6516
6576
  },
6517
6577
  data: data,
@@ -6550,6 +6610,18 @@ function getBatchDelete(objectName){
6550
6610
  return {
6551
6611
  method: 'post',
6552
6612
  url: getApi$2(),
6613
+ adaptor: `
6614
+ if(payload.errors){
6615
+ payload.data.deleteErrorMessage = [];
6616
+ payload.errors.forEach(function(error){
6617
+ let errorRecord = error.path.map(function (item) {
6618
+ return item.split('delete__')[1].to_float() + 1;
6619
+ }).toString();
6620
+ payload.data.deleteErrorMessage.push("第" + errorRecord + "条记录删除出现异常,报错信息为(" + (window.t ? window.t(error.message) : error.message) + ")");
6621
+ })
6622
+ }
6623
+ return payload;
6624
+ `,
6553
6625
  requestAdaptor: `
6554
6626
  var ids = api.data.ids.split(",");
6555
6627
  var deleteArray = [];
@@ -7344,7 +7416,7 @@ async function getListBody(fields, options){
7344
7416
 
7345
7417
  function getDefaultParams(options){
7346
7418
  return {
7347
- perPage: options.top || options.perPage || 10
7419
+ perPage: options.top || options.perPage || 20
7348
7420
  }
7349
7421
  }
7350
7422
 
@@ -7547,7 +7619,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
7547
7619
  "objectApiName": "\${objectName}",
7548
7620
  "recordId": "",
7549
7621
  "mode": "edit",
7550
- "layout": "normal"
7551
7622
  };
7552
7623
 
7553
7624
  if (payload && payload.schema) {
@@ -8252,7 +8323,7 @@ const StandardButtons = {
8252
8323
  }
8253
8324
  };
8254
8325
 
8255
- const getGlobalData$1 = () => {
8326
+ const getGlobalData = () => {
8256
8327
  return {
8257
8328
  now: new Date(),
8258
8329
  };
@@ -8311,7 +8382,7 @@ const getButtonVisible = (button, ctx) => {
8311
8382
  button._visible,
8312
8383
  props.record,
8313
8384
  "#",
8314
- getGlobalData$1(),
8385
+ getGlobalData(),
8315
8386
  props.userSession
8316
8387
  );
8317
8388
  };
@@ -9689,6 +9760,48 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
9689
9760
  return headerSchema;
9690
9761
  }
9691
9762
 
9763
+ function getBackButtonSchema(){
9764
+ return {
9765
+ "type": "service",
9766
+ "onEvent": {
9767
+ "@history_paths.changed": {
9768
+ "actions": [
9769
+ {
9770
+ "actionType": "reload",
9771
+ // amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
9772
+ "data": {
9773
+ }
9774
+ }
9775
+ ]
9776
+ }
9777
+ },
9778
+ "body":[{
9779
+ "type": "button",
9780
+ "visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
9781
+ "className":"flex mr-4",
9782
+ "onEvent": {
9783
+ "click": {
9784
+ "actions": [
9785
+ {
9786
+ "actionType": "custom",
9787
+ "script": "window.goBack()"
9788
+ }
9789
+ ]
9790
+ }
9791
+ },
9792
+ "body": [
9793
+ {
9794
+ "type": "steedos-icon",
9795
+ "category": "utility",
9796
+ "name": "back",
9797
+ "colorVariant": "default",
9798
+ "className": "slds-button_icon slds-global-header__icon w-4"
9799
+ }
9800
+ ]
9801
+ }]
9802
+ }
9803
+ }
9804
+
9692
9805
  /**
9693
9806
  * 记录详细界面顶部头amisSchema,也是标题面板组件的amisSchema
9694
9807
  * @param {*} objectSchema 对象UISchema
@@ -9697,11 +9810,21 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
9697
9810
  * @returns amisSchema
9698
9811
  */
9699
9812
  async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9813
+ // console.log(`getObjectRecordDetailHeader====>`, options)
9700
9814
  const { showRecordTitle = true } = options || {};
9701
9815
  // console.log('getObjectRecordDetailHeader==>', objectSchema, recordId)
9702
9816
  const { name, label, icon, NAME_FIELD_KEY } = objectSchema;
9703
9817
 
9704
- let amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
9818
+ let amisButtonsSchema = [];
9819
+ if(options.showButtons != false){
9820
+ amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
9821
+ }
9822
+
9823
+ let backButtonsSchema = null;
9824
+
9825
+ if(options.showBackButton != false){
9826
+ backButtonsSchema = getBackButtonSchema();
9827
+ }
9705
9828
 
9706
9829
  // console.log(`getObjectRecordDetailHeader==>`, amisButtonsSchema)
9707
9830
 
@@ -9716,45 +9839,9 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9716
9839
  "type": "grid",
9717
9840
  "columns": [
9718
9841
  {
9719
- "body": [{
9720
- "type": "service",
9721
- "onEvent": {
9722
- "@history_paths.changed": {
9723
- "actions": [
9724
- {
9725
- "actionType": "reload",
9726
- // amis 3.6需要传入data来触发下面的window:historyPaths重新计算,此问题随机偶发,加上data后正常
9727
- "data": {
9728
- }
9729
- }
9730
- ]
9731
- }
9732
- },
9733
- "body":[{
9734
- "type": "button",
9735
- "visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
9736
- "className":"flex mr-4",
9737
- "onEvent": {
9738
- "click": {
9739
- "actions": [
9740
- {
9741
- "actionType": "custom",
9742
- "script": "window.goBack()"
9743
- }
9744
- ]
9745
- }
9746
- },
9747
- "body": [
9748
- {
9749
- "type": "steedos-icon",
9750
- "category": "utility",
9751
- "name": "back",
9752
- "colorVariant": "default",
9753
- "className": "slds-button_icon slds-global-header__icon w-4"
9754
- }
9755
- ]
9756
- }]
9757
- },{
9842
+ "body": [
9843
+ backButtonsSchema
9844
+ ,{
9758
9845
  "type": "tpl",
9759
9846
  "className": "block",
9760
9847
  // "tpl": `<img class='slds-icon slds-icon_container slds-icon-standard-${standardIcon}' src='\${context.rootUrl}/unpkg.com/@salesforce-ux/design-system/assets/icons/standard/${icon}.svg'>`
@@ -9775,8 +9862,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9775
9862
  },
9776
9863
  {
9777
9864
  "type": "tpl",
9778
- "tpl": "${name}",
9779
- // "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
9865
+ "tpl": "${NAME_FIELD_VALUE}",
9780
9866
  "inline": false,
9781
9867
  "wrapperComponent": "",
9782
9868
  "className": "record-detail-header-name leading-5 text-xl font-bold"
@@ -9804,7 +9890,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9804
9890
  let body = [
9805
9891
  {
9806
9892
  "type": "wrapper",
9807
- "className": "p-0",
9893
+ "className": "p-4 bg-gray-100 border-b",
9808
9894
  "body": [
9809
9895
  {
9810
9896
  "type": "grid",
@@ -9819,7 +9905,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9819
9905
  if(showRecordTitle){
9820
9906
  body.push({
9821
9907
  "type": "wrapper",
9822
- "className": "p-0",
9908
+ "className": "p-4",
9823
9909
  "body": [
9824
9910
  {
9825
9911
  "type": "grid",
@@ -9831,11 +9917,76 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
9831
9917
  });
9832
9918
  }
9833
9919
 
9920
+ let max = 10;
9921
+ if(options.formFactor === 'SMALL'){
9922
+ max = 4;
9923
+ }else {
9924
+
9925
+ let divWidth = window.innerWidth;
9926
+
9927
+ if(options.display === 'split'){
9928
+ divWidth = divWidth - 388;
9929
+ }
9930
+
9931
+ if(document.body.classList.contains('sidebar')){
9932
+ divWidth = divWidth - 210;
9933
+ }
9934
+
9935
+ // 根据屏幕宽度计算显示数量, 使高亮字段只占1行
9936
+ max = Math.trunc(divWidth / 200 );
9937
+ if(max > 10){
9938
+ max = 10;
9939
+ }
9940
+ }
9941
+
9942
+ // console.log('=======================max=========================', max)
9943
+
9944
+ if(objectSchema.compactLayouts){
9945
+ const details = [];
9946
+ _.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
9947
+ const field = objectSchema.fields[fieldName];
9948
+ if(field){
9949
+ details.push({
9950
+ type: 'steedos-field',
9951
+ static: true,
9952
+ config: field,
9953
+ });
9954
+ }
9955
+ });
9956
+
9957
+ // 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
9958
+ // lg:grid-cols-1
9959
+ // lg:grid-cols-2
9960
+ // lg:grid-cols-3
9961
+ // lg:grid-cols-4
9962
+ // lg:grid-cols-5
9963
+ // lg:grid-cols-6
9964
+ // lg:grid-cols-7
9965
+ // lg:grid-cols-8
9966
+ // lg:grid-cols-9
9967
+ // lg:grid-cols-10
9968
+ // lg:grid-cols-11
9969
+ // lg:grid-cols-12
9970
+
9971
+ body.push({
9972
+ "type": "wrapper",
9973
+ "body": {
9974
+ "type": "form",
9975
+ // "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
9976
+ "className": `gap-2 grid grid-cols-1 lg:grid-cols-${max}`,
9977
+ "wrapWithPanel": false,
9978
+ "actions": [],
9979
+ "body": details,
9980
+ "hiddenOn": "${recordLoaded != true}"
9981
+ },
9982
+ "className": "steedos-record-compact-layouts p-4 bg-white compact-layouts border-b"
9983
+ });
9984
+ }
9985
+
9834
9986
  return {
9835
9987
  type: 'service',
9836
9988
  id: `page_readonly_${name}_header`,
9837
9989
  name: `page`,
9838
- data: { objectName: name, _id: recordId, recordPermissions: objectSchema.permissions, uiSchema: objectSchema, record: "${record}" },
9839
9990
  body: body,
9840
9991
  className: ''
9841
9992
  }
@@ -9907,7 +10058,7 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
9907
10058
  "className": "flex justify-between"
9908
10059
  }
9909
10060
  ],
9910
- "className": "p-3"
10061
+ "className": "steedos-record-related-header py-2 px-0"
9911
10062
  };
9912
10063
  return recordRelatedListHeader;
9913
10064
  }
@@ -10892,14 +11043,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
10892
11043
  {
10893
11044
  "type": "button",
10894
11045
  "label": instance.t('frontend_display_type_is_table'),
10895
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
11046
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
10896
11047
  "rightIcon": displayAs != 'split' ? "fa fa-check" : null,
10897
11048
  "rightIconClassName": "m-l-sm"
10898
11049
  },
10899
11050
  {
10900
11051
  "type": "button",
10901
11052
  "label": instance.t('frontend_display_type_is_split'),
10902
- "onClick": "const key = 'tab_"+objectName+"_display';localStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
11053
+ "onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
10903
11054
  "rightIcon": displayAs === 'split' ? "fa fa-check" : null,
10904
11055
  "rightIconClassName": "m-l-sm"
10905
11056
  }
@@ -11042,7 +11193,7 @@ function getObjectHeaderQuickSearchBox(mainObject, fields, formFactor, { isLooku
11042
11193
  {
11043
11194
  "type": "search-box",
11044
11195
  "name": keywordsSearchBoxName,
11045
- "placeholder": "搜索此列表",
11196
+ "placeholder": "快捷搜索",
11046
11197
  "value": crudKeywords,
11047
11198
  // "clearable": true,//因为清除并不会触发失去焦点事件,只有禁用,但是它会触发change事件,所以等升级到amis 3.4+后可以重新放开
11048
11199
  "clearAndSubmit": true,
@@ -11246,7 +11397,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11246
11397
  // ]
11247
11398
  if(options.displayAs === 'split'){
11248
11399
  return [
11249
- "switch-per-page",
11400
+ {
11401
+ "type": "switch-per-page",
11402
+ "visibleOn": "${count >= 20}"
11403
+ },
11250
11404
  {
11251
11405
  "type": "pagination",
11252
11406
  "maxButtons": 5,
@@ -11268,7 +11422,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11268
11422
  else {
11269
11423
  if(options && options.isRelated){
11270
11424
  return [
11271
- "statistics",
11272
11425
  {
11273
11426
  "type": "pagination",
11274
11427
  "maxButtons": 10,
@@ -11281,7 +11434,6 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11281
11434
  const no_pagination = mainObject.paging && (mainObject.paging.enabled === false);
11282
11435
  const is_lookup = options.isLookup;
11283
11436
  const commonConfig = [
11284
- "statistics",
11285
11437
  {
11286
11438
  "type": "pagination",
11287
11439
  "maxButtons": 10,
@@ -11292,7 +11444,10 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11292
11444
  if (no_pagination && is_lookup) {
11293
11445
  return commonConfig;
11294
11446
  } else {
11295
- return ["switch-per-page", ...commonConfig];
11447
+ return [{
11448
+ "type": "switch-per-page",
11449
+ "visibleOn": "${count >= 20}"
11450
+ }, ...commonConfig];
11296
11451
  }
11297
11452
  }
11298
11453
  }
@@ -11400,6 +11555,29 @@ function getBulkActions(objectSchema){
11400
11555
  "className": "hidden",
11401
11556
  "id": "batchDelete",
11402
11557
  "api": getBatchDelete(objectSchema.name),
11558
+ "feedback": {
11559
+ "title": "删除警告",
11560
+ "visibleOn": "${deleteErrorMessage}",
11561
+ "body": [
11562
+ {
11563
+ "type": "each",
11564
+ "name": "deleteErrorMessage",
11565
+ "items": {
11566
+ "type": "alert",
11567
+ "body": "${item}",
11568
+ "level": "danger",
11569
+ "className": "mb-3"
11570
+ }
11571
+ }
11572
+ ],
11573
+ "actions": [
11574
+ {
11575
+ "type": "button",
11576
+ "actionType": "close",
11577
+ "label": "关闭"
11578
+ }
11579
+ ]
11580
+ }
11403
11581
  }
11404
11582
  // {
11405
11583
  // "label": "批量修改",
@@ -11546,6 +11724,10 @@ async function getObjectCRUD(objectSchema, fields, options){
11546
11724
  const rowsDiff = _.cloneDeep(api.data.rowsDiff);
11547
11725
  rowsDiff.forEach(function (item, index) {
11548
11726
  for(key in item){
11727
+ // image、select等字段清空值后保存的空字符串转换为null。
11728
+ if(item[key] === ''){
11729
+ item[key] = null;
11730
+ }
11549
11731
  if(_.includes(imageNames, key)){
11550
11732
  if(typeof item[key] == "string"){
11551
11733
  const match = item[key].match(/\\/([^\\/]+)$/);
@@ -11592,7 +11774,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11592
11774
  // "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
11593
11775
  // },
11594
11776
  bodyClassName: {
11595
- "bg-white": "true",
11777
+ "mb-0": true,
11596
11778
  "is-steedos-crud-data-empty": "${!items || COUNT(items) == 0}"
11597
11779
  },
11598
11780
  crudClassName: crudClassName,
@@ -11612,7 +11794,9 @@ async function getObjectCRUD(objectSchema, fields, options){
11612
11794
  return payload;
11613
11795
  `
11614
11796
  },
11615
- rowClassNameExpr: options.rowClassNameExpr
11797
+ // 外层data发生变化的时候, 不会重新渲染rowClassNameExpr, 所以先用css标记tr唯一标识
11798
+ // 使用表达式给tr添加初始选中状态
11799
+ rowClassNameExpr: options.rowClassNameExpr || "<%= data._id === data.recordId ? 'steedos-record-tr steedos-record-tr-' + data._id + ' steedos-record-selected' : 'steedos-record-tr steedos-record-tr-' + data._id %>"
11616
11800
  }, bodyProps);
11617
11801
 
11618
11802
  }
@@ -11627,7 +11811,7 @@ async function getObjectCRUD(objectSchema, fields, options){
11627
11811
 
11628
11812
  if(body.columns && options.formFactor != 'SMALL'){
11629
11813
  //将_display放入crud的columns的倒数第二列中(最后一列会影响固定列),可以通过setvalue修改行内数据域的_display,而不影响上层items的_display,用于批量编辑
11630
- body.columns.splice(body.columns.length - 1, 0, {name: '_display',type: 'static', width: 32, placeholder: "",id: objectSchema.name + "_display_${_index}", className: "hidden"});
11814
+ body.columns.splice(body.columns.length -1 , 0, {name: '_display',type: 'static', width: 1, placeholder: "",id: objectSchema.name + "_display_${_index}", tpl: "${''}"});
11631
11815
  }
11632
11816
 
11633
11817
  if (defaults) {
@@ -11685,11 +11869,6 @@ async function getObjectCRUD(objectSchema, fields, options){
11685
11869
  }
11686
11870
  }
11687
11871
 
11688
- const getGlobalData = (mode)=>{
11689
- const user = getSteedosAuth();
11690
- return {mode: mode, user: user, spaceId: user.spaceId, userId: user.userId}
11691
- };
11692
-
11693
11872
  const getFormFields$1 = (objectSchema, formProps)=>{
11694
11873
  /**
11695
11874
  * fieldsExtend: 重写字段定义
@@ -11751,7 +11930,7 @@ async function getFormSchemaWithDataFilter(form, options = {}){
11751
11930
  }
11752
11931
 
11753
11932
  async function getObjectForm(objectSchema, ctx){
11754
- const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
11933
+ const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
11755
11934
  formDataFilter, onFormDataFilter, amisData, env } = ctx;
11756
11935
  const fields = _$1__default["default"].values(objectSchema.fields);
11757
11936
  const formFields = getFormFields$1(objectSchema, ctx);
@@ -11767,9 +11946,7 @@ async function getObjectForm(objectSchema, ctx){
11767
11946
  id: `service_${formSchema.id}`,
11768
11947
  className: 'p-0',
11769
11948
  name: `page_edit_${recordId}`,
11770
- api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
11771
11949
  data:{
11772
- editFormInited: false,
11773
11950
  ...amisData
11774
11951
  },
11775
11952
  // data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
@@ -11778,8 +11955,9 @@ async function getObjectForm(objectSchema, ctx){
11778
11955
  body: [defaultsDeep({}, formSchema, {
11779
11956
  type: "form",
11780
11957
  mode: layout,
11958
+ initApi: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
11781
11959
  data: {
11782
- "&": "${initialValues}"
11960
+ editFormInited: false,
11783
11961
  },
11784
11962
  labelAlign,
11785
11963
  persistData: false,
@@ -11793,11 +11971,15 @@ async function getObjectForm(objectSchema, ctx){
11793
11971
  submitText: "", // amis 表单不显示提交按钮, 表单提交由项目代码接管
11794
11972
  api: await getSaveApi(objectSchema, recordId, fields, ctx),
11795
11973
  initFetch: recordId != 'new',
11796
- body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
11974
+ body: {
11975
+ type: 'wrapper',
11976
+ className: 'p-0 m-0',
11977
+ body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
11978
+ hiddenOn: "${editFormInited != true}",
11979
+ },
11797
11980
  panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
11798
11981
  bodyClassName: 'p-0',
11799
11982
  className: 'steedos-amis-form',
11800
- hiddenOn: "${editFormInited != true}",
11801
11983
  onEvent: {
11802
11984
  "submitSucc": {
11803
11985
  "weight": 0,
@@ -11842,7 +12024,7 @@ async function getObjectForm(objectSchema, ctx){
11842
12024
  }
11843
12025
 
11844
12026
  async function getObjectDetail(objectSchema, recordId, ctx){
11845
- const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign,
12027
+ const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign,
11846
12028
  formDataFilter, onFormDataFilter, amisData, env } = ctx;
11847
12029
  const fields = _$1__default["default"].values(objectSchema.fields);
11848
12030
  const formFields = getFormFields$1(objectSchema, ctx);
@@ -11851,8 +12033,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
11851
12033
  type: 'service',
11852
12034
  name: `page_readonly_${recordId}`,
11853
12035
  id: serviceId,
11854
- data: {global: getGlobalData('read'), context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
11855
- api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
12036
+ // api: await getReadonlyFormInitApi(objectSchema, recordId, fields, ctx),
11856
12037
  body: [
11857
12038
  {
11858
12039
  "type": "wrapper", //form 的 hiddenOn 会导致 form onEvent 异常, 使用wrapper包裹一次form,并在wrapper上控制显隐
@@ -11878,60 +12059,41 @@ async function getObjectDetail(objectSchema, recordId, ctx){
11878
12059
  ),
11879
12060
  className: 'steedos-amis-form bg-white',
11880
12061
  actions: [], // 不显示表单默认的提交按钮
11881
- onEvent: {
11882
- [`@data.changed.${objectSchema.name}`]: { // 由于amis service 组件的 onEvent 存在bug ,此处借助form来刷新 上层 service https://github.com/baidu/amis/issues/6294
11883
- "actions": [
11884
- {
11885
- "actionType": "reload",
11886
- "componentId": serviceId,
11887
- "expression": "this.__deletedRecord != true"
11888
- },
11889
- {
11890
- // "args": {
11891
- // "url": "/app/${appId}/${objectName}/grid/${side_listview_id}",
11892
- // "blank": false
11893
- // },
11894
- "actionType": "custom",
11895
- "script": "window.goBack()",
11896
- "expression": "this.__deletedRecord === true"
11897
- }
11898
- ]
11899
- }
11900
- }
11901
12062
  },
11902
12063
  }
11903
12064
  ],
11904
- onEvent: {
11905
- "fetchInited": {
11906
- "weight": 0,
11907
- "actions": [
11908
- {
11909
- actionType: 'broadcast',
11910
- eventName: "recordLoaded",
11911
- args: {
11912
- eventName: "recordLoaded"
11913
- },
11914
- data: {
11915
- objectName: "${event.data.__objectName}",
11916
- record: "${event.data.__record}"
11917
- },
11918
- expression: "${event.data.__response.error != true}"
11919
- },
11920
- {
11921
- "actionType": "setValue",
11922
- "args": {
11923
- value: {
11924
- "recordLoaded": true,
11925
- }
11926
- },
11927
- expression: "${event.data.__response.error != true}"
11928
- }
11929
- ]
11930
- }
11931
- }
12065
+ // onEvent: {
12066
+ // "fetchInited": {
12067
+ // "weight": 0,
12068
+ // "actions": [
12069
+ // {
12070
+ // actionType: 'broadcast',
12071
+ // eventName: "recordLoaded",
12072
+ // args: {
12073
+ // eventName: "recordLoaded"
12074
+ // },
12075
+ // data: {
12076
+ // objectName: "${event.data.__objectName}",
12077
+ // record: "${event.data.__record}"
12078
+ // },
12079
+ // expression: "${event.data.__response.error != true}"
12080
+ // },
12081
+ // {
12082
+ // "actionType": "setValue",
12083
+ // "args": {
12084
+ // value: {
12085
+ // "recordLoaded": true,
12086
+ // }
12087
+ // },
12088
+ // expression: "${event.data.__response.error != true}"
12089
+ // }
12090
+ // ]
12091
+ // }
12092
+ // }
11932
12093
  };
11933
12094
 
11934
12095
  amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
12096
+ // console.log('getObjectDetail=====>', amisSchema);
11935
12097
  return amisSchema;
11936
12098
  }
11937
12099
 
@@ -12011,8 +12173,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
12011
12173
  /*
12012
12174
  * @Author: baozhoutao@steedos.com
12013
12175
  * @Date: 2022-07-05 15:55:39
12014
- * @LastEditors: liaodaxue
12015
- * @LastEditTime: 2023-11-14 15:55:32
12176
+ * @LastEditors: baozhoutao@steedos.com
12177
+ * @LastEditTime: 2024-01-15 10:34:46
12016
12178
  * @Description:
12017
12179
  */
12018
12180
 
@@ -12187,7 +12349,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12187
12349
  setDataToComponentId: componentId,
12188
12350
  // tableHiddenOn: hiddenEmptyTable ? "this.$count === 0" : null,
12189
12351
  appId: appId,
12190
- crudClassName: 'border-t border-gray-300 hidden',
12352
+ crudClassName: 'steedos-record-related-crud hidden',
12191
12353
  refField,
12192
12354
  ...ctx
12193
12355
  };
@@ -12200,7 +12362,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
12200
12362
  amisSchema: {
12201
12363
  type: "service",
12202
12364
  id: componentId,
12203
- className: `steedos-record-related-list ${componentId} rounded border border-gray-300 bg-gray-100 mb-4 ${className}`,
12365
+ className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
12204
12366
  data: {
12205
12367
  relatedKey: relatedKey,
12206
12368
  listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
@@ -12392,11 +12554,44 @@ async function getRelatedListSchema(
12392
12554
  };
12393
12555
  }
12394
12556
 
12557
+ async function getObjectRelatedListsMiniSchema(objectApiName){
12558
+ const relatedLists = await getObjectRelatedList(objectApiName);
12559
+
12560
+ const relatedListsMiniSchema = [];
12561
+
12562
+ for (const relatedList of relatedLists) {
12563
+ relatedListsMiniSchema.push(
12564
+ {
12565
+ type: 'steedos-record-detail-list-mini',
12566
+ objectApiName: objectApiName,
12567
+ // recordId: recordId,
12568
+ formFactor: formFactor,
12569
+ relatedObjectApiName: relatedList.object_name,
12570
+ foreign_key: relatedList.foreign_key,
12571
+ relatedKey: relatedList.foreign_key,
12572
+ columns: relatedList.columns,
12573
+ sort: relatedList.sort,
12574
+ filters: relatedList.filters,
12575
+ visible_on: relatedList.visible_on,
12576
+ perPage: relatedList.page_size || perPage,
12577
+ hiddenEmptyTable: true,
12578
+ relatedLabel: relatedList.label
12579
+ }
12580
+ );
12581
+ }
12582
+
12583
+ return {
12584
+ type: 'wrapper',
12585
+ className: "steedos-record-detail-related-lists-mini",
12586
+ body: relatedListsMiniSchema
12587
+ }
12588
+ }
12589
+
12395
12590
  /*
12396
12591
  * @Author: baozhoutao@steedos.com
12397
12592
  * @Date: 2022-07-05 15:55:39
12398
- * @LastEditors: liaodaxue
12399
- * @LastEditTime: 2023-10-20 11:38:25
12593
+ * @LastEditors: baozhoutao@steedos.com
12594
+ * @LastEditTime: 2024-01-16 11:14:34
12400
12595
  * @Description:
12401
12596
  */
12402
12597
 
@@ -12568,7 +12763,7 @@ async function getField(objectName, fieldName) {
12568
12763
  async function getFormSchema(objectName, ctx) {
12569
12764
  const uiSchema = await getUISchema(objectName);
12570
12765
  const amisSchema = await getObjectForm(uiSchema, ctx);
12571
- console.log(`getFormSchema====>`, amisSchema);
12766
+ // console.log(`getFormSchema====>`, amisSchema)
12572
12767
  return {
12573
12768
  uiSchema,
12574
12769
  amisSchema,
@@ -12894,110 +13089,164 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
12894
13089
  "label": "对象表单",
12895
13090
  "objectApiName": "${objectName}",
12896
13091
  "recordId": "${recordId}",
12897
- "id": "u:d4a495811d57",
12898
13092
  appId: appId
12899
13093
  }
12900
13094
  ],
12901
- "id": "u:5d4e7e3f6ecc"
12902
13095
  };
12903
13096
  const related = {
12904
13097
  "title": instance.t('frontend_record_detail_tab_related'),
12905
- "className": "px-0 pt-4",
13098
+ "className": "px-0 py-4",
12906
13099
  "body": [
12907
13100
  {
12908
13101
  "type": "steedos-object-related-lists",
12909
13102
  "label": "相关列表",
12910
13103
  "objectApiName": "${objectName}",
12911
13104
  "recordId": "${recordId}",
12912
- "id": "u:3b85b7b7a7f6",
12913
13105
  appId: appId
12914
13106
  }
12915
13107
  ],
12916
- "id": "u:1a0326aeec2b"
12917
13108
  };
12918
13109
  const content = {
12919
13110
  "type": "tabs",
12920
- "className": "sm:mt-3 bg-white sm:rounded sm:border border-gray-300 p-4",
13111
+ "className": "steedos-record-tabs bg-white p-4 m-0 mt-2 border-y",
13112
+ "contentClassName": "bg-none",
12921
13113
  "tabs": [
12922
13114
  detailed
12923
13115
  ],
12924
- "id": "u:a649e4094a12"
12925
13116
  };
12926
13117
  if(relatedLists.length){
12927
13118
  content.tabs.push(related);
12928
13119
  }
13120
+ // content.tabs = reverse(content.tabs)
12929
13121
  return {
12930
13122
  uiSchema,
12931
13123
  amisSchema: {
12932
- "type": "service",
13124
+ "type": "steedos-record-service",
12933
13125
  "body": [
12934
13126
  {
12935
13127
  "type": "steedos-record-detail-header",
12936
13128
  "label": "标题面板",
12937
13129
  "objectApiName": "${objectName}",
12938
13130
  "recordId": "${recordId}",
12939
- "id": "u:48d2c28eb755"
13131
+ "id": "u:48d2c28eb755",
13132
+ "showButtons": props.showButtons,
13133
+ "showBackButton": props.showBackButton,
12940
13134
  },
12941
13135
  content
12942
13136
  ],
12943
- data: {
12944
- "_master.objectName": "${objectName}",
12945
- "_master.recordId": "${recordId}"
12946
- },
12947
- onEvent: {
12948
- "recordLoaded": {
12949
- "actions": [
12950
- {
12951
- "actionType": "reload",
12952
- "data": {
12953
- "name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
12954
- "_master.record": `\${record}`,
12955
- // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
12956
- "_master.objectName": "${objectName}",
12957
- "_master.recordId": "${recordId}"
12958
- }
12959
- }
12960
- ]
12961
- },
12962
- ...props.onEvent
12963
- },
13137
+ "objectApiName": "${objectName}",
13138
+ "recordId": "${recordId}",
13139
+ onEvent: props.onEvent,
12964
13140
  }
12965
13141
  }
12966
13142
  }
12967
13143
 
12968
- async function getRecordServiceSchema(objectName, appId, props = {}) {
13144
+ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
12969
13145
  const uiSchema = await getUISchema(objectName);
13146
+ const fields = _$1__default["default"].values(uiSchema.fields);
13147
+ const serviceId = `u:steedos-record-service-${objectName}`;
12970
13148
  return {
12971
13149
  uiSchema,
12972
13150
  amisSchema: {
12973
- "type": "service",
12974
- "body": [],
12975
- data: {
12976
- "_master.objectName": "${objectName}",
12977
- "_master.recordId": "${recordId}"
12978
- },
12979
- "style": {
12980
- "padding": "var(--Page-body-padding)",
12981
- ...props.style
12982
- },
13151
+ type: 'service',
13152
+ className: "p-0 m-0",
12983
13153
  onEvent: {
12984
- "recordLoaded": {
13154
+ [`@data.changed.${objectName}`]: {
12985
13155
  "actions": [
12986
13156
  {
12987
13157
  "actionType": "reload",
12988
- "data": {
12989
- "name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
12990
- "_master.record": `\${record}`,
12991
- // 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
12992
- "_master.objectName": "${objectName}",
12993
- "_master.recordId": "${recordId}"
12994
- }
13158
+ "componentId": serviceId,
13159
+ "expression": "this.__deletedRecord != true"
13160
+ },
13161
+ {
13162
+ "actionType": "custom",
13163
+ "script": "window.goBack()",
13164
+ "expression": "this.__deletedRecord === true"
12995
13165
  }
12996
13166
  ]
12997
13167
  },
12998
- ...props.onEvent
13168
+ },
13169
+ body: {
13170
+ "type": "service",
13171
+ id: serviceId,
13172
+ className: 'steedos-record-service p-0',
13173
+ api: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
13174
+ body: {
13175
+ "type": "wrapper",
13176
+ "className": "p-0 m-0",
13177
+ "body": body || [],
13178
+ "hiddenOn": "${recordLoaded != true}"
13179
+ },
13180
+ data: {
13181
+ "_master.objectName": "${objectName}",
13182
+ "_master.recordId": "${recordId}",
13183
+ ...(props.data || {})
13184
+ },
13185
+ "style": {
13186
+ // "padding": "var(--Page-body-padding)",
13187
+ ...props.style
13188
+ },
13189
+ onEvent: {
13190
+ // 如果定义了fetchInited,则无法接收到广播事件@data.changed
13191
+ "fetchInited": {
13192
+ "weight": 0,
13193
+ "actions": [
13194
+ {
13195
+ actionType: 'broadcast',
13196
+ eventName: "recordLoaded",
13197
+ data: {
13198
+ objectName: "${event.data.__objectName}",
13199
+ record: "${event.data.record}"
13200
+ },
13201
+ expression: "${event.data.__response.error != true}"
13202
+ },
13203
+ ]
13204
+ },
13205
+ ...props.onEvent
13206
+ }
12999
13207
  }
13000
13208
  }
13209
+
13210
+
13211
+ }
13212
+ }
13213
+
13214
+ async function getRecordDetailMiniSchema(objectName, appId, props = {}){
13215
+ const uiSchema = await getUISchema(objectName);
13216
+ const fields = _$1__default["default"].values(uiSchema.fields);
13217
+
13218
+ props.initApiAdaptor = 'payload.data=Object.assign({}, payload.data, payload.data.record); payload.data._finished=true; console.log("payload data is ====>", payload)';
13219
+
13220
+ // TODO 处理相关表
13221
+ // getObjectRelatedListsMiniSchema
13222
+
13223
+ return {
13224
+ type: "form",
13225
+ wrapWithPanel: false,
13226
+ actions: [],
13227
+ initApi: await getReadonlyFormInitApi(uiSchema, props.recordId, fields, props),
13228
+ body: {
13229
+ "type": "wrapper",
13230
+ "className": "p-0 m-0",
13231
+ "body": [
13232
+ {
13233
+ "type": "steedos-record-detail-header",
13234
+ "showButtons": false,
13235
+ "showBackButton": false,
13236
+ "objectApiName": "${objectName}",
13237
+ "recordId": "${recordId}",
13238
+ },
13239
+ // {
13240
+ // "type": "steedos-object-related-lists",
13241
+ // "label": "相关列表",
13242
+ // "objectApiName": "${objectName}",
13243
+ // "staticRecordId": "${recordId}",
13244
+ // formFactor: "SMALL",
13245
+ // appId: appId
13246
+ // }
13247
+ ],
13248
+ "hiddenOn": "${_finished != true}"
13249
+ }
13001
13250
  }
13002
13251
  }
13003
13252
 
@@ -13938,9 +14187,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
13938
14187
  */
13939
14188
  if(enable_tree){
13940
14189
  const rows = _.map(payload.data.rows, (item)=>{
13941
- delete item.children;
13942
- delete item.parent;
13943
- return item;
14190
+ if (!item.children) {
14191
+ return { ...item, children: [] };
14192
+ } else {
14193
+ return item;
14194
+ }
13944
14195
  })
13945
14196
  payload.data.rows = rows;
13946
14197
  }
@@ -14389,9 +14640,17 @@ async function lookupToAmis(field, readonly, ctx){
14389
14640
  }
14390
14641
  // console.log(`lookupToAmis====`, field, readonly, ctx)
14391
14642
  if(readonly){
14392
- return {
14393
- type: getAmisStaticFieldType$1('picker', readonly),
14394
- tpl: getRelatedFieldTpl(field, ctx)
14643
+ if(field.reference_to){
14644
+ return {
14645
+ type: 'steedos-field',
14646
+ config: field,
14647
+ static: true
14648
+ }
14649
+ }else {
14650
+ return {
14651
+ type: getAmisStaticFieldType$1('picker', readonly),
14652
+ tpl: getRelatedFieldTpl(field, ctx)
14653
+ }
14395
14654
  }
14396
14655
  }
14397
14656
  if(field.reference_to && !_$1__namespace.isString(field.reference_to) && !readonly){
@@ -15385,11 +15644,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15385
15644
  if(field.subFields){
15386
15645
  convertData = {
15387
15646
  type: 'steedos-input-table',
15388
- showIndex: true,
15389
15647
  editable: !readonly,
15390
15648
  addable: !readonly,
15391
15649
  removable: !readonly,
15392
- draggable: !readonly,
15393
15650
  fields: [],
15394
15651
  amis:{
15395
15652
  columnsTogglable: false
@@ -15441,7 +15698,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15441
15698
  if(field.is_wide || convertData.type === 'group'){
15442
15699
  convertData.className = 'col-span-2 m-0';
15443
15700
  }else {
15444
- convertData.className = 'm-1';
15701
+ convertData.className = 'm-0';
15445
15702
  }
15446
15703
  if(readonly){
15447
15704
  convertData.className = `${convertData.className} border-b`;
@@ -15466,6 +15723,10 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15466
15723
  }
15467
15724
  }
15468
15725
 
15726
+ if(ctx.amisData && ctx.amisData._master && ctx.amisData._master.relatedKey === field.name){
15727
+ convertData.className = `${convertData.className || ''} hidden`;
15728
+ }
15729
+
15469
15730
  if(_$1__namespace.isString(baseData.required)){
15470
15731
  if(baseData.required.startsWith("{{")){
15471
15732
  baseData.requiredOn = `${baseData.required.substring(2, baseData.required.length -2).replace(/formData./g, 'data.')}`;
@@ -15846,9 +16107,61 @@ async function getFormBody(permissionFields, formFields, ctx){
15846
16107
  /*
15847
16108
  * @Author: 殷亮辉 yinlianghui@hotoa.com
15848
16109
  * @Date: 2023-11-15 09:50:22
15849
- * @LastEditors: liaodaxue
15850
- * @LastEditTime: 2024-01-09 18:12:28
16110
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
16111
+ * @LastEditTime: 2024-01-18 10:29:57
16112
+ */
16113
+
16114
+ /**
16115
+ * 子表组件字段值中每行数据的键值key移除指定前缀
16116
+ * @param {*} value 子表组件字段值,数组
16117
+ * @param {*} fieldPrefix 字段前缀
16118
+ * @returns 转换后的子表组件字段值
16119
+ */
16120
+ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
16121
+ let convertedValue = [];
16122
+ (value || []).forEach((itemValue)=>{
16123
+ var newItemValue = {};
16124
+ for(let n in itemValue){
16125
+ newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
16126
+ }
16127
+ convertedValue.push(newItemValue);
16128
+ });
16129
+ return convertedValue;
16130
+ }
16131
+
16132
+ /**
16133
+ * 子表组件字段值中每行数据的键值key补上指定前缀
16134
+ * @param {*} value 子表组件字段值,数组
16135
+ * @param {*} fieldPrefix 字段前缀
16136
+ * @returns 转换后的子表组件字段值
16137
+ */
16138
+ function getTableValuePrependFieldPrefix(value, fieldPrefix){
16139
+ let convertedValue = [];
16140
+ (value || []).forEach((itemValue)=>{
16141
+ var newItemValue = {};
16142
+ for(let n in itemValue){
16143
+ if(typeof itemValue[n] !== undefined){
16144
+ newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
16145
+ }
16146
+ }
16147
+ convertedValue.push(newItemValue);
16148
+ });
16149
+ return convertedValue;
16150
+ }
16151
+
16152
+ /**
16153
+ * 子表组件字段集合属性中每个字段name移除指定前缀
16154
+ * @param {*} fields 子表组件字段集合,数组
16155
+ * @param {*} fieldPrefix 字段前缀
16156
+ * @returns 转换后的子表组件字段值
15851
16157
  */
16158
+ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
16159
+ return (fields || []).map((item) => {
16160
+ const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
16161
+ newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
16162
+ return newItem;
16163
+ });
16164
+ }
15852
16165
 
15853
16166
  /**
15854
16167
  * @param {*} props
@@ -15996,7 +16309,19 @@ function getFormPagination(props, mode) {
15996
16309
  let currentIndex = event.data.index;
15997
16310
  // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
15998
16311
  let currentFormValues = scope.getComponentById(__formId).getValues();
15999
- fieldValue[currentIndex] = currentFormValues;
16312
+ var parent = event.data.parent;
16313
+ var __parentIndex = event.data.__parentIndex;
16314
+ if(parent){
16315
+ fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
16316
+ // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
16317
+ fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
16318
+ children: fieldValue[__parentIndex].children,
16319
+ __fix_rerender_after_children_modified_tag: new Date().getTime()
16320
+ });
16321
+ }
16322
+ else{
16323
+ fieldValue[currentIndex] = currentFormValues;
16324
+ }
16000
16325
  // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
16001
16326
  doAction({
16002
16327
  "componentId": "${props.id}",
@@ -16063,7 +16388,8 @@ function getFormPagination(props, mode) {
16063
16388
  },
16064
16389
  {
16065
16390
  "type": "tpl",
16066
- "tpl": "${__page}/${__tableItems.length}"
16391
+ // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
16392
+ "tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
16067
16393
  },
16068
16394
  {
16069
16395
  "type": "button",
@@ -16071,7 +16397,9 @@ function getFormPagination(props, mode) {
16071
16397
  "icon": `fa fa-angle-right`,
16072
16398
  "level": "link",
16073
16399
  "pageChangeDirection": "next",
16074
- "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
16400
+ // "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
16401
+ // 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
16402
+ "disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
16075
16403
  "size": "sm",
16076
16404
  "id": buttonNextId,
16077
16405
  "onEvent": {
@@ -16104,14 +16432,14 @@ function getFormPaginationWrapper(props, form, mode) {
16104
16432
  "data": {
16105
16433
  // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
16106
16434
  // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
16107
- "&": "${__tableItems[__super.index]}"
16435
+ "&": "${__super.parent ? __tableItems[__parentIndex]['children'][__super.index] : __tableItems[__super.index]}"
16108
16436
  }
16109
16437
  });
16110
16438
  let formBody = [
16111
16439
  {
16112
16440
  "type": "wrapper",
16113
16441
  "size": "none",
16114
- "className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white -mt-2",
16442
+ "className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white",
16115
16443
  "body": [
16116
16444
  getFormPagination(props, mode)
16117
16445
  ]
@@ -16127,7 +16455,8 @@ function getFormPaginationWrapper(props, form, mode) {
16127
16455
  }
16128
16456
  ];
16129
16457
  let onServiceInitedScript = `
16130
- // 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
16458
+
16459
+ // 以下脚本解决了有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
16131
16460
  // 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
16132
16461
  // 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
16133
16462
  // 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
@@ -16140,6 +16469,11 @@ function getFormPaginationWrapper(props, form, mode) {
16140
16469
  // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16141
16470
  // 这里如果不.clone的话,在弹出窗口中显示的子表组件,添加行后点窗口的取消按钮关闭窗口后无法把之前的操作还原,即把之前添加的行自动移除
16142
16471
  let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
16472
+ let fieldPrefix = "${props.fieldPrefix}";
16473
+ if(fieldPrefix){
16474
+ let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
16475
+ lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
16476
+ }
16143
16477
  //不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
16144
16478
  let mode = "${mode}";
16145
16479
  if(mode === "new"){
@@ -16162,6 +16496,16 @@ function getFormPaginationWrapper(props, form, mode) {
16162
16496
  event.data.__tableItems.forEach(function(n,i){
16163
16497
  event.data.__tableItems[i] = lastestFieldValue[i];
16164
16498
  });
16499
+
16500
+ var parent = event.data.parent;
16501
+ var fieldValue = event.data.__tableItems;
16502
+ if(parent){
16503
+ // 如果是子行,即在节点嵌套情况下,当前节点如果是children属性下的子节点时,则算出其所属父行的索引值
16504
+ var primaryKey = "${props.primaryKey}";
16505
+ event.data.__parentIndex = _.findIndex(fieldValue, function(item){
16506
+ return item[primaryKey] == parent[primaryKey];
16507
+ });
16508
+ }
16165
16509
  `;
16166
16510
  let schema = {
16167
16511
  "type": "service",
@@ -16182,6 +16526,7 @@ function getFormPaginationWrapper(props, form, mode) {
16182
16526
  // "body": formBody,
16183
16527
  "data": {
16184
16528
  "__page": "${index + 1}",
16529
+ "__parentIndex": null,//兼容节点嵌套情况,即节点中有children属性时,这里记录当前节点所属上层节点index,只支持向上找一层,不支持多层
16185
16530
  // "__total": `\${${props.name}.length}`,
16186
16531
  // "__total": "${__tableItems.length}",
16187
16532
  // "__paginationServiceId": serviceId,
@@ -16229,7 +16574,22 @@ async function getForm(props, mode = "edit", formId) {
16229
16574
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16230
16575
  //这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
16231
16576
  // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
16232
- fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
16577
+ // fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
16578
+ var currentIndex = event.data.__super.__super.index;
16579
+ var currentFormValues = JSON.parse(JSON.stringify(event.data));
16580
+ var parent = event.data.__super.__super.parent;
16581
+ var __parentIndex = event.data.__super.__super.__parentIndex;
16582
+ if(parent){
16583
+ fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
16584
+ // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
16585
+ fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
16586
+ children: fieldValue[__parentIndex].children,
16587
+ __fix_rerender_after_children_modified_tag: new Date().getTime()
16588
+ });
16589
+ }
16590
+ else{
16591
+ fieldValue[currentIndex] = currentFormValues;
16592
+ }
16233
16593
  doAction({
16234
16594
  "componentId": "${props.id}",
16235
16595
  "actionType": "setValue",
@@ -16369,7 +16729,18 @@ async function getButtonActions(props, mode) {
16369
16729
  let scope = event.context.scoped;
16370
16730
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16371
16731
  // 新建一条空白行并保存到子表组件
16372
- fieldValue.push({});
16732
+ var parent = event.data.__super.parent;
16733
+ var primaryKey = "${props.primaryKey}";
16734
+ var __parentIndex = parent && _.findIndex(fieldValue, function(item){
16735
+ return item[primaryKey] == parent[primaryKey];
16736
+ });
16737
+ if(parent){
16738
+ fieldValue[__parentIndex].children.push({});
16739
+ // 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
16740
+ }
16741
+ else{
16742
+ fieldValue.push({});
16743
+ }
16373
16744
  doAction({
16374
16745
  "componentId": "${props.id}",
16375
16746
  "actionType": "setValue",
@@ -16381,7 +16752,13 @@ async function getButtonActions(props, mode) {
16381
16752
  let __paginationServiceId = "${formPaginationId}";
16382
16753
  let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16383
16754
  event.data.index = __paginationData.index;
16384
- event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16755
+ if(parent){
16756
+ event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16757
+ event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
16758
+ }
16759
+ else{
16760
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16761
+ }
16385
16762
  // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16386
16763
  scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16387
16764
  `;
@@ -16392,7 +16769,19 @@ async function getButtonActions(props, mode) {
16392
16769
  let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
16393
16770
  let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16394
16771
  // 复制当前页数据到新建行并保存到子表组件
16395
- fieldValue.push(newItem);
16772
+ // fieldValue.push(newItem);
16773
+ var parent = event.data.__super.parent;
16774
+ var primaryKey = "${props.primaryKey}";
16775
+ var __parentIndex = parent && _.findIndex(fieldValue, function(item){
16776
+ return item[primaryKey] == parent[primaryKey];
16777
+ });
16778
+ if(parent){
16779
+ fieldValue[__parentIndex].children.push(newItem);
16780
+ // 这里实测不需要fieldValue[__parentIndex] = ... 来重写整个父行让子表回显,所以没加相关代码
16781
+ }
16782
+ else{
16783
+ fieldValue.push(newItem);
16784
+ }
16396
16785
  doAction({
16397
16786
  "componentId": "${props.id}",
16398
16787
  "actionType": "setValue",
@@ -16404,7 +16793,13 @@ async function getButtonActions(props, mode) {
16404
16793
  let __paginationServiceId = "${formPaginationId}";
16405
16794
  let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16406
16795
  event.data.index = __paginationData.index;
16407
- event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16796
+ if(parent){
16797
+ event.data.__page = fieldValue[__parentIndex].children.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16798
+ event.data.__parentIndex = __parentIndex; //执行下面的翻页按钮事件中依赖了__parentIndex值
16799
+ }
16800
+ else{
16801
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16802
+ }
16408
16803
  // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16409
16804
  scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16410
16805
  `;
@@ -16480,13 +16875,16 @@ async function getButtonActions(props, mode) {
16480
16875
  "_master": "${_master}",
16481
16876
  "global": "${global}",
16482
16877
  "uiSchema": "${uiSchema}",
16483
- "index": "${index}",
16878
+ "index": "${index}",//amis组件自带行索引,在节点嵌套情况下,当前节点如果是children属性下的子节点时,这里的index是当前节点在children中的索引,而不是外层父节点的index
16879
+ "parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
16484
16880
  // "__tableItems": `\${${props.name}}`
16485
16881
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16486
16882
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16487
16883
  // "__tableItems": `\${${props.name}|json|toJson}`
16488
- "__tableItems": `\${(${props.name} || [])|json|toJson}`
16489
- },
16884
+ // 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
16885
+ // 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
16886
+ "__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
16887
+ },
16490
16888
  "actions": dialogButtons,
16491
16889
  "onEvent": {
16492
16890
  "confirm": {
@@ -16508,35 +16906,39 @@ async function getButtonActions(props, mode) {
16508
16906
  Object.assign(actionShowEditDialog.dialog, props.dialog);
16509
16907
  }
16510
16908
  if (mode == "new") {
16511
- `
16512
- let newItem = {};
16513
- if(event.data["${props.name}"]){
16514
- // let fieldValue = event.data.__tableItems;
16515
- // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16516
- // let fieldValue = _.clone(event.data["${props.name}"]);
16517
- let fieldValue = event.data["${props.name}"];
16518
- fieldValue.push(newItem);
16519
- doAction({
16520
- "componentId": "${props.id}",
16521
- "actionType": "setValue",
16522
- "args": {
16523
- "value": fieldValue
16524
- }
16525
- });
16526
- event.data.index = fieldValue.length - 1;
16527
- }
16528
- else{
16529
- // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
16530
- doAction({
16531
- "componentId": "${props.id}",
16532
- "actionType": "setValue",
16533
- "args": {
16534
- "value": [newItem]
16535
- }
16536
- });
16537
- event.data.index = 1;
16538
- }
16539
- `;
16909
+ // let onNewLineScript = `
16910
+ // let newItem = {};
16911
+ // if(event.data["${props.name}"]){
16912
+ // // let fieldValue = event.data.__tableItems;
16913
+ // // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16914
+ // // let fieldValue = _.clone(event.data["${props.name}"]);
16915
+ // let fieldValue = event.data["${props.name}"];
16916
+ // fieldValue.push(newItem);
16917
+ // doAction({
16918
+ // "componentId": "${props.id}",
16919
+ // "actionType": "setValue",
16920
+ // "args": {
16921
+ // "value": fieldValue
16922
+ // }
16923
+ // });
16924
+ // event.data.index = fieldValue.length - 1;
16925
+ // }
16926
+ // else{
16927
+ // // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
16928
+ // doAction({
16929
+ // "componentId": "${props.id}",
16930
+ // "actionType": "setValue",
16931
+ // "args": {
16932
+ // "value": [newItem]
16933
+ // }
16934
+ // });
16935
+ // event.data.index = 1;
16936
+ // }
16937
+ // `;
16938
+ // let actionNewLine = {
16939
+ // "actionType": "custom",
16940
+ // "script": onNewLineScript
16941
+ // };
16540
16942
  // 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
16541
16943
  // actions = [actionNewLine, actionShowEditDialog];
16542
16944
  actions = [actionShowEditDialog];
@@ -16571,15 +16973,17 @@ async function getButtonActions(props, mode) {
16571
16973
  // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16572
16974
  // "__parentForm": "${__super.__super || {}}",
16573
16975
  "__parentForm": parentFormData,
16976
+ "_master": "${_master}",
16574
16977
  "global": "${global}",
16575
16978
  "uiSchema": "${uiSchema}",
16576
16979
  "index": "${index}",
16980
+ "parent": "${__super.parent}",//amis组件自带父节点数据域数据,即节点嵌套情况下,当前节点为某个节点(比如A节点)的children属性下的子节点时,当前节点的父节点(即A节点)的数据域数据
16577
16981
  // "__tableItems": `\${${props.name}}`
16578
16982
  // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16579
16983
  // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16580
16984
  // "__tableItems": `\${${props.name}|json|toJson}`
16581
- "__tableItems": `\${(${props.name} || [])|json|toJson}`
16582
- },
16985
+ "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
16986
+ },
16583
16987
  }
16584
16988
  }
16585
16989
  ];
@@ -16595,7 +16999,23 @@ async function getButtonActions(props, mode) {
16595
16999
  // 这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16596
17000
  // 这里_.clone是因为字段设计布局设置分组这种弹出窗口中的子表组件,直接删除后,点取消无法还原
16597
17001
  let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"]);
16598
- lastestFieldValue.splice(event.data.index, 1);
17002
+ var currentIndex = event.data.index;
17003
+ var parent = event.data.__super.parent;
17004
+ var primaryKey = "${props.primaryKey}";
17005
+ var __parentIndex = parent && _.findIndex(lastestFieldValue, function(item){
17006
+ return item[primaryKey] == parent[primaryKey];
17007
+ });
17008
+ if(parent){
17009
+ lastestFieldValue[__parentIndex].children.splice(currentIndex, 1);
17010
+ // 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
17011
+ lastestFieldValue[__parentIndex] = Object.assign({}, lastestFieldValue[__parentIndex], {
17012
+ children: lastestFieldValue[__parentIndex].children,
17013
+ __fix_rerender_after_children_modified_tag: new Date().getTime()
17014
+ });
17015
+ }
17016
+ else{
17017
+ lastestFieldValue.splice(currentIndex, 1);
17018
+ }
16599
17019
  doAction({
16600
17020
  "componentId": "${props.id}",
16601
17021
  "actionType": "setValue",
@@ -16681,39 +17101,53 @@ const getAmisInputTableSchema = async (props) => {
16681
17101
  if (!props.id) {
16682
17102
  props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
16683
17103
  }
17104
+ if (!props.primaryKey) {
17105
+ props.primaryKey = "_id";
17106
+ }
17107
+ let showOperation = props.showOperation;
17108
+ if(showOperation !== false){
17109
+ showOperation = true;
17110
+ }
17111
+ // props.fieldPrefix = "project_milestone_";
17112
+ if (props.fieldPrefix) {
17113
+ props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
17114
+ }
16684
17115
  let serviceId = getComponentId("table_service", props.id);
16685
17116
  let buttonsForColumnOperations = [];
16686
17117
  let inlineEditMode = props.inlineEditMode;
16687
17118
  let showAsInlineEditMode = inlineEditMode && props.editable;
16688
- if (props.editable) {
16689
- let showEditButton = true;
16690
- if (showAsInlineEditMode) {
16691
- // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
16692
- showEditButton = true;
16693
- // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16694
- // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16695
- // showEditButton = true;
16696
- // }
16697
- // else {
16698
- // showEditButton = false;
16699
- // }
17119
+ if(showOperation){
17120
+ if (props.editable) {
17121
+ let showEditButton = true;
17122
+ if (showAsInlineEditMode) {
17123
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
17124
+ showEditButton = true;
17125
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
17126
+ // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
17127
+ // showEditButton = true;
17128
+ // }
17129
+ // else {
17130
+ // showEditButton = false;
17131
+ // }
17132
+ }
17133
+ // 编辑时显示编辑按钮
17134
+ if (showEditButton) {
17135
+ let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
17136
+ buttonsForColumnOperations.push(buttonEditSchema);
17137
+ }
16700
17138
  }
16701
- // 编辑时显示编辑按钮
16702
- if (showEditButton) {
16703
- let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
16704
- buttonsForColumnOperations.push(buttonEditSchema);
17139
+ else {
17140
+ // 只读时显示查看按钮
17141
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
17142
+ let buttonViewSchema = await getButtonView(props);
17143
+ buttonsForColumnOperations.push(buttonViewSchema);
17144
+ }
17145
+ if (props.removable) {
17146
+ let buttonDeleteSchema = await getButtonDelete(props);
17147
+ buttonsForColumnOperations.push(buttonDeleteSchema);
16705
17148
  }
16706
17149
  }
16707
- else {
16708
- // 只读时显示查看按钮
16709
- // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
16710
- let buttonViewSchema = await getButtonView(props);
16711
- buttonsForColumnOperations.push(buttonViewSchema);
16712
- }
16713
- if (props.removable) {
16714
- let buttonDeleteSchema = await getButtonDelete(props);
16715
- buttonsForColumnOperations.push(buttonDeleteSchema);
16716
- }
17150
+ let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16717
17151
  let inputTableSchema = {
16718
17152
  "type": "input-table",
16719
17153
  "label": props.label,
@@ -16731,8 +17165,37 @@ const getAmisInputTableSchema = async (props) => {
16731
17165
  "strictMode": props.strictMode,
16732
17166
  "showTableAddBtn": false,
16733
17167
  "showFooterAddBtn": false,
16734
- "className": props.tableClassName
17168
+ "className": props.tableClassName,
17169
+ "pipeOut": (value, data) => {
17170
+ value = (value || []).map(function(item){
17171
+ delete item.__fix_rerender_after_children_modified_tag;
17172
+ return item;
17173
+ });
17174
+ if(props.fieldPrefix){
17175
+ value = getTableValuePrependFieldPrefix(value, props.fieldPrefix);
17176
+ }
17177
+ if(amis.pipeOut){
17178
+ if(typeof amis.pipeOut === 'function'){
17179
+ return amis.pipeOut(value, data);
17180
+ }
17181
+ }
17182
+ return value;
17183
+ }
16735
17184
  };
17185
+ if(amis.pipeIn){
17186
+ inputTableSchema.pipeIn = amis.pipeIn;
17187
+ }
17188
+ if(props.fieldPrefix){
17189
+ inputTableSchema.pipeIn = (value, data) => {
17190
+ value = getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
17191
+ if(amis.pipeIn){
17192
+ if(typeof amis.pipeIn === 'function'){
17193
+ return amis.pipeIn(value, data);
17194
+ }
17195
+ }
17196
+ return value;
17197
+ };
17198
+ }
16736
17199
  if (buttonsForColumnOperations.length) {
16737
17200
  inputTableSchema.columns.push({
16738
17201
  "name": "__op__",
@@ -16744,17 +17207,18 @@ const getAmisInputTableSchema = async (props) => {
16744
17207
  if (showAsInlineEditMode) {
16745
17208
  inputTableSchema.needConfirm = false;
16746
17209
  }
16747
- let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16748
17210
  if (amis) {
16749
17211
  // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
16750
17212
  delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
17213
+ delete amis.pipeIn;//该属性在上面合并过了
17214
+ delete amis.pipeOut;//该属性在上面合并过了
16751
17215
  Object.assign(inputTableSchema, amis);
16752
17216
  }
16753
17217
  const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
16754
17218
  return item.depend_on;
16755
17219
  });
16756
17220
  if (isAnyFieldHasDependOn) {
16757
- // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
17221
+ // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式,因为strictMode模式下,dependOn的字段值变更后,不会rerender整个子表
16758
17222
  Object.assign(inputTableSchema, {
16759
17223
  strictMode: false
16760
17224
  });
@@ -16859,7 +17323,7 @@ async function getListPageInitSchema(objectApiName, formFactor, userSession) {
16859
17323
  // 获取
16860
17324
  async function getRecordPageInitSchema(objectApiName){
16861
17325
  const relatedList = await getObjectRelatedList(objectApiName);
16862
- const uiSchema = await getUISchema(objectApiName);
17326
+ await getUISchema(objectApiName);
16863
17327
  let body = [
16864
17328
  // detailHeaderAmisSchema,
16865
17329
  {
@@ -16867,28 +17331,7 @@ async function getRecordPageInitSchema(objectApiName){
16867
17331
  "label": "标题面板",
16868
17332
  "objectApiName": "${objectName}",
16869
17333
  "recordId": "${recordId}",
16870
- "onEvent": {
16871
- "recordLoaded": {
16872
- "actions": [
16873
- {
16874
- "actionType": "setValue",
16875
- "args": {
16876
- "value": {
16877
- "recordLoaded": true,
16878
- }
16879
- }
16880
- },
16881
- {
16882
- "actionType": "reload",
16883
- "data": {
16884
- "name": `\${record.${uiSchema?.NAME_FIELD_KEY || 'name'}}`,
16885
- "record": `\${record}`,
16886
- "recordLoaded": true,
16887
- }
16888
- }
16889
- ]
16890
- }
16891
- }
17334
+ "onEvent": {}
16892
17335
  }
16893
17336
  ];
16894
17337
  let contentBody = {
@@ -19521,9 +19964,11 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
19521
19964
  getObjectRelatedList: getObjectRelatedList,
19522
19965
  getObjectRelatedListButtons: getObjectRelatedListButtons,
19523
19966
  getObjectRelatedListHeader: getObjectRelatedListHeader,
19967
+ getObjectRelatedListsMiniSchema: getObjectRelatedListsMiniSchema,
19524
19968
  getPage: getPage,
19525
19969
  getRecord: getRecord,
19526
19970
  getRecordDetailHeaderSchema: getRecordDetailHeaderSchema,
19971
+ getRecordDetailMiniSchema: getRecordDetailMiniSchema,
19527
19972
  getRecordDetailRelatedListSchema: getRecordDetailRelatedListSchema,
19528
19973
  getRecordDetailSchema: getRecordDetailSchema,
19529
19974
  getRecordPageInitSchema: getRecordPageInitSchema,
@@ -19705,7 +20150,7 @@ var AmisObjectFieldLookup = function (props) {
19705
20150
  };
19706
20151
 
19707
20152
  var AmisObjectButton = function (props) {
19708
- // console.log(`AmisObjectButton`, props)
20153
+ // console.log(`AmisObjectButton=====》`, props)
19709
20154
  var objectName = props.objectName, name = props.name, data = props.data, render = props.render, className = props.className, listViewId = props.listViewId;
19710
20155
  var _a = __read(React.useState(), 2), button = _a[0], setButton = _a[1];
19711
20156
  var _b = __read(React.useState(), 2), uiSchema = _b[0], setUiSchema = _b[1];
@@ -19982,11 +20427,11 @@ var SteedosSkeleton = function (props) {
19982
20427
  };
19983
20428
 
19984
20429
  var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
19985
- var $schema, recordId, defaultData, mode, layout, labelAlign, appId, fieldsExtend, _a, excludedFields, _b, fields, _c, form, _d, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, submitSuccActions, data, formDataFilter, onFormDataFilter, env, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, allData, schema, schema, formData, fieldsArray, excludedFieldsArray, InitApiResendOn;
19986
- return __generator(this, function (_e) {
19987
- switch (_e.label) {
20430
+ var $schema, recordId, defaultData, mode, _a, layout, labelAlign, appId, fieldsExtend, _b, excludedFields, _c, fields, _d, form, _e, className, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, submitSuccActions, data, formDataFilter, onFormDataFilter, env, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, allData, schema, schema, formData, fieldsArray, excludedFieldsArray, InitApiResendOn;
20431
+ return __generator(this, function (_f) {
20432
+ switch (_f.label) {
19988
20433
  case 0:
19989
- $schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, layout = props.layout, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _a = props.excludedFields, excludedFields = _a === void 0 ? null : _a, _b = props.fields, fields = _b === void 0 ? null : _b, _c = props.form, form = _c === void 0 ? {} : _c, _d = props.className, className = _d === void 0 ? "" : _d, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode, submitSuccActions = props.submitSuccActions, data = props.data, formDataFilter = props.formDataFilter, onFormDataFilter = props.onFormDataFilter, env = props.env;
20434
+ $schema = props.$schema, recordId = props.recordId, defaultData = props.defaultData, mode = props.mode, _a = props.layout, layout = _a === void 0 ? "horizontal" : _a, labelAlign = props.labelAlign, appId = props.appId, fieldsExtend = props.fieldsExtend, _b = props.excludedFields, excludedFields = _b === void 0 ? null : _b, _c = props.fields, fields = _c === void 0 ? null : _c, _d = props.form, form = _d === void 0 ? {} : _d, _e = props.className, className = _e === void 0 ? "" : _e, initApiRequestAdaptor = props.initApiRequestAdaptor, initApiAdaptor = props.initApiAdaptor, apiRequestAdaptor = props.apiRequestAdaptor, apiAdaptor = props.apiAdaptor, enableTabs = props.enableTabs, tabsMode = props.tabsMode, submitSuccActions = props.submitSuccActions, data = props.data, formDataFilter = props.formDataFilter, onFormDataFilter = props.onFormDataFilter, env = props.env;
19990
20435
  objectApiName = props.objectApiName || "space_users";
19991
20436
  schemaKeys = _$1.difference(_$1.keys($schema), ["id", "form", "type", "mode", "layout", "defaultData", "formDataFilter", "onFormDataFilter", "env"]);
19992
20437
  formSchema = _$1.pick(props, schemaKeys);
@@ -20033,7 +20478,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
20033
20478
  env: env
20034
20479
  }))];
20035
20480
  case 1:
20036
- schema = _e.sent();
20481
+ schema = _f.sent();
20037
20482
  amisSchema = schema.amisSchema;
20038
20483
  uiSchema = schema.uiSchema;
20039
20484
  return [3 /*break*/, 4];
@@ -20052,10 +20497,10 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
20052
20497
  env: env
20053
20498
  }))];
20054
20499
  case 3:
20055
- schema = _e.sent();
20500
+ schema = _f.sent();
20056
20501
  amisSchema = schema.amisSchema;
20057
20502
  uiSchema = schema.uiSchema;
20058
- _e.label = 4;
20503
+ _f.label = 4;
20059
20504
  case 4:
20060
20505
  formData = {};
20061
20506
  // formData.recordId = recordId || null;
@@ -20066,7 +20511,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
20066
20511
  formData.recordId = props.recordId;
20067
20512
  }
20068
20513
  amisSchema.className = "steedos-object-form ".concat(className);
20069
- amisSchema.data = Object.assign(amisSchema.data, formData, { global: globalData, uiSchema: uiSchema });
20514
+ // console.log('AmisObjectForm amisSchema======>', amisSchema)
20515
+ amisSchema.data = Object.assign({}, amisSchema.data || {}, formData, { global: globalData, uiSchema: uiSchema });
20070
20516
  if (_$1.has(props, 'objectApiName')) {
20071
20517
  amisSchema.data.objectName = objectApiName;
20072
20518
  }
@@ -20245,7 +20691,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20245
20691
  {
20246
20692
  "type": "service",
20247
20693
  "id": "service_schema_api_" + objectApiName,
20248
- "className": " steedos-object-listview-content grow",
20694
+ "className": " steedos-object-listview-content md:overflow-auto grow",
20249
20695
  "schemaApi": {
20250
20696
  // 这里url上加objectApiName属性是因为设计器中切换对象时不会变更列表视图界面,不可以用objectName=${objectName}使用作用域中objectName变量是因为设计器那边不会监听识别data变化来render组件
20251
20697
  "url": "${context.rootUrl}/graphql?objectName=" + objectApiName + "&listName=${listName}&display=${display}&rebuildOn=" + rebuildOn,
@@ -20255,7 +20701,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
20255
20701
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20256
20702
  },
20257
20703
  "requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
20258
- "adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n console.log(\"payload================>\", payload)\n resolve(payload)\n });\n });\n ")
20704
+ "adaptor": "\n // console.log('service listview schemaApi adaptor....', api.body); \n let { appId, objectName, defaultListName: listName, display, formFactor: defaultFormFactor, uiSchema} = api.body;\n if(api.body.listName){\n listName = api.body.listName;\n }\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n listViewSchemaProps.displayAs = display;\n // console.log(\"====listViewSchemaProps===>\", listName, display, listViewSchemaProps)\n const crud_mode = listView.crud_mode;\n if(crud_mode){\n if(!listViewSchemaProps.defaults.listSchema.mode){\n // \u8FD9\u91CC\u4F18\u5148\u8BA4\u5FAE\u9875\u9762\u4E2D\u4E3A\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\uFF0C\n // \u53EA\u6709\u7EC4\u4EF6\u4E2D\u672A\u914D\u7F6E\u8BE5\u5C5E\u6027\u65F6\u624D\u53D6\u5143\u6570\u636E\u4E2D\u4E3A\u5F53\u524D\u5217\u8868\u89C6\u56FE\u914D\u7F6E\u7684crud_mode\u5C5E\u6027\u4F5C\u4E3Acrud\u7684mode\u503C\n // \u4E0D\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u662F\u56E0\u4E3A\u5728\u754C\u9762\u4E0A\u65B0\u5EFA\u7F16\u8F91\u5217\u8868\u89C6\u56FE\u65F6\uFF0Ccrud_mode\u5B57\u6BB5\u503C\u9ED8\u8BA4\u503C\u662Ftable\uFF0C\u8FD9\u4F1A\u8BA9\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u4E2D\u914D\u7F6E\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u4E0D\u751F\u6548\n // \u5982\u679C\u60F3\u4F18\u5148\u8BA4\u5404\u4E2A\u5217\u8868\u89C6\u56FE\u5143\u6570\u636E\u4E2D\u7684\u914D\u7F6E\uFF0C\u53EA\u8981\u628A\u5FAE\u9875\u9762\u4E2D\u5217\u8868\u89C6\u56FE\u7EC4\u4EF6\u7684crudMode\u53CAcrud.mode\u5C5E\u6027\u503C\u6E05\u9664\u5373\u53EF\n listViewSchemaProps.defaults.listSchema.mode = crud_mode;\n }\n }\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n try{\n const uiSchema = schema.uiSchema;\n const listView = _.find(\n uiSchema.list_views,\n (listView, name) => {\n // \u4F20\u5165listViewName\u7A7A\u503C\u5219\u53D6\u7B2C\u4E00\u4E2A\n if(!listName){\n listName = name;\n }\n return name === listName || listView._id === listName;\n }\n );\n if(listView){\n window.Steedos && window.Steedos.setDocumentTitle && window.Steedos.setDocumentTitle({pageName: listView.label || listView.name})\n }\n }catch(e){\n console.error(e)\n }\n payload.data = schema.amisSchema;\n resolve(payload)\n });\n });\n ")
20259
20705
  },
20260
20706
  // "body": body,
20261
20707
  // "data": serviceData
@@ -20413,34 +20859,18 @@ var AmisObjectCalendar = function (props) { return __awaiter(void 0, void 0, voi
20413
20859
  }); };
20414
20860
 
20415
20861
  var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20416
- var _a, className, schemaFilter, objectUiSchema, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
20862
+ var _a, className, schemaFilter, showButtons, showBackButton, defaultOnEvent, recordId, _b, onEvent, _c, showRecordTitle, objectApiName, schema, config, schemaFilterFun, _config, e_1;
20417
20863
  return __generator(this, function (_d) {
20418
20864
  switch (_d.label) {
20419
20865
  case 0:
20420
- _a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 bg-gray-100 border-b sm:rounded sm:border border-gray-300 p-4' : _a, schemaFilter = props.schemaFilter;
20866
+ _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;
20421
20867
  return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
20422
20868
  case 1:
20423
- objectUiSchema = _d.sent();
20424
- defaultOnEvent = {
20425
- "recordLoaded": {
20426
- "actions": [
20427
- {
20428
- "actionType": "reload",
20429
- "data": {
20430
- "name": "${event.data.record.".concat((objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.NAME_FIELD_KEY) || 'name', "}"),
20431
- "record": "${event.data.record}",
20432
- "_id": "\${event.data.record._id}",
20433
- "recordId": "\${event.data.record._id}",
20434
- "recordLoaded": true,
20435
- },
20436
- "expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
20437
- }
20438
- ]
20439
- }
20440
- };
20869
+ _d.sent();
20870
+ defaultOnEvent = {};
20441
20871
  props.$schema, recordId = props.recordId, _b = props.onEvent, onEvent = _b === void 0 ? defaultOnEvent : _b, _c = props.showRecordTitle, showRecordTitle = _c === void 0 ? true : _c;
20442
20872
  objectApiName = props.objectApiName || "space_users";
20443
- return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor })];
20873
+ return [4 /*yield*/, getRecordDetailHeaderSchema(objectApiName, recordId, { showRecordTitle: showRecordTitle, formFactor: props.data.formFactor, showButtons: showButtons, showBackButton: showBackButton, display: props.data.display })];
20444
20874
  case 2:
20445
20875
  schema = (_d.sent()).amisSchema;
20446
20876
  schema.className = className;
@@ -20459,18 +20889,20 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
20459
20889
  e_1 = _d.sent();
20460
20890
  console.warn(e_1);
20461
20891
  return [3 /*break*/, 6];
20462
- case 6: return [2 /*return*/, config];
20892
+ case 6:
20893
+ // console.log(`AmisRecordDetailHeader==>`, config)
20894
+ return [2 /*return*/, config];
20463
20895
  }
20464
20896
  });
20465
20897
  }); };
20466
20898
 
20467
20899
  var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20468
- var className, $schema, appId, _a, objectApiName, body, schema;
20900
+ var className, $schema, appId, _a, objectApiName, body, showButtons, showBackButton, schema;
20469
20901
  return __generator(this, function (_b) {
20470
20902
  switch (_b.label) {
20471
20903
  case 0:
20472
- className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body;
20473
- return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
20904
+ className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body, showButtons = props.showButtons, showBackButton = props.showBackButton;
20905
+ return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId, { showButtons: showButtons, showBackButton: showBackButton })];
20474
20906
  case 1:
20475
20907
  schema = (_b.sent()).amisSchema;
20476
20908
  // 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
@@ -20480,8 +20912,17 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
20480
20912
  // }
20481
20913
  // schema.data = Object.assign({}, schema.data, recordDetailData);
20482
20914
  if (_$1.has(props, "recordId") && $schema.recordId !== "${recordId}") {
20915
+ if (!schema.data) {
20916
+ schema.data = {};
20917
+ }
20483
20918
  schema.data.recordId = props.recordId;
20484
20919
  }
20920
+ if (_$1.has(props, "objectApiName") && props.objectApiName && $schema.objectApiName !== "${objectName}") {
20921
+ if (!schema.data) {
20922
+ schema.data = {};
20923
+ }
20924
+ schema.data.objectName = props.objectApiName;
20925
+ }
20485
20926
  schema.className = className;
20486
20927
  if (body) {
20487
20928
  schema.body = body;
@@ -20495,28 +20936,39 @@ var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void
20495
20936
  /*
20496
20937
  * @Author: baozhoutao@steedos.com
20497
20938
  * @Date: 2022-12-08 10:32:17
20498
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
20499
- * @LastEditTime: 2023-04-14 11:30:21
20939
+ * @LastEditors: baozhoutao@steedos.com
20940
+ * @LastEditTime: 2024-01-16 14:09:23
20500
20941
  * @Description:
20501
20942
  */
20502
20943
  var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20503
- var className, _a, objectApiName, body, style, schema;
20944
+ var className, $schema, appId, _a, objectApiName, body, style, recordId, options, schema;
20504
20945
  return __generator(this, function (_b) {
20505
20946
  switch (_b.label) {
20506
20947
  case 0:
20507
- className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.fields, body = props.body, style = props.style;
20508
- return [4 /*yield*/, getRecordServiceSchema(objectApiName)];
20948
+ className = props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.fields, body = props.body, style = props.style, props.onEvent, recordId = props.recordId;
20949
+ if (_$1.has($schema.data, "recordId") && $schema.data.recordId !== "${recordId}") {
20950
+ recordId = $schema.data.recordId;
20951
+ }
20952
+ if (_$1.has($schema.data, "objectName") && $schema.data.objectName !== "${objectName}") {
20953
+ objectApiName = $schema.data.objectName;
20954
+ }
20955
+ options = { onEvent: $schema.onEvent, data: $schema.data, recordId: recordId };
20956
+ if (props.$$editor) {
20957
+ options.isEditor = true;
20958
+ }
20959
+ return [4 /*yield*/, getRecordServiceSchema(objectApiName, appId, options, body)];
20509
20960
  case 1:
20510
20961
  schema = (_b.sent()).amisSchema;
20511
- if (body) {
20512
- schema.body = body;
20513
- }
20514
20962
  if (className) {
20515
20963
  schema.className = className;
20516
20964
  }
20517
20965
  if (style) {
20966
+ if (!schema.style) {
20967
+ schema.style = {};
20968
+ }
20518
20969
  Object.assign(schema.style, style);
20519
20970
  }
20971
+ // console.log(`AmisRecordService====schema==>`, schema)
20520
20972
  return [2 /*return*/, schema];
20521
20973
  }
20522
20974
  });
@@ -20573,7 +21025,7 @@ var AmisRecordDetailRelatedList = function (props) { return __awaiter(void 0, vo
20573
21025
  }); };
20574
21026
 
20575
21027
  var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20576
- var $schema, objectApiName, recordId, _a, perPage, relatedLists, staticRecordId;
21028
+ var $schema, objectApiName, recordId, _a, perPage, formFactor, relatedLists, staticRecordId;
20577
21029
  return __generator(this, function (_b) {
20578
21030
  switch (_b.label) {
20579
21031
  case 0:
@@ -20588,7 +21040,10 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
20588
21040
  "className": "mb-3"
20589
21041
  }];
20590
21042
  }
20591
- props.formFactor;
21043
+ formFactor = props.formFactor;
21044
+ if (!formFactor) {
21045
+ formFactor = window.innerWidth < 768 ? 'SMALL' : 'LARGE';
21046
+ }
20592
21047
  return [4 /*yield*/, getObjectRelatedList(objectApiName)];
20593
21048
  case 1:
20594
21049
  relatedLists = _b.sent();
@@ -20601,11 +21056,12 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
20601
21056
  "className": "mb-3"
20602
21057
  }];
20603
21058
  }
20604
- staticRecordId = '';
21059
+ staticRecordId = props.staticRecordId;
20605
21060
  // 在设计器中的设计状态,当上层有recordId具体值,相关表组件的$schema.recordId的默认值就是 "${recordId}"; 会导致获取不到 _master, 进而导致组件显示不了数据。
20606
21061
  if (_$1.has(props, "recordId") && ($schema.recordId !== "${recordId}" || (props.$$editor && props.recordId !== "${recordId}"))) {
20607
21062
  staticRecordId = recordId;
20608
21063
  }
21064
+ // console.log('relatedLists======>', relatedLists, staticRecordId)
20609
21065
  return [2 /*return*/, {
20610
21066
  type: 'service',
20611
21067
  className: "steedos-record-detail-related-lists",
@@ -20614,6 +21070,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
20614
21070
  type: 'steedos-object-related-listview',
20615
21071
  objectApiName: objectApiName,
20616
21072
  // recordId: recordId,
21073
+ formFactor: formFactor,
20617
21074
  relatedObjectApiName: item.object_name,
20618
21075
  foreign_key: item.foreign_key,
20619
21076
  relatedKey: item.foreign_key,
@@ -20628,6 +21085,7 @@ var AmisRecordDetailRelatedLists = function (props) { return __awaiter(void 0, v
20628
21085
  if (staticRecordId) {
20629
21086
  relatedList.recordId = staticRecordId;
20630
21087
  }
21088
+ // console.log('relatedList=====>', relatedList)
20631
21089
  return relatedList;
20632
21090
  })
20633
21091
  }];
@@ -21140,7 +21598,7 @@ var AmisGlobalFooter = function (props) { return __awaiter(void 0, void 0, void
21140
21598
  * @Author: baozhoutao@steedos.com
21141
21599
  * @Date: 2022-09-01 14:44:57
21142
21600
  * @LastEditors: baozhoutao@steedos.com
21143
- * @LastEditTime: 2023-09-08 17:54:54
21601
+ * @LastEditTime: 2024-01-19 17:12:48
21144
21602
  * @Description:
21145
21603
  */
21146
21604
  var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0, void 0, function () {
@@ -21452,6 +21910,26 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
21452
21910
  }
21453
21911
  ]
21454
21912
  },
21913
+ {
21914
+ "type": "button",
21915
+ "label": "切换工作区",
21916
+ "className": "flex",
21917
+ "onEvent": {
21918
+ "click": {
21919
+ "actions": [
21920
+ {
21921
+ "args": {
21922
+ "url": "/accounts/a/#/select-space",
21923
+ "blank": false
21924
+ },
21925
+ "actionType": "url"
21926
+ }
21927
+ ]
21928
+ }
21929
+ },
21930
+ "level": "link",
21931
+ "visibleOn": "${window:Meteor.settings.public.enable_saas}"
21932
+ },
21455
21933
  {
21456
21934
  "type": "button",
21457
21935
  "label": instance.t('frontend_profile'),
@@ -21522,14 +22000,14 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
21522
22000
  /*
21523
22001
  * @Author: baozhoutao@steedos.com
21524
22002
  * @Date: 2022-09-01 14:44:57
21525
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
21526
- * @LastEditTime: 2024-01-04 09:24:11
22003
+ * @LastEditors: baozhoutao@steedos.com
22004
+ * @LastEditTime: 2024-01-16 13:45:42
21527
22005
  * @Description:
21528
22006
  */
21529
22007
  var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
21530
- var logoSrc, isMobile, schema;
22008
+ var logoSrc, customButtons, isMobile, schema;
21531
22009
  return __generator(this, function (_a) {
21532
- logoSrc = props.logoSrc;
22010
+ logoSrc = props.logoSrc, customButtons = props.customButtons;
21533
22011
  isMobile = window.innerWidth <= 768;
21534
22012
  schema = {
21535
22013
  "type": "wrapper",
@@ -21620,39 +22098,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
21620
22098
  "label": "Global Header",
21621
22099
  className: 'flex flex-nowrap gap-x-3 items-center',
21622
22100
  logoutScript: "window.signOut();",
21623
- customButtons: [
21624
- {
21625
- "type": "button",
21626
- "className": "toggle-sidebar",
21627
- "visibleOn": "${AND(app.showSidebar,!" + isMobile + ")}",
21628
- "onEvent": {
21629
- "click": {
21630
- "actions": [
21631
- {
21632
- "actionType": "custom",
21633
- "script": "document.body.classList.toggle('sidebar-open')",
21634
- }
21635
- ]
21636
- }
21637
- },
21638
- "body": [
21639
- {
21640
- "type": "steedos-icon",
21641
- "category": "utility",
21642
- "name": "rows",
21643
- "colorVariant": "default",
21644
- "id": "u:afc3a08e8cf3",
21645
- "className": "slds-button_icon slds-global-header__icon"
21646
- }
21647
- ],
21648
- },
21649
- {
21650
- "type": "steedos-app-launcher",
21651
- "showAppName": false,
21652
- "appId": "${app.id}",
21653
- "visibleOn": "${isMobile}"
21654
- }
21655
- ]
22101
+ customButtons: customButtons
21656
22102
  }
21657
22103
  ],
21658
22104
  },
@@ -21768,13 +22214,13 @@ function getAmisStaticFieldType(type, data_type, options) {
21768
22214
  return "switch";
21769
22215
  }
21770
22216
  else if (type === 'currency') {
21771
- return "number";
22217
+ return "input-number";
21772
22218
  }
21773
22219
  else if (type === 'autonumber') {
21774
22220
  return "input-text"; //不可以用text,因为会出现字段label显示不出来的问题
21775
22221
  }
21776
22222
  else if (type === 'percent') {
21777
- return "number";
22223
+ return "input-number";
21778
22224
  }
21779
22225
  else if (type === 'formula' || type === 'summary') {
21780
22226
  return getAmisStaticFieldType(data_type, null, options);
@@ -21791,14 +22237,14 @@ function getAmisStaticFieldType(type, data_type, options) {
21791
22237
  return type;
21792
22238
  }
21793
22239
  var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
21794
- var steedosField, field, _a, readonly, _b, ctx, config, fStatic, env, inInputTable, defaultSource, source, fieldBaseProps, tpl_1, res, valueOptions, fieldValue_1, reference_to_field_1, schema, fieldSchema, fieldValue, hasImageOrFile_1, fieldHtml_1, schema, tableFields, _c, _d, subField, subFieldName, fieldAmis, schema, error_1;
21795
- var e_1, _e;
21796
- var _f, _g, _h, _j, _k;
21797
- return __generator(this, function (_l) {
21798
- switch (_l.label) {
22240
+ 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;
22241
+ var _e, e_1, _f;
22242
+ var _g, _h, _j, _k, _l;
22243
+ return __generator(this, function (_m) {
22244
+ switch (_m.label) {
21799
22245
  case 0:
21800
22246
  steedosField = null;
21801
- 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;
22247
+ 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;
21802
22248
  // console.log(`AmisSteedosField`, props)
21803
22249
  // if($schema.config && isString($schema.config)){
21804
22250
  // $schema.config = JSON.parse($schema.config)
@@ -21826,14 +22272,14 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21826
22272
  // 字段配置为只读,强制走fStatic模式,加上_display判断是为了不影响历史代码,比如直接在ObjectForm中调用steedos-field组件
21827
22273
  fStatic = true;
21828
22274
  }
21829
- _l.label = 1;
22275
+ _m.label = 1;
21830
22276
  case 1:
21831
- _l.trys.push([1, 21, , 22]);
21832
- if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 5];
22277
+ _m.trys.push([1, 24, , 25]);
22278
+ if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 7];
21833
22279
  defaultSource = {
21834
22280
  "method": "post",
21835
22281
  "url": "${context.rootUrl}/graphql",
21836
- "requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + '}}'\n }\n return api;\n "),
22282
+ "requestAdaptor": "\n var steedosField = ".concat(JSON.stringify(steedosField), ";\n // console.log('defaultSource====>steedosField', steedosField);\n var objectName, filters, valueFieldKey, labelFieldKey;\n if(_.isString(steedosField.reference_to)){\n // reference_to\u4E3A\u5355\u9009\n const referenceTo = getReferenceToSync(steedosField);\n const referenceToField = steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = _.get(api.data, steedosField.name);\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\" || objectName == \"object_actions\"){\n //\u5BF9\u8C61\u4E3Aobject_fields\u65F6\uFF0C\u5FC5\u987B\u52A0\u4E0Aobject\u7684\u8FC7\u6EE4\u6761\u4EF6\n const filtersFunction = ").concat(steedosField.filtersFunction || steedosField._filtersFunction, ";\n if(filtersFunction){\n const _filters = filtersFunction(filters, api.data);\n if(_filters && _filters.length > 0){\n filters = [filters,_filters]\n }\n }\n }\n }else{\n // reference_to\u4E3A\u591A\u9009\n const _steedosField = {\n ...steedosField,\n reference_to: api.data[steedosField.name].o\n }\n const referenceTo = getReferenceToSync(_steedosField);\n const referenceToField = _steedosField.reference_to_field || '_id';\n\n objectName = referenceTo.objectName\n valueFieldKey = referenceTo && referenceTo.valueField?.name || '_id' ;\n labelFieldKey = referenceTo && referenceTo.labelField?.name || 'name';\n let value = api.data[_steedosField.name] && api.data[_steedosField.name].ids;\n filters = [referenceToField, \"in\", value || []];\n }\n\n // \u989D\u5916\u8FD4\u56DE_id\u5B57\u6BB5\n api.data = {\n query: '{options:' + objectName + '(filters: ' + JSON.stringify(filters) + '){label: ' + labelFieldKey + ',value: ' + valueFieldKey + ', _id}}'\n }\n return api;\n "),
21837
22283
  "trackExpression": "${" + steedosField.name + "}",
21838
22284
  "cache": 3000
21839
22285
  };
@@ -21850,50 +22296,168 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21850
22296
  defaultSource.adaptor = "\n var options = ".concat(JSON.stringify(steedosField.options), "\n if(api.body.$term){\n options = _.filter(options, function(o) {\n var label = o.label;\n return label.toLowerCase().indexOf(api.body.$term.toLowerCase()) > -1;\n });\n }\n if(!payload.data){\n payload.data = {};\n }\n payload.data.options = options;\n return payload;\n ");
21851
22297
  }
21852
22298
  }
21853
- source = ((_f = steedosField.amis) === null || _f === void 0 ? void 0 : _f.source) || ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.autoComplete) || defaultSource;
22299
+ source = ((_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.source) || ((_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.autoComplete) || defaultSource;
21854
22300
  fieldBaseProps = {
21855
22301
  multiple: steedosField.multiple,
21856
22302
  name: steedosField.name,
21857
22303
  label: steedosField.label,
21858
22304
  static: true,
21859
- className: (_h = steedosField.amis) === null || _h === void 0 ? void 0 : _h.className
22305
+ className: "".concat(className || '', " ").concat(((_j = steedosField.amis) === null || _j === void 0 ? void 0 : _j.className) || '')
21860
22306
  };
21861
22307
  if (!inInputTable) return [3 /*break*/, 2];
21862
22308
  fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'select', source: source });
21863
- return [3 /*break*/, 4];
22309
+ return [3 /*break*/, 6];
21864
22310
  case 2:
21865
- tpl_1 = '';
21866
- return [4 /*yield*/, env.fetcher(source, props.data)];
22311
+ referenceTo_1 = steedosField.reference_to;
22312
+ if (!referenceTo_1) return [3 /*break*/, 6];
22313
+ steedosField.reference_to_field;
22314
+ if (referenceTo_1 === 'users') {
22315
+ referenceTo_1 = 'space_users';
22316
+ }
22317
+ return [4 /*yield*/, getUISchema(referenceTo_1)];
21867
22318
  case 3:
21868
- res = _l.sent();
21869
- valueOptions = ((_j = res === null || res === void 0 ? void 0 : res.data) === null || _j === void 0 ? void 0 : _j.options) || [];
21870
- fieldValue_1 = (_k = props.data) === null || _k === void 0 ? void 0 : _k[steedosField.name];
21871
- if (fieldValue_1 && fieldValue_1.length && valueOptions && valueOptions.length) {
21872
- reference_to_field_1 = steedosField.reference_to_field;
21873
- _$1.forEach(valueOptions, function (item, index) {
21874
- var label = item.label, value = item.value;
21875
- if (fieldValue_1.indexOf(value) > -1) {
21876
- // 因为lookup、master_detail字段配置了reference_to_field != _id的情况下,source中返回的值不能当作链接的后缀值,所以移除字段链接。
21877
- var optionTpl = "<a href=\"/app/-/".concat(steedosField.reference_to, "/view/").concat(value, "\" >").concat(label, "</a>");
21878
- if (reference_to_field_1 && reference_to_field_1 != '_id') {
21879
- optionTpl = "".concat(label);
21880
- }
21881
- tpl_1 += tpl_1 ? ',' + optionTpl : optionTpl;
22319
+ fieldRefObject = _m.sent();
22320
+ if (!(props.data._display && _$1.has(props.data._display, steedosField.name))) return [3 /*break*/, 4];
22321
+ disPlayValue = props.data._display[steedosField.name];
22322
+ if (disPlayValue) {
22323
+ if (!_$1.isArray(disPlayValue) && _$1.isObject(disPlayValue)) {
22324
+ disPlayValue = [disPlayValue];
22325
+ }
22326
+ fieldBaseProps = Object.assign({}, fieldBaseProps, {
22327
+ type: 'control',
22328
+ name: null,
22329
+ body: {
22330
+ type: 'wrapper',
22331
+ className: "steedos-field-lookup-wrapper p-0",
22332
+ "wrapWithPanel": false,
22333
+ "actions": [],
22334
+ body: [
22335
+ {
22336
+ type: 'each',
22337
+ className: "steedos-field-lookup-each flex flex-wrap gap-2",
22338
+ source: "${_display.".concat(steedosField.name, "|asArray}"),
22339
+ items: {
22340
+ type: 'static',
22341
+ labelClassName: "hidden",
22342
+ label: false,
22343
+ className: 'm-0',
22344
+ tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
22345
+ popOver: fieldRefObject.compactLayouts ? {
22346
+ "trigger": "hover",
22347
+ "className": "steedos-record-detail-popover",
22348
+ "position": "left-bottom",
22349
+ "showIcon": false,
22350
+ "title": false,
22351
+ "offset": {
22352
+ "top": 0,
22353
+ "left": 20
22354
+ },
22355
+ "body": [
22356
+ {
22357
+ "type": "steedos-record-mini",
22358
+ "objectApiName": "${objectName}",
22359
+ "recordId": "${value}",
22360
+ "showButtons": false,
22361
+ "showBackButton": false,
22362
+ "data": {
22363
+ "objectName": "${objectName}",
22364
+ "recordId": "${value}"
22365
+ }
22366
+ }
22367
+ ]
22368
+ } : null
22369
+ }
22370
+ }
22371
+ ]
21882
22372
  }
21883
22373
  });
21884
22374
  }
21885
- fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: tpl_1 });
21886
- _l.label = 4;
21887
- case 4:
22375
+ else {
22376
+ fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
22377
+ }
22378
+ return [3 /*break*/, 6];
22379
+ case 4: return [4 /*yield*/, env.fetcher(source, props.data)];
22380
+ case 5:
22381
+ res = _m.sent();
22382
+ valueOptions_1 = ((_k = res === null || res === void 0 ? void 0 : res.data) === null || _k === void 0 ? void 0 : _k.options) || [];
22383
+ fieldValue = (_l = props.data) === null || _l === void 0 ? void 0 : _l[steedosField.name];
22384
+ values = fieldValue;
22385
+ if (_$1.isString(values)) {
22386
+ values = [values];
22387
+ }
22388
+ if (values && values.length > 0) {
22389
+ disPlayValue_1 = [];
22390
+ _$1.each(values, function (value) {
22391
+ var option = valueOptions_1.find(function (item) { return item.value === value; });
22392
+ if (option) {
22393
+ disPlayValue_1.push({
22394
+ objectName: referenceTo_1,
22395
+ value: option._id || option.value,
22396
+ label: option.label
22397
+ });
22398
+ }
22399
+ });
22400
+ fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'control', name: null, body: {
22401
+ type: 'form',
22402
+ className: "steedos-field-lookup-wrapper p-0",
22403
+ "wrapWithPanel": false,
22404
+ "actions": [],
22405
+ data: (_e = {},
22406
+ _e[steedosField.name] = disPlayValue_1,
22407
+ _e),
22408
+ body: [
22409
+ {
22410
+ type: 'each',
22411
+ className: "steedos-field-lookup-each flex flex-wrap gap-2",
22412
+ source: "${".concat(steedosField.name, "}"),
22413
+ items: {
22414
+ type: 'static',
22415
+ className: 'm-0',
22416
+ tpl: "<a href=\"/app/-/${objectName}/view/${value}\" target=\"_blank\">${label}</a>",
22417
+ popOver: fieldRefObject.compactLayouts ? {
22418
+ "trigger": "hover",
22419
+ "className": "steedos-record-detail-popover",
22420
+ "position": "left-bottom",
22421
+ "showIcon": false,
22422
+ "title": false,
22423
+ "offset": {
22424
+ "top": 0,
22425
+ "left": 20
22426
+ },
22427
+ "body": [
22428
+ {
22429
+ "type": "steedos-record-mini",
22430
+ "objectApiName": "${objectName}",
22431
+ "recordId": "${value}",
22432
+ "showButtons": false,
22433
+ "showBackButton": false,
22434
+ "data": {
22435
+ "objectName": "${objectName}",
22436
+ "recordId": "${value}"
22437
+ }
22438
+ }
22439
+ ]
22440
+ } : null
22441
+ }
22442
+ }
22443
+ ]
22444
+ } });
22445
+ }
22446
+ else {
22447
+ fieldBaseProps = Object.assign({}, fieldBaseProps, { type: 'static', tpl: '-', className: "".concat(fieldBaseProps.className || '', " text-muted") });
22448
+ }
22449
+ _m.label = 6;
22450
+ case 6:
21888
22451
  schema = Object.assign({}, fieldBaseProps, _$1.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
21889
22452
  schema.placeholder = "";
22453
+ // console.log(`steedos field [lookup] schema:`, schema)
21890
22454
  return [2 /*return*/, schema];
21891
- case 5:
21892
- if (!fStatic) return [3 /*break*/, 18];
21893
- if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 7];
22455
+ case 7:
22456
+ if (!fStatic) return [3 /*break*/, 21];
22457
+ if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 9];
21894
22458
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
21895
- case 6:
21896
- fieldSchema = _l.sent();
22459
+ case 8:
22460
+ fieldSchema = _m.sent();
21897
22461
  if (steedosField.type === 'file' && fieldSchema.disabled) {
21898
22462
  fieldValue = fieldSchema.value;
21899
22463
  if (fieldValue && fieldValue.length) {
@@ -21929,59 +22493,59 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21929
22493
  }
21930
22494
  }
21931
22495
  return [2 /*return*/, fieldSchema];
21932
- case 7:
22496
+ case 9:
21933
22497
  schema = Object.assign({}, steedosField, {
21934
22498
  type: getAmisStaticFieldType(steedosField.type, steedosField.data_type, steedosField),
21935
22499
  static: true,
21936
22500
  label: steedosField.label
21937
22501
  });
21938
- if (!(steedosField.type === "time")) return [3 /*break*/, 8];
22502
+ if (!(steedosField.type === "time")) return [3 /*break*/, 10];
21939
22503
  Object.assign(schema, {
21940
22504
  inputFormat: 'HH:mm',
21941
22505
  timeFormat: 'HH:mm',
21942
22506
  format: '1970-01-01THH:mm:00.000[Z]',
21943
22507
  });
21944
- return [3 /*break*/, 17];
21945
- case 8:
21946
- if (!(steedosField.type === "percent")) return [3 /*break*/, 9];
22508
+ return [3 /*break*/, 20];
22509
+ case 10:
22510
+ if (!(steedosField.type === "percent")) return [3 /*break*/, 11];
21947
22511
  Object.assign(schema, {
21948
22512
  "percent": steedosField.scale ? steedosField.scale : true
21949
22513
  });
21950
- return [3 /*break*/, 17];
21951
- case 9:
21952
- if (!(steedosField.type === "password")) return [3 /*break*/, 10];
22514
+ return [3 /*break*/, 20];
22515
+ case 11:
22516
+ if (!(steedosField.type === "password")) return [3 /*break*/, 12];
21953
22517
  Object.assign(schema, {
21954
22518
  "revealPassword": false //没生效,需要用样式隐藏
21955
22519
  });
21956
- return [3 /*break*/, 17];
21957
- case 10:
21958
- if (!(steedosField.type === "select")) return [3 /*break*/, 11];
22520
+ return [3 /*break*/, 20];
22521
+ case 12:
22522
+ if (!(steedosField.type === "select")) return [3 /*break*/, 13];
21959
22523
  Object.assign(schema, {
21960
22524
  "placeholder": ""
21961
22525
  });
21962
- return [3 /*break*/, 17];
21963
- case 11:
21964
- if (!(steedosField.type === "color")) return [3 /*break*/, 12];
22526
+ return [3 /*break*/, 20];
22527
+ case 13:
22528
+ if (!(steedosField.type === "color")) return [3 /*break*/, 14];
21965
22529
  Object.assign(schema, {
21966
22530
  "defaultColor": null
21967
22531
  });
21968
- return [3 /*break*/, 17];
21969
- case 12:
21970
- if (!(steedosField.type === "number")) return [3 /*break*/, 13];
22532
+ return [3 /*break*/, 20];
22533
+ case 14:
22534
+ if (!(steedosField.type === "number" || steedosField.type === 'currency')) return [3 /*break*/, 15];
21971
22535
  // amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
21972
22536
  Object.assign(schema, {
21973
22537
  "precision": steedosField.scale || 0
21974
22538
  });
21975
- return [3 /*break*/, 17];
21976
- case 13:
21977
- if (!(steedosField.type === "table")) return [3 /*break*/, 14];
22539
+ return [3 /*break*/, 20];
22540
+ case 15:
22541
+ if (!(steedosField.type === "table")) return [3 /*break*/, 16];
21978
22542
  if (steedosField.subFields) {
21979
22543
  tableFields = [];
21980
22544
  try {
21981
- for (_c = __values(field.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
22545
+ for (_c = __values(steedosField.subFields), _d = _c.next(); !_d.done; _d = _c.next()) {
21982
22546
  subField = _d.value;
21983
22547
  if (!subField.name.endsWith(".$")) {
21984
- subFieldName = subField.name.replace("".concat(field._prefix || '').concat(field.name, ".$."), '').replace("".concat(field.name, "."), '');
22548
+ subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
21985
22549
  // const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
21986
22550
  tableFields.push(Object.assign({}, subField, { name: subFieldName }));
21987
22551
  }
@@ -21990,13 +22554,12 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21990
22554
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
21991
22555
  finally {
21992
22556
  try {
21993
- if (_d && !_d.done && (_e = _c.return)) _e.call(_c);
22557
+ if (_d && !_d.done && (_f = _c.return)) _f.call(_c);
21994
22558
  }
21995
22559
  finally { if (e_1) throw e_1.error; }
21996
22560
  }
21997
22561
  Object.assign(schema, {
21998
22562
  type: 'steedos-input-table',
21999
- showIndex: true,
22000
22563
  editable: false,
22001
22564
  addable: false,
22002
22565
  removable: false,
@@ -22007,9 +22570,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22007
22570
  }
22008
22571
  });
22009
22572
  }
22010
- return [3 /*break*/, 17];
22011
- case 14:
22012
- if (!(steedosField.type === "image")) return [3 /*break*/, 15];
22573
+ return [3 /*break*/, 20];
22574
+ case 16:
22575
+ if (!(steedosField.type === "image")) return [3 /*break*/, 17];
22013
22576
  Object.assign(schema, {
22014
22577
  enlargeAble: true,
22015
22578
  showToolbar: true,
@@ -22040,18 +22603,27 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22040
22603
  return value;
22041
22604
  }
22042
22605
  });
22043
- return [3 /*break*/, 17];
22044
- case 15:
22045
- if (!(steedosField.type === "file")) return [3 /*break*/, 17];
22606
+ return [3 /*break*/, 20];
22607
+ case 17:
22608
+ if (!(steedosField.type === "file")) return [3 /*break*/, 19];
22046
22609
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22047
- case 16:
22610
+ case 18:
22048
22611
  // 附件static模式先保持原来的逻辑,依赖_display,审批王中相关功能在creator中
22049
22612
  // convertSFieldToAmisField中会合并steedosField.amis,所以也不需要再次合并steedosField.amis,直接return就好
22050
- return [2 /*return*/, _l.sent()];
22051
- case 17:
22613
+ return [2 /*return*/, _m.sent()];
22614
+ case 19:
22615
+ if (steedosField.type === 'formula' || steedosField.type === 'summary') {
22616
+ if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
22617
+ Object.assign(schema, {
22618
+ "precision": steedosField.scale || 0
22619
+ });
22620
+ }
22621
+ }
22622
+ _m.label = 20;
22623
+ case 20:
22052
22624
  Object.assign(schema, steedosField.amis || {});
22053
22625
  return [2 /*return*/, schema];
22054
- case 18:
22626
+ case 21:
22055
22627
  fieldAmis = steedosField.amis || {};
22056
22628
  if (!props.data.hasOwnProperty("_display")) {
22057
22629
  // 有_display时保持原来的逻辑不变,不走以下新的逻辑,审批王中会特意传入_display以跳过后面新加的代码
@@ -22109,16 +22681,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
22109
22681
  }
22110
22682
  }
22111
22683
  return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
22112
- case 19:
22113
- schema = _l.sent();
22684
+ case 22:
22685
+ schema = _m.sent();
22114
22686
  // console.log(`AmisSteedosField return schema`, schema)
22115
22687
  return [2 /*return*/, schema];
22116
- case 20: return [3 /*break*/, 22];
22117
- case 21:
22118
- error_1 = _l.sent();
22688
+ case 23: return [3 /*break*/, 25];
22689
+ case 24:
22690
+ error_1 = _m.sent();
22119
22691
  console.log("error", error_1);
22120
- return [3 /*break*/, 22];
22121
- case 22: return [2 /*return*/, null];
22692
+ return [3 /*break*/, 25];
22693
+ case 25: return [2 /*return*/, null];
22122
22694
  }
22123
22695
  });
22124
22696
  }); };
@@ -22361,7 +22933,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
22361
22933
  return __generator(this, function (_a) {
22362
22934
  switch (_a.label) {
22363
22935
  case 0:
22364
- 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;
22936
+ 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;
22365
22937
  return [4 /*yield*/, getAmisInputTableSchema(props)];
22366
22938
  case 1:
22367
22939
  amisSchema = _a.sent();
@@ -22371,6 +22943,46 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
22371
22943
  });
22372
22944
  }); };
22373
22945
 
22946
+ var AmisRecordDetailMini = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22947
+ var $schema, appId, _a, objectApiName, recordId, schemaData, options, schema;
22948
+ return __generator(this, function (_b) {
22949
+ switch (_b.label) {
22950
+ case 0:
22951
+ props.className, $schema = props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.fields, props.body, props.style, props.onEvent, recordId = props.recordId;
22952
+ schemaData = {};
22953
+ if (_$1.has(props.data, "recordId") && props.data.recordId !== "${recordId}") {
22954
+ recordId = props.data.recordId;
22955
+ schemaData.recordId = recordId;
22956
+ }
22957
+ if (_$1.has(props.data, "value")) {
22958
+ recordId = props.data.value;
22959
+ schemaData.recordId = recordId;
22960
+ }
22961
+ if (_$1.has(props.data, "objectName") && props.data.objectName !== "${objectName}") {
22962
+ objectApiName = props.data.objectName;
22963
+ schemaData.objectName = objectApiName;
22964
+ }
22965
+ options = {
22966
+ onEvent: $schema.onEvent,
22967
+ data: $schema.data,
22968
+ recordId: recordId
22969
+ };
22970
+ if (props.$$editor) {
22971
+ options.isEditor = true;
22972
+ }
22973
+ console.log("AmisRecordDetailMini==2=>", objectApiName, options);
22974
+ return [4 /*yield*/, getRecordDetailMiniSchema(objectApiName, appId, options)];
22975
+ case 1:
22976
+ schema = _b.sent();
22977
+ if (!_$1.isEmpty(schemaData)) {
22978
+ schema.data = schemaData;
22979
+ }
22980
+ // console.log(`AmisRecordDetailMini===>`, schema)
22981
+ return [2 /*return*/, schema];
22982
+ }
22983
+ });
22984
+ }); };
22985
+
22374
22986
  var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
22375
22987
  var formFactor, appId, objectApiName, display, data, _display, page, listSchema;
22376
22988
  return __generator(this, function (_b) {
@@ -22444,14 +23056,14 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
22444
23056
  recordPage = _a.sent();
22445
23057
  recordSchema = recordPage ? recordPage.schema : {
22446
23058
  "type": "wrapper",
22447
- "className": "overflow-y-auto p-0 m-0 flex-1 h-full",
23059
+ "className": "steedos-record-content overflow-y-auto p-0 m-0 flex-1 h-full",
22448
23060
  "name": "amis-".concat(appId, "-").concat(objectApiName, "-detail"),
22449
23061
  "body": [
22450
23062
  {
22451
23063
  "type": "steedos-record-detail",
22452
23064
  // "recordId": "${recordId}",
22453
23065
  "objectApiName": "${objectName}",
22454
- className: "sm:m-3",
23066
+ // className: "sm:m-3",
22455
23067
  appId: appId,
22456
23068
  }
22457
23069
  ],
@@ -22466,7 +23078,7 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
22466
23078
  "actions": [
22467
23079
  {
22468
23080
  "actionType": "custom",
22469
- "script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name})"
23081
+ "script": "window.Steedos && window.Steedos.setDocumentTitle && Steedos.setDocumentTitle({pageName: event.data.record.name}); $('.steedos-record-tr').removeClass('steedos-record-selected');$('.steedos-record-tr-'+event.data.record._id).addClass('steedos-record-selected');"
22470
23082
  }
22471
23083
  ]
22472
23084
  }
@@ -22545,7 +23157,21 @@ var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, fun
22545
23157
  "visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
22546
23158
  }
22547
23159
  ]
22548
- }
23160
+ },
23161
+ // onEvent: {
23162
+ // "recordLoaded": {
23163
+ // "actions": [
23164
+ // {
23165
+ // "actionType": "setValue",
23166
+ // "args": {
23167
+ // "value": {
23168
+ // "steedos_selected_recordId": "${event.data.record._id}"
23169
+ // }
23170
+ // }
23171
+ // }
23172
+ // ]
23173
+ // }
23174
+ // }
22549
23175
  }];
22550
23176
  }
22551
23177
  });
@@ -22577,6 +23203,7 @@ exports.AmisObjectTable = AmisObjectTable;
22577
23203
  exports.AmisProvider = AmisProvider;
22578
23204
  exports.AmisRecordDetail = AmisRecordDetail;
22579
23205
  exports.AmisRecordDetailHeader = AmisRecordDetailHeader;
23206
+ exports.AmisRecordDetailMini = AmisRecordDetailMini;
22580
23207
  exports.AmisRecordDetailRelatedList = AmisRecordDetailRelatedList;
22581
23208
  exports.AmisRecordDetailRelatedLists = AmisRecordDetailRelatedLists;
22582
23209
  exports.AmisRecordService = AmisRecordService;