@steedos-widgets/amis-lib 6.3.0-beta.13 → 6.3.0-beta.14
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/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +132 -185
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +132 -185
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +10 -9
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/buttons.d.ts +308 -107
- package/dist/types/lib/converter/amis/header.d.ts +318 -124
- package/dist/types/schema/standard_delete.amis.d.ts +0 -1
- package/dist/types/schema/standard_edit.amis.d.ts +0 -11
- package/dist/types/schema/standard_new.amis.d.ts +1 -10
- package/dist/types/standard/button.d.ts +1 -22
- package/package.json +2 -2
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}`;
|
|
@@ -1824,7 +1824,12 @@ async function getQuickEditSchema(object, columnField, options){
|
|
|
1824
1824
|
break;
|
|
1825
1825
|
case "percent":
|
|
1826
1826
|
TempDisplayField = `
|
|
1827
|
-
|
|
1827
|
+
if(event.data.value){
|
|
1828
|
+
_display["${field.name}"] = event.data.value.toFixed(${field.scale}) + '%';
|
|
1829
|
+
} else {
|
|
1830
|
+
_display["${field.name}"] = event.data.value;
|
|
1831
|
+
}
|
|
1832
|
+
|
|
1828
1833
|
`;
|
|
1829
1834
|
quickEditSchema.body[0].onEvent["change"] = quickEditOnEvent(TempDisplayField);
|
|
1830
1835
|
break;
|
|
@@ -2176,6 +2181,7 @@ async function getColumnItemOnClick(field, options){
|
|
|
2176
2181
|
...recordPage.schema.data,
|
|
2177
2182
|
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2178
2183
|
"recordLoaded": false, // 重置数据加载状态
|
|
2184
|
+
"recordId": `\${${options.idFieldName}}`//审批微页面依赖了作用域中的recordId
|
|
2179
2185
|
}
|
|
2180
2186
|
}) : {
|
|
2181
2187
|
"type": "steedos-record-detail",
|
|
@@ -3318,7 +3324,7 @@ function getReadonlyFormAdaptor(object, fields, options){
|
|
|
3318
3324
|
var fieldNames = _$1.map(fields, function(n){return n.name});
|
|
3319
3325
|
var nameField = object.fields[object.NAME_FIELD_KEY];
|
|
3320
3326
|
let nameLabel = nameField && nameField.name;
|
|
3321
|
-
if (nameField && nameField.type == "lookup") {
|
|
3327
|
+
if (nameField && (nameField.type == "lookup" || nameField.type == "master_detail")) {
|
|
3322
3328
|
if(!nameField.reference_to && (nameField.optionsFunction || nameField._optionsFunction || nameField.options)){
|
|
3323
3329
|
if(!nameField.isTableField){
|
|
3324
3330
|
nameLabel = `record.${nameField.name}__label`;
|
|
@@ -4710,16 +4716,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4710
4716
|
data: formSchema
|
|
4711
4717
|
};
|
|
4712
4718
|
`;
|
|
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
4719
|
const getSelectedRowsScript = `
|
|
4724
4720
|
const isLookup = event.data.isLookup;
|
|
4725
4721
|
if(isLookup){
|
|
@@ -4809,17 +4805,6 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4809
4805
|
"closeOnEsc": false,
|
|
4810
4806
|
"closeOnOutside": false,
|
|
4811
4807
|
"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
4808
|
"actions": [
|
|
4824
4809
|
{
|
|
4825
4810
|
type: 'button',
|
|
@@ -4837,8 +4822,7 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4837
4822
|
type: 'button',
|
|
4838
4823
|
actionType: 'confirm',
|
|
4839
4824
|
label: i18next.t('frontend_form_save'),
|
|
4840
|
-
primary: true
|
|
4841
|
-
close: `object_actions_drawer_${uiSchema.name}`
|
|
4825
|
+
primary: true
|
|
4842
4826
|
},
|
|
4843
4827
|
]
|
|
4844
4828
|
}
|
|
@@ -4890,16 +4874,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4890
4874
|
: page.schema;
|
|
4891
4875
|
}
|
|
4892
4876
|
|
|
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
4877
|
|
|
4904
4878
|
return {
|
|
4905
4879
|
type: "service",
|
|
@@ -4929,17 +4903,6 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4929
4903
|
"_master.relatedKey": "${relatedKey}"
|
|
4930
4904
|
},
|
|
4931
4905
|
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
4906
|
"actions": [
|
|
4944
4907
|
{
|
|
4945
4908
|
type: 'button',
|
|
@@ -4950,8 +4913,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4950
4913
|
type: 'button',
|
|
4951
4914
|
actionType: 'confirm',
|
|
4952
4915
|
label: i18next.t('frontend_form_save'),
|
|
4953
|
-
primary: true
|
|
4954
|
-
close: `object_actions_drawer_${uiSchema.name}`
|
|
4916
|
+
primary: true
|
|
4955
4917
|
},
|
|
4956
4918
|
]
|
|
4957
4919
|
},
|
|
@@ -5035,8 +4997,7 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
5035
4997
|
}
|
|
5036
4998
|
]
|
|
5037
4999
|
}
|
|
5038
|
-
}
|
|
5039
|
-
"close": `object_actions_drawer_${uiSchema.name}`
|
|
5000
|
+
}
|
|
5040
5001
|
}
|
|
5041
5002
|
],
|
|
5042
5003
|
"regions": [
|
|
@@ -5734,6 +5695,105 @@ const getObjectDetailHeaderButtons = (objectSchema, recordId)=>{
|
|
|
5734
5695
|
};
|
|
5735
5696
|
};
|
|
5736
5697
|
|
|
5698
|
+
const getDropdown = (dropdownButtons)=>{
|
|
5699
|
+
const dropdown = {
|
|
5700
|
+
"type": "dropdown-button",
|
|
5701
|
+
"icon": "fa fa-angle-down",
|
|
5702
|
+
"size": "sm",
|
|
5703
|
+
"hideCaret": true,
|
|
5704
|
+
"className": "mr-0 steedos-mobile-header-drop-down",
|
|
5705
|
+
"closeOnClick": true,
|
|
5706
|
+
"menuClassName": "buttons-drawer fixed inset-0 bg-none border-0 shadow-none",
|
|
5707
|
+
"align": "right",
|
|
5708
|
+
"body": [
|
|
5709
|
+
{
|
|
5710
|
+
"type": "action",
|
|
5711
|
+
"style": {
|
|
5712
|
+
"position": "fixed",
|
|
5713
|
+
"top": 0,
|
|
5714
|
+
"right": 0,
|
|
5715
|
+
"bottom": 0,
|
|
5716
|
+
"left": 0,
|
|
5717
|
+
"z-index": 1,
|
|
5718
|
+
"background": "var(--Drawer-overlay-bg)",
|
|
5719
|
+
"height": "unset",
|
|
5720
|
+
"width": "unset",
|
|
5721
|
+
"padding": "0",
|
|
5722
|
+
"margin": "0",
|
|
5723
|
+
"border-radius": "0"
|
|
5724
|
+
}
|
|
5725
|
+
},
|
|
5726
|
+
{
|
|
5727
|
+
"type": "wrapper",
|
|
5728
|
+
"style": {
|
|
5729
|
+
"position": "fixed",
|
|
5730
|
+
"bottom": 0,
|
|
5731
|
+
"z-index": 2,
|
|
5732
|
+
"width": "100vw",
|
|
5733
|
+
"left": "0",
|
|
5734
|
+
"padding": "0",
|
|
5735
|
+
"background": "white",
|
|
5736
|
+
"box-shadow": "0 -10px 10px -10px rgba(0, 0, 0, 0.2)"
|
|
5737
|
+
},
|
|
5738
|
+
"body": [
|
|
5739
|
+
{
|
|
5740
|
+
"type": "flex",
|
|
5741
|
+
"justify": "space-between",
|
|
5742
|
+
"items": [
|
|
5743
|
+
{
|
|
5744
|
+
"type": "tpl",
|
|
5745
|
+
"tpl": "操作",
|
|
5746
|
+
"style": {
|
|
5747
|
+
"padding": "4px 12px",
|
|
5748
|
+
"align-items": "center",
|
|
5749
|
+
"display": "flex"
|
|
5750
|
+
}
|
|
5751
|
+
},
|
|
5752
|
+
{
|
|
5753
|
+
"type": "action",
|
|
5754
|
+
"label": "",
|
|
5755
|
+
"icon": "fa fa-times",
|
|
5756
|
+
"level": "link",
|
|
5757
|
+
"style": {
|
|
5758
|
+
"color": "black"
|
|
5759
|
+
},
|
|
5760
|
+
}
|
|
5761
|
+
],
|
|
5762
|
+
"style": {
|
|
5763
|
+
"padding-top": "0.5rem",
|
|
5764
|
+
"padding-bottom": "0.5rem",
|
|
5765
|
+
"border-bottom": "var(--Drawer-content-borderWidth) solid var(--Drawer-header-borderColor)"
|
|
5766
|
+
}
|
|
5767
|
+
},
|
|
5768
|
+
{
|
|
5769
|
+
"type": "wrapper",
|
|
5770
|
+
"body": [
|
|
5771
|
+
{
|
|
5772
|
+
"type": "button-group",
|
|
5773
|
+
"id": "u:fd837823be5b",
|
|
5774
|
+
"vertical": true,
|
|
5775
|
+
"tiled": true,
|
|
5776
|
+
"buttons": dropdownButtons,
|
|
5777
|
+
"className": "w-full overflow-auto",
|
|
5778
|
+
"btnClassName": "w-full",
|
|
5779
|
+
"size": "lg"
|
|
5780
|
+
}
|
|
5781
|
+
],
|
|
5782
|
+
"style": {
|
|
5783
|
+
"padding": "0",
|
|
5784
|
+
"overflow": "auto",
|
|
5785
|
+
"max-height": "70vh"
|
|
5786
|
+
}
|
|
5787
|
+
}
|
|
5788
|
+
|
|
5789
|
+
]
|
|
5790
|
+
}
|
|
5791
|
+
]
|
|
5792
|
+
};
|
|
5793
|
+
|
|
5794
|
+
return dropdown;
|
|
5795
|
+
};
|
|
5796
|
+
|
|
5737
5797
|
const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
5738
5798
|
const { buttons, moreButtons, moreButtonsVisibleOn } = getObjectDetailHeaderButtons(objectSchema, recordId);
|
|
5739
5799
|
if(ctx.formFactor === 'SMALL'){
|
|
@@ -5757,46 +5817,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5757
5817
|
}
|
|
5758
5818
|
});
|
|
5759
5819
|
|
|
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
|
-
]
|
|
5820
|
+
return [getDropdown(dropdownButtons)];
|
|
5800
5821
|
}else {
|
|
5801
5822
|
if(moreButtons.length > 0){
|
|
5802
5823
|
const dropdownButtonsSchema = {
|
|
@@ -5817,54 +5838,16 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5817
5838
|
const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
5818
5839
|
const buttons = getListViewButtons(objectSchema, ctx);
|
|
5819
5840
|
if(ctx.formFactor === 'SMALL'){
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
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
|
-
}
|
|
5841
|
+
const dropdownButtons = _$1.map(buttons, (button)=>{
|
|
5842
|
+
return {
|
|
5843
|
+
type: 'steedos-object-button',
|
|
5844
|
+
name: button.name,
|
|
5845
|
+
objectName: button.objectName,
|
|
5846
|
+
visibleOn: getButtonVisibleOn(button),
|
|
5847
|
+
className: `button_${button.name} w-full`
|
|
5866
5848
|
}
|
|
5867
|
-
|
|
5849
|
+
});
|
|
5850
|
+
return getDropdown(dropdownButtons);
|
|
5868
5851
|
}else {
|
|
5869
5852
|
return _$1.map(buttons, (button) => {
|
|
5870
5853
|
return {
|
|
@@ -5881,55 +5864,19 @@ const getObjectListViewButtonsSchemas = (objectSchema, ctx)=>{
|
|
|
5881
5864
|
const getObjectRecordDetailRelatedListButtonsSchemas = (objectSchema, ctx)=>{
|
|
5882
5865
|
const buttons = getObjectRelatedListButtons(objectSchema, ctx);
|
|
5883
5866
|
if(ctx.formFactor === 'SMALL'){
|
|
5884
|
-
|
|
5885
|
-
|
|
5886
|
-
|
|
5887
|
-
|
|
5888
|
-
|
|
5889
|
-
|
|
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
|
-
}
|
|
5867
|
+
const dropdownButtons = _$1.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`
|
|
5928
5874
|
}
|
|
5929
|
-
|
|
5875
|
+
});
|
|
5876
|
+
return [getDropdown(dropdownButtons)];
|
|
5930
5877
|
}else {
|
|
5931
5878
|
return _$1.map(buttons, (button) => {
|
|
5932
|
-
return {
|
|
5879
|
+
return {
|
|
5933
5880
|
type: 'steedos-object-button',
|
|
5934
5881
|
name: button.name,
|
|
5935
5882
|
objectName: button.objectName,
|
|
@@ -10354,7 +10301,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10354
10301
|
};
|
|
10355
10302
|
const content = {
|
|
10356
10303
|
"type": "tabs",
|
|
10357
|
-
"className": "steedos-record-tabs bg-white p-4 m-2 border rounded",
|
|
10304
|
+
"className": "steedos-record-tabs bg-white p-4 sm:m-2 sm:border sm:rounded",
|
|
10358
10305
|
"contentClassName": "bg-none",
|
|
10359
10306
|
"tabs": [
|
|
10360
10307
|
detailed
|