@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.cjs.js
CHANGED
|
@@ -510,8 +510,8 @@ function getComparableAmisVersion() {
|
|
|
510
510
|
/*
|
|
511
511
|
* @Author: baozhoutao@steedos.com
|
|
512
512
|
* @Date: 2022-05-23 09:53:08
|
|
513
|
-
* @LastEditors:
|
|
514
|
-
* @LastEditTime: 2024-
|
|
513
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
514
|
+
* @LastEditTime: 2024-02-21 17:19:30
|
|
515
515
|
* @Description:
|
|
516
516
|
*/
|
|
517
517
|
|
|
@@ -597,7 +597,11 @@ function getNameTpl(field, ctx){
|
|
|
597
597
|
if(ctx && ctx.isLookup){
|
|
598
598
|
linkTarget = "target='_blank'";
|
|
599
599
|
}
|
|
600
|
-
|
|
600
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
601
|
+
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
|
|
602
|
+
}else {
|
|
603
|
+
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
604
|
+
}
|
|
601
605
|
}
|
|
602
606
|
|
|
603
607
|
function getRelatedFieldTpl(field, ctx){
|
|
@@ -626,6 +630,9 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
626
630
|
if(_.isString(field.reference_to) || !field.reference_to){
|
|
627
631
|
if(field.multiple){
|
|
628
632
|
let labelTpl = `<%=item.label%>`;
|
|
633
|
+
if(ctx.isRelated){
|
|
634
|
+
linkTarget = "target='_blank'";
|
|
635
|
+
}
|
|
629
636
|
if(!onlyDisplayLookLabel){
|
|
630
637
|
const href = Router.getObjectDetailPath({
|
|
631
638
|
formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
|
|
@@ -648,7 +655,12 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
648
655
|
const href = Router.getObjectDetailPath({
|
|
649
656
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
650
657
|
});
|
|
651
|
-
|
|
658
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
659
|
+
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
660
|
+
}else {
|
|
661
|
+
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
662
|
+
}
|
|
663
|
+
|
|
652
664
|
}
|
|
653
665
|
tpl = labelTpl;
|
|
654
666
|
}
|
|
@@ -763,27 +775,29 @@ async function getFieldsTemplate(fields, display){
|
|
|
763
775
|
fieldsArr = ___namespace.values(fields);
|
|
764
776
|
}
|
|
765
777
|
for (const field of fieldsArr) {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
if(
|
|
772
|
-
|
|
773
|
-
|
|
778
|
+
if(field.name){
|
|
779
|
+
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
780
|
+
if(field.expand){
|
|
781
|
+
expandFields.push(field);
|
|
782
|
+
}else {
|
|
783
|
+
if(field.name.indexOf('.') < 0){
|
|
784
|
+
if(display && (field.type == 'lookup' || field.type == 'master_detail')){
|
|
785
|
+
fieldsName.push(`${field.name}`);
|
|
786
|
+
displayFields.push(`${field.name}`);
|
|
787
|
+
}else {
|
|
788
|
+
fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
|
|
789
|
+
}
|
|
790
|
+
if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
791
|
+
fieldsName.push(`${field.name}`);
|
|
792
|
+
}
|
|
793
|
+
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
794
|
+
displayFields.push(`${field.name}`);
|
|
795
|
+
}
|
|
774
796
|
}else {
|
|
775
|
-
|
|
797
|
+
objectFieldName = field.name.split('.')[0];
|
|
798
|
+
fieldsName.push(objectFieldName);
|
|
799
|
+
displayFields.push(objectFieldName);
|
|
776
800
|
}
|
|
777
|
-
if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
778
|
-
fieldsName.push(`${field.name}`);
|
|
779
|
-
}
|
|
780
|
-
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
781
|
-
displayFields.push(`${field.name}`);
|
|
782
|
-
}
|
|
783
|
-
}else {
|
|
784
|
-
objectFieldName = field.name.split('.')[0];
|
|
785
|
-
fieldsName.push(objectFieldName);
|
|
786
|
-
displayFields.push(objectFieldName);
|
|
787
801
|
}
|
|
788
802
|
}
|
|
789
803
|
}
|
|
@@ -2297,6 +2311,55 @@ async function getTableColumns(fields, options){
|
|
|
2297
2311
|
columnItem.type = 'color';
|
|
2298
2312
|
columnItem.defaultColor = null;
|
|
2299
2313
|
}
|
|
2314
|
+
|
|
2315
|
+
if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && ___namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
2316
|
+
|
|
2317
|
+
const drawerRecordDetailSchema = {
|
|
2318
|
+
"type": "steedos-record-detail",
|
|
2319
|
+
"objectApiName": "${objectName}",
|
|
2320
|
+
"recordId": `\${${options.idFieldName}}`,
|
|
2321
|
+
"showBackButton": false,
|
|
2322
|
+
"showButtons": true,
|
|
2323
|
+
"data": {
|
|
2324
|
+
"_inDrawer": true, // 用于判断是否在抽屉中
|
|
2325
|
+
"recordLoaded": false, // 重置数据加载状态
|
|
2326
|
+
}
|
|
2327
|
+
};
|
|
2328
|
+
|
|
2329
|
+
|
|
2330
|
+
if(!(field.is_name || field.name === options.labelFieldName)){
|
|
2331
|
+
drawerRecordDetailSchema.objectApiName = field.reference_to;
|
|
2332
|
+
drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2335
|
+
columnItem.onEvent = {
|
|
2336
|
+
"click": {
|
|
2337
|
+
"actions": [
|
|
2338
|
+
{
|
|
2339
|
+
"actionType": "drawer",
|
|
2340
|
+
"drawer": {
|
|
2341
|
+
"type": "drawer",
|
|
2342
|
+
"title": " ",
|
|
2343
|
+
"headerClassName": "hidden",
|
|
2344
|
+
"size": "lg",
|
|
2345
|
+
"bodyClassName": "p-0 m-0",
|
|
2346
|
+
"closeOnEsc": true,
|
|
2347
|
+
"closeOnOutside": true,
|
|
2348
|
+
"resizable": true,
|
|
2349
|
+
"actions": [],
|
|
2350
|
+
"body": [
|
|
2351
|
+
drawerRecordDetailSchema
|
|
2352
|
+
],
|
|
2353
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2354
|
+
"id": "u:fc5f055afa8c"
|
|
2355
|
+
},
|
|
2356
|
+
"preventDefault": true
|
|
2357
|
+
}
|
|
2358
|
+
]
|
|
2359
|
+
}
|
|
2360
|
+
};
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2300
2363
|
}
|
|
2301
2364
|
}
|
|
2302
2365
|
if(columnItem){
|
|
@@ -2345,7 +2408,7 @@ function getMobileLines(tpls){
|
|
|
2345
2408
|
let isNewLine = false;
|
|
2346
2409
|
let isLeft = true;
|
|
2347
2410
|
let lineChildrenClassName = "";
|
|
2348
|
-
let lineClassName = "flex items-center justify-between";
|
|
2411
|
+
let lineClassName = "flex items-center justify-between mb-1";
|
|
2349
2412
|
tpls.forEach(function(item){
|
|
2350
2413
|
if(isNewLine && lines.length < maxLineCount){
|
|
2351
2414
|
lines.push({
|
|
@@ -4529,8 +4592,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4529
4592
|
/*
|
|
4530
4593
|
* @Author: baozhoutao@steedos.com
|
|
4531
4594
|
* @Date: 2022-11-01 15:51:00
|
|
4532
|
-
* @LastEditors:
|
|
4533
|
-
* @LastEditTime:
|
|
4595
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4596
|
+
* @LastEditTime: 2024-02-18 18:37:35
|
|
4534
4597
|
* @Description:
|
|
4535
4598
|
*/
|
|
4536
4599
|
|
|
@@ -4570,13 +4633,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4570
4633
|
const recordId = _master.recordId;
|
|
4571
4634
|
let relatedKeySaveValue = recordId;
|
|
4572
4635
|
const relatedField = fields[relatedKey];
|
|
4573
|
-
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4636
|
+
if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4574
4637
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
4575
4638
|
}
|
|
4576
4639
|
let relatedKeyValue;
|
|
4577
|
-
if(!_.isString(relatedField.reference_to)){
|
|
4640
|
+
if(relatedField && !_.isString(relatedField.reference_to)){
|
|
4578
4641
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
4579
|
-
}else if (relatedField.multiple) {
|
|
4642
|
+
}else if (relatedField && relatedField.multiple) {
|
|
4580
4643
|
relatedKeyValue = [relatedKeySaveValue];
|
|
4581
4644
|
} else {
|
|
4582
4645
|
relatedKeyValue = relatedKeySaveValue;
|
|
@@ -4860,8 +4923,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4860
4923
|
/*
|
|
4861
4924
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
4862
4925
|
* @Date: 2023-03-22 09:31:21
|
|
4863
|
-
* @LastEditors:
|
|
4864
|
-
* @LastEditTime:
|
|
4926
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4927
|
+
* @LastEditTime: 2024-02-18 16:06:21
|
|
4865
4928
|
*/
|
|
4866
4929
|
const getSchema$3 = (uiSchema)=>{
|
|
4867
4930
|
return {
|
|
@@ -4907,7 +4970,8 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
4907
4970
|
},
|
|
4908
4971
|
"data": {
|
|
4909
4972
|
"objectName": `${uiSchema.name}`,
|
|
4910
|
-
"__deletedRecord": true
|
|
4973
|
+
"__deletedRecord": true,
|
|
4974
|
+
"_inDrawer": "${_inDrawer}"
|
|
4911
4975
|
}
|
|
4912
4976
|
},
|
|
4913
4977
|
{
|
|
@@ -5644,44 +5708,46 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5644
5708
|
}
|
|
5645
5709
|
});
|
|
5646
5710
|
|
|
5647
|
-
return
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
5651
|
-
|
|
5652
|
-
|
|
5653
|
-
|
|
5654
|
-
|
|
5655
|
-
|
|
5656
|
-
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5711
|
+
return [
|
|
5712
|
+
{
|
|
5713
|
+
"type": "button",
|
|
5714
|
+
"icon": "fa fa-angle-down",
|
|
5715
|
+
"visibleOn": phoneMoreButtonsVisibleOn,
|
|
5716
|
+
"onEvent": {
|
|
5717
|
+
"click": {
|
|
5718
|
+
"actions": [
|
|
5719
|
+
{
|
|
5720
|
+
"actionType": "drawer",
|
|
5721
|
+
"drawer": {
|
|
5722
|
+
"type": "drawer",
|
|
5723
|
+
"title": i18next__default["default"].t('frontend_operation'),
|
|
5724
|
+
"id": "object_actions_drawer_" + objectSchema.name,
|
|
5725
|
+
"body": [
|
|
5726
|
+
{
|
|
5727
|
+
"type": "button-group",
|
|
5728
|
+
"id": "u:fd837823be5b",
|
|
5729
|
+
"vertical": true,
|
|
5730
|
+
"tiled": true,
|
|
5731
|
+
"buttons": dropdownButtons,
|
|
5732
|
+
"btnLevel": "enhance",
|
|
5733
|
+
"className": "w-full",
|
|
5734
|
+
"btnClassName": "w-full",
|
|
5735
|
+
"size": "lg"
|
|
5736
|
+
}
|
|
5737
|
+
],
|
|
5738
|
+
"position": "bottom",
|
|
5739
|
+
"closeOnOutside": true,
|
|
5740
|
+
"resizable": false,
|
|
5741
|
+
"className": "buttons-drawer",
|
|
5742
|
+
"bodyClassName": "m-none p-none",
|
|
5743
|
+
"actions": []
|
|
5671
5744
|
}
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
"closeOnOutside": true,
|
|
5675
|
-
"resizable": false,
|
|
5676
|
-
"className": "buttons-drawer",
|
|
5677
|
-
"bodyClassName": "m-none p-none",
|
|
5678
|
-
"actions": []
|
|
5679
|
-
}
|
|
5745
|
+
}
|
|
5746
|
+
]
|
|
5680
5747
|
}
|
|
5681
|
-
|
|
5748
|
+
}
|
|
5682
5749
|
}
|
|
5683
|
-
|
|
5684
|
-
}
|
|
5750
|
+
]
|
|
5685
5751
|
}else {
|
|
5686
5752
|
if(moreButtons.length > 0){
|
|
5687
5753
|
const dropdownButtonsSchema = {
|
|
@@ -6750,6 +6816,33 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6750
6816
|
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
6751
6817
|
}
|
|
6752
6818
|
|
|
6819
|
+
amisButtonsSchema.push(
|
|
6820
|
+
{
|
|
6821
|
+
"type": "button",
|
|
6822
|
+
"visibleOn": "${_inDrawer === true || _inRecordMini === true}",
|
|
6823
|
+
"className":"ant-dropdown-trigger slds-button slds-button_icon slds-button_icon-border-filled slds-button_icon-x-small slds-icon ml-1 flex",
|
|
6824
|
+
"onEvent": {
|
|
6825
|
+
"click": {
|
|
6826
|
+
"actions": [
|
|
6827
|
+
{
|
|
6828
|
+
"actionType": "custom",
|
|
6829
|
+
"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}`)"
|
|
6830
|
+
}
|
|
6831
|
+
]
|
|
6832
|
+
}
|
|
6833
|
+
},
|
|
6834
|
+
"body": [
|
|
6835
|
+
{
|
|
6836
|
+
"type": "steedos-icon",
|
|
6837
|
+
"category": "utility",
|
|
6838
|
+
"name": "new_window",
|
|
6839
|
+
"colorVariant": "default",
|
|
6840
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
6841
|
+
}
|
|
6842
|
+
]
|
|
6843
|
+
}
|
|
6844
|
+
);
|
|
6845
|
+
|
|
6753
6846
|
let backButtonsSchema = null;
|
|
6754
6847
|
|
|
6755
6848
|
if(options.showBackButton != false){
|
|
@@ -6770,7 +6863,32 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6770
6863
|
"columns": [
|
|
6771
6864
|
{
|
|
6772
6865
|
"body": [
|
|
6773
|
-
backButtonsSchema
|
|
6866
|
+
backButtonsSchema,
|
|
6867
|
+
{
|
|
6868
|
+
"type": "button",
|
|
6869
|
+
"visibleOn": "${_inDrawer === true}",
|
|
6870
|
+
"className":"flex mr-4",
|
|
6871
|
+
"onEvent": {
|
|
6872
|
+
"click": {
|
|
6873
|
+
"actions": [
|
|
6874
|
+
{
|
|
6875
|
+
"componentId": "",
|
|
6876
|
+
"args": {},
|
|
6877
|
+
"actionType": "closeDrawer"
|
|
6878
|
+
}
|
|
6879
|
+
]
|
|
6880
|
+
}
|
|
6881
|
+
},
|
|
6882
|
+
"body": [
|
|
6883
|
+
{
|
|
6884
|
+
"type": "steedos-icon",
|
|
6885
|
+
"category": "utility",
|
|
6886
|
+
"name": "close",
|
|
6887
|
+
"colorVariant": "default",
|
|
6888
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
6889
|
+
}
|
|
6890
|
+
]
|
|
6891
|
+
}
|
|
6774
6892
|
,{
|
|
6775
6893
|
"type": "tpl",
|
|
6776
6894
|
"className": "block",
|
|
@@ -6985,10 +7103,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
6985
7103
|
"md": "auto"
|
|
6986
7104
|
}
|
|
6987
7105
|
],
|
|
6988
|
-
"className": "flex justify-between"
|
|
7106
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
6989
7107
|
}
|
|
6990
7108
|
],
|
|
6991
|
-
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border"
|
|
7109
|
+
"className": "steedos-record-related-header py-2 px-3 bg-gray-50 border rounded"
|
|
6992
7110
|
};
|
|
6993
7111
|
return recordRelatedListHeader;
|
|
6994
7112
|
}
|
|
@@ -9192,8 +9310,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
9192
9310
|
/*
|
|
9193
9311
|
* @Author: baozhoutao@steedos.com
|
|
9194
9312
|
* @Date: 2022-07-05 15:55:39
|
|
9195
|
-
* @LastEditors:
|
|
9196
|
-
* @LastEditTime: 2024-02-
|
|
9313
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9314
|
+
* @LastEditTime: 2024-02-18 14:46:50
|
|
9197
9315
|
* @Description:
|
|
9198
9316
|
*/
|
|
9199
9317
|
|
|
@@ -9327,7 +9445,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9327
9445
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
9328
9446
|
// }
|
|
9329
9447
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
9330
|
-
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
9448
|
+
const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
|
|
9331
9449
|
const isMobile = window.innerWidth < 768;
|
|
9332
9450
|
let headerToolbar = [];
|
|
9333
9451
|
if(!isMobile){
|
|
@@ -9601,8 +9719,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9601
9719
|
/*
|
|
9602
9720
|
* @Author: baozhoutao@steedos.com
|
|
9603
9721
|
* @Date: 2022-07-05 15:55:39
|
|
9604
|
-
* @LastEditors:
|
|
9605
|
-
* @LastEditTime: 2024-02-
|
|
9722
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9723
|
+
* @LastEditTime: 2024-02-18 16:05:21
|
|
9606
9724
|
* @Description:
|
|
9607
9725
|
*/
|
|
9608
9726
|
|
|
@@ -10171,10 +10289,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
10171
10289
|
"componentId": serviceId,
|
|
10172
10290
|
"expression": "this.__deletedRecord != true"
|
|
10173
10291
|
},
|
|
10292
|
+
{
|
|
10293
|
+
"actionType": "closeDialog",
|
|
10294
|
+
"expression": "this.__deletedRecord === true && this._inDrawer === true"
|
|
10295
|
+
},
|
|
10174
10296
|
{
|
|
10175
10297
|
"actionType": "custom",
|
|
10176
10298
|
"script": "window.goBack()",
|
|
10177
|
-
"expression": "this.__deletedRecord === true"
|
|
10299
|
+
"expression": "this.__deletedRecord === true && this._inDrawer != true"
|
|
10178
10300
|
}
|
|
10179
10301
|
]
|
|
10180
10302
|
},
|
|
@@ -11694,6 +11816,33 @@ async function getApi(object, recordId, fields, options){
|
|
|
11694
11816
|
}
|
|
11695
11817
|
}
|
|
11696
11818
|
|
|
11819
|
+
async function getAutoFill(field, refObject) {
|
|
11820
|
+
let autoFillMapping = field.auto_fill_mapping;
|
|
11821
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11822
|
+
let fillMapping = {};
|
|
11823
|
+
let fieldsForApi = [];
|
|
11824
|
+
autoFillMapping.forEach(function (item) {
|
|
11825
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
11826
|
+
fieldsForApi.push(item.from);
|
|
11827
|
+
});
|
|
11828
|
+
// let api = {
|
|
11829
|
+
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11830
|
+
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
11831
|
+
// // "responseData": {
|
|
11832
|
+
// // "name": "${name}"
|
|
11833
|
+
// // },
|
|
11834
|
+
// "silent": false
|
|
11835
|
+
// }
|
|
11836
|
+
// return {
|
|
11837
|
+
// fillMapping,
|
|
11838
|
+
// // api
|
|
11839
|
+
// }
|
|
11840
|
+
// 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
|
|
11841
|
+
// 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
|
|
11842
|
+
return fillMapping;
|
|
11843
|
+
}
|
|
11844
|
+
}
|
|
11845
|
+
|
|
11697
11846
|
async function lookupToAmis(field, readonly, ctx){
|
|
11698
11847
|
if(!ctx){
|
|
11699
11848
|
ctx = {};
|
|
@@ -11777,6 +11926,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11777
11926
|
amisSchema = ___namespace.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
11778
11927
|
}
|
|
11779
11928
|
}
|
|
11929
|
+
const autoFill = await getAutoFill(field);
|
|
11930
|
+
if(autoFill){
|
|
11931
|
+
amisSchema.autoFill = autoFill;
|
|
11932
|
+
}
|
|
11780
11933
|
return amisSchema;
|
|
11781
11934
|
}
|
|
11782
11935
|
|
|
@@ -11952,6 +12105,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
11952
12105
|
{
|
|
11953
12106
|
"type": "editor",
|
|
11954
12107
|
"name": field.name,
|
|
12108
|
+
"labelClassName": "none",
|
|
11955
12109
|
"language": "markdown",
|
|
11956
12110
|
}
|
|
11957
12111
|
]
|
|
@@ -14449,7 +14603,9 @@ async function getButtonNew(props) {
|
|
|
14449
14603
|
"actions": await getButtonActions(props, "new")
|
|
14450
14604
|
}
|
|
14451
14605
|
},
|
|
14452
|
-
"level": "
|
|
14606
|
+
"level": "link",
|
|
14607
|
+
"className": "text-gray-500",
|
|
14608
|
+
"size": "xs"
|
|
14453
14609
|
};
|
|
14454
14610
|
}
|
|
14455
14611
|
|
|
@@ -14459,6 +14615,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
14459
14615
|
"label": "",
|
|
14460
14616
|
"icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
|
|
14461
14617
|
"level": "link",
|
|
14618
|
+
"className": "text-gray-400",
|
|
14462
14619
|
"onEvent": {
|
|
14463
14620
|
"click": {
|
|
14464
14621
|
"actions": await getButtonActions(props, "edit")
|
|
@@ -14473,6 +14630,7 @@ async function getButtonView(props) {
|
|
|
14473
14630
|
"label": "",
|
|
14474
14631
|
"icon": "fa fa-expand-alt",//fa-external-link
|
|
14475
14632
|
"level": "link",
|
|
14633
|
+
"className": "text-gray-400",
|
|
14476
14634
|
"onEvent": {
|
|
14477
14635
|
"click": {
|
|
14478
14636
|
"actions": await getButtonActions(props, "readonly")
|
|
@@ -14485,6 +14643,7 @@ async function getButtonDelete(props) {
|
|
|
14485
14643
|
return {
|
|
14486
14644
|
"type": "dropdown-button",
|
|
14487
14645
|
"level": "link",
|
|
14646
|
+
"btnClassName": "text-gray-400",
|
|
14488
14647
|
"icon": "fa fa-trash-alt",
|
|
14489
14648
|
"size": "xs",
|
|
14490
14649
|
"hideCaret": true,
|
|
@@ -14719,6 +14878,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14719
14878
|
"labelAlign": props.labelAlign,
|
|
14720
14879
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14721
14880
|
"mode": props.mode || null,
|
|
14881
|
+
"visibleOn": props.$schema.visibleOn,
|
|
14882
|
+
"visible": props.$schema.visible,
|
|
14883
|
+
"hiddenOn": props.$schema.hiddenOn,
|
|
14884
|
+
"hidden": props.$schema.hidden,
|
|
14722
14885
|
className
|
|
14723
14886
|
};
|
|
14724
14887
|
// console.log("===schema===", schema);
|
|
@@ -17393,11 +17556,15 @@ exports.getButtonVisible = getButtonVisible;
|
|
|
17393
17556
|
exports.getButtonVisibleOn = getButtonVisibleOn;
|
|
17394
17557
|
exports.getButtons = getButtons;
|
|
17395
17558
|
exports.getCalendarSchema = getCalendarSchema;
|
|
17559
|
+
exports.getCreatedInfoTpl = getCreatedInfoTpl;
|
|
17560
|
+
exports.getDateTimeTpl = getDateTimeTpl;
|
|
17561
|
+
exports.getDateTpl = getDateTpl;
|
|
17396
17562
|
exports.getDefaultRenderData = getDefaultRenderData;
|
|
17397
17563
|
exports.getEnv = getEnv;
|
|
17398
17564
|
exports.getEnvs = getEnvs;
|
|
17399
17565
|
exports.getEvn = getEvn;
|
|
17400
17566
|
exports.getField = getField;
|
|
17567
|
+
exports.getFieldTpl = getFieldTpl;
|
|
17401
17568
|
exports.getFileSrc = getFileSrc;
|
|
17402
17569
|
exports.getFlowFormSchema = getFlowFormSchema;
|
|
17403
17570
|
exports.getFormPageInitSchema = getFormPageInitSchema;
|
|
@@ -17414,8 +17581,14 @@ exports.getListViewFilter = getListViewFilter;
|
|
|
17414
17581
|
exports.getListViewItemButtons = getListViewItemButtons;
|
|
17415
17582
|
exports.getListViewSort = getListViewSort;
|
|
17416
17583
|
exports.getListviewInitSchema = getListviewInitSchema;
|
|
17584
|
+
exports.getLocationTpl = getLocationTpl;
|
|
17417
17585
|
exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
|
|
17586
|
+
exports.getLookupTpl = getLookupTpl;
|
|
17587
|
+
exports.getModifiedInfoTpl = getModifiedInfoTpl;
|
|
17588
|
+
exports.getNameTpl = getNameTpl;
|
|
17589
|
+
exports.getNameTplUrl = getNameTplUrl;
|
|
17418
17590
|
exports.getNotifications = getNotifications;
|
|
17591
|
+
exports.getNumberTpl = getNumberTpl;
|
|
17419
17592
|
exports.getObjectDetailButtons = getObjectDetailButtons;
|
|
17420
17593
|
exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
|
|
17421
17594
|
exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
|
|
@@ -17436,6 +17609,7 @@ exports.getObjectRelatedListButtons = getObjectRelatedListButtons;
|
|
|
17436
17609
|
exports.getObjectRelatedListHeader = getObjectRelatedListHeader;
|
|
17437
17610
|
exports.getObjectRelatedListsMiniSchema = getObjectRelatedListsMiniSchema;
|
|
17438
17611
|
exports.getPage = getPage;
|
|
17612
|
+
exports.getPasswordTpl = getPasswordTpl;
|
|
17439
17613
|
exports.getRecord = getRecord;
|
|
17440
17614
|
exports.getRecordDetailHeaderSchema = getRecordDetailHeaderSchema;
|
|
17441
17615
|
exports.getRecordDetailMiniSchema = getRecordDetailMiniSchema;
|
|
@@ -17444,21 +17618,29 @@ exports.getRecordDetailSchema = getRecordDetailSchema;
|
|
|
17444
17618
|
exports.getRecordPageInitSchema = getRecordPageInitSchema;
|
|
17445
17619
|
exports.getRecordPermissions = getRecordPermissions;
|
|
17446
17620
|
exports.getRecordServiceSchema = getRecordServiceSchema;
|
|
17621
|
+
exports.getRefObjectNameFieldName = getRefObjectNameFieldName;
|
|
17447
17622
|
exports.getReferenceTo = getReferenceTo;
|
|
17448
17623
|
exports.getReferenceToFieldSchema = getReferenceToFieldSchema;
|
|
17449
17624
|
exports.getReferenceToSync = getReferenceToSync;
|
|
17625
|
+
exports.getRelatedFieldTpl = getRelatedFieldTpl;
|
|
17450
17626
|
exports.getRelatedFieldValue = getRelatedFieldValue;
|
|
17451
17627
|
exports.getRelatedListSchema = getRelatedListSchema;
|
|
17452
17628
|
exports.getRelatedsCount = getRelatedsCount;
|
|
17453
17629
|
exports.getRootUrl = getRootUrl;
|
|
17630
|
+
exports.getSelectMap = getSelectMap;
|
|
17631
|
+
exports.getSelectTpl = getSelectTpl;
|
|
17454
17632
|
exports.getSelectUserSchema = getSelectUserSchema;
|
|
17455
17633
|
exports.getSpaceUsersPickerAmisSchema = getSpaceUsersPickerAmisSchema;
|
|
17456
17634
|
exports.getSpaceUsersPickerSchema = getSpaceUsersPickerSchema;
|
|
17457
17635
|
exports.getSteedosAuth = getSteedosAuth;
|
|
17636
|
+
exports.getSwitchTpl = getSwitchTpl;
|
|
17458
17637
|
exports.getTableSchema = getTableSchema;
|
|
17459
17638
|
exports.getTenantId = getTenantId;
|
|
17639
|
+
exports.getTimeTpl = getTimeTpl;
|
|
17460
17640
|
exports.getUISchema = getUISchema;
|
|
17461
17641
|
exports.getUISchemaSync = getUISchemaSync$1;
|
|
17642
|
+
exports.getUiFieldTpl = getUiFieldTpl;
|
|
17643
|
+
exports.getUiFileSizeTpl = getUiFileSizeTpl;
|
|
17462
17644
|
exports.getUserId = getUserId;
|
|
17463
17645
|
exports.getViewSchema = getViewSchema;
|
|
17464
17646
|
exports.isExpression = isExpression;
|