@steedos-widgets/amis-object 1.3.21 → 1.3.22-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4903,21 +4903,21 @@ async function getQuickEditSchema(field, options){
4903
4903
  break;
4904
4904
  case "avatar":
4905
4905
  case "image":
4906
- quickEditSchema.body[0].receiver.adaptor = `
4907
- const { context } = api.body;
4908
- var rootUrl = context.rootUrl + "/api/files/${field.type}s/";
4909
- payload = {
4910
- status: response.status == 200 ? 0 : response.status,
4911
- msg: response.statusText,
4912
- data: {
4913
- value: rootUrl + payload._id,//为了实现图片crud的回显,需要将value从id改为url,当保存数据数据时,再在发送适配器内重新将id提取出来
4914
- name: payload.original.name,
4915
- url: rootUrl + payload._id,
4906
+ quickEditSchema.body[0].receiver.adaptor = `
4907
+ const { context } = api.body;
4908
+ var rootUrl = context.rootUrl + "/api/files/${field.type}s/";
4909
+ payload = {
4910
+ status: response.status == 200 ? 0 : response.status,
4911
+ msg: response.statusText,
4912
+ data: {
4913
+ value: rootUrl + payload._id,//为了实现图片crud的回显,需要将value从id改为url,当保存数据数据时,再在发送适配器内重新将id提取出来
4914
+ name: payload.original.name,
4915
+ url: rootUrl + payload._id,
4916
+ }
4916
4917
  }
4917
- }
4918
- return payload;
4919
- `;
4920
- break;
4918
+ return payload;
4919
+ `;
4920
+ break;
4921
4921
  }
4922
4922
  quickEditSchema.body[0].visibleOn = "${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";
4923
4923
  quickEditSchema.body.push({
@@ -5124,6 +5124,11 @@ async function getQuickEditSchema(field, options){
5124
5124
  if(field.type == "location"){
5125
5125
  quickEditSchema = false;
5126
5126
  }
5127
+ if(field.type == "color"){
5128
+ quickEditSchema = {
5129
+ type: "input-color"
5130
+ };
5131
+ }
5127
5132
  }
5128
5133
  return quickEditSchema;
5129
5134
  }
@@ -11109,7 +11114,8 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11109
11114
  {
11110
11115
  "type": "pagination",
11111
11116
  "maxButtons": 5,
11112
- "showPageInput": false
11117
+ "showPageInput": true,
11118
+ "layout": "total,pager,go"
11113
11119
  }
11114
11120
  ]
11115
11121
  }
@@ -14675,6 +14681,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
14675
14681
  };
14676
14682
  if(readonly){
14677
14683
  convertData.defaultColor = null;
14684
+ }else {
14685
+ convertData.pipeIn = (value, data) => {
14686
+ if(value && value.indexOf('#')<0){
14687
+ return '#'+value;
14688
+ }
14689
+ return value;
14690
+ };
14678
14691
  }
14679
14692
  break;
14680
14693
  case 'boolean':
@@ -14691,7 +14704,16 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
14691
14704
  format:'YYYY-MM-DDT00:00:00.000[Z]',
14692
14705
  tpl: readonly ? getDateTpl(field) : null,
14693
14706
  // utc: true,
14694
- joinValues: false
14707
+ joinValues: false,
14708
+ "shortcuts": [
14709
+ "thismonth",
14710
+ "2monthsago",
14711
+ "3monthslater",
14712
+ "prevquarter",
14713
+ "thisquarter",
14714
+ "thisyear",
14715
+ "lastYear"
14716
+ ]
14695
14717
  };
14696
14718
  break;
14697
14719
  case 'date':
@@ -15102,6 +15124,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15102
15124
  let subFieldName = subField.name.replace(`${field.name}.$.`, '').replace(`${field.name}.`, '');
