@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.esm.js CHANGED
@@ -572,7 +572,7 @@ function getNameTpl(field, ctx){
572
572
  }
573
573
  let nameLabel = field.name;
574
574
  //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
575
- if (field.type == "lookup") {
575
+ if (field.type == "lookup" || field.type == "master_detail") {
576
576
  if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
577
577
  if(!field.isTableField){
578
578
  nameLabel = `\${${field.name}__label}`;
@@ -1359,6 +1359,7 @@ var frontend_setup$1 = "Setup";
1359
1359
  var frontend_notifications$1 = "Notifications";
1360
1360
  var frontend_notifications_allread$1 = "Mark all as read";
1361
1361
  var frontend_notifications_allread_message$1 = "All marked as read";
1362
+ var frontend_notifications_close_dialog$1 = "Close";
1362
1363
  var frontend_profile$1 = "Profile";
1363
1364
  var switch_space$1 = "Switch Space";
1364
1365
  var frontend_about$1 = "About";
@@ -1448,6 +1449,7 @@ var en_us = {
1448
1449
  frontend_notifications: frontend_notifications$1,
1449
1450
  frontend_notifications_allread: frontend_notifications_allread$1,
1450
1451
  frontend_notifications_allread_message: frontend_notifications_allread_message$1,
1452
+ frontend_notifications_close_dialog: frontend_notifications_close_dialog$1,
1451
1453
  frontend_profile: frontend_profile$1,
1452
1454
  switch_space: switch_space$1,
1453
1455
  frontend_about: frontend_about$1,
@@ -1539,6 +1541,7 @@ var frontend_setup = "设置";
1539
1541
  var frontend_notifications = "通知";
1540
1542
  var frontend_notifications_allread = "全部标记为已读";
1541
1543
  var frontend_notifications_allread_message = "已全部标记为已读";
1544
+ var frontend_notifications_close_dialog = "关闭";
1542
1545
  var frontend_profile = "个人资料";
1543
1546
  var switch_space = "切换工作区";
1544
1547
  var frontend_about = "关于";
@@ -1629,6 +1632,7 @@ var zh_cn = {
1629
1632
  frontend_notifications: frontend_notifications,
1630
1633
  frontend_notifications_allread: frontend_notifications_allread,
1631
1634
  frontend_notifications_allread_message: frontend_notifications_allread_message,
1635
+ frontend_notifications_close_dialog: frontend_notifications_close_dialog,
1632
1636
  frontend_profile: frontend_profile,
1633
1637
  switch_space: switch_space,
1634
1638
  frontend_about: frontend_about,
@@ -1824,7 +1828,12 @@ async function getQuickEditSchema(object, columnField, options){
1824
1828
  break;
1825
1829
  case "percent":
1826
1830
  TempDisplayField = `
1827
- _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
1831
+ if(event.data.value){
1832
+ _display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
1833
+ } else {
1834
+ _display["${field.name}"] = event.data.value;
1835
+ }
1836
+
1828
1837
  `;
1829
1838
  quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
1830
1839
  break;
@@ -2176,6 +2185,7 @@ async function getColumnItemOnClick(field, options){
2176
2185
  ...recordPage.schema.data,
2177
2186
  "_inDrawer": true, // 用于判断是否在抽屉中
2178
2187
  "recordLoaded": false, // 重置数据加载状态
2188
+ "recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
2179
2189
  }
2180
2190
  }) : {
2181
2191
  "type": "steedos-record-detail",
@@ -3318,7 +3328,7 @@ function getReadonlyFormAdaptor(object, fields, options){
3318
3328
  var fieldNames = _$1.map(fields, function(n){return n.name});
3319
3329
  var nameField = object.fields[object.NAME_FIELD_KEY];
3320
3330
  let nameLabel = nameField && nameField.name;
3321
- if (nameField && nameField.type == "lookup") {
3331
+ if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
3322
3332
  if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
3323
3333
  if(!nameField.isTableField){
3324
3334
  nameLabel = `record.${nameField.name}__label`;
@@ -4710,16 +4720,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
4710
4720
  data: formSchema
4711
4721
  };
4712
4722
  `;
4713
- const onDialogCancelScript = `
4714
- // 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
4715
- // 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击新建按钮的时候异常
4716
- setTimeout(function(){
4717
- doAction({
4718
- "actionType": "cancel",
4719
- "componentId": "object_actions_drawer_${uiSchema.name}"
4720
- });
4721
- }, 200);
4722
- `;
4723
4723
  const getSelectedRowsScript = `
4724
4724
  const isLookup = event.data.isLookup;
4725
4725
  if(isLookup){
@@ -4809,17 +4809,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
4809
4809
  "closeOnEsc": false,
4810
4810
  "closeOnOutside": false,
4811
4811
  "size": "lg",
4812
- "onEvent": {
4813
- "cancel": {
4814
- "actions": [
4815
- {
4816
- "actionType": "custom",
4817
- "script": onDialogCancelScript,
4818
- "expression": "${window:innerWidth < 768}",
4819
- }
4820
- ]
4821
- }
4822
- },
4823
4812
  "actions": [
4824
4813
  {
4825
4814
  type: 'button',
@@ -4837,8 +4826,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
4837
4826
  type: 'button',
4838
4827
  actionType: 'confirm',
4839
4828
  label: i18next.t('frontend_form_save'),
4840
- primary: true,
4841
- close: `object_actions_drawer_${uiSchema.name}`
4829
+ primary: true
4842
4830
  },
4843
4831
  ]
4844
4832
  }
@@ -4890,16 +4878,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
4890
4878
  : page.schema;
4891
4879
  }
4892
4880
 
4893
- const onDialogCancelScript = `
4894
- // 这里加setTimeout是因为amis的Bug,它会先触发cancel事件执行此脚本关闭父窗口然后再关闭子窗口
4895
- // 正确的顺序应该是先关闭子窗口再关闭父窗口,顺序错了会造成第二次点击编辑按钮的时候异常
4896
- setTimeout(function(){
4897
- doAction({
4898
- "actionType": "cancel",
4899
- "componentId": "object_actions_drawer_${uiSchema.name}"
4900
- });
4901
- }, 200);
4902
- `;
4903
4881
 
4904
4882
  return {
4905
4883
  type: "service",
@@ -4929,17 +4907,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
4929
4907
  "_master.relatedKey": "${relatedKey}"
4930
4908
  },
4931
4909
  size: "lg",
4932
- "onEvent": {
4933
- "cancel": {
4934
- "actions": [
4935
- {
4936
- "actionType": "custom",
4937
- "script": onDialogCancelScript,
4938
- "expression": "${window:innerWidth < 768}",
4939
- }
4940
- ]
4941
- }
4942
- },
4943
4910
  "actions": [
4944
4911
  {
4945
4912
  type: 'button',
@@ -4950,8 +4917,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
4950
4917
  type: 'button',
4951
4918
  actionType: 'confirm',
4952
4919
  label: i18next.t('frontend_form_save'),
4953
- primary: true,
4954
- close: `object_actions_drawer_${uiSchema.name}`
4920
+ primary: true
4955
4921
  },
4956
4922
  ]
4957
4923
  },
@@ -5035,8 +5001,7 @@ const getSchema$3 = (uiSchema)=>{
5035
5001
  }
5036
5002
  ]
5037
5003
  }
5038
- },
5039
- "close": `object_actions_drawer_${uiSchema.name}`
5004
+ }
5040
5005
  }
