@steedos-widgets/amis-lib 6.3.0-beta.13 → 6.3.0-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -599,7 +599,7 @@ function getNameTpl(field, ctx){
599
599
  }
600
600
  let nameLabel = field.name;
601
601
  //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
602
- if (field.type == "lookup") {
602
+ if (field.type == "lookup" || field.type == "master_detail") {
603
603
  if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
604
604
  if(!field.isTableField){
605
605
  nameLabel = `\${${field.name}__label}`;
@@ -1386,6 +1386,7 @@ var frontend_setup$1 = "Setup";
1386
1386
  var frontend_notifications$1 = "Notifications";
1387
1387
  var frontend_notifications_allread$1 = "Mark all as read";
1388
1388
  var frontend_notifications_allread_message$1 = "All marked as read";
1389
+ var frontend_notifications_close_dialog$1 = "Close";
1389
1390
  var frontend_profile$1 = "Profile";
1390
1391
  var switch_space$1 = "Switch Space";
1391
1392
  var frontend_about$1 = "About";
@@ -1475,6 +1476,7 @@ var en_us = {
1475
1476
  frontend_notifications: frontend_notifications$1,
1476
1477
  frontend_notifications_allread: frontend_notifications_allread$1,
1477
1478
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
1479
+ frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
1478
1480
  frontend_profile: frontend_profile$1,
1479
1481
  switch_space: switch_space$1,
1480
1482
  frontend_about: frontend_about$1,
@@ -1566,6 +1568,7 @@ var frontend_setup = "设置";
1566
1568
  var frontend_notifications = "通知";
1567
1569
  var frontend_notifications_allread = "全部标记为已读";
1568
1570
  var frontend_notifications_allread_message = "已全部标记为已读";
1571
+ var frontend_notifications_close_dialog = "关闭";
1569
1572
  var frontend_profile = "个人资料";
1570
1573
  var switch_space = "切换工作区";
1571
1574
  var frontend_about = "关于";
@@ -1656,6 +1659,7 @@ var zh_cn = {
1656
1659
  frontend_notifications: frontend_notifications,
1657
1660
  frontend_notifications_allread: frontend_notifications_allread,
1658
1661
  frontend_notifications_allread_message: frontend_notifications_allread_message,
1662
+ frontend_notifications_close_dialog: frontend_notifications_close_dialog,
1659
1663
  frontend_profile: frontend_profile,
1660
1664
  switch_space: switch_space,
1661
1665
  frontend_about: frontend_about,
@@ -1851,7 +1855,12 @@ async function getQuickEditSchema(object, columnField, options){
1851
1855
  break;
1852
1856
  case "percent":
1853
1857
  TempDisplayField = `
1854
- _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
1858
+ if(event.data.value){
1859
+ _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
1860
+ } else {
1861
+ _display["${field.name}"] = event.data.value;
1862
+ }
1863
+
1855
1864
  `;
1856
1865
  quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
1857
1866
  break;
@@ -2203,6 +2212,7 @@ async function getColumnItemOnClick(field, options){
2203
2212
  ...recordPage.schema.data,
2204
2213
  "_inDrawer": true, // 用于判断是否在抽屉中
2205
2214
  "recordLoaded": false, // 重置数据加载状态
2215
+ "recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
2206
2216
  }
2207
2217
  }) : {
2208
2218
  "type": "steedos-record-detail",
@@ -3345,7 +3355,7 @@ function getReadonlyFormAdaptor(object, fields, options){
3345
3355
  var fieldNames = ___namespace.map(fields, function(n){return n.name});
3346
3356
  var nameField = object.fields[object.NAME_FIELD_KEY];
3347
3357
  let nameLabel = nameField && nameField.name;
3348
- if (nameField && nameField.type == "lookup") {
3358
+ if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
3349
3359
  if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
3350
3360
  if(!nameField.isTableField){
3351
3361
  nameLabel = `record.${nameField.name}__label`;
@@ -4737,16 +4747,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
4737
4747
  data: formSchema
4738
4748
  };
4739
4749
  `;
4740
- const onDialogCancelScript = `
4741
- // 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
4742
- // 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
4743
- setTimeout(function(){
4744
- doAction({
4745
- "actionType": "cancel",
4746
- "componentId": "object_actions_drawer_${uiSchema.name}"
4747
- });
4748
- }, 200);
4749
- `;
4750
4750
  const getSelectedRowsScript = `
4751
4751
  const isLookup = event.data.isLookup;
4752
4752
  if(isLookup){
@@ -4836,17 +4836,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
4836
4836
  "closeOnEsc": false,
4837
4837
  "closeOnOutside": false,
4838
4838
  "size": "lg",
4839
- "onEvent": {
4840
- "cancel": {
4841
- "actions": [
4842
- {
4843
- "actionType": "custom",
4844
- "script": onDialogCancelScript,
4845
- "expression": "${window:innerWidth < 768}",
4846
- }
4847
- ]
4848
- }
4849
- },
4850
4839
  "actions": [
4851
4840
  {
4852
4841
  type: 'button',
@@ -4864,8 +4853,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
4864
4853
  type: 'button',
4865
4854
  actionType: 'confirm',
4866
4855
  label: i18next__default["default"].t('frontend_form_save'),
4867
- primary: true,
4868
- close: `object_actions_drawer_${uiSchema.name}`
4856
+ primary: true
4869
4857
  },
4870
4858
  ]
4871
4859
  }
@@ -4917,16 +4905,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
4917
4905
  : page.schema;
4918
4906
  }
4919
4907
 
4920
- const onDialogCancelScript = `
4921
- // 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
4922
- // 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
4923
- setTimeout(function(){
4924
- doAction({
4925
- "actionType": "cancel",
4926
- "componentId": "object_actions_drawer_${uiSchema.name}"
4927
- });
4928
- }, 200);
4929
- `;
4930
4908
 
4931
4909
  return {
4932
4910
  type: "service",
@@ -4956,17 +4934,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
4956
4934
  "_master.relatedKey": "${relatedKey}"
4957
4935
  },
4958
4936
  size: "lg",
4959
- "onEvent": {
4960
- "cancel": {
4961
- "actions": [
4962
- {
4963
- "actionType": "custom",
4964
- "script": onDialogCancelScript,
4965
- "expression": "${window:innerWidth < 768}",
4966
- }
4967
- ]
4968
- }
4969
- },
4970
4937
  "actions": [
4971
4938
  {
4972
4939
  type: 'button',
@@ -4977,8 +4944,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
4977
4944
  type: 'button',
4978
4945
  actionType: 'confirm',
4979
4946
  label: i18next__default["default"].t('frontend_form_save'),
4980
- primary: true,
4981
- close: `object_actions_drawer_${uiSchema.name}`
4947
+ primary: true
4982
4948
  },
4983
4949
  ]
4984
4950
  },
@@ -5062,8 +5028,7 @@ const getSchema$3 = (uiSchema)=>{
5062
5028
  }
5063
5029
  ]
5064
5030
  }
5065
- },
5066
- "close": `object_actions_drawer_${uiSchema.name}`
5031
+ }
5067
5032
  }