15103
15125
  if(subField.type === 'grid'){
15104
15126
  subField = await getGridFieldSubFields(subField, ctx.__formFields);
15127
+ }else if(subField.type === 'table'){
15128
+ subField = await getTabledFieldSubFields(subField, ctx.__formFields);
15105
15129
  }else {
15106
15130
  if(readonly){
15107
15131
  subFieldName = `${field.name}.${subFieldName}`;
@@ -15218,7 +15242,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
15218
15242
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15219
15243
  }
15220
15244
  if(_field.type === 'datetime'){
15221
- _field.type = 'input-datetime-range';
15245
+ // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
15246
+ _field.type = 'input-date-range';
15222
15247
  _field.is_wide = true;
15223
15248
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15224
15249
  }
@@ -15530,7 +15555,7 @@ async function getFormBody(permissionFields, formFields, ctx){
15530
15555
  * @Author: 殷亮辉 yinlianghui@hotoa.com
15531
15556
  * @Date: 2023-11-15 09:50:22
15532
15557
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
15533
- * @LastEditTime: 2023-12-16 16:39:49
15558
+ * @LastEditTime: 2023-12-23 22:13:22
15534
15559
  */
15535
15560
 
15536
15561
  /**
@@ -15576,6 +15601,28 @@ function getInputTableCell(field, showAsInlineEditMode) {
15576
15601
  }
15577
15602
  }
15578
15603
 
15604
+ function getComponentId(name, tag) {
15605
+ let id = "";
15606
+ switch (name) {
15607
+ case "table_service":
15608
+ id = `service_wrapper__${tag}`;
15609
+ break;
15610
+ case "form_pagination":
15611
+ id = `service_popup_pagination_wrapper__${tag}`;
15612
+ break;
15613
+ case "form":
15614
+ id = `form_popup__${tag}`;
15615
+ break;
15616
+ case "dialog":
15617
+ id = `dialog_popup__${tag}`;
15618
+ break;
15619
+ default:
15620
+ id = `${name}__${tag}`;
15621
+ break;
15622
+ }
15623
+ return id;
15624
+ }
15625
+
15579
15626
  /**
15580
15627
  * @param {*} props
15581
15628
  * @param {*} mode edit/new/readonly
@@ -15623,39 +15670,46 @@ async function getInputTableColumns(props) {
15623
15670
  }
15624
15671
  }
15625
15672
 
15626
- function getFormPagination(props) {
15673
+ /**
15674
+ * @param {*} props input-table组件props
15675
+ * @param {*} mode edit/new/readonly
15676
+ * @returns 翻页组件
15677
+ */
15678
+ function getFormPagination(props, mode) {
15679
+ let showPagination = true;
15680
+ if(mode === "new" && !!!props.editable){
15681
+ //不允许编辑只允许新建时不应该让用户操作翻页
15682
+ showPagination = false;
15683
+ }
15684
+ let buttonPrevId = getComponentId("button_prev", props.id);
15685
+ let buttonNextId = getComponentId("button_next", props.id);
15686
+ let formId = getComponentId("form", props.id);
15687
+ let tableServiceId = getComponentId("table_service", props.id);
15688
+ let formPaginationId = getComponentId("form_pagination", props.id);
15627
15689
  let onPageChangeScript = `
15628
15690
  let scope = event.context.scoped;
15629
- let __paginationServiceId = event.data.__paginationServiceId;
15630
- let __wrapperServiceId = event.data.__wrapperServiceId;
15631
- let __formId = event.data.__formId;
15632
- let fieldValue = event.data.__changedItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.changedItems,直接变更其值即可改变表单中的值
15691
+ let __paginationServiceId = "${formPaginationId}";
15692
+ let __wrapperServiceId = "${tableServiceId}";
15693
+ let __formId = "${formId}";
15694
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
15633
15695
  let pageChangeDirection = context.props.pageChangeDirection;
15696
+ // event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
15697
+ // 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
15698
+ // 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
15699
+ // let currentPage = currentIndex + 1;
15634
15700
  let currentPage = event.data.__page;
15635
15701
  let currentIndex = event.data.index;
15636
-
15637
- // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量changedItems中
15702
+ // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
15638
15703
  let currentFormValues = scope.getComponentById(__formId).getValues();
15639
15704
  fieldValue[currentIndex] = currentFormValues;
15640
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15641
- // doAction({
15642
- // "componentId": __wrapperServiceId,
15643
- // "actionType": "setValue",
15644
- // "args": {
15645
- // "value": {
15646
- // "__changedItems": fieldValue
15647
- // }
15648
- // }
15649
- // });
15650
- // 如果翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,需要额外给正式表单字段执行一次setValue
15651
- // 但是同时保存到正式表单字段中会造成翻页后点击取消无法取消翻页之前的改动内容
15652
- // doAction({
15653
- // "componentId": "${props.id}",
15654
- // "actionType": "setValue",
15655
- // "args": {
15656
- // "value": fieldValue
15657
- // }
15658
- // });
15705
+ // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
15706
+ doAction({
15707
+ "componentId": "${props.id}",
15708
+ "actionType": "setValue",
15709
+ "args": {
15710
+ "value": fieldValue
15711
+ }
15712
+ });
15659
15713
 
15660
15714
  // 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
15661
15715
  let targetPage;
@@ -15666,7 +15720,7 @@ function getFormPagination(props) {
15666
15720
  targetPage = currentPage - 1;
15667
15721
  }
15668
15722
  let targetIndex = targetPage - 1;//input-table组件行索引,从0开始的索引
15669
- // let targetFormData = __changedItems[targetIndex];
15723
+ // let targetFormData = __tableItems[targetIndex];
15670
15724
  doAction({
15671
15725
  "actionType": "setValue",
15672
15726
  "componentId": __paginationServiceId,
@@ -15689,7 +15743,8 @@ function getFormPagination(props) {
15689
15743
  `;
15690
15744
  return {
15691
15745
  "type": "wrapper",
15692
- "className": "py-2",
15746
+ "size": "none",
15747
+ "className": "mr-1",
15693
15748
  "body": [
15694
15749
  {
15695
15750
  "type": "button",
@@ -15697,8 +15752,9 @@ function getFormPagination(props) {
15697
15752
  "icon": `fa fa-angle-left`,
15698
15753
  "level": "link",
15699
15754
  "pageChangeDirection": "prev",
15700
- "disabledOn": "${__page <= 1}",
15755
+ "disabledOn": showPagination ? "${__page <= 1}" : "true",
15701
15756
  "size": "sm",
15757
+ "id": buttonPrevId,
15702
15758
  "onEvent": {
15703
15759
  "click": {
15704
15760
  "actions": [
@@ -15712,7 +15768,7 @@ function getFormPagination(props) {
15712
15768
  },
15713
15769
  {
15714
15770
  "type": "tpl",
15715
- "tpl": "${__page}/${__total}"
15771
+ "tpl": "${__page}/${__tableItems.length}"
15716
15772
  },
15717
15773
  {
15718
15774
  "type": "button",
@@ -15720,8 +15776,9 @@ function getFormPagination(props) {
15720
15776
  "icon": `fa fa-angle-right`,
15721
15777
  "level": "link",
15722
15778
  "pageChangeDirection": "next",
15723
- "disabledOn": "${__page >= __total}",
15779
+ "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
15724
15780
  "size": "sm",
15781
+ "id": buttonNextId,
15725
15782
  "onEvent": {
15726
15783
  "click": {
15727
15784
  "actions": [
@@ -15741,30 +15798,27 @@ function getFormPagination(props) {
15741
15798
  * 传入formSchema输出带翻页容器的wrapper
15742
15799
  * @param {*} props input-table组件props
15743
15800
  * @param {*} form formSchema
15744
- * @param {*} mode edit/readonly
15801
+ * @param {*} mode edit/new/readonly
15745
15802
  * @returns 带翻页容器的wrapper
15746
15803
  */
15747
15804
  function getFormPaginationWrapper(props, form, mode) {
15748
- let serviceId = `service_popup_pagination_wrapper__${props.id}`;
15749
- // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15750
- // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15751
- // 只读的时候不可以走中间变量__changedItems,比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__changedItems值是修改前的值
15752
- let formValues = mode === "readonly" ? `\${${props.name}[__super.index]}` : "${__changedItems[__super.index]}";
15753
- // 这时用__readonlyItemsLength是因为`\${${props.name}.length}`拿不到值
15754
- let totalValue = mode === "readonly" ? "${__readonlyItemsLength}" : "${__changedItems.length}";
15805
+ console.log("==getFormPaginationWrapper===", props, mode);
15806
+ let serviceId = getComponentId("form_pagination", props.id);
15807
+ let tableServiceId = getComponentId("table_service", props.id);
15755
15808
  let innerForm = Object.assign({}, form, {
15756
15809
  "data": {
15757
- // "&": "${__changedItems[__super.index]}"
15758
- "&": formValues,
15810
+ // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15811
+ // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15812
+ "&": "${__tableItems[__super.index]}"
15759
15813
  }
15760
15814
  });
15761
15815
  let formBody = [
15762
15816
  {
15763
15817
  "type": "wrapper",
15764
15818
  "size": "none",
15765
- "className": "flex justify-end border-y border-gray-200 -mx-6 shadow-inner sticky top-0 right-0 left-0 z-20 bg-white mb-4",
15819
+ "className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white -mt-2",
15766
15820
  "body": [
15767
- getFormPagination(props)
15821
+ getFormPagination(props, mode)
15768
15822
  ]
15769
15823
  },
15770
15824
  {
@@ -15778,49 +15832,45 @@ function getFormPaginationWrapper(props, form, mode) {
15778
15832
  }
15779
15833
  ];
15780
15834
  let onServiceInitedScript = `
15781
- // 以下脚本在inlineEditMode模式时才有必要执行(不过执行了也没有坏处,纯粹是没必要),是为了解决:
15782
- // inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
15783
- // 思路是每次弹出form之前先把其changedItems同步更新为最新值,这样就能在弹出form中包含单元格中做的修改
15835
+ // 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
15836
+ // 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
15837
+ // 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
15838
+ // 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
15839
+ // 处理思路是每次弹出form之前先把其__tableItems同步更新为最新值,这样就能在弹出form中包含单元格中做的修改
15784
15840
  // 注意:service init事件只会在每次弹出窗口时才执行,在触发翻页时并不会触发service init事件
15785
- let inlineEditMode = ${props.inlineEditMode};
15786
- if(!inlineEditMode){
15787
- return;
15788
- }
15789
15841
  let scope = event.context.scoped;
15790
- let __wrapperServiceId = event.data.__wrapperServiceId;
15842
+ let __wrapperServiceId = "${tableServiceId}";
15791
15843
  let wrapperService = scope.getComponentById(__wrapperServiceId);
15792
15844
  let wrapperServiceData = wrapperService.getData();
15793
15845
  let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
15794
- //不可以直接像event.data.__changedItems = originalFieldValue; 这样整个赋值,否则作用域会断
15795
- event.data.__changedItems.forEach(function(n,i){
15796
- event.data.__changedItems[i] = lastestFieldValue[i];
15846
+ //不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
15847
+ event.data.__tableItems.forEach(function(n,i){
15848
+ event.data.__tableItems[i] = lastestFieldValue[i];
15797
15849
  });
15798
15850
  `;
15799
15851
  let schema = {
15800
15852
  "type": "service",
15801
15853
  "id": serviceId,
15802
15854
  "schemaApi": {
15803
- "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
15804
- // "url": "${context.rootUrl}/graphql",
15805
- "method": "post",
15806
- "headers": {
15807
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
15808
- },
15809
- "requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
15855
+ // "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
15856
+ "url": "${context.rootUrl}/api/v1/spaces/none",
15857
+ "trackExpression": "${index}",
15858
+ "method": "get",
15810
15859
  "adaptor": `
15811
15860
  const formBody = ${JSON.stringify(formBody)};
15812
15861
  return {
15813
15862
  "body": formBody
15814
15863
  }
15815
- `
15864
+ `,
15865
+ "cache": 600000
15816
15866
  },
15817
15867
  // "body": formBody,
15818
15868
  "data": {
15819
15869
  "__page": "${index + 1}",
15820
15870
  // "__total": `\${${props.name}.length}`,
15821
- "__total": totalValue,
15822
- "__paginationServiceId": serviceId,
15823
- "__formId": form.id
15871
+ // "__total": "${__tableItems.length}",
15872
+ // "__paginationServiceId": serviceId,
15873
+ // "__formId": form.id
15824
15874
  },
15825
15875
  "onEvent": {
15826
15876
  "init": {
@@ -15840,13 +15890,15 @@ function getFormPaginationWrapper(props, form, mode) {
15840
15890
  * @param {*} props
15841
15891
  * @param {*} mode edit/new/readonly
15842
15892
  */
15843
- async function getForm(props, mode = "edit") {
15893
+ async function getForm(props, mode = "edit", formId) {
15844
15894
  let formFields = getFormFields(props, mode);
15845
15895
  let body = await getFormBody(null, formFields);
15846
- let forId = `form_popup__${props.id}`;
15896
+ if (!formId) {
15897
+ formId = getComponentId("form", props.id);
15898
+ }
15847
15899
  let schema = {
15848
15900
  "type": "form",
15849
- "id": forId,
15901
+ "id": formId,
15850
15902
  "title": "表单",
15851
15903
  "debug": false,
15852
15904
  "mode": "normal",
@@ -15858,8 +15910,7 @@ async function getForm(props, mode = "edit") {
15858
15910
  if (mode === "edit") {
15859
15911
  let onEditItemSubmitScript = `
15860
15912
  // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
15861
- let fieldValue = event.data.__changedItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.changedItems,直接变更其值即可改变表单中的值
15862
-
15913
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
15863
15914
  //这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15864
15915
  // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15865
15916
  fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
@@ -15870,16 +15921,6 @@ async function getForm(props, mode = "edit") {
15870
15921
  "value": fieldValue
15871
15922
  }
15872
15923
  });
15873
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15874
- // doAction({
15875
- // "componentId": event.data.__wrapperServiceId,
15876
- // "actionType": "setValue",
15877
- // "args": {
15878
- // "value": {
15879
- // "__changedItems": fieldValue
15880
- // }
15881
- // }
15882
- // });
15883
15924
  `;
15884
15925
  Object.assign(schema, {
15885
15926
  "onEvent": {
@@ -15907,29 +15948,30 @@ async function getForm(props, mode = "edit") {
15907
15948
  }
15908
15949
  else if (mode === "new") {
15909
15950
  let onNewItemSubmitScript = `
15910
- // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
15911
- if(!event.data.__changedItems){
15912
- event.data.__changedItems = [];
15951
+ let newItem = JSON.parse(JSON.stringify(event.data));
15952
+ if(event.data["${props.name}"]){
15953
+ // let fieldValue = event.data.__tableItems;
15954
+ // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
15955
+ let fieldValue = event.data["${props.name}"];
15956
+ fieldValue.push(newItem);
15957
+ doAction({
15958
+ "componentId": "${props.id}",
15959
+ "actionType": "setValue",
15960
+ "args": {
15961
+ "value": fieldValue
15962
+ }
15963
+ });
15964
+ }
15965
+ else{
15966
+ // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
15967
+ doAction({
15968
+ "componentId": "${props.id}",
15969
+ "actionType": "setValue",
15970
+ "args": {
15971
+ "value": [newItem]
15972
+ }
15973
+ });
15913
15974
  }
15914
- let fieldValue = event.data.__changedItems;
15915
- fieldValue.push(JSON.parse(JSON.stringify(event.data)));
15916
- doAction({
15917
- "componentId": "${props.id}",
15918
- "actionType": "setValue",
15919
- "args": {
15920
- "value": fieldValue
15921
- }
15922
- });
15923
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15924
- // doAction({
15925
- // "componentId": event.data.__wrapperServiceId,
15926
- // "actionType": "setValue",
15927
- // "args": {
15928
- // "value": {
15929
- // "__changedItems": fieldValue
15930
- // }
15931
- // }
15932
- // });
15933
15975
  `;
15934
15976
  Object.assign(schema, {
15935
15977
  "onEvent": {
@@ -15955,12 +15997,271 @@ async function getForm(props, mode = "edit") {
15955
15997
  }
15956
15998
  });
15957
15999
  }
15958
- if (mode === "edit" || mode === "readonly") {
15959
- schema = getFormPaginationWrapper(props, schema, mode);
15960
- }
16000
+ schema = getFormPaginationWrapper(props, schema, mode);
15961
16001
  return schema;
15962
16002
  }
15963
16003
 
16004
+
16005
+ /**
16006
+ * 编辑、新增和查看按钮actions
16007
+ * @param {*} props
16008
+ * @param {*} mode edit/new/readonly
16009
+ */
16010
+ async function getButtonActions(props, mode) {
16011
+ let actions = [];
16012
+ let formId = getComponentId("form", props.id);
16013
+ let dialogId = getComponentId("dialog", props.id);
16014
+ let buttonNextId = getComponentId("button_next", props.id);
16015
+ let formPaginationId = getComponentId("form_pagination", props.id);
16016
+ if (mode == "new" || mode == "edit") {
16017
+ // let actionShowNewDialog = {
16018
+ // "actionType": "dialog",
16019
+ // "dialog": {
16020
+ // "type": "dialog",
16021
+ // "title": "新增行",
16022
+ // "body": [
16023
+ // await getForm(props, "new", formId)
16024
+ // ],
16025
+ // "size": "lg",
16026
+ // "showCloseButton": true,
16027
+ // "showErrorMsg": true,
16028
+ // "showLoading": true,
16029
+ // "className": "app-popover",
16030
+ // "closeOnEsc": false,
16031
+ // "onEvent": {
16032
+ // "confirm": {
16033
+ // "actions": [
16034
+ // {
16035
+ // "actionType": "validate",
16036
+ // "componentId": formId
16037
+ // },
16038
+ // {
16039
+ // "preventDefault": true,
16040
+ // "expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16041
+ // }
16042
+ // ]
16043
+ // }
16044
+ // }
16045
+ // }
16046
+ // };
16047
+ let onSaveAndNewItemScript = `
16048
+ let scope = event.context.scoped;
16049
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16050
+ // 新建一条空白行并保存到子表组件
16051
+ fieldValue.push({});
16052
+ doAction({
16053
+ "componentId": "${props.id}",
16054
+ "actionType": "setValue",
16055
+ "args": {
16056
+ "value": fieldValue
16057
+ }
16058
+ });
16059
+ let buttonNextId = "${buttonNextId}";
16060
+ let __paginationServiceId = "${formPaginationId}";
16061
+ let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16062
+ event.data.index = __paginationData.index;
16063
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16064
+ // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16065
+ scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16066
+ `;
16067
+ let onSaveAndCopyItemScript = `
16068
+ let scope = event.context.scoped;
16069
+ let __formId = "${formId}";
16070
+ // let newItem = JSON.parse(JSON.stringify(event.data));
16071
+ let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
16072
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16073
+ // 复制当前页数据到新建行并保存到子表组件
16074
+ fieldValue.push(newItem);
16075
+ doAction({
16076
+ "componentId": "${props.id}",
16077
+ "actionType": "setValue",
16078
+ "args": {
16079
+ "value": fieldValue
16080
+ }
16081
+ });
16082
+ let buttonNextId = "${buttonNextId}";
16083
+ let __paginationServiceId = "${formPaginationId}";
16084
+ let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16085
+ event.data.index = __paginationData.index;
16086
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16087
+ // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16088
+ scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16089
+ `;
16090
+ let dialogButtons = [
16091
+ {
16092
+ "type": "button",
16093
+ "label": "完成",
16094
+ "actionType": "confirm",
16095
+ "level": "primary"
16096
+ }
16097
+ ];
16098
+ if(props.addable){
16099
+ dialogButtons = [
16100
+ {
16101
+ "type": "button",
16102
+ "label": "新增",
16103
+ "tooltip": "保存并新增一行,即保存当前行数据并新增一条空白行",
16104
+ "onEvent": {
16105
+ "click": {
16106
+ "actions": [
16107
+ {
16108
+ "actionType": "custom",
16109
+ "script": onSaveAndNewItemScript
16110
+ }
16111
+ ]
16112
+ }
16113
+ }
16114
+ },
16115
+ {
16116
+ "type": "button",
16117
+ "label": "复制",
16118
+ "tooltip": "复制并新增一行,即保存当前行数据并复制当前行数据到新增行",
16119
+ "onEvent": {
16120
+ "click": {
16121
+ "actions": [
16122
+ {
16123
+ "actionType": "custom",
16124
+ "script": onSaveAndCopyItemScript
16125
+ }
16126
+ ]
16127
+ }
16128
+ }
16129
+ },
16130
+ dialogButtons[0]
16131
+ ];
16132
+ }
16133
+ let actionShowEditDialog = {
16134
+ "actionType": "dialog",
16135
+ "dialog": {
16136
+ "type": "dialog",
16137
+ "id": dialogId,
16138
+ "title": `\${uiSchema.fields.${props.name}.label} 明细`,
16139
+ "body": [
16140
+ await getForm(props, mode, formId)
16141
+ ],
16142
+ "size": "lg",
16143
+ "showCloseButton": true,
16144
+ "showErrorMsg": true,
16145
+ "showLoading": true,
16146
+ "className": "app-popover",
16147
+ "closeOnEsc": false,
16148
+ "data": {
16149
+ // 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16150
+ // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16151
+ // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16152
+ // "&": "${record || {}}",
16153
+ // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16154
+ // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16155
+ // "__parentForm": "${__super.__super || {}}",
16156
+ "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
16157
+ "global": "${global}",
16158
+ "uiSchema": "${uiSchema}",
16159
+ "index": "${index}",
16160
+ // "__tableItems": `\${${props.name}}`
16161
+ // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16162
+ // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16163
+ "__tableItems": `\${${props.name}|json|toJson}`
16164
+ },
16165
+ "actions": dialogButtons,
16166
+ "onEvent": {
16167
+ "confirm": {
16168
+ "actions": [
16169
+ {
16170
+ "actionType": "validate",
16171
+ "componentId": formId
16172
+ },
16173
+ {
16174
+ "preventDefault": true,
16175
+ "expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16176
+ }
16177
+ ]
16178
+ }
16179
+ }
16180
+ }
16181
+ };
16182
+ if (props.dialog) {
16183
+ Object.assign(actionShowEditDialog.dialog, props.dialog);
16184
+ }
16185
+ if (mode == "new") {
16186
+ let onNewLineScript = `
16187
+ let newItem = {};
16188
+ if(event.data["${props.name}"]){
16189
+ // let fieldValue = event.data.__tableItems;
16190
+ // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16191
+ let fieldValue = event.data["${props.name}"];
16192
+ fieldValue.push(newItem);
16193
+ doAction({
16194
+ "componentId": "${props.id}",
16195
+ "actionType": "setValue",
16196
+ "args": {
16197
+ "value": fieldValue
16198
+ }
16199
+ });
16200
+ event.data.index = fieldValue.length - 1;
16201
+ }
16202
+ else{
16203
+ // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
16204
+ doAction({
16205
+ "componentId": "${props.id}",
16206
+ "actionType": "setValue",
16207
+ "args": {
16208
+ "value": [newItem]
16209
+ }
16210
+ });
16211
+ event.data.index = 1;
16212
+ }
16213
+ `;
16214
+ let actionNewLine = {
16215
+ "actionType": "custom",
16216
+ "script": onNewLineScript
16217
+ };
16218
+ actions = [actionNewLine, actionShowEditDialog];
16219
+ }
16220
+ else if (mode == "edit") {
16221
+ actions = [actionShowEditDialog];
16222
+ }
16223
+ }
16224
+ else if (mode == "readonly") {
16225
+ actions = [
16226
+ {
16227
+ "actionType": "dialog",
16228
+ "dialog": {
16229
+ "type": "dialog",
16230
+ "title": `\${uiSchema.fields.${props.name}.label} 明细`,
16231
+ "body": [
16232
+ await getForm(props, "readonly")
16233
+ ],
16234
+ "size": "lg",
16235
+ "showCloseButton": true,
16236
+ "showErrorMsg": true,
16237
+ "showLoading": true,
16238
+ "className": "app-popover",
16239
+ "closeOnEsc": false,
16240
+ "actions": [],
16241
+ "data": {
16242
+ // 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16243
+ // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16244
+ // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16245
+ // "&": "${record || {}}",
16246
+ // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16247
+ // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16248
+ // "__parentForm": "${__super.__super || {}}",
16249
+ "__parentForm": "${__super.__super || {}}",
16250
+ "global": "${global}",
16251
+ "uiSchema": "${uiSchema}",
16252
+ "index": "${index}",
16253
+ // "__tableItems": `\${${props.name}}`
16254
+ // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16255
+ // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16256
+ "__tableItems": `\${${props.name}|json|toJson}`
16257
+ },
16258
+ }
16259
+ }
16260
+ ];
16261
+ }
16262
+ return actions;
16263
+ }
16264
+
15964
16265
  async function getButtonNew(props) {
15965
16266
  return {
15966
16267
  "label": "新增",
@@ -15968,24 +16269,7 @@ async function getButtonNew(props) {
15968
16269
  "icon": "fa fa-plus",
15969
16270
  "onEvent": {
15970
16271
  "click": {
15971
- "actions": [
15972
- {
15973
- "actionType": "dialog",
15974
- "dialog": {
15975
- "type": "dialog",
15976
- "title": "新增行",
15977
- "body": [
15978
- await getForm(props, "new")
15979
- ],
15980
- "size": "lg",
15981
- "showCloseButton": true,
15982
- "showErrorMsg": true,
15983
- "showLoading": true,
15984
- "className": "app-popover",
15985
- "closeOnEsc": false
15986
- }
15987
- }
15988
- ]
16272
+ "actions": await getButtonActions(props, "new")
15989
16273
  }
15990
16274
  },
15991
16275
  "level": "primary"
@@ -15993,76 +16277,14 @@ async function getButtonNew(props) {
15993
16277
  }
15994
16278
 
15995
16279
  async function getButtonEdit(props, showAsInlineEditMode) {
15996
- let onCancelScript = `
15997
- let scope = event.context.scoped;
15998
- let __wrapperServiceId = event.data.__wrapperServiceId;
15999
- let wrapperService = scope.getComponentById(__wrapperServiceId);
16000
- let wrapperServiceData = wrapperService.getData();
16001
- let originalFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16002
- //不可以直接像event.data.__changedItems = originalFieldValue; 这样整个赋值,否则作用域会断,造成无法还原
16003
- event.data.__changedItems.forEach(function(n,i){
16004
- event.data.__changedItems[i] = originalFieldValue[i];
16005
- });
16006
- // 因为翻页form中用的是event.data.changedItems中的数据,所以像下面这样doAction setValue无法实现还原
16007
- // doAction({
16008
- // "componentId": __wrapperServiceId,
16009
- // "actionType": "setValue",
16010
- // "args": {
16011
- // "value": {
16012
- // "__changedItems": originalFieldValue
16013
- // }
16014
- // }
16015
- // });
16016
- `;
16017
16280
  return {
16018
16281
  "type": "button",
16019
16282
  "label": "",
16020
- "icon": `fa fa-${showAsInlineEditMode ? "expand" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
16283
+ "icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
16021
16284
  "level": "link",
16022
16285
  "onEvent": {
16023
16286
  "click": {
16024
- "actions": [
16025
- {
16026
- "actionType": "dialog",
16027
- "dialog": {
16028
- "type": "dialog",
16029
- "title": "编辑行",
16030
- "body": [
16031
- await getForm(props, "edit")
16032
- ],
16033
- "size": "lg",
16034
- "showCloseButton": true,
16035
- "showErrorMsg": true,
16036
- "showLoading": true,
16037
- "className": "app-popover",
16038
- "closeOnEsc": false,
16039
- "data": {
16040
- // 这里必须加data数据映射,否则翻页功能中取changedItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16041
- // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16042
- // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16043
- // "&": "${record || {}}",
16044
- // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16045
- // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16046
- "__parentForm": "${__super.__super || {}}",
16047
- "global": "${global}",
16048
- "uiSchema": "${uiSchema}",
16049
- "index": "${index}",
16050
- "__changedItems": "${__changedItems}",
16051
- "__wrapperServiceId": "${__wrapperServiceId}"
16052
- },
16053
- "onEvent": {
16054
- "cancel": {
16055
- "actions": [
16056
- {
16057
- "actionType": "custom",
16058
- "script": onCancelScript
16059
- }
16060
- ]
16061
- }
16062
- }
16063
- }
16064
- }
16065
- ]
16287
+ "actions": await getButtonActions(props, "edit")
16066
16288
  }
16067
16289
  }
16068
16290
  };
@@ -16072,78 +16294,38 @@ async function getButtonView(props) {
16072
16294
  return {
16073
16295
  "type": "button",
16074
16296
  "label": "",
16075
- "icon": "fa fa-expand",//fa-external-link
16297
+ "icon": "fa fa-expand-alt",//fa-external-link
16076
16298
  "level": "link",
16077
16299
  "onEvent": {
16078
16300
  "click": {
16079
- "actions": [
16080
- {
16081
- "actionType": "dialog",
16082
- "dialog": {
16083
- "type": "dialog",
16084
- "title": "查看行",
16085
- "body": [
16086
- await getForm(props, "readonly")
16087
- ],
16088
- "size": "lg",
16089
- "showCloseButton": true,
16090
- "showErrorMsg": true,
16091
- "showLoading": true,
16092
- "className": "app-popover",
16093
- "closeOnEsc": false,
16094
- "actions": [],
16095
- "data": {
16096
- // 这里必须加data数据映射,否则翻页功能中取changedItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16097
- // 额外把华炎魔方主表记录ObjectForm中的字段值从formData变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16098
- // global、uiSchema等常用变量本来就在formData变量已经存在了,无需另外映射
16099
- // "&": "${formData || {}}",
16100
- // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有formData变量
16101
- // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16102
- "__parentForm": "${__super.__super || {}}",
16103
- "index": "${index}",
16104
- "__changedItems": "${__changedItems}",
16105
- "__wrapperServiceId": "${__wrapperServiceId}",
16106
- "__readonlyItemsLength": `\${${props.name}.length}`
16107
- }
16108
- }
16109
- }
16110
- ]
16301
+ "actions": await getButtonActions(props, "readonly")
16111
16302
  }
16112
16303
  }
16113
16304
  };
16114
16305
  }
16115
16306
 
16116
16307
  function getButtonDelete(props) {
16308
+ let tableServiceId = getComponentId("table_service", props.id);
16117
16309
  let onDeleteItemScript = `
16118
- // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
16119
- if(!event.data.__changedItems){
16120
- event.data.__changedItems = [];
16121
- }
16122
- let fieldValue = event.data.__changedItems;
16123
- // fieldValue.push(JSON.parse(JSON.stringify(event.data)));
16124
- fieldValue.splice(event.data.index, 1)
16310
+ // let fieldValue = event.data["${props.name}"];
16311
+ let scope = event.context.scoped;
16312
+ let __wrapperServiceId = "${tableServiceId}";
16313
+ let wrapperService = scope.getComponentById(__wrapperServiceId);
16314
+ let wrapperServiceData = wrapperService.getData();
16315
+ let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16316
+ lastestFieldValue.splice(event.data.index, 1);
16125
16317
  doAction({
16126
16318
  "componentId": "${props.id}",
16127
16319
  "actionType": "setValue",
16128
16320
  "args": {
16129
- "value": fieldValue
16321
+ "value": lastestFieldValue
16130
16322
  }
16131
16323
  });
16132
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
16133
- // doAction({
16134
- // "componentId": event.data.__wrapperServiceId,
16135
- // "actionType": "setValue",
16136
- // "args": {
16137
- // "value": {
16138
- // "__changedItems": fieldValue
16139
- // }
16140
- // }
16141
- // });
16142
16324
  `;
16143
16325
  return {
16144
16326
  "type": "button",
16145
16327
  "label": "",
16146
- "icon": "fa fa-minus",
16328
+ "icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
16147
16329
  "level": "link",
16148
16330
  "onEvent": {
16149
16331
  "click": {
@@ -16169,20 +16351,22 @@ const getAmisInputTableSchema = async (props) => {
16169
16351
  if (!props.id) {
16170
16352
  props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
16171
16353
  }
16172
- let serviceId = `service_wrapper__${props.id}`;
16354
+ let serviceId = getComponentId("table_service", props.id);
16173
16355
  let buttonsForColumnOperations = [];
16174
16356
  let inlineEditMode = props.inlineEditMode;
16175
16357
  let showAsInlineEditMode = inlineEditMode && props.editable;
16176
16358
  if (props.editable) {
16177
16359
  let showEditButton = true;
16178
16360
  if (showAsInlineEditMode) {
16179
- // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16180
- if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16181
- showEditButton = true;
16182
- }
16183
- else {
16184
- showEditButton = false;
16185
- }
16361
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
16362
+ showEditButton = true;
16363
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16364
+ // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16365
+ // showEditButton = true;
16366
+ // }
16367
+ // else {
16368
+ // showEditButton = false;
16369
+ // }
16186
16370
  }
16187
16371
  // 编辑时显示编辑按钮
16188
16372
  if (showEditButton) {
@@ -16192,11 +16376,9 @@ const getAmisInputTableSchema = async (props) => {
16192
16376
  }
16193
16377
  else {
16194
16378
  // 只读时显示查看按钮
16195
- if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16196
- // 只在有列被隐藏时才需要显示查看按钮
16197
- let buttonViewSchema = await getButtonView(props);
16198
- buttonsForColumnOperations.push(buttonViewSchema);
16199
- }
16379
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
16380
+ let buttonViewSchema = await getButtonView(props);
16381
+ buttonsForColumnOperations.push(buttonViewSchema);
16200
16382
  }
16201
16383
  if (props.removable) {
16202
16384
  let buttonDeleteSchema = getButtonDelete(props);
@@ -16232,85 +16414,51 @@ const getAmisInputTableSchema = async (props) => {
16232
16414
  if (showAsInlineEditMode) {
16233
16415
  inputTableSchema.needConfirm = false;
16234
16416
  }
16235
- let dataProviderInited = `
16236
- // 单独维护一份中间变量changedItems,因为原变量在input-table组件有单独的作用域,翻页功能中无法维护此作用域中的行记录值
16237
- setData({ __changedItems: _.cloneDeep(data["${props.name}"]) || []});
16238
- `;
16239
- let onInitScript = `
16240
- // 上面dataProviderInited中setData有时不生效,没有成功给service组件设置__changedItems变量值
16241
- // 比如设计字段布局界面中的设置分组功能就因为__changedItems变量值不存在而报错,应该是因为把steedos-input-table组件单独放到弹出窗口中会有这个问题
16242
- // 所以额外在service init事件中手动设置一次__changedItems值
16243
- let __wrapperServiceId = event.data.__wrapperServiceId;
16244
- let fieldValue = _.cloneDeep(event.data["${props.name}"]) || [];
16245
- doAction({
16246
- "componentId": __wrapperServiceId,
16247
- "actionType": "setValue",
16248
- "args": {
16249
- "value": {
16250
- "__changedItems": fieldValue
16251
- }
16252
- }
16417
+ let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16418
+ if (amis) {
16419
+ // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
16420
+ delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
16421
+ Object.assign(inputTableSchema, amis);
16422
+ }
16423
+ const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
16424
+ return item.depend_on;
16425
+ });
16426
+ if (isAnyFieldHasDependOn) {
16427
+ // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
16428
+ Object.assign(inputTableSchema, {
16429
+ strictMode: false
16253
16430
  });
16254
- // 下面的doAction好像不是必须的
16255
- // doAction({
16256
- // "componentId": "${props.id}",
16257
- // "actionType": "setValue",
16258
- // "args": {
16259
- // "value": fieldValue
16260
- // }
16261
- // });
16262
- `;
16263
- let schema = {
16264
- "type": "service",
16265
- "body": [
16266
- inputTableSchema
16267
- ],
16268
- "className": props.className,
16269
- "id": serviceId,
16270
- "data": {
16271
- "__wrapperServiceId": serviceId
16272
- },
16273
- "dataProvider": {
16274
- "inited": dataProviderInited
16275
- },
16276
- "onEvent": {
16277
- "init": {
16278
- "actions": [
16279
- {
16280
- "actionType": "custom",
16281
- "script": onInitScript
16282
- }
16283
- ]
16284
- }
16285
- }
16286
- };
16431
+ }
16432
+ let schemaBody = [inputTableSchema];
16287
16433
  let footerToolbar = clone(props.footerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
16288
16434
  if (props.addable) {
16289
16435
  let buttonNewSchema = await getButtonNew(props);
16290
16436
  footerToolbar.unshift(buttonNewSchema);
16291
16437
  }
16292
16438
  if (footerToolbar.length) {
16293
- schema.body.push({
16439
+ schemaBody.push({
16294
16440
  "type": "wrapper",
16295
16441
  "size": "none",
16296
16442
  "body": footerToolbar
16297
16443
  });
16298
16444
  }
16299
- let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16300
- if (amis) {
16301
- // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
16302
- delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
16303
- Object.assign(schema.body[0], amis);
16304
- }
16305
- const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
16306
- return item.depend_on;
16307
- });
16308
- if(isAnyFieldHasDependOn){
16309
- // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
16310
- Object.assign(schema.body[0], {
16311
- strictMode: false
16445
+ // 直接把headerToolbar unshift进schemaBody,不会显示在label下面,而是显示在上面了,这个暂时没有解决办法,只能等amis 升级
16446
+ // 看起来amis官方后续会支持给input-table组件配置headerToolbar,见:https://github.com/baidu/amis/issues/7246
16447
+ // 不过依然放开此功能的意义在于有的场景字段label本来就不需要显示出来,此时headerToolbar就有意义
16448
+ let headerToolbar = clone(props.headerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
16449
+ if (headerToolbar.length) {
16450
+ schemaBody.unshift({
16451
+ "type": "wrapper",
16452
+ "size": "none",
16453
+ "body": headerToolbar
16312
16454
  });
16313
16455
  }
16456
+ let schema = {
16457
+ "type": "service",
16458
+ "body": schemaBody,
16459
+ "className": props.className,
16460
+ "id": serviceId
16461
+ };
16314
16462
  // console.log("===schema===", schema);
16315
16463
  return schema;
16316
16464
  };
@@ -19331,7 +19479,7 @@ var SteedosDropdownButton = function (props) {
19331
19479
  env.fetcher(onOpenApi, createObject(data, {})).then(function (result) {
19332
19480
  var openData = (result === null || result === void 0 ? void 0 : result.hasOwnProperty('ok')) ? result.data : result;
19333
19481
  setMenu(getMenu(render, buttons, btnClassName, {
19334
- data: createObject(data, defaultsDeep$1(openData, data))
19482
+ data: createObject(data, defaultsDeep$1(openData, data, { record: data }))
19335
19483
  }));
19336
19484
  }).catch(function (e) {
19337
19485
  console.error(e);
@@ -20551,14 +20699,16 @@ var AmisLogo = function (props) { return __awaiter(void 0, void 0, void 0, funct
20551
20699
  }); };
20552
20700
 
20553
20701
  var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20554
- var _a, stacked, overflow, appId, data, _b, links, _c, showIcon, _d, className, _e, indentSize, selectedId, schema;
20702
+ var _a, stacked, overflow, appId, data, _b, links, _c, showIcon, _d, className, _e, indentSize, selectedId, badgeText, schema;
20555
20703
  return __generator(this, function (_f) {
20556
20704
  _a = props.stacked, stacked = _a === void 0 ? false : _a, overflow = props.overflow, appId = props.appId, data = props.data, _b = props.links, links = _b === void 0 ? null : _b, _c = props.showIcon, showIcon = _c === void 0 ? true : _c, _d = props.className, className = _d === void 0 ? '' : _d, _e = props.indentSize, indentSize = _e === void 0 ? 12 : _e, selectedId = props.selectedId;
20557
20705
  if (!appId) {
20558
20706
  appId = data.context.appId || 'admin';
20559
20707
  }
20560
- // console.log(`AmisAppMenu appId`, appId)
20561
- // console.log(`AmisAppMenu`, appId, props)
20708
+ badgeText = "${ss:keyvalues.badge.value | pick:".concat(appId, " | toInt}");
20709
+ if (appId == "approve_workflow") {
20710
+ badgeText = "${ss:keyvalues.badge.value | pick:'workflow' | toInt}";
20711
+ }
20562
20712
  if (links) {
20563
20713
  return [2 /*return*/, {
20564
20714
  "type": "nav",
@@ -20574,7 +20724,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
20574
20724
  schemaApi: {
20575
20725
  "method": "get",
20576
20726
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
20577
- "adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
20727
+ "adaptor": "\n try {\n // console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n const locationPathname = window.location.pathname;\n var customTabId = \"\";\n var objectTabId = \"").concat(data.tabId, "\";\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n })\n })\n } else {\n var tabGroup = _.find(tab_groups, {\"group_name\": groupName});\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": tabGroup && tabGroup.default_open != false,\n \"isGroup\": true,\n \"children\": _.sortBy(_.map(tabs, (tab) => {\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n }\n }),(tab) => {return tab.index})\n }) \n }\n });\n \n }else{\n _.each(payload.children, (tab)=>{\n if(locationPathname == tab.path){\n customTabId = tab.id;\n }else if(locationPathname.startsWith(tab.path + \"/\")){\n objectTabId = tab.id;\n }\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 whitespace-normal leading-6 block -ml-px no-underline group flex items-center text-[14px] rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target,\n \"id\": tab.id,\n \"activeOn\": \"\\\\${tabId == '\"+ tab.id +\"'}\",\n \"index\": tab.index\n // active: selectedId === tab.id,\n });\n })\n }\n //\u4EE5\u4E0B\u4E3Anav\u7B2C\u4E00\u5C42\u6392\u5E8F\uFF0C\u5305\u62EC\u5206\u7EC4\u4E0E\u9009\u9879\u5361\n // let groupLength = ((payload.tab_groups && payload.tab_groups.length) || 0) + 1000;\n data.nav = _.sortBy(data.nav, function(tab){\n if(tab.isGroup){\n return _.findIndex(payload.tab_groups, function(group){\n return group.group_name === tab.label;\n });\n }else{\n // \u6CA1\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u6309index\u6392\u5217\u5728\u6709\u5206\u7EC4\u7684\u9009\u9879\u5361\u524D\u65B9\n return (tab.index || 0) - 1000;\n }\n })\n payload.data = {\n \"type\":\"service\",\n \"data\":{\n \"tabId\": customTabId || objectTabId,\n \"items\": data.nav\n },\n \"id\": \"appMenuService\",\n \"body\":{\n \"type\": \"nav\",\n className: \"").concat(className, " text-black\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"source\": \"${items}\",\n //\u5DE6\u5C42\u663E\u793A\u65F6\u5BA1\u6279\u5355\u663E\u793Abadge\u6570\u91CF\n \"itemBadge\": {\n \"mode\": \"text\",\n \"text\": \"").concat(badgeText, "\",\n \"visibleOn\": \"${id == 'instances'}\",\n \"overflowCount\": 99,\n \"style\": stacked?{\n \"right\": \"20%\",\n \"margin-right\": \"-23px\",\n \"height\": \"20px\",\n \"border-radius\": \"10px\",\n \"font-size\": \"16px\",\n \"line-height\": \"18px\",\n \"top\": \"50%\"\n }:{\n \"transform\": \"translate(calc(50% - 17px), calc(-50% + 10px))\",\n \"border-radius\": \"6.5px\",\n \"height\": \"15px\",\n \"line-height\": \"13px\",\n \"padding\": \"0px 4px\",\n \"font-size\": \"12px\"\n }\n },\n \"onEvent\": {\n \"click\": {\n \"actions\": [\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.item.id}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.item.id}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n },\n \"@tabId.changed\":{\n \"actions\":[\n {\n \"actionType\": \"setValue\",\n \"componentId\": \"appMenuService\",\n \"args\": {\n \"value\": {\n \"tabId\": \"${event.data.tabId}\",\n \"items\": data.nav\n }\n },\n \"expression\":\"${event.data.tabId}\"\n },\n {\n \"actionType\": \"custom\",\n \"script\" : \"window.postMessage(Object.assign({type: 'nav.click', data: event.data.item}), '*');\"\n }\n ]\n }\n }\n }\n };\n } catch (error) {\n console.log(`error`, error)\n }\n // console.log('payload===2==>', payload)\n return payload;\n "),
20578
20728
  "headers": {
20579
20729
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20580
20730
  }
@@ -21327,7 +21477,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21327
21477
  defaultSource = {
21328
21478
  "method": "post",
21329
21479
  "url": "${context.rootUrl}/graphql",
21330
- "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 = api.data[steedosField.name];\n if(_.isString(value)){\n value = [value]\n }\n filters = [referenceToField, \"in\", value || []];\n if(objectName == \"object_fields\"){\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 "),
21480
+ "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\"){\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 "),
21331
21481
  "trackExpression": "${" + steedosField.name + "}",
21332
21482
  "cache": 3000
21333
21483
  };
@@ -21762,7 +21912,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
21762
21912
  return __generator(this, function (_a) {
21763
21913
  switch (_a.label) {
21764
21914
  case 0:
21765
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.footerToolbar, props.inlineEditMode, props.strictMode;
21915
+ 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;
21766
21916
  return [4 /*yield*/, getAmisInputTableSchema(props)];
21767
21917
  case 1:
21768
21918
  amisSchema = _a.sent();