5041
5006
  ],
5042
5007
  "regions": [
@@ -5734,6 +5699,105 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
5734
5699
  };
5735
5700
  };
5736
5701
 
5702
+ const getDropdown = (dropdownButtons)=>{
5703
+ const dropdown = {
5704
+ "type": "dropdown-button",
5705
+ "icon": "fa fa-angle-down",
5706
+ "size": "sm",
5707
+ "hideCaret": true,
5708
+ "className": "mr-0 steedos-mobile-header-drop-down",
5709
+ "closeOnClick": true,
5710
+ "menuClassName": "buttons-drawer fixed inset-0 bg-none border-0 shadow-none",
5711
+ "align": "right",
5712
+ "body": [
5713
+ {
5714
+ "type": "action",
5715
+ "style": {
5716
+ "position": "fixed",
5717
+ "top": 0,
5718
+ "right": 0,
5719
+ "bottom": 0,
5720
+ "left": 0,
5721
+ "z-index": 1,
5722
+ "background": "var(--Drawer-overlay-bg)",
5723
+ "height": "unset",
5724
+ "width": "unset",
5725
+ "padding": "0",
5726
+ "margin": "0",
5727
+ "border-radius": "0"
5728
+ }
5729
+ },
5730
+ {
5731
+ "type": "wrapper",
5732
+ "style": {
5733
+ "position": "fixed",
5734
+ "bottom": 0,
5735
+ "z-index": 2,
5736
+ "width": "100vw",
5737
+ "left": "0",
5738
+ "padding": "0",
5739
+ "background": "white",
5740
+ "box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
5741
+ },
5742
+ "body": [
5743
+ {
5744
+ "type": "flex",
5745
+ "justify": "space-between",
5746
+ "items": [
5747
+ {
5748
+ "type": "tpl",
5749
+ "tpl": "操作",
5750
+ "style": {
5751
+ "padding": "4px 12px",
5752
+ "align-items": "center",
5753
+ "display": "flex"
5754
+ }
5755
+ },
5756
+ {
5757
+ "type": "action",
5758
+ "label": "",
5759
+ "icon": "fa fa-times",
5760
+ "level": "link",
5761
+ "style": {
5762
+ "color": "black"
5763
+ },
5764
+ }
5765
+ ],
5766
+ "style": {
5767
+ "padding-top": "0.5rem",
5768
+ "padding-bottom": "0.5rem",
5769
+ "border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
5770
+ }
5771
+ },
5772
+ {
5773
+ "type": "wrapper",
5774
+ "body": [
5775
+ {
5776
+ "type": "button-group",
5777
+ "id": "u:fd837823be5b",
5778
+ "vertical": true,
5779
+ "tiled": true,
5780
+ "buttons": dropdownButtons,
5781
+ "className": "w-full overflow-auto",
5782
+ "btnClassName": "w-full",
5783
+ "size": "lg"
5784
+ }
5785
+ ],
5786
+ "style": {
5787
+ "padding": "0",
5788
+ "overflow": "auto",
5789
+ "max-height": "70vh"
5790
+ }
5791
+ }
5792
+
5793
+ ]
5794
+ }
5795
+ ]
5796
+ };
5797
+
5798
+ return dropdown;
5799
+ };
5800
+
5737
5801
  const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5738
