@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.
@@ -4931,21 +4931,21 @@ async function getQuickEditSchema(field, options){
4931
4931
  break;
4932
4932
  case "avatar":
4933
4933
  case "image":
4934
- quickEditSchema.body[0].receiver.adaptor = `
4935
- const { context } = api.body;
4936
- var rootUrl = context.rootUrl + "/api/files/${field.type}s/";
4937
- payload = {
4938
- status: response.status == 200 ? 0 : response.status,
4939
- msg: response.statusText,
4940
- data: {
4941
- value: rootUrl + payload._id,//为了实现图片crud的回显,需要将value从id改为url,当保存数据数据时,再在发送适配器内重新将id提取出来
4942
- name: payload.original.name,
4943
- url: rootUrl + payload._id,
4934
+ quickEditSchema.body[0].receiver.adaptor = `
4935
+ const { context } = api.body;
4936
+ var rootUrl = context.rootUrl + "/api/files/${field.type}s/";
4937
+ payload = {
4938
+ status: response.status == 200 ? 0 : response.status,
4939
+ msg: response.statusText,
4940
+ data: {
4941
+ value: rootUrl + payload._id,//为了实现图片crud的回显,需要将value从id改为url,当保存数据数据时,再在发送适配器内重新将id提取出来
4942
+ name: payload.original.name,
4943
+ url: rootUrl + payload._id,
4944
+ }
4944
4945
  }
4945
- }
4946
- return payload;
4947
- `;
4948
- break;
4946
+ return payload;
4947
+ `;
4948
+ break;
4949
4949
  }
4950
4950
  quickEditSchema.body[0].visibleOn = "${quickedit_record_permissions.allowEdit && quickedit_record_permissions_loading == false}";
4951
4951
  quickEditSchema.body.push({
@@ -5152,6 +5152,11 @@ async function getQuickEditSchema(field, options){
5152
5152
  if(field.type == "location"){
5153
5153
  quickEditSchema = false;
5154
5154
  }
5155
+ if(field.type == "color"){
5156
+ quickEditSchema = {
5157
+ type: "input-color"
5158
+ };
5159
+ }
5155
5160
  }
5156
5161
  return quickEditSchema;
5157
5162
  }
@@ -11137,7 +11142,8 @@ function getObjectFooterToolbar(mainObject, formFactor, options) {
11137
11142
  {
11138
11143
  "type": "pagination",
11139
11144
  "maxButtons": 5,
11140
- "showPageInput": false
11145
+ "showPageInput": true,
11146
+ "layout": "total,pager,go"
11141
11147
  }
11142
11148
  ]
11143
11149
  }
@@ -14703,6 +14709,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
14703
14709
  };
14704
14710
  if(readonly){
14705
14711
  convertData.defaultColor = null;
14712
+ }else {
14713
+ convertData.pipeIn = (value, data) => {
14714
+ if(value && value.indexOf('#')<0){
14715
+ return '#'+value;
14716
+ }
14717
+ return value;
14718
+ };
14706
14719
  }
14707
14720
  break;
14708
14721
  case 'boolean':
@@ -14719,7 +14732,16 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
14719
14732
  format:'YYYY-MM-DDT00:00:00.000[Z]',
14720
14733
  tpl: readonly ? getDateTpl(field) : null,
14721
14734
  // utc: true,
14722
- joinValues: false
14735
+ joinValues: false,
14736
+ "shortcuts": [
14737
+ "thismonth",
14738
+ "2monthsago",
14739
+ "3monthslater",
14740
+ "prevquarter",
14741
+ "thisquarter",
14742
+ "thisyear",
14743
+ "lastYear"
14744
+ ]
14723
14745
  };
14724
14746
  break;
14725
14747
  case 'date':
@@ -15130,6 +15152,8 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15130
15152
  let subFieldName = subField.name.replace(`${field.name}.$.`, '').replace(`${field.name}.`, '');