5068
5033
  ],
5069
5034
  "regions": [
@@ -5761,6 +5726,105 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
5761
5726
  };
5762
5727
  };
5763
5728
 
5729
+ const getDropdown = (dropdownButtons)=>{
5730
+ const dropdown = {
5731
+ "type": "dropdown-button",
5732
+ "icon": "fa fa-angle-down",
5733
+ "size": "sm",
5734
+ "hideCaret": true,
5735
+ "className": "mr-0 steedos-mobile-header-drop-down",
5736
+ "closeOnClick": true,
5737
+ "menuClassName": "buttons-drawer fixed inset-0 bg-none border-0 shadow-none",
5738
+ "align": "right",
5739
+ "body": [
5740
+ {
5741
+ "type": "action",
5742
+ "style": {
5743
+ "position": "fixed",
5744
+ "top": 0,
5745
+ "right": 0,
5746
+ "bottom": 0,
5747
+ "left": 0,
5748
+ "z-index": 1,
5749
+ "background": "var(--Drawer-overlay-bg)",
5750
+ "height": "unset",
5751
+ "width": "unset",
5752
+ "padding": "0",
5753
+ "margin": "0",
5754
+ "border-radius": "0"
5755
+ }
5756
+ },
5757
+ {
5758
+ "type": "wrapper",
5759
+ "style": {
5760
+ "position": "fixed",
5761
+ "bottom": 0,
5762
+ "z-index": 2,
5763
+ "width": "100vw",
5764
+ "left": "0",
5765
+ "padding": "0",
5766
+ "background": "white",
5767
+ "box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
5768
+ },
5769
+ "body": [
5770
+ {
5771
+ "type": "flex",
5772
+ "justify": "space-between",
5773
+ "items": [
5774
+ {
5775
+ "type": "tpl",
5776
+ "tpl": "操作",
5777
+ "style": {
5778
+ "padding": "4px 12px",
5779
+ "align-items": "center",
5780
+ "display": "flex"
5781
+ }
5782
+ },
5783
+ {
5784
+ "type": "action",
5785
+ "label": "",
5786
+ "icon": "fa fa-times",
5787
+ "level": "link",
5788
+ "style": {
5789
+ "color": "black"
5790
+ },
5791
+ }
5792
+ ],
5793
+ "style": {
5794
+ "padding-top": "0.5rem",
5795
+ "padding-bottom": "0.5rem",
5796
+ "border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
5797
+ }
5798
+ },
5799
+ {
5800
+ "type": "wrapper",
5801
+ "body": [
5802
+ {
5803
+ "type": "button-group",
5804
+ "id": "u:fd837823be5b",
5805
+ "vertical": true,
5806
+ "tiled": true,
5807
+ "buttons": dropdownButtons,
5808
+ "className": "w-full overflow-auto",
5809
+ "btnClassName": "w-full",
5810
+ "size": "lg"
5811
+ }
5812
+ ],
5813
+ "style": {
5814
+ "padding": "0",
5815
+ "overflow": "auto",
5816
+ "max-height": "70vh"
5817
+ }
5818
+ }
5819
+
5820
+ ]
5821
+ }
5822
+ ]
5823
+ };
5824
+
5825
+ return dropdown;
5826
+ };
5827
+
5764
5828
  const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5765
