@steedos-widgets/amis-lib 3.6.3 → 3.6.4-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.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +259 -77
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +241 -78
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +111 -95
- package/dist/index.umd.js.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/buttons.d.ts +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +1 -0
- package/dist/types/lib/converter/amis/header.d.ts +24 -0
- package/dist/types/lib/input_table.d.ts +4 -0
- package/dist/types/lib/objects.d.ts +29 -0
- package/dist/types/schema/standard_delete.amis.d.ts +2 -0
- package/dist/types/standard/button.d.ts +2 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -483,8 +483,8 @@ function getComparableAmisVersion() {
|
|
|
483
483
|
/*
|
|
484
484
|
* @Author: baozhoutao@steedos.com
|
|
485
485
|
* @Date: 2022-05-23 09:53:08
|
|
486
|
-
* @LastEditors:
|
|
487
|
-
* @LastEditTime: 2024-
|
|
486
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
487
|
+
* @LastEditTime: 2024-02-21 17:19:30
|
|
488
488
|
* @Description:
|
|
489
489
|
*/
|
|
490
490
|
|
|
@@ -570,7 +570,11 @@ function getNameTpl(field, ctx){
|
|
|
570
570
|
if(ctx && ctx.isLookup){
|
|
571
571
|
linkTarget = "target='_blank'";
|
|
572
572
|
}
|
|
573
|
-
|
|
573
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
574
|
+
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
|
|
575
|
+
}else {
|
|
576
|
+
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
577
|
+
}
|
|
574
578
|
}
|
|
575
579
|
|
|
576
580
|
function getRelatedFieldTpl(field, ctx){
|
|
@@ -599,6 +603,9 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
599
603
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
600
604
|
if(field.multiple){
|
|
601
605
|
let labelTpl = `<%=item.label%>`;
|
|
606
|
+
if(ctx.isRelated){
|
|
607
|
+
linkTarget = "target='_blank'";
|
|
608
|
+
}
|
|
602
609
|
if(!onlyDisplayLookLabel){
|
|
603
610
|
const href = Router.getObjectDetailPath({
|
|
604
611
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
@@ -621,7 +628,12 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
621
628
|
const href = Router.getObjectDetailPath({
|
|
622
629
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
623
630
|
});
|
|
624
|
-
|
|
631
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
632
|
+
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
633
|
+
}else {
|
|
634
|
+
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
635
|
+
}
|
|
636
|
+
|
|
625
637
|
}
|
|
626
638
|
tpl = labelTpl;
|
|
627
639
|
}
|
|
@@ -736,27 +748,29 @@ async function getFieldsTemplate(fields, display){
|
|
|
736
748
|
fieldsArr = _$1.values(fields);
|
|
737
749
|
}
|
|
738
750
|
for (const field of fieldsArr) {
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
if(
|
|
745
|
-
|
|
746
|
-
|
|
751
|
+
if(field.name){
|
|
752
|
+
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
753
|
+
if(field.expand){
|
|
754
|
+
expandFields.push(field);
|
|
755
|
+
}else {
|
|
756
|
+
if(field.name.indexOf('.') < 0){
|
|
757
|
+
if(display && (field.type == 'lookup' || field.type == 'master_detail')){
|
|
758
|
+
fieldsName.push(`${field.name}`);
|
|
759
|
+
displayFields.push(`${field.name}`);
|
|
760
|
+
}else {
|
|
761
|
+
fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
|
|
762
|
+
}
|
|
763
|
+
if(includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
764
|
+
fieldsName.push(`${field.name}`);
|
|
765
|
+
}
|
|
766
|
+
if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
767
|
+
displayFields.push(`${field.name}`);
|
|
768
|
+
}
|
|
747
769
|
}else {
|
|
748
|
-
|
|
770
|
+
objectFieldName = field.name.split('.')[0];
|
|
771
|
+
fieldsName.push(objectFieldName);
|
|
772
|
+
displayFields.push(objectFieldName);
|
|
749
773
|
}
|
|
750
|
-
if(includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
751
|
-
fieldsName.push(`${field.name}`);
|
|
752
|
-
}
|
|
753
|
-
if(includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
754
|
-
displayFields.push(`${field.name}`);
|
|
755
|
-
}
|
|
756
|
-
}else {
|
|
757
|
-
objectFieldName = field.name.split('.')[0];
|
|
758
|
-
fieldsName.push(objectFieldName);
|
|
759
|
-
displayFields.push(objectFieldName);
|
|
760
774
|
}
|
|
761
775
|
}
|
|
762
776
|
}
|
|
@@ -2270,6 +2284,55 @@ async function getTableColumns(fields, options){
|
|
|
2270
2284
|
columnItem.type = 'color';
|
|
2271
2285
|
columnItem.defaultColor = null;
|
|
2272
2286
|
}
|
|
2287
|
+
|
|
2288
|
+
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2289
|
+
|
|
2290
|
+
const drawerRecordDetailSchema = {
|
|
2291
|
+
"type": "steedos-record-detail",
|
|
2292
|
+
"objectApiName": "${objectName}",
|
|
2293
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2294
|
+
"showBackButton": false,
|
|
2295
|
+
"showButtons": true,
|
|
2296
|
+
"data": {
|
|
2297
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2298
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2299
|
+
}
|
|
2300
|
+
};
|
|
2301
|
+
|
|
2302
|
+
|
|
2303
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2304
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2305
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
columnItem.onEvent = {
|
|
2309
|
+
"click": {
|
|
2310
|
+
"actions": [
|
|
2311
|
+
{
|
|
2312
|
+
"actionType": "drawer",
|
|
2313
|
+
"drawer": {
|
|
2314
|
+
"type": "drawer",
|
|
2315
|
+
"title": " ",
|
|
2316
|
+
"headerClassName": "hidden",
|
|
2317
|
+
"size": "lg",
|
|
2318
|
+
"bodyClassName": "p-0 m-0",
|
|
2319
|
+
"closeOnEsc": true,
|
|
2320
|
+
"closeOnOutside": true,
|
|
2321
|
+
"resizable": true,
|
|
2322
|
+
"actions": [],
|
|
2323
|
+
"body": [
|
|
2324
|
+
drawerRecordDetailSchema
|
|
2325
|
+
],
|
|
2326
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2327
|
+
"id": "u:fc5f055afa8c"
|
|
2328
|
+
},
|
|
2329
|
+
"preventDefault": true
|
|
2330
|
+
}
|
|
2331
|
+
]
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2273
2336
|
}
|
|
2274
2337
|
}
|
|
2275
2338
|
if(columnItem){
|
|
@@ -2318,7 +2381,7 @@ function getMobileLines(tpls){
|
|
|
2318
2381
|
let isNewLine = false;
|
|
2319
2382
|
let isLeft = true;
|
|
2320
2383
|
let lineChildrenClassName = "";
|
|
2321
|
-
let lineClassName = "flex items-center justify-between";
|
|
2384
|
+
let lineClassName = "flex items-center justify-between mb-1";
|
|
2322
2385
|
tpls.forEach(function(item){
|
|
2323
2386
|
if(isNewLine && lines.length < maxLineCount){
|
|
2324
2387
|
lines.push({
|
|
@@ -4502,8 +4565,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4502
4565
|
/*
|
|
4503
4566
|
* @Author: baozhoutao@steedos.com
|
|
4504
4567
|
* @Date: 2022-11-01 15:51:00
|
|
4505
|
-
* @LastEditors:
|
|
4506
|
-
* @LastEditTime:
|
|
4568
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4569
|
+
* @LastEditTime: 2024-02-18 18:37:35
|
|
4507
4570
|
* @Description:
|
|
4508
4571
|
*/
|
|
4509
4572
|
|
|
@@ -4543,13 +4606,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4543
4606
|
const recordId = _master.recordId;
|
|
4544
4607
|
let relatedKeySaveValue = recordId;
|
|
4545
4608
|
const relatedField = fields[relatedKey];
|
|
4546
|
-
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4609
|
+
if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4547
4610
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
4548
4611
|
}
|
|
4549
4612
|
let relatedKeyValue;
|
|
4550
|
-
if(!_.isString(relatedField.reference_to)){
|
|
4613
|
+
if(relatedField && !_.isString(relatedField.reference_to)){
|
|
4551
4614
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
4552
|
-
}else if (relatedField.multiple) {
|
|
4615
|
+
}else if (relatedField && relatedField.multiple) {
|
|
4553
4616
|
relatedKeyValue = [relatedKeySaveValue];
|
|
4554
4617
|
} else {
|
|
4555
4618
|
relatedKeyValue = relatedKeySaveValue;
|
|
@@ -4833,8 +4896,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4833
4896
|
/*
|
|
4834
4897
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
4835
4898
|
* @Date: 2023-03-22 09:31:21
|
|
4836
|
-
* @LastEditors:
|
|
4837
|
-
* @LastEditTime:
|
|
4899
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4900
|
+
* @LastEditTime: 2024-02-18 16:06:21
|
|
4838
4901
|
*/
|
|
4839
4902
|
const getSchema$3 = (uiSchema)=>{
|
|
4840
4903
|
return {
|
|
@@ -4880,7 +4943,8 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
4880
4943
|
},
|
|
4881
4944
|
"data": {
|
|
4882
4945
|
"objectName": `${uiSchema.name}`,
|
|
4883
|
-
"__deletedRecord": true
|
|
4946
|
+
"__deletedRecord": true,
|
|
4947
|
+
"_inDrawer": "${_inDrawer}"
|
|
4884
4948
|
}
|
|
4885
4949
|
},
|
|
4886
4950
|
{
|
|
@@ -5617,44 +5681,46 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5617
5681
|
}
|
|
5618
5682
|
});
|
|
5619
5683
|
|
|
5620
|
-
return
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5684
|
+
return [
|
|
5685
|
+
{
|
|
5686
|
+
"type": "button",
|
|
5687
|
+
"icon": "fa fa-angle-down",
|
|
5688
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
5689
|
+
"onEvent": {
|
|
5690
|
+
"click": {
|
|
5691
|
+
"actions": [
|
|
5692
|
+
{
|
|
5693
|
+
"actionType": "drawer",
|
|
5694
|
+
"drawer": {
|
|
5695
|
+
"type": "drawer",
|
|
5696
|
+
"title": i18next.t('frontend_operation'),
|
|
5697
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
5698
|
+
"body": [
|
|
5699
|
+
{
|
|
5700
|
+
"type": "button-group",
|
|
5701
|
+
"id": "u:fd837823be5b",
|
|
5702
|
+
"vertical": true,
|
|
5703
|
+
"tiled": true,
|
|
5704
|
+
"buttons": dropdownButtons,
|
|
5705
|
+
"btnLevel": "enhance",
|
|
5706
|
+
"className": "w-full",
|
|
5707
|
+
"btnClassName": "w-full",
|
|
5708
|
+
"size": "lg"
|
|
5709
|
+
}
|
|
5710
|
+
],
|
|
5711
|
+
"position": "bottom",
|
|
5712
|
+
"closeOnOutside": true,
|
|
5713
|
+
"resizable": false,
|
|
5714
|
+
"className": "buttons-drawer",
|
|
5715
|
+
"bodyClassName": "m-none p-none",
|
|
5716
|
+
"actions": []
|
|
5644
5717
|
}
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
"closeOnOutside": true,
|
|
5648
|
-
"resizable": false,
|
|
5649
|
-
"className": "buttons-drawer",
|
|
5650
|
-
"bodyClassName": "m-none p-none",
|
|
5651
|
-
"actions": []
|
|
5652
|
-
}
|
|
5718
|
+
}
|
|
5719
|
+
]
|
|
5653
5720
|
}
|
|
5654
|
-
|
|
5721
|
+
}
|
|
5655
5722
|
}
|
|
5656
|
-
|
|
5657
|
-
}
|
|
5723
|
+
]
|
|
5658
5724
|
}else {
|
|
5659
5725
|
if(moreButtons.length > 0){
|
|
5660
5726
|
const dropdownButtonsSchema = {
|
|
@@ -6723,6 +6789,33 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6723
6789
|
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
6724
6790
|
}
|
|
6725
6791
|
|
|
6792
|
+
amisButtonsSchema.push(
|
|
6793
|
+
{
|
|
6794
|
+
"type": "button",
|
|
6795
|
+
"visibleOn": "${_inDrawer === true || _inRecordMini === true}",
|
|
6796
|
+
"className":"ant-dropdown-trigger slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small slds-icon ml-1 flex",
|
|
6797
|
+
"onEvent": {
|
|
6798
|
+
"click": {
|
|
6799
|
+
"actions": [
|
|
6800
|
+
{
|
|
6801
|
+
"actionType": "custom",
|
|
6802
|
+
"script": "const data = event.data; window.open(`/app/${data.app_id}/${data.objectName}/view/${data.recordId}?side_object=${data.side_object}&side_listview_id=${data.side_listview_id}`)"
|
|
6803
|
+
}
|
|
6804
|
+
]
|
|
6805
|
+
}
|
|
6806
|
+
},
|
|
6807
|
+
"body": [
|
|
6808
|
+
{
|
|
6809
|
+
"type": "steedos-icon",
|
|
6810
|
+
"category": "utility",
|
|
6811
|
+
"name": "new_window",
|
|
6812
|
+
"colorVariant": "default",
|
|
6813
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
6814
|
+
}
|
|
6815
|
+
]
|
|
6816
|
+
}
|
|
6817
|
+
);
|
|
6818
|
+
|
|
6726
6819
|
let backButtonsSchema = null;
|
|
6727
6820
|
|
|
6728
6821
|
if(options.showBackButton != false){
|
|
@@ -6743,7 +6836,32 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6743
6836
|
"columns": [
|
|
6744
6837
|
{
|
|
6745
6838
|
"body": [
|
|
6746
|
-
backButtonsSchema
|
|
6839
|
+
backButtonsSchema,
|
|
6840
|
+
{
|
|
6841
|
+
"type": "button",
|
|
6842
|
+
"visibleOn": "${_inDrawer === true}",
|
|
6843
|
+
"className":"flex mr-4",
|
|
6844
|
+
"onEvent": {
|
|
6845
|
+
"click": {
|
|
6846
|
+
"actions": [
|
|
6847
|
+
{
|
|
6848
|
+
"componentId": "",
|
|
6849
|
+
"args": {},
|
|
6850
|
+
"actionType": "closeDrawer"
|
|
6851
|
+
}
|
|
6852
|
+
]
|
|
6853
|
+
}
|
|
6854
|
+
},
|
|
6855
|
+
"body": [
|
|
6856
|
+
{
|
|
6857
|
+
"type": "steedos-icon",
|
|
6858
|
+
"category": "utility",
|
|
6859
|
+
"name": "close",
|
|
6860
|
+
"colorVariant": "default",
|
|
6861
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
6862
|
+
}
|
|
6863
|
+
]
|
|
6864
|
+
}
|
|
6747
6865
|
,{
|
|
6748
6866
|
"type": "tpl",
|
|
6749
6867
|
"className": "block",
|
|
@@ -6958,10 +7076,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6958
7076
|
"md": "auto"
|
|
6959
7077
|
}
|
|
6960
7078
|
],
|
|
6961
|
-
"className": "flex justify-between"
|
|
7079
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
6962
7080
|
}
|
|
6963
7081
|
],
|
|
6964
|
-
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
|
|
7082
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
6965
7083
|
};
|
|
6966
7084
|
return recordRelatedListHeader;
|
|
6967
7085
|
}
|
|
@@ -9165,8 +9283,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
9165
9283
|
/*
|
|
9166
9284
|
* @Author: baozhoutao@steedos.com
|
|
9167
9285
|
* @Date: 2022-07-05 15:55:39
|
|
9168
|
-
* @LastEditors:
|
|
9169
|
-
* @LastEditTime: 2024-02-
|
|
9286
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9287
|
+
* @LastEditTime: 2024-02-18 14:46:50
|
|
9170
9288
|
* @Description:
|
|
9171
9289
|
*/
|
|
9172
9290
|
|
|
@@ -9300,7 +9418,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9300
9418
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
9301
9419
|
// }
|
|
9302
9420
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
9303
|
-
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
9421
|
+
const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
|
|
9304
9422
|
const isMobile = window.innerWidth < 768;
|
|
9305
9423
|
let headerToolbar = [];
|
|
9306
9424
|
if(!isMobile){
|
|
@@ -9574,8 +9692,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9574
9692
|
/*
|
|
9575
9693
|
* @Author: baozhoutao@steedos.com
|
|
9576
9694
|
* @Date: 2022-07-05 15:55:39
|
|
9577
|
-
* @LastEditors:
|
|
9578
|
-
* @LastEditTime: 2024-02-
|
|
9695
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9696
|
+
* @LastEditTime: 2024-02-18 16:05:21
|
|
9579
9697
|
* @Description:
|
|
9580
9698
|
*/
|
|
9581
9699
|
|
|
@@ -10144,10 +10262,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
10144
10262
|
"componentId": serviceId,
|
|
10145
10263
|
"expression": "this.__deletedRecord != true"
|
|
10146
10264
|
},
|
|
10265
|
+
{
|
|
10266
|
+
"actionType": "closeDialog",
|
|
10267
|
+
"expression": "this.__deletedRecord === true && this._inDrawer === true"
|
|
10268
|
+
},
|
|
10147
10269
|
{
|
|
10148
10270
|
"actionType": "custom",
|
|
10149
10271
|
"script": "window.goBack()",
|
|
10150
|
-
"expression": "this.__deletedRecord === true"
|
|
10272
|
+
"expression": "this.__deletedRecord === true && this._inDrawer != true"
|
|
10151
10273
|
}
|
|
10152
10274
|
]
|
|
10153
10275
|
},
|
|
@@ -11667,6 +11789,33 @@ async function getApi(object, recordId, fields, options){
|
|
|
11667
11789
|
}
|
|
11668
11790
|
}
|
|
11669
11791
|
|
|
11792
|
+
async function getAutoFill(field, refObject) {
|
|
11793
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11794
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11795
|
+
let fillMapping = {};
|
|
11796
|
+
let fieldsForApi = [];
|
|
11797
|
+
autoFillMapping.forEach(function (item) {
|
|
11798
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
11799
|
+
fieldsForApi.push(item.from);
|
|
11800
|
+
});
|
|
11801
|
+
// let api = {
|
|
11802
|
+
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11803
|
+
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
11804
|
+
// // "responseData": {
|
|
11805
|
+
// // "name": "${name}"
|
|
11806
|
+
// // },
|
|
11807
|
+
// "silent": false
|
|
11808
|
+
// }
|
|
11809
|
+
// return {
|
|
11810
|
+
// fillMapping,
|
|
11811
|
+
// // api
|
|
11812
|
+
// }
|
|
11813
|
+
// 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
|
|
11814
|
+
// 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
|
|
11815
|
+
return fillMapping;
|
|
11816
|
+
}
|
|
11817
|
+
}
|
|
11818
|
+
|
|
11670
11819
|
async function lookupToAmis(field, readonly, ctx){
|
|
11671
11820
|
if(!ctx){
|
|
11672
11821
|
ctx = {};
|
|
@@ -11750,6 +11899,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11750
11899
|
amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
11751
11900
|
}
|
|
11752
11901
|
}
|
|
11902
|
+
const autoFill = await getAutoFill(field);
|
|
11903
|
+
if(autoFill){
|
|
11904
|
+
amisSchema.autoFill = autoFill;
|
|
11905
|
+
}
|
|
11753
11906
|
return amisSchema;
|
|
11754
11907
|
}
|
|
11755
11908
|
|
|
@@ -11925,6 +12078,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
11925
12078
|
{
|
|
11926
12079
|
"type": "editor",
|
|
11927
12080
|
"name": field.name,
|
|
12081
|
+
"labelClassName": "none",
|
|
11928
12082
|
"language": "markdown",
|
|
11929
12083
|
}
|
|
11930
12084
|
]
|
|
@@ -14422,7 +14576,9 @@ async function getButtonNew(props) {
|
|
|
14422
14576
|
"actions": await getButtonActions(props, "new")
|
|
14423
14577
|
}
|
|
14424
14578
|
},
|
|
14425
|
-
"level": "
|
|
14579
|
+
"level": "link",
|
|
14580
|
+
"className": "text-gray-500",
|
|
14581
|
+
"size": "xs"
|
|
14426
14582
|
};
|
|
14427
14583
|
}
|
|
14428
14584
|
|
|
@@ -14432,6 +14588,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
14432
14588
|
"label": "",
|
|
14433
14589
|
"icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
|
|
14434
14590
|
"level": "link",
|
|
14591
|
+
"className": "text-gray-400",
|
|
14435
14592
|
"onEvent": {
|
|
14436
14593
|
"click": {
|
|
14437
14594
|
"actions": await getButtonActions(props, "edit")
|
|
@@ -14446,6 +14603,7 @@ async function getButtonView(props) {
|
|
|
14446
14603
|
"label": "",
|
|
14447
14604
|
"icon": "fa fa-expand-alt",//fa-external-link
|
|
14448
14605
|
"level": "link",
|
|
14606
|
+
"className": "text-gray-400",
|
|
14449
14607
|
"onEvent": {
|
|
14450
14608
|
"click": {
|
|
14451
14609
|
"actions": await getButtonActions(props, "readonly")
|
|
@@ -14458,6 +14616,7 @@ async function getButtonDelete(props) {
|
|
|
14458
14616
|
return {
|
|
14459
14617
|
"type": "dropdown-button",
|
|
14460
14618
|
"level": "link",
|
|
14619
|
+
"btnClassName": "text-gray-400",
|
|
14461
14620
|
"icon": "fa fa-trash-alt",
|
|
14462
14621
|
"size": "xs",
|
|
14463
14622
|
"hideCaret": true,
|
|
@@ -14692,6 +14851,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14692
14851
|
"labelAlign": props.labelAlign,
|
|
14693
14852
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14694
14853
|
"mode": props.mode || null,
|
|
14854
|
+
"visibleOn": props.$schema.visibleOn,
|
|
14855
|
+
"visible": props.$schema.visible,
|
|
14856
|
+
"hiddenOn": props.$schema.hiddenOn,
|
|
14857
|
+
"hidden": props.$schema.hidden,
|
|
14695
14858
|
className
|
|
14696
14859
|
};
|
|
14697
14860
|
// console.log("===schema===", schema);
|
|
@@ -17337,5 +17500,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17337
17500
|
};
|
|
17338
17501
|
};
|
|
17339
17502
|
|
|
17340
|
-
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getAmisInputTableSchema, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getGlobalNowData, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListButtonsSchemas, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getObjectRelatedListsMiniSchema, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailMiniSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getReferenceTo, getReferenceToFieldSchema, getReferenceToSync, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync$1 as getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
|
|
17503
|
+
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getAmisInputTableSchema, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn, getButtons, getCalendarSchema, getCreatedInfoTpl, getDateTimeTpl, getDateTpl, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFieldTpl, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getGlobalNowData, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLocationTpl, getLookupSapceUserTreeSchema, getLookupTpl, getModifiedInfoTpl, getNameTpl, getNameTplUrl, getNotifications, getNumberTpl, getObjectDetailButtons, getObjectDetailButtonsSchemas, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectListViewButtonsSchemas, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListButtonsSchemas, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getObjectRelatedListsMiniSchema, getPage, getPasswordTpl, getRecord, getRecordDetailHeaderSchema, getRecordDetailMiniSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRefObjectNameFieldName, getReferenceTo, getReferenceToFieldSchema, getReferenceToSync, getRelatedFieldTpl, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectMap, getSelectTpl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getSwitchTpl, getTableSchema, getTenantId, getTimeTpl, getUISchema, getUISchemaSync$1 as getUISchemaSync, getUiFieldTpl, getUiFileSizeTpl, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
|
|
17341
17504
|
//# sourceMappingURL=index.esm.js.map
|