5802
  const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
5739
5803
  if(ctx.formFactor === 'SMALL'){
@@ -5757,46 +5821,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5757
5821
  }
5758
5822
  });
5759
5823
 
5760
- return [
5761
- {
5762
- "type": "button",
5763
- "icon": "fa fa-angle-down",
5764
- "visibleOn": phoneMoreButtonsVisibleOn,
5765
- "onEvent": {
5766
- "click": {
5767
- "actions": [
5768
- {
5769
- "actionType": "drawer",
5770
- "drawer": {
5771
- "type": "drawer",
5772
- "title": i18next.t('frontend_operation'),
5773
- "id": "object_actions_drawer_" + objectSchema.name,
5774
- "body": [
5775
- {
5776
- "type": "button-group",
5777
- "id": "u:fd837823be5b",
5778
- "vertical": true,
5779
- "tiled": true,
5780
- "buttons": dropdownButtons,
5781
- "btnLevel": "enhance",
5782
- "className": "w-full",
5783
- "btnClassName": "w-full",
5784
- "size": "lg"
5785
- }
5786
- ],
5787
- "position": "bottom",
5788
- "closeOnOutside": true,
5789
- "resizable": false,
5790
- "className": "buttons-drawer",
5791
- "bodyClassName": "m-none p-none",
5792
- "actions": []
5793
- }
5794
- }
5795
- ]
5796
- }
5797
- }
5798
- }
5799
- ]
5824
+ return [getDropdown(dropdownButtons)];
5800
5825
  }else {
5801
5826
  if(moreButtons.length > 0){
5802
5827
  const dropdownButtonsSchema = {
@@ -5817,54 +5842,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
5817
5842
  const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
5818
5843
  const buttons = getListViewButtons(objectSchema, ctx);
5819
5844
  if(ctx.formFactor === 'SMALL'){
5820
- return {
5821
- "type": "button",
5822
- "icon": "fa fa-angle-down",
5823
- "className": "mr-0",
5824
- "onEvent": {
5825
- "click": {
5826
- "actions": [
5827
- {
5828
- "actionType": "drawer",
5829
- "drawer": {
5830
- "type": "drawer",
5831
- "title": i18next.t('frontend_operation'),
5832
- "id": "object_actions_drawer_" + objectSchema.name,
5833
- "body": [
5834
- {
5835
- "type": "button-group",
5836
- "id": "u:fd837823be5b",
5837
- "vertical": true,
5838
- "tiled": true,
5839
- "buttons": [
5840
- ..._$1.map(buttons, (button)=>{
5841
- return {
5842
- type: 'steedos-object-button',
5843
- name: button.name,
5844
- objectName: button.objectName,
5845
- visibleOn: getButtonVisibleOn(button),
5846
- className: `button_${button.name} w-full`
5847
- }
5848
- })
5849
- ],
5850
- "btnLevel": "enhance",
5851
- "className": "w-full",
5852
- "btnClassName": "w-full",
5853
- "size": "lg"
5854
- }
5855
- ],
5856
- "position": "bottom",
5857
- "closeOnOutside": true,
5858
- "resizable": false,
5859
- "className": "buttons-drawer",
5860
- "bodyClassName": "m-none p-none",
5861
- "actions": []
5862
- }
5863
- }
5864
- ]
5865
- }
5845
+ const dropdownButtons = _$1.map(buttons, (button)=>{
5846
+ return {
5847
+ type: 'steedos-object-button',
5848
+ name: button.name,
5849
+ objectName: button.objectName,
5850
+ visibleOn: getButtonVisibleOn(button),
5851
+ className: `button_${button.name} w-full`
5866
5852
  }
5867
- }
5853
+ });
5854
+ return getDropdown(dropdownButtons);
5868
5855
  }else {
5869
5856
  return _$1.map(buttons, (button) => {
5870
5857
  return {
@@ -5881,55 +5868,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
5881
5868
  const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
5882
5869
  const buttons = getObjectRelatedListButtons(objectSchema, ctx);
5883
5870
  if(ctx.formFactor === 'SMALL'){
5884
- return {
5885
- "type": "button",
5886
- "icon": "fa fa-angle-down",
5887
- "onEvent": {
5888
- "click": {
5889
- "actions": [
5890
- {
5891
- "actionType": "drawer",
5892
- "drawer": {
5893
- "type": "drawer",
5894
- "title": i18next.t('frontend_operation'),
5895
- "id": "object_actions_drawer_" + objectSchema.name,
5896
- "body": [
5897
- {
5898
- "type": "button-group",
5899
- "vertical": true,
5900
- "tiled": true,
5901
- "buttons": [
5902
- ..._$1.map(buttons, (button)=>{
5903
- return {
5904
- type: 'steedos-object-button',
5905
- name: button.name,
5906
- objectName: button.objectName,
5907
- visibleOn: getButtonVisibleOn(button),
5908
- className: `button_${button.name} w-full`
5909
- }
5910
- })
5911
- ],
5912
- "btnLevel": "enhance",
5913
- "className": "w-full",
5914
- "btnClassName": "w-full",
5915
- "size": "lg"
5916
- }
5917
- ],
5918
- "position": "bottom",
5919
- "closeOnOutside": true,
5920
- "resizable": false,
5921
- "className": "buttons-drawer",
5922
- "bodyClassName": "m-none p-none",
5923
- "actions": []
5924
- }
5925
- }
5926
- ]
5927
- }
5871
+ const dropdownButtons = _$1.map(buttons, (button)=>{
5872
+ return {
5873
+ type: 'steedos-object-button',
5874
+ name: button.name,
5875
+ objectName: button.objectName,
5876
+ visibleOn: getButtonVisibleOn(button),
5877
+ className: `button_${button.name} w-full`
5928
5878
  }
5929
- }
5879
+ });
5880
+ return [getDropdown(dropdownButtons)];
5930
5881
  }else {
5931
5882
  return _$1.map(buttons, (button) => {
5932
- return {
5883
+ return {
5933
5884
  type: 'steedos-object-button',
5934
5885
  name: button.name,
5935
5886
  objectName: button.objectName,
@@ -10354,7 +10305,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
10354
10305
  };
10355
10306
  const content = {
10356
10307
  "type": "tabs",
10357
- "className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
10308
+ "className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
10358
10309
  "contentClassName": "bg-none",
10359
10310
  "tabs": [
10360
10311
  detailed