5829
  const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
5766
5830
  if(ctx.formFactor === 'SMALL'){
@@ -5784,46 +5848,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5784
5848
  }
5785
5849
  });
5786
5850
 
5787
- return [
5788
- {
5789
- "type": "button",
5790
- "icon": "fa fa-angle-down",
5791
- "visibleOn": phoneMoreButtonsVisibleOn,
5792
- "onEvent": {
5793
- "click": {
5794
- "actions": [
5795
- {
5796
- "actionType": "drawer",
5797
- "drawer": {
5798
- "type": "drawer",
5799
- "title": i18next__default["default"].t('frontend_operation'),
5800
- "id": "object_actions_drawer_" + objectSchema.name,
5801
- "body": [
5802
- {
5803
- "type": "button-group",
5804
- "id": "u:fd837823be5b",
5805
- "vertical": true,
5806
- "tiled": true,
5807
- "buttons": dropdownButtons,
5808
- "btnLevel": "enhance",
5809
- "className": "w-full",
5810
- "btnClassName": "w-full",
5811
- "size": "lg"
5812
- }
5813
- ],
5814
- "position": "bottom",
5815
- "closeOnOutside": true,
5816
- "resizable": false,
5817
- "className": "buttons-drawer",
5818
- "bodyClassName": "m-none p-none",
5819
- "actions": []
5820
- }
5821
- }
5822
- ]
5823
- }
5824
- }
5825
- }
5826
- ]
5851
+ return [getDropdown(dropdownButtons)];
5827
5852
  }else {
5828
5853
  if(moreButtons.length > 0){
5829
5854
  const dropdownButtonsSchema = {
@@ -5844,54 +5869,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5844
5869
  const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
5845
5870
  const buttons = getListViewButtons(objectSchema, ctx);
5846
5871
  if(ctx.formFactor === 'SMALL'){
5847
- return {
5848
- "type": "button",
5849
- "icon": "fa fa-angle-down",
5850
- "className": "mr-0",
5851
- "onEvent": {
5852
- "click": {
5853
- "actions": [
5854
- {
5855
- "actionType": "drawer",
5856
- "drawer": {
5857
- "type": "drawer",
5858
- "title": i18next__default["default"].t('frontend_operation'),
5859
- "id": "object_actions_drawer_" + objectSchema.name,
5860
- "body": [
5861
- {
5862
- "type": "button-group",
5863
- "id": "u:fd837823be5b",
5864
- "vertical": true,
5865
- "tiled": true,
5866
- "buttons": [
5867
- ...___namespace.map(buttons, (button)=>{
5868
- return {
5869
- type: 'steedos-object-button',
5870
- name: button.name,
5871
- objectName: button.objectName,
5872
- visibleOn: getButtonVisibleOn(button),
5873
- className: `button_${button.name} w-full`
5874
- }
5875
- })
5876
- ],
5877
- "btnLevel": "enhance",
5878
- "className": "w-full",
5879
- "btnClassName": "w-full",
5880
- "size": "lg"
5881
- }
5882
- ],
5883
- "position": "bottom",
5884
- "closeOnOutside": true,
5885
- "resizable": false,
5886
- "className": "buttons-drawer",
5887
- "bodyClassName": "m-none p-none",
5888
- "actions": []
5889
- }
5890
- }
5891
- ]
5892
- }
5872
+ const dropdownButtons = ___namespace.map(buttons, (button)=>{
5873
+ return {
5874
+ type: 'steedos-object-button',
5875
+ name: button.name,
5876
+ objectName: button.objectName,
5877
+ visibleOn: getButtonVisibleOn(button),
5878
+ className: `button_${button.name} w-full`
5893
5879
  }
5894
- }
5880
+ });
5881
+ return getDropdown(dropdownButtons);
5895
5882
  }else {
5896
5883
  return ___namespace.map(buttons, (button) => {
5897
5884
  return {
@@ -5908,55 +5895,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
5908
5895
  const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
5909
5896
  const buttons = getObjectRelatedListButtons(objectSchema, ctx);
5910
5897
  if(ctx.formFactor === 'SMALL'){
5911
- return {
5912
- "type": "button",
5913
- "icon": "fa fa-angle-down",
5914
- "onEvent": {
5915
- "click": {
5916
- "actions": [
5917
- {
5918
- "actionType": "drawer",
5919
- "drawer": {
5920
- "type": "drawer",
5921
- "title": i18next__default["default"].t('frontend_operation'),
5922
- "id": "object_actions_drawer_" + objectSchema.name,
5923
- "body": [
5924
- {
5925
- "type": "button-group",
5926
- "vertical": true,
5927
- "tiled": true,
5928
- "buttons": [
5929
- ...___namespace.map(buttons, (button)=>{
5930
- return {
5931
- type: 'steedos-object-button',
5932
- name: button.name,
5933
- objectName: button.objectName,
5934
- visibleOn: getButtonVisibleOn(button),
5935
- className: `button_${button.name} w-full`
5936
- }
5937
- })
5938
- ],
5939
- "btnLevel": "enhance",
5940
- "className": "w-full",
5941
- "btnClassName": "w-full",
5942
- "size": "lg"
5943
- }
5944
- ],
5945
- "position": "bottom",
5946
- "closeOnOutside": true,
5947
- "resizable": false,
5948
- "className": "buttons-drawer",
5949
- "bodyClassName": "m-none p-none",
5950
- "actions": []
5951
- }
5952
- }
5953
- ]
5954
- }
5898
+ const dropdownButtons = ___namespace.map(buttons, (button)=>{
5899
+ return {
5900
+ type: 'steedos-object-button',
5901
+ name: button.name,
5902
+ objectName: button.objectName,
5903
+ visibleOn: getButtonVisibleOn(button),
5904
+ className: `button_${button.name} w-full`
5955
5905
  }
5956
- }
5906
+ });
5907
+ return [getDropdown(dropdownButtons)];
5957
5908
  }else {
5958
5909
  return ___namespace.map(buttons, (button) => {
5959
- return {
5910
+ return {
5960
5911
  type: 'steedos-object-button',
5961
5912
  name: button.name,
5962
5913
  objectName: button.objectName,
@@ -10381,7 +10332,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
10381
10332
  };
10382
10333
  const content = {
10383
10334
  "type": "tabs",
10384
- "className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
10335
+ "className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
10385
10336
  "contentClassName": "bg-none",
10386
10337
  "tabs": [
10387
10338
  detailed