15131
15153
  if(subField.type === 'grid'){
15132
15154
  subField = await getGridFieldSubFields(subField, ctx.__formFields);
15155
+ }else if(subField.type === 'table'){
15156
+ subField = await getTabledFieldSubFields(subField, ctx.__formFields);
15133
15157
  }else {
15134
15158
  if(readonly){
15135
15159
  subFieldName = `${field.name}.${subFieldName}`;
@@ -15246,7 +15270,8 @@ async function getFieldSearchable(perField, permissionFields, ctx){
15246
15270
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15247
15271
  }
15248
15272
  if(_field.type === 'datetime'){
15249
- _field.type = 'input-datetime-range';
15273
+ // 特意改为日期范围而不是日期时间范围,因为搜索时一般精确到日期就足够了,需要精确到日期时间范围需要在字段上配置amis属性来实现
15274
+ _field.type = 'input-date-range';
15250
15275
  _field.is_wide = true;
15251
15276
  fieldNamePrefix = `${fieldNamePrefix}between__`;
15252
15277
  }
@@ -15558,7 +15583,7 @@ async function getFormBody(permissionFields, formFields, ctx){
15558
15583
  * @Author: 殷亮辉 yinlianghui@hotoa.com
15559
15584
  * @Date: 2023-11-15 09:50:22
15560
15585
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
15561
- * @LastEditTime: 2023-12-16 16:39:49
15586
+ * @LastEditTime: 2023-12-23 22:13:22
15562
15587
  */
15563
15588
 
15564
15589
  /**
@@ -15604,6 +15629,28 @@ function getInputTableCell(field, showAsInlineEditMode) {
15604
15629
  }
15605
15630
  }
15606
15631
 
15632
+ function getComponentId(name, tag) {
15633
+ let id = "";
15634
+ switch (name) {
15635
+ case "table_service":
15636
+ id = `service_wrapper__${tag}`;
15637
+ break;
15638
+ case "form_pagination":
15639
+ id = `service_popup_pagination_wrapper__${tag}`;
15640
+ break;
15641
+ case "form":
15642
+ id = `form_popup__${tag}`;
15643
+ break;
15644
+ case "dialog":
15645
+ id = `dialog_popup__${tag}`;
15646
+ break;
15647
+ default:
15648
+ id = `${name}__${tag}`;
15649
+ break;
15650
+ }
15651
+ return id;
15652
+ }
15653
+
15607
15654
  /**
15608
15655
  * @param {*} props
15609
15656
  * @param {*} mode edit/new/readonly
@@ -15651,39 +15698,46 @@ async function getInputTableColumns(props) {
15651
15698
  }
15652
15699
  }
15653
15700
 
15654
- function getFormPagination(props) {
15701
+ /**
15702
+ * @param {*} props input-table组件props
15703
+ * @param {*} mode edit/new/readonly
15704
+ * @returns 翻页组件
15705
+ */
15706
+ function getFormPagination(props, mode) {
15707
+ let showPagination = true;
15708
+ if(mode === "new" && !!!props.editable){
15709
+ //不允许编辑只允许新建时不应该让用户操作翻页
15710
+ showPagination = false;
15711
+ }
15712
+ let buttonPrevId = getComponentId("button_prev", props.id);
15713
+ let buttonNextId = getComponentId("button_next", props.id);
15714
+ let formId = getComponentId("form", props.id);
15715
+ let tableServiceId = getComponentId("table_service", props.id);
15716
+ let formPaginationId = getComponentId("form_pagination", props.id);
15655
15717
  let onPageChangeScript = `
15656
15718
  let scope = event.context.scoped;
15657
- let __paginationServiceId = event.data.__paginationServiceId;
15658
- let __wrapperServiceId = event.data.__wrapperServiceId;
15659
- let __formId = event.data.__formId;
15660
- let fieldValue = event.data.__changedItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.changedItems,直接变更其值即可改变表单中的值
15719
+ let __paginationServiceId = "${formPaginationId}";
15720
+ let __wrapperServiceId = "${tableServiceId}";
15721
+ let __formId = "${formId}";
15722
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
15661
15723
  let pageChangeDirection = context.props.pageChangeDirection;
15724
+ // event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
15725
+ // 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
15726
+ // 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
15727
+ // let currentPage = currentIndex + 1;
15662
15728
  let currentPage = event.data.__page;
15663
15729
  let currentIndex = event.data.index;
15664
-
15665
- // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量changedItems中
15730
+ // 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
15666
15731
  let currentFormValues = scope.getComponentById(__formId).getValues();
15667
15732
  fieldValue[currentIndex] = currentFormValues;
15668
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15669
- // doAction({
15670
- // "componentId": __wrapperServiceId,
15671
- // "actionType": "setValue",
15672
- // "args": {
15673
- // "value": {
15674
- // "__changedItems": fieldValue
15675
- // }
15676
- // }
15677
- // });
15678
- // 如果翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,需要额外给正式表单字段执行一次setValue
15679
- // 但是同时保存到正式表单字段中会造成翻页后点击取消无法取消翻页之前的改动内容
15680
- // doAction({
15681
- // "componentId": "${props.id}",
15682
- // "actionType": "setValue",
15683
- // "args": {
15684
- // "value": fieldValue
15685
- // }
15686
- // });
15733
+ // 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
15734
+ doAction({
15735
+ "componentId": "${props.id}",
15736
+ "actionType": "setValue",
15737
+ "args": {
15738
+ "value": fieldValue
15739
+ }
15740
+ });
15687
15741
 
15688
15742
  // 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
15689
15743
  let targetPage;
@@ -15694,7 +15748,7 @@ function getFormPagination(props) {
15694
15748
  targetPage = currentPage - 1;
15695
15749
  }
15696
15750
  let targetIndex = targetPage - 1;//input-table组件行索引,从0开始的索引
15697
- // let targetFormData = __changedItems[targetIndex];
15751
+ // let targetFormData = __tableItems[targetIndex];
15698
15752
  doAction({
15699
15753
  "actionType": "setValue",
15700
15754
  "componentId": __paginationServiceId,
@@ -15717,7 +15771,8 @@ function getFormPagination(props) {
15717
15771
  `;
15718
15772
  return {
15719
15773
  "type": "wrapper",
15720
- "className": "py-2",
15774
+ "size": "none",
15775
+ "className": "mr-1",
15721
15776
  "body": [
15722
15777
  {
15723
15778
  "type": "button",
@@ -15725,8 +15780,9 @@ function getFormPagination(props) {
15725
15780
  "icon": `fa fa-angle-left`,
15726
15781
  "level": "link",
15727
15782
  "pageChangeDirection": "prev",
15728
- "disabledOn": "${__page <= 1}",
15783
+ "disabledOn": showPagination ? "${__page <= 1}" : "true",
15729
15784
  "size": "sm",
15785
+ "id": buttonPrevId,
15730
15786
  "onEvent": {
15731
15787
  "click": {
15732
15788
  "actions": [
@@ -15740,7 +15796,7 @@ function getFormPagination(props) {
15740
15796
  },
15741
15797
  {
15742
15798
  "type": "tpl",
15743
- "tpl": "${__page}/${__total}"
15799
+ "tpl": "${__page}/${__tableItems.length}"
15744
15800
  },
15745
15801
  {
15746
15802
  "type": "button",
@@ -15748,8 +15804,9 @@ function getFormPagination(props) {
15748
15804
  "icon": `fa fa-angle-right`,
15749
15805
  "level": "link",
15750
15806
  "pageChangeDirection": "next",
15751
- "disabledOn": "${__page >= __total}",
15807
+ "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
15752
15808
  "size": "sm",
15809
+ "id": buttonNextId,
15753
15810
  "onEvent": {
15754
15811
  "click": {
15755
15812
  "actions": [
@@ -15769,30 +15826,27 @@ function getFormPagination(props) {
15769
15826
  * 传入formSchema输出带翻页容器的wrapper
15770
15827
  * @param {*} props input-table组件props
15771
15828
  * @param {*} form formSchema
15772
- * @param {*} mode edit/readonly
15829
+ * @param {*} mode edit/new/readonly
15773
15830
  * @returns 带翻页容器的wrapper
15774
15831
  */
15775
15832
  function getFormPaginationWrapper(props, form, mode) {
15776
- let serviceId = `service_popup_pagination_wrapper__${props.id}`;
15777
- // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15778
- // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15779
- // 只读的时候不可以走中间变量__changedItems,比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__changedItems值是修改前的值
15780
- let formValues = mode === "readonly" ? `\${${props.name}[__super.index]}` : "${__changedItems[__super.index]}";
15781
- // 这时用__readonlyItemsLength是因为`\${${props.name}.length}`拿不到值
15782
- let totalValue = mode === "readonly" ? "${__readonlyItemsLength}" : "${__changedItems.length}";
15833
+ console.log("==getFormPaginationWrapper===", props, mode);
15834
+ let serviceId = getComponentId("form_pagination", props.id);
15835
+ let tableServiceId = getComponentId("table_service", props.id);
15783
15836
  let innerForm = Object.assign({}, form, {
15784
15837
  "data": {
15785
- // "&": "${__changedItems[__super.index]}"
15786
- "&": formValues,
15838
+ // 这里加__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15839
+ // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15840
+ "&": "${__tableItems[__super.index]}"
15787
15841
  }
15788
15842
  });
15789
15843
  let formBody = [
15790
15844
  {
15791
15845
  "type": "wrapper",
15792
15846
  "size": "none",
15793
- "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",
15847
+ "className": "flex justify-end sticky top-0 right-0 left-0 z-20 bg-white -mt-2",
15794
15848
  "body": [
15795
- getFormPagination(props)
15849
+ getFormPagination(props, mode)
15796
15850
  ]
15797
15851
  },
15798
15852
  {
@@ -15806,49 +15860,45 @@ function getFormPaginationWrapper(props, form, mode) {
15806
15860
  }
15807
15861
  ];
15808
15862
  let onServiceInitedScript = `
15809
- // 以下脚本在inlineEditMode模式时才有必要执行(不过执行了也没有坏处,纯粹是没必要),是为了解决:
15810
- // inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
15811
- // 思路是每次弹出form之前先把其changedItems同步更新为最新值,这样就能在弹出form中包含单元格中做的修改
15863
+ // 以下脚本是为了解决有时弹出编辑表单时,表单中的值比最后一次编辑保存的值会延迟一拍。
15864
+ // 比如:inlineEditMode模式时,用户在表格单元格中直接修改数据,然后弹出的表单form中并没有包含单元格中修改的内容
15865
+ // 另外有的地方在非inlineEditMode模式时也会有这种延迟一拍问题,比如对象字段中下拉框类型字段的”选择项“属性
15866
+ // 再比如工作流规则详细页面修改了子表字段”时间触发器“值后,在只读界面点击查看按钮弹出的表单中__tableItems值是修改前的值
15867
+ // 处理思路是每次弹出form之前先把其__tableItems同步更新为最新值,这样就能在弹出form中包含单元格中做的修改
15812
15868
  // 注意:service init事件只会在每次弹出窗口时才执行,在触发翻页时并不会触发service init事件
15813
- let inlineEditMode = ${props.inlineEditMode};
15814
- if(!inlineEditMode){
15815
- return;
15816
- }
15817
15869
  let scope = event.context.scoped;
15818
- let __wrapperServiceId = event.data.__wrapperServiceId;
15870
+ let __wrapperServiceId = "${tableServiceId}";
15819
15871
  let wrapperService = scope.getComponentById(__wrapperServiceId);
15820
15872
  let wrapperServiceData = wrapperService.getData();
15821
15873
  let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
15822
- //不可以直接像event.data.__changedItems = originalFieldValue; 这样整个赋值,否则作用域会断
15823
- event.data.__changedItems.forEach(function(n,i){
15824
- event.data.__changedItems[i] = lastestFieldValue[i];
15874
+ //不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
15875
+ event.data.__tableItems.forEach(function(n,i){
15876
+ event.data.__tableItems[i] = lastestFieldValue[i];
15825
15877
  });
15826
15878
  `;
15827
15879
  let schema = {
15828
15880
  "type": "service",
15829
15881
  "id": serviceId,
15830
15882
  "schemaApi": {
15831
- "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
15832
- // "url": "${context.rootUrl}/graphql",
15833
- "method": "post",
15834
- "headers": {
15835
- "Authorization": "Bearer ${context.tenantId},${context.authToken}"
15836
- },
15837
- "requestAdaptor": "api.data={query: '{spaces__findOne(id: \"none\"){_id,name}}'};return api;",
15883
+ // "url": "${context.rootUrl}/graphql?rebuildOn=${index}",
15884
+ "url": "${context.rootUrl}/api/v1/spaces/none",
15885
+ "trackExpression": "${index}",
15886
+ "method": "get",
15838
15887
  "adaptor": `
15839
15888
  const formBody = ${JSON.stringify(formBody)};
15840
15889
  return {
15841
15890
  "body": formBody
15842
15891
  }
15843
- `
15892
+ `,
15893
+ "cache": 600000
15844
15894
  },
15845
15895
  // "body": formBody,
15846
15896
  "data": {
15847
15897
  "__page": "${index + 1}",
15848
15898
  // "__total": `\${${props.name}.length}`,
15849
- "__total": totalValue,
15850
- "__paginationServiceId": serviceId,
15851
- "__formId": form.id
15899
+ // "__total": "${__tableItems.length}",
15900
+ // "__paginationServiceId": serviceId,
15901
+ // "__formId": form.id
15852
15902
  },
15853
15903
  "onEvent": {
15854
15904
  "init": {
@@ -15868,13 +15918,15 @@ function getFormPaginationWrapper(props, form, mode) {
15868
15918
  * @param {*} props
15869
15919
  * @param {*} mode edit/new/readonly
15870
15920
  */
15871
- async function getForm(props, mode = "edit") {
15921
+ async function getForm(props, mode = "edit", formId) {
15872
15922
  let formFields = getFormFields(props, mode);
15873
15923
  let body = await getFormBody(null, formFields);
15874
- let forId = `form_popup__${props.id}`;
15924
+ if (!formId) {
15925
+ formId = getComponentId("form", props.id);
15926
+ }
15875
15927
  let schema = {
15876
15928
  "type": "form",
15877
- "id": forId,
15929
+ "id": formId,
15878
15930
  "title": "表单",
15879
15931
  "debug": false,
15880
15932
  "mode": "normal",
@@ -15886,8 +15938,7 @@ async function getForm(props, mode = "edit") {
15886
15938
  if (mode === "edit") {
15887
15939
  let onEditItemSubmitScript = `
15888
15940
  // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
15889
- let fieldValue = event.data.__changedItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.changedItems,直接变更其值即可改变表单中的值
15890
-
15941
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
15891
15942
  //这里加__super.__super前缀是因为__parentForm变量(即主表单)中可能会正好有名为index的字段
15892
15943
  // 比如“对象字段”对象options字段是一个子表字段,但是主表(即“对象字段”对象)中正好有一个名为index的字段
15893
15944
  fieldValue[event.data.__super.__super.index] = JSON.parse(JSON.stringify(event.data));
@@ -15898,16 +15949,6 @@ async function getForm(props, mode = "edit") {
15898
15949
  "value": fieldValue
15899
15950
  }
15900
15951
  });
15901
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15902
- // doAction({
15903
- // "componentId": event.data.__wrapperServiceId,
15904
- // "actionType": "setValue",
15905
- // "args": {
15906
- // "value": {
15907
- // "__changedItems": fieldValue
15908
- // }
15909
- // }
15910
- // });
15911
15952
  `;
15912
15953
  Object.assign(schema, {
15913
15954
  "onEvent": {
@@ -15935,29 +15976,30 @@ async function getForm(props, mode = "edit") {
15935
15976
  }
15936
15977
  else if (mode === "new") {
15937
15978
  let onNewItemSubmitScript = `
15938
- // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
15939
- if(!event.data.__changedItems){
15940
- event.data.__changedItems = [];
15979
+ let newItem = JSON.parse(JSON.stringify(event.data));
15980
+ if(event.data["${props.name}"]){
15981
+ // let fieldValue = event.data.__tableItems;
15982
+ // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
15983
+ let fieldValue = event.data["${props.name}"];
15984
+ fieldValue.push(newItem);
15985
+ doAction({
15986
+ "componentId": "${props.id}",
15987
+ "actionType": "setValue",
15988
+ "args": {
15989
+ "value": fieldValue
15990
+ }
15991
+ });
15992
+ }
15993
+ else{
15994
+ // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
15995
+ doAction({
15996
+ "componentId": "${props.id}",
15997
+ "actionType": "setValue",
15998
+ "args": {
15999
+ "value": [newItem]
16000
+ }
16001
+ });
15941
16002
  }
15942
- let fieldValue = event.data.__changedItems;
15943
- fieldValue.push(JSON.parse(JSON.stringify(event.data)));
15944
- doAction({
15945
- "componentId": "${props.id}",
15946
- "actionType": "setValue",
15947
- "args": {
15948
- "value": fieldValue
15949
- }
15950
- });
15951
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
15952
- // doAction({
15953
- // "componentId": event.data.__wrapperServiceId,
15954
- // "actionType": "setValue",
15955
- // "args": {
15956
- // "value": {
15957
- // "__changedItems": fieldValue
15958
- // }
15959
- // }
15960
- // });
15961
16003
  `;
15962
16004
  Object.assign(schema, {
15963
16005
  "onEvent": {
@@ -15983,12 +16025,271 @@ async function getForm(props, mode = "edit") {
15983
16025
  }
15984
16026
  });
15985
16027
  }
15986
- if (mode === "edit" || mode === "readonly") {
15987
- schema = getFormPaginationWrapper(props, schema, mode);
15988
- }
16028
+ schema = getFormPaginationWrapper(props, schema, mode);
15989
16029
  return schema;
15990
16030
  }
15991
16031
 
16032
+
16033
+ /**
16034
+ * 编辑、新增和查看按钮actions
16035
+ * @param {*} props
16036
+ * @param {*} mode edit/new/readonly
16037
+ */
16038
+ async function getButtonActions(props, mode) {
16039
+ let actions = [];
16040
+ let formId = getComponentId("form", props.id);
16041
+ let dialogId = getComponentId("dialog", props.id);
16042
+ let buttonNextId = getComponentId("button_next", props.id);
16043
+ let formPaginationId = getComponentId("form_pagination", props.id);
16044
+ if (mode == "new" || mode == "edit") {
16045
+ // let actionShowNewDialog = {
16046
+ // "actionType": "dialog",
16047
+ // "dialog": {
16048
+ // "type": "dialog",
16049
+ // "title": "新增行",
16050
+ // "body": [
16051
+ // await getForm(props, "new", formId)
16052
+ // ],
16053
+ // "size": "lg",
16054
+ // "showCloseButton": true,
16055
+ // "showErrorMsg": true,
16056
+ // "showLoading": true,
16057
+ // "className": "app-popover",
16058
+ // "closeOnEsc": false,
16059
+ // "onEvent": {
16060
+ // "confirm": {
16061
+ // "actions": [
16062
+ // {
16063
+ // "actionType": "validate",
16064
+ // "componentId": formId
16065
+ // },
16066
+ // {
16067
+ // "preventDefault": true,
16068
+ // "expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16069
+ // }
16070
+ // ]
16071
+ // }
16072
+ // }
16073
+ // }
16074
+ // };
16075
+ let onSaveAndNewItemScript = `
16076
+ let scope = event.context.scoped;
16077
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16078
+ // 新建一条空白行并保存到子表组件
16079
+ fieldValue.push({});
16080
+ doAction({
16081
+ "componentId": "${props.id}",
16082
+ "actionType": "setValue",
16083
+ "args": {
16084
+ "value": fieldValue
16085
+ }
16086
+ });
16087
+ let buttonNextId = "${buttonNextId}";
16088
+ let __paginationServiceId = "${formPaginationId}";
16089
+ let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16090
+ event.data.index = __paginationData.index;
16091
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16092
+ // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16093
+ scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16094
+ `;
16095
+ let onSaveAndCopyItemScript = `
16096
+ let scope = event.context.scoped;
16097
+ let __formId = "${formId}";
16098
+ // let newItem = JSON.parse(JSON.stringify(event.data));
16099
+ let newItem = scope.getComponentById(__formId).getValues();//这里不可以用event.data,因为其拿到的是弹出表单时的初始值,不是用户实时填写的数据
16100
+ let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
16101
+ // 复制当前页数据到新建行并保存到子表组件
16102
+ fieldValue.push(newItem);
16103
+ doAction({
16104
+ "componentId": "${props.id}",
16105
+ "actionType": "setValue",
16106
+ "args": {
16107
+ "value": fieldValue
16108
+ }
16109
+ });
16110
+ let buttonNextId = "${buttonNextId}";
16111
+ let __paginationServiceId = "${formPaginationId}";
16112
+ let __paginationData = scope.getComponentById(__paginationServiceId).getData();
16113
+ event.data.index = __paginationData.index;
16114
+ event.data.__page = fieldValue.length - 1;//这里不可以用Object.assign否则,event.data中上层作用域数据会丢失
16115
+ // 触发翻页按钮事件,实现保存当前页数据并跳转到最后一行
16116
+ scope.getComponentById(buttonNextId).props.dispatchEvent("click", event.data);
16117
+ `;
16118
+ let dialogButtons = [
16119
+ {
16120
+ "type": "button",
16121
+ "label": "完成",
16122
+ "actionType": "confirm",
16123
+ "level": "primary"
16124
+ }
16125
+ ];
16126
+ if(props.addable){
16127
+ dialogButtons = [
16128
+ {
16129
+ "type": "button",
16130
+ "label": "新增",
16131
+ "tooltip": "保存并新增一行,即保存当前行数据并新增一条空白行",
16132
+ "onEvent": {
16133
+ "click": {
16134
+ "actions": [
16135
+ {
16136
+ "actionType": "custom",
16137
+ "script": onSaveAndNewItemScript
16138
+ }
16139
+ ]
16140
+ }
16141
+ }
16142
+ },
16143
+ {
16144
+ "type": "button",
16145
+ "label": "复制",
16146
+ "tooltip": "复制并新增一行,即保存当前行数据并复制当前行数据到新增行",
16147
+ "onEvent": {
16148
+ "click": {
16149
+ "actions": [
16150
+ {
16151
+ "actionType": "custom",
16152
+ "script": onSaveAndCopyItemScript
16153
+ }
16154
+ ]
16155
+ }
16156
+ }
16157
+ },
16158
+ dialogButtons[0]
16159
+ ];
16160
+ }
16161
+ let actionShowEditDialog = {
16162
+ "actionType": "dialog",
16163
+ "dialog": {
16164
+ "type": "dialog",
16165
+ "id": dialogId,
16166
+ "title": `\${uiSchema.fields.${props.name}.label} 明细`,
16167
+ "body": [
16168
+ await getForm(props, mode, formId)
16169
+ ],
16170
+ "size": "lg",
16171
+ "showCloseButton": true,
16172
+ "showErrorMsg": true,
16173
+ "showLoading": true,
16174
+ "className": "app-popover",
16175
+ "closeOnEsc": false,
16176
+ "data": {
16177
+ // 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16178
+ // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16179
+ // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16180
+ // "&": "${record || {}}",
16181
+ // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16182
+ // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16183
+ // "__parentForm": "${__super.__super || {}}",
16184
+ "__parentForm": mode == "new" ? "$$" : "${__super.__super || {}}",
16185
+ "global": "${global}",
16186
+ "uiSchema": "${uiSchema}",
16187
+ "index": "${index}",
16188
+ // "__tableItems": `\${${props.name}}`
16189
+ // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16190
+ // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16191
+ "__tableItems": `\${${props.name}|json|toJson}`
16192
+ },
16193
+ "actions": dialogButtons,
16194
+ "onEvent": {
16195
+ "confirm": {
16196
+ "actions": [
16197
+ {
16198
+ "actionType": "validate",
16199
+ "componentId": formId
16200
+ },
16201
+ {
16202
+ "preventDefault": true,
16203
+ "expression": "${event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
16204
+ }
16205
+ ]
16206
+ }
16207
+ }
16208
+ }
16209
+ };
16210
+ if (props.dialog) {
16211
+ Object.assign(actionShowEditDialog.dialog, props.dialog);
16212
+ }
16213
+ if (mode == "new") {
16214
+ let onNewLineScript = `
16215
+ let newItem = {};
16216
+ if(event.data["${props.name}"]){
16217
+ // let fieldValue = event.data.__tableItems;
16218
+ // 这里不用__tableItems是因为新建的时候没有翻页,里面没有也不需要走__tableItems变量
16219
+ let fieldValue = event.data["${props.name}"];
16220
+ fieldValue.push(newItem);
16221
+ doAction({
16222
+ "componentId": "${props.id}",
16223
+ "actionType": "setValue",
16224
+ "args": {
16225
+ "value": fieldValue
16226
+ }
16227
+ });
16228
+ event.data.index = fieldValue.length - 1;
16229
+ }
16230
+ else{
16231
+ // 这里不可以执行event.data["${props.name}"]=[newItem],数据域会断掉
16232
+ doAction({
16233
+ "componentId": "${props.id}",
16234
+ "actionType": "setValue",
16235
+ "args": {
16236
+ "value": [newItem]
16237
+ }
16238
+ });
16239
+ event.data.index = 1;
16240
+ }
16241
+ `;
16242
+ let actionNewLine = {
16243
+ "actionType": "custom",
16244
+ "script": onNewLineScript
16245
+ };
16246
+ actions = [actionNewLine, actionShowEditDialog];
16247
+ }
16248
+ else if (mode == "edit") {
16249
+ actions = [actionShowEditDialog];
16250
+ }
16251
+ }
16252
+ else if (mode == "readonly") {
16253
+ actions = [
16254
+ {
16255
+ "actionType": "dialog",
16256
+ "dialog": {
16257
+ "type": "dialog",
16258
+ "title": `\${uiSchema.fields.${props.name}.label} 明细`,
16259
+ "body": [
16260
+ await getForm(props, "readonly")
16261
+ ],
16262
+ "size": "lg",
16263
+ "showCloseButton": true,
16264
+ "showErrorMsg": true,
16265
+ "showLoading": true,
16266
+ "className": "app-popover",
16267
+ "closeOnEsc": false,
16268
+ "actions": [],
16269
+ "data": {
16270
+ // 这里必须加data数据映射,否则翻页功能中取__tableItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16271
+ // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16272
+ // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16273
+ // "&": "${record || {}}",
16274
+ // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16275
+ // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16276
+ // "__parentForm": "${__super.__super || {}}",
16277
+ "__parentForm": "${__super.__super || {}}",
16278
+ "global": "${global}",
16279
+ "uiSchema": "${uiSchema}",
16280
+ "index": "${index}",
16281
+ // "__tableItems": `\${${props.name}}`
16282
+ // 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
16283
+ // 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
16284
+ "__tableItems": `\${${props.name}|json|toJson}`
16285
+ },
16286
+ }
16287
+ }
16288
+ ];
16289
+ }
16290
+ return actions;
16291
+ }
16292
+
15992
16293
  async function getButtonNew(props) {
15993
16294
  return {
15994
16295
  "label": "新增",
@@ -15996,24 +16297,7 @@ async function getButtonNew(props) {
15996
16297
  "icon": "fa fa-plus",
15997
16298
  "onEvent": {
15998
16299
  "click": {
15999
- "actions": [
16000
- {
16001
- "actionType": "dialog",
16002
- "dialog": {
16003
- "type": "dialog",
16004
- "title": "新增行",
16005
- "body": [
16006
- await getForm(props, "new")
16007
- ],
16008
- "size": "lg",
16009
- "showCloseButton": true,
16010
- "showErrorMsg": true,
16011
- "showLoading": true,
16012
- "className": "app-popover",
16013
- "closeOnEsc": false
16014
- }
16015
- }
16016
- ]
16300
+ "actions": await getButtonActions(props, "new")
16017
16301
  }
16018
16302
  },
16019
16303
  "level": "primary"
@@ -16021,76 +16305,14 @@ async function getButtonNew(props) {
16021
16305
  }
16022
16306
 
16023
16307
  async function getButtonEdit(props, showAsInlineEditMode) {
16024
- let onCancelScript = `
16025
- let scope = event.context.scoped;
16026
- let __wrapperServiceId = event.data.__wrapperServiceId;
16027
- let wrapperService = scope.getComponentById(__wrapperServiceId);
16028
- let wrapperServiceData = wrapperService.getData();
16029
- let originalFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16030
- //不可以直接像event.data.__changedItems = originalFieldValue; 这样整个赋值,否则作用域会断,造成无法还原
16031
- event.data.__changedItems.forEach(function(n,i){
16032
- event.data.__changedItems[i] = originalFieldValue[i];
16033
- });
16034
- // 因为翻页form中用的是event.data.changedItems中的数据,所以像下面这样doAction setValue无法实现还原
16035
- // doAction({
16036
- // "componentId": __wrapperServiceId,
16037
- // "actionType": "setValue",
16038
- // "args": {
16039
- // "value": {
16040
- // "__changedItems": originalFieldValue
16041
- // }
16042
- // }
16043
- // });
16044
- `;
16045
16308
  return {
16046
16309
  "type": "button",
16047
16310
  "label": "",
16048
- "icon": `fa fa-${showAsInlineEditMode ? "expand" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
16311
+ "icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
16049
16312
  "level": "link",
16050
16313
  "onEvent": {
16051
16314
  "click": {
16052
- "actions": [
16053
- {
16054
- "actionType": "dialog",
16055
- "dialog": {
16056
- "type": "dialog",
16057
- "title": "编辑行",
16058
- "body": [
16059
- await getForm(props, "edit")
16060
- ],
16061
- "size": "lg",
16062
- "showCloseButton": true,
16063
- "showErrorMsg": true,
16064
- "showLoading": true,
16065
- "className": "app-popover",
16066
- "closeOnEsc": false,
16067
- "data": {
16068
- // 这里必须加data数据映射,否则翻页功能中取changedItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16069
- // 额外把华炎魔方主表记录ObjectForm中的字段值从record变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16070
- // 额外把global、uiSchema也映射过去,有可能要用,后续需要用到其他变更可以这里加映射
16071
- // "&": "${record || {}}",
16072
- // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有record变量
16073
- // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16074
- "__parentForm": "${__super.__super || {}}",
16075
- "global": "${global}",
16076
- "uiSchema": "${uiSchema}",
16077
- "index": "${index}",
16078
- "__changedItems": "${__changedItems}",
16079
- "__wrapperServiceId": "${__wrapperServiceId}"
16080
- },
16081
- "onEvent": {
16082
- "cancel": {
16083
- "actions": [
16084
- {
16085
- "actionType": "custom",
16086
- "script": onCancelScript
16087
- }
16088
- ]
16089
- }
16090
- }
16091
- }
16092
- }
16093
- ]
16315
+ "actions": await getButtonActions(props, "edit")
16094
16316
  }
16095
16317
  }
16096
16318
  };
@@ -16100,78 +16322,38 @@ async function getButtonView(props) {
16100
16322
  return {
16101
16323
  "type": "button",
16102
16324
  "label": "",
16103
- "icon": "fa fa-expand",//fa-external-link
16325
+ "icon": "fa fa-expand-alt",//fa-external-link
16104
16326
  "level": "link",
16105
16327
  "onEvent": {
16106
16328
  "click": {
16107
- "actions": [
16108
- {
16109
- "actionType": "dialog",
16110
- "dialog": {
16111
- "type": "dialog",
16112
- "title": "查看行",
16113
- "body": [
16114
- await getForm(props, "readonly")
16115
- ],
16116
- "size": "lg",
16117
- "showCloseButton": true,
16118
- "showErrorMsg": true,
16119
- "showLoading": true,
16120
- "className": "app-popover",
16121
- "closeOnEsc": false,
16122
- "actions": [],
16123
- "data": {
16124
- // 这里必须加data数据映射,否则翻页功能中取changedItems值时会乱,比如翻页编辑后会把上一页中没改过的字段值带过去
16125
- // 额外把华炎魔方主表记录ObjectForm中的字段值从formData变量中映射到子表form中,因为子表lookup字段filtersFunction中可能依赖了主表记录中的字段值,比如“工作流规则”对象“时间触发器”字段中的“日期字段”字段
16126
- // global、uiSchema等常用变量本来就在formData变量已经存在了,无需另外映射
16127
- // "&": "${formData || {}}",
16128
- // 换成从__super来映射上级表单数据是因为对象列表视图界面中每行下拉菜单中的编辑按钮弹出的表单中的子表所在作用域中没有formData变量
16129
- // 映射到中间变量__parentForm而不是直接用&展开映射是为了避免表单中字段名与作用域中变量重名
16130
- "__parentForm": "${__super.__super || {}}",
16131
- "index": "${index}",
16132
- "__changedItems": "${__changedItems}",
16133
- "__wrapperServiceId": "${__wrapperServiceId}",
16134
- "__readonlyItemsLength": `\${${props.name}.length}`
16135
- }
16136
- }
16137
- }
16138
- ]
16329
+ "actions": await getButtonActions(props, "readonly")
16139
16330
  }
16140
16331
  }
16141
16332
  };
16142
16333
  }
16143
16334
 
16144
16335
  function getButtonDelete(props) {
16336
+ let tableServiceId = getComponentId("table_service", props.id);
16145
16337
  let onDeleteItemScript = `
16146
- // let fieldValue = _.cloneDeep(event.data["${props.name}"]);
16147
- if(!event.data.__changedItems){
16148
- event.data.__changedItems = [];
16149
- }
16150
- let fieldValue = event.data.__changedItems;
16151
- // fieldValue.push(JSON.parse(JSON.stringify(event.data)));
16152
- fieldValue.splice(event.data.index, 1)
16338
+ // let fieldValue = event.data["${props.name}"];
16339
+ let scope = event.context.scoped;
16340
+ let __wrapperServiceId = "${tableServiceId}";
16341
+ let wrapperService = scope.getComponentById(__wrapperServiceId);
16342
+ let wrapperServiceData = wrapperService.getData();
16343
+ let lastestFieldValue = wrapperServiceData["${props.name}"];//这里不可以用event.data["${props.name}"]因为amis input talbe有一层单独的作用域,其值会延迟一拍
16344
+ lastestFieldValue.splice(event.data.index, 1);
16153
16345
  doAction({
16154
16346
  "componentId": "${props.id}",
16155
16347
  "actionType": "setValue",
16156
16348
  "args": {
16157
- "value": fieldValue
16349
+ "value": lastestFieldValue
16158
16350
  }
16159
16351
  });
16160
- // // 因为翻页form中用的是event.data.changedItems中的数据,所以不需要像下面这样doAction setValue变更中间变量changedItems值
16161
- // doAction({
16162
- // "componentId": event.data.__wrapperServiceId,
16163
- // "actionType": "setValue",
16164
- // "args": {
16165
- // "value": {
16166
- // "__changedItems": fieldValue
16167
- // }
16168
- // }
16169
- // });
16170
16352
  `;
16171
16353
  return {
16172
16354
  "type": "button",
16173
16355
  "label": "",
16174
- "icon": "fa fa-minus",
16356
+ "icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
16175
16357
  "level": "link",
16176
16358
  "onEvent": {
16177
16359
  "click": {
@@ -16197,20 +16379,22 @@ const getAmisInputTableSchema = async (props) => {
16197
16379
  if (!props.id) {
16198
16380
  props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
16199
16381
  }
16200
- let serviceId = `service_wrapper__${props.id}`;
16382
+ let serviceId = getComponentId("table_service", props.id);
16201
16383
  let buttonsForColumnOperations = [];
16202
16384
  let inlineEditMode = props.inlineEditMode;
16203
16385
  let showAsInlineEditMode = inlineEditMode && props.editable;
16204
16386
  if (props.editable) {
16205
16387
  let showEditButton = true;
16206
16388
  if (showAsInlineEditMode) {
16207
- // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16208
- if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16209
- showEditButton = true;
16210
- }
16211
- else {
16212
- showEditButton = false;
16213
- }
16389
+ // 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
16390
+ showEditButton = true;
16391
+ // // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
16392
+ // if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16393
+ // showEditButton = true;
16394
+ // }
16395
+ // else {
16396
+ // showEditButton = false;
16397
+ // }
16214
16398
  }
16215
16399
  // 编辑时显示编辑按钮
16216
16400
  if (showEditButton) {
@@ -16220,11 +16404,9 @@ const getAmisInputTableSchema = async (props) => {
16220
16404
  }
16221
16405
  else {
16222
16406
  // 只读时显示查看按钮
16223
- if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length) {
16224
- // 只在有列被隐藏时才需要显示查看按钮
16225
- let buttonViewSchema = await getButtonView(props);
16226
- buttonsForColumnOperations.push(buttonViewSchema);
16227
- }
16407
+ // 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < props.fields.length)
16408
+ let buttonViewSchema = await getButtonView(props);
16409
+ buttonsForColumnOperations.push(buttonViewSchema);
16228
16410
  }
16229
16411
  if (props.removable) {
16230
16412
  let buttonDeleteSchema = getButtonDelete(props);
@@ -16260,85 +16442,51 @@ const getAmisInputTableSchema = async (props) => {
16260
16442
  if (showAsInlineEditMode) {
16261
16443
  inputTableSchema.needConfirm = false;
16262
16444
  }
16263
- let dataProviderInited = `
16264
- // 单独维护一份中间变量changedItems,因为原变量在input-table组件有单独的作用域,翻页功能中无法维护此作用域中的行记录值
16265
- setData({ __changedItems: _.cloneDeep(data["${props.name}"]) || []});
16266
- `;
16267
- let onInitScript = `
16268
- // 上面dataProviderInited中setData有时不生效,没有成功给service组件设置__changedItems变量值
16269
- // 比如设计字段布局界面中的设置分组功能就因为__changedItems变量值不存在而报错,应该是因为把steedos-input-table组件单独放到弹出窗口中会有这个问题
16270
- // 所以额外在service init事件中手动设置一次__changedItems值
16271
- let __wrapperServiceId = event.data.__wrapperServiceId;
16272
- let fieldValue = _.cloneDeep(event.data["${props.name}"]) || [];
16273
- doAction({
16274
- "componentId": __wrapperServiceId,
16275
- "actionType": "setValue",
16276
- "args": {
16277
- "value": {
16278
- "__changedItems": fieldValue
16279
- }
16280
- }
16445
+ let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16446
+ if (amis) {
16447
+ // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
16448
+ delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
16449
+ Object.assign(inputTableSchema, amis);
16450
+ }
16451
+ const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
16452
+ return item.depend_on;
16453
+ });
16454
+ if (isAnyFieldHasDependOn) {
16455
+ // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
16456
+ Object.assign(inputTableSchema, {
16457
+ strictMode: false
16281
16458
  });
16282
- // 下面的doAction好像不是必须的
16283
- // doAction({
16284
- // "componentId": "${props.id}",
16285
- // "actionType": "setValue",
16286
- // "args": {
16287
- // "value": fieldValue
16288
- // }
16289
- // });
16290
- `;
16291
- let schema = {
16292
- "type": "service",
16293
- "body": [
16294
- inputTableSchema
16295
- ],
16296
- "className": props.className,
16297
- "id": serviceId,
16298
- "data": {
16299
- "__wrapperServiceId": serviceId
16300
- },
16301
- "dataProvider": {
16302
- "inited": dataProviderInited
16303
- },
16304
- "onEvent": {
16305
- "init": {
16306
- "actions": [
16307
- {
16308
- "actionType": "custom",
16309
- "script": onInitScript
16310
- }
16311
- ]
16312
- }
16313
- }
16314
- };
16459
+ }
16460
+ let schemaBody = [inputTableSchema];
16315
16461
  let footerToolbar = _$1.clone(props.footerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
16316
16462
  if (props.addable) {
16317
16463
  let buttonNewSchema = await getButtonNew(props);
16318
16464
  footerToolbar.unshift(buttonNewSchema);
16319
16465
  }
16320
16466
  if (footerToolbar.length) {
16321
- schema.body.push({
16467
+ schemaBody.push({
16322
16468
  "type": "wrapper",
16323
16469
  "size": "none",
16324
16470
  "body": footerToolbar
16325
16471
  });
16326
16472
  }
16327
- let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
16328
- if (amis) {
16329
- // 支持配置amis属性重写或添加最终生成的input-table中任何属性。
16330
- delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
16331
- Object.assign(schema.body[0], amis);
16332
- }
16333
- const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
16334
- return item.depend_on;
16335
- });
16336
- if(isAnyFieldHasDependOn){
16337
- // 有任意一个子字段有depend_on属性时,强制设置禁用静态模式
16338
- Object.assign(schema.body[0], {
16339
- strictMode: false
16473
+ // 直接把headerToolbar unshift进schemaBody,不会显示在label下面,而是显示在上面了,这个暂时没有解决办法,只能等amis 升级
16474
+ // 看起来amis官方后续会支持给input-table组件配置headerToolbar,见:https://github.com/baidu/amis/issues/7246
16475
+ // 不过依然放开此功能的意义在于有的场景字段label本来就不需要显示出来,此时headerToolbar就有意义
16476
+ let headerToolbar = _$1.clone(props.headerToolbar || []); //这里不clone的话,会造成死循环,应该是因为props属性变更会让组件重新渲染
16477
+ if (headerToolbar.length) {
16478
+ schemaBody.unshift({
16479
+ "type": "wrapper",
16480
+ "size": "none",
16481
+ "body": headerToolbar
16340
16482
  });
16341
16483
  }
16484
+ let schema = {
16485
+ "type": "service",
16486
+ "body": schemaBody,
16487
+ "className": props.className,
16488
+ "id": serviceId
16489
+ };
16342
16490
  // console.log("===schema===", schema);
16343
16491
  return schema;
16344
16492
  };
@@ -19359,7 +19507,7 @@ var SteedosDropdownButton = function (props) {
19359
19507
  env.fetcher(onOpenApi, createObject(data, {})).then(function (result) {
19360
19508
  var openData = (result === null || result === void 0 ? void 0 : result.hasOwnProperty('ok')) ? result.data : result;
19361
19509
  setMenu(getMenu(render, buttons, btnClassName, {
19362
- data: createObject(data, _$1.defaultsDeep(openData, data))
19510
+ data: createObject(data, _$1.defaultsDeep(openData, data, { record: data }))
19363
19511
  }));
19364
19512
  }).catch(function (e) {
19365
19513
  console.error(e);
@@ -20579,14 +20727,16 @@ var AmisLogo = function (props) { return __awaiter(void 0, void 0, void 0, funct
20579
20727
  }); };
20580
20728
 
20581
20729
  var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, function () {
20582
- var _a, stacked, overflow, appId, data, _b, links, _c, showIcon, _d, className, _e, indentSize, selectedId, schema;
20730
+ var _a, stacked, overflow, appId, data, _b, links, _c, showIcon, _d, className, _e, indentSize, selectedId, badgeText, schema;
20583
20731
  return __generator(this, function (_f) {
20584
20732
  _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;
20585
20733
  if (!appId) {
20586
20734
  appId = data.context.appId || 'admin';
20587
20735
  }
20588
- // console.log(`AmisAppMenu appId`, appId)
20589
- // console.log(`AmisAppMenu`, appId, props)
20736
+ badgeText = "${ss:keyvalues.badge.value | pick:".concat(appId, " | toInt}");
20737
+ if (appId == "approve_workflow") {
20738
+ badgeText = "${ss:keyvalues.badge.value | pick:'workflow' | toInt}";
20739
+ }
20590
20740
  if (links) {
20591
20741
  return [2 /*return*/, {
20592
20742
  "type": "nav",
@@ -20602,7 +20752,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
20602
20752
  schemaApi: {
20603
20753
  "method": "get",
20604
20754
  "url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
20605
- "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 "),
20755
+ "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 "),
20606
20756
  "headers": {
20607
20757
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
20608
20758
  }
@@ -21355,7 +21505,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
21355
21505
  defaultSource = {
21356
21506
  "method": "post",
21357
21507
  "url": "${context.rootUrl}/graphql",
21358
- "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 "),
21508
+ "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 "),
21359
21509
  "trackExpression": "${" + steedosField.name + "}",
21360
21510
  "cache": 3000
21361
21511
  };
@@ -21790,7 +21940,7 @@ var AmisInputTable = function (props) { return __awaiter(void 0, void 0, void 0,
21790
21940
  return __generator(this, function (_a) {
21791
21941
  switch (_a.label) {
21792
21942
  case 0:
21793
- props.$schema, props.fields, props.name, props.id, props.data, props.columns, props.amis, props.className, props.tableClassName, props.footerToolbar, props.inlineEditMode, props.strictMode;
21943
+ 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;
21794
21944
  return [4 /*yield*/, getAmisInputTableSchema(props)];
21795
21945
  case 1:
21796
21946
  amisSchema = _a.sent();