@steedos-widgets/amis-lib 3.6.4-beta.1 → 3.6.4-beta.3
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 +273 -85
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +255 -86
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +119 -99
- 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 +24 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -511,7 +511,7 @@ function getComparableAmisVersion() {
|
|
|
511
511
|
* @Author: baozhoutao@steedos.com
|
|
512
512
|
* @Date: 2022-05-23 09:53:08
|
|
513
513
|
* @LastEditors: baozhoutao@steedos.com
|
|
514
|
-
* @LastEditTime: 2024-02-
|
|
514
|
+
* @LastEditTime: 2024-02-21 17:19:30
|
|
515
515
|
* @Description:
|
|
516
516
|
*/
|
|
517
517
|
|
|
@@ -597,7 +597,7 @@ function getNameTpl(field, ctx){
|
|
|
597
597
|
if(ctx && ctx.isLookup){
|
|
598
598
|
linkTarget = "target='_blank'";
|
|
599
599
|
}
|
|
600
|
-
if(ctx.isRelated){
|
|
600
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
601
601
|
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
|
|
602
602
|
}else {
|
|
603
603
|
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
@@ -655,7 +655,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
655
655
|
const href = Router.getObjectDetailPath({
|
|
656
656
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
657
657
|
});
|
|
658
|
-
if(ctx.isRelated){
|
|
658
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
659
659
|
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
660
660
|
}else {
|
|
661
661
|
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
@@ -2312,7 +2312,7 @@ async function getTableColumns(fields, options){
|
|
|
2312
2312
|
columnItem.defaultColor = null;
|
|
2313
2313
|
}
|
|
2314
2314
|
|
|
2315
|
-
if(((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && ___namespace.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
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
2316
|
|
|
2317
2317
|
const drawerRecordDetailSchema = {
|
|
2318
2318
|
"type": "steedos-record-detail",
|
|
@@ -2340,16 +2340,17 @@ async function getTableColumns(fields, options){
|
|
|
2340
2340
|
"drawer": {
|
|
2341
2341
|
"type": "drawer",
|
|
2342
2342
|
"title": " ",
|
|
2343
|
-
"headerClassName": "",
|
|
2343
|
+
"headerClassName": "hidden",
|
|
2344
2344
|
"size": "lg",
|
|
2345
|
-
"bodyClassName": "p-0 m-0
|
|
2345
|
+
"bodyClassName": "p-0 m-0",
|
|
2346
2346
|
"closeOnEsc": true,
|
|
2347
|
+
"closeOnOutside": true,
|
|
2347
2348
|
"resizable": true,
|
|
2348
2349
|
"actions": [],
|
|
2349
2350
|
"body": [
|
|
2350
2351
|
drawerRecordDetailSchema
|
|
2351
2352
|
],
|
|
2352
|
-
"className": "app-popover",
|
|
2353
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2353
2354
|
"id": "u:fc5f055afa8c"
|
|
2354
2355
|
},
|
|
2355
2356
|
"preventDefault": true
|
|
@@ -2407,7 +2408,7 @@ function getMobileLines(tpls){
|
|
|
2407
2408
|
let isNewLine = false;
|
|
2408
2409
|
let isLeft = true;
|
|
2409
2410
|
let lineChildrenClassName = "";
|
|
2410
|
-
let lineClassName = "flex items-center justify-between";
|
|
2411
|
+
let lineClassName = "flex items-center justify-between mb-1";
|
|
2411
2412
|
tpls.forEach(function(item){
|
|
2412
2413
|
if(isNewLine && lines.length < maxLineCount){
|
|
2413
2414
|
lines.push({
|
|
@@ -5707,44 +5708,46 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5707
5708
|
}
|
|
5708
5709
|
});
|
|
5709
5710
|
|
|
5710
|
-
return
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
|
|
5721
|
-
|
|
5722
|
-
|
|
5723
|
-
|
|
5724
|
-
|
|
5725
|
-
|
|
5726
|
-
|
|
5727
|
-
|
|
5728
|
-
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
|
|
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": []
|
|
5734
5744
|
}
|
|
5735
|
-
|
|
5736
|
-
|
|
5737
|
-
"closeOnOutside": true,
|
|
5738
|
-
"resizable": false,
|
|
5739
|
-
"className": "buttons-drawer",
|
|
5740
|
-
"bodyClassName": "m-none p-none",
|
|
5741
|
-
"actions": []
|
|
5742
|
-
}
|
|
5745
|
+
}
|
|
5746
|
+
]
|
|
5743
5747
|
}
|
|
5744
|
-
|
|
5748
|
+
}
|
|
5745
5749
|
}
|
|
5746
|
-
|
|
5747
|
-
}
|
|
5750
|
+
]
|
|
5748
5751
|
}else {
|
|
5749
5752
|
if(moreButtons.length > 0){
|
|
5750
5753
|
const dropdownButtonsSchema = {
|
|
@@ -6813,6 +6816,33 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6813
6816
|
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
6814
6817
|
}
|
|
6815
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
|
+
|
|
6816
6846
|
let backButtonsSchema = null;
|
|
6817
6847
|
|
|
6818
6848
|
if(options.showBackButton != false){
|
|
@@ -6833,7 +6863,32 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6833
6863
|
"columns": [
|
|
6834
6864
|
{
|
|
6835
6865
|
"body": [
|
|
6836
|
-
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
|
+
}
|
|
6837
6892
|
,{
|
|
6838
6893
|
"type": "tpl",
|
|
6839
6894
|
"className": "block",
|
|
@@ -7048,10 +7103,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7048
7103
|
"md": "auto"
|
|
7049
7104
|
}
|
|
7050
7105
|
],
|
|
7051
|
-
"className": "flex justify-between"
|
|
7106
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
7052
7107
|
}
|
|
7053
7108
|
],
|
|
7054
|
-
"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"
|
|
7055
7110
|
};
|
|
7056
7111
|
return recordRelatedListHeader;
|
|
7057
7112
|
}
|
|
@@ -10644,7 +10699,22 @@ async function getSelectUserSchema(field, readonly, ctx) {
|
|
|
10644
10699
|
async function getSource(field, ctx) {
|
|
10645
10700
|
// data.query 最终格式 "{ \tleftOptions:organizations(filters: {__filters}){value:_id,label:name,children}, children:organizations(filters: {__filters}){ref:_id,children}, defaultValueOptions:space_users(filters: {__options_filters}){user,name} }"
|
|
10646
10701
|
const refObjectName = ctx.objectName;
|
|
10647
|
-
|
|
10702
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10703
|
+
let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
|
|
10704
|
+
|
|
10705
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10706
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10707
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10708
|
+
autoFillMapping.forEach(function (item) {
|
|
10709
|
+
if(item.from !== "children"){
|
|
10710
|
+
optionQueryFields.push({ name: item.from });
|
|
10711
|
+
}
|
|
10712
|
+
defaultOptionQueryFields.push({ name: item.from });
|
|
10713
|
+
});
|
|
10714
|
+
}
|
|
10715
|
+
|
|
10716
|
+
const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
|
|
10717
|
+
expand: false,
|
|
10648
10718
|
alias: "options",
|
|
10649
10719
|
filters: "{__filters}"
|
|
10650
10720
|
});
|
|
@@ -10655,7 +10725,8 @@ async function getSource(field, ctx) {
|
|
|
10655
10725
|
// });
|
|
10656
10726
|
// childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
|
|
10657
10727
|
// data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
|
|
10658
|
-
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null,
|
|
10728
|
+
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
|
|
10729
|
+
expand: false,
|
|
10659
10730
|
alias: "defaultValueOptions",
|
|
10660
10731
|
filters: "{__options_filters}"
|
|
10661
10732
|
});
|
|
@@ -10722,7 +10793,20 @@ async function getSource(field, ctx) {
|
|
|
10722
10793
|
async function getDeferApi(field, ctx) {
|
|
10723
10794
|
// data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
|
|
10724
10795
|
const refObjectName = ctx.objectName;
|
|
10725
|
-
|
|
10796
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10797
|
+
|
|
10798
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10799
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10800
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10801
|
+
autoFillMapping.forEach(function (item) {
|
|
10802
|
+
if(item.from !== "children"){
|
|
10803
|
+
optionQueryFields.push({ name: item.from });
|
|
10804
|
+
}
|
|
10805
|
+
});
|
|
10806
|
+
}
|
|
10807
|
+
|
|
10808
|
+
const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
|
|
10809
|
+
expand: false,
|
|
10726
10810
|
alias: "options",
|
|
10727
10811
|
// filters: "{__filters}",
|
|
10728
10812
|
queryOptions: `filters: {__filters}, sort: "{__sort}"`
|
|
@@ -10737,8 +10821,6 @@ async function getDeferApi(field, ctx) {
|
|
|
10737
10821
|
filters = filters(field);
|
|
10738
10822
|
}
|
|
10739
10823
|
data.query = data.query.replace(/,count\:.+/, "}");
|
|
10740
|
-
// 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
|
|
10741
|
-
data.query = data.query.replace("{_id}", "{{__fields}}");
|
|
10742
10824
|
const requestAdaptor = `
|
|
10743
10825
|
var dep = api.query.dep;
|
|
10744
10826
|
var term = api.query.term;
|
|
@@ -10748,11 +10830,10 @@ async function getDeferApi(field, ctx) {
|
|
|
10748
10830
|
var sort = "";
|
|
10749
10831
|
if (dep) {
|
|
10750
10832
|
objectName = "${refObjectName}";
|
|
10751
|
-
fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
|
|
10752
10833
|
filters = [['parent', '=', dep]];
|
|
10753
10834
|
sort = "${ctx.sort}";
|
|
10754
10835
|
}
|
|
10755
|
-
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{
|
|
10836
|
+
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
|
|
10756
10837
|
return api;
|
|
10757
10838
|
`;
|
|
10758
10839
|
const adaptor = `
|
|
@@ -11106,6 +11187,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11106
11187
|
}
|
|
11107
11188
|
});
|
|
11108
11189
|
|
|
11190
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11191
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11192
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11193
|
+
autoFillMapping.forEach(function (item) {
|
|
11194
|
+
if(!___namespace.find(tableFields, function(f){
|
|
11195
|
+
return f.name === item.from
|
|
11196
|
+
})){
|
|
11197
|
+
tableFields.push(refObjectConfig.fields[item.from]);
|
|
11198
|
+
}
|
|
11199
|
+
});
|
|
11200
|
+
}
|
|
11201
|
+
|
|
11109
11202
|
___namespace.each(refObjectConfig.fields, function (field) {
|
|
11110
11203
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
11111
11204
|
searchableFields.push(field.name);
|
|
@@ -11537,22 +11630,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11537
11630
|
|
|
11538
11631
|
let apiInfo;
|
|
11539
11632
|
let defaultValueOptionsQueryData;
|
|
11633
|
+
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11540
11634
|
if(referenceTo){
|
|
11541
|
-
|
|
11542
|
-
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
11635
|
+
let queryFields = [
|
|
11543
11636
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11544
11637
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11545
|
-
]
|
|
11638
|
+
];
|
|
11639
|
+
|
|
11640
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11641
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11642
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11643
|
+
autoFillMapping.forEach(function (item) {
|
|
11644
|
+
queryFields.push(refObjectConfig.fields[item.from]);
|
|
11645
|
+
});
|
|
11646
|
+
}
|
|
11647
|
+
|
|
11648
|
+
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
11649
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
|
|
11650
|
+
expand: false,
|
|
11546
11651
|
alias: "defaultValueOptions",
|
|
11547
11652
|
filters: "{__options_filters}",
|
|
11548
11653
|
count: false
|
|
11549
11654
|
});
|
|
11550
11655
|
apiInfo = await getApi({
|
|
11551
11656
|
name: referenceTo.objectName
|
|
11552
|
-
}, null,
|
|
11553
|
-
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11554
|
-
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11555
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11657
|
+
}, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11556
11658
|
|
|
11557
11659
|
apiInfo.adaptor = `
|
|
11558
11660
|
const data = payload.data;
|
|
@@ -11576,7 +11678,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11576
11678
|
};
|
|
11577
11679
|
}
|
|
11578
11680
|
|
|
11579
|
-
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11580
11681
|
let listView = getLookupListView(refObjectConfig);
|
|
11581
11682
|
|
|
11582
11683
|
let listviewFilter = getListViewFilter(listView);
|
|
@@ -11761,6 +11862,33 @@ async function getApi(object, recordId, fields, options){
|
|
|
11761
11862
|
}
|
|
11762
11863
|
}
|
|
11763
11864
|
|
|
11865
|
+
async function getAutoFill(field, refObject) {
|
|
11866
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11867
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11868
|
+
let fillMapping = {};
|
|
11869
|
+
// let fieldsForApi = [];
|
|
11870
|
+
autoFillMapping.forEach(function (item) {
|
|
11871
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
11872
|
+
// fieldsForApi.push(item.from);
|
|
11873
|
+
});
|
|
11874
|
+
// let api = {
|
|
11875
|
+
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11876
|
+
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
11877
|
+
// // "responseData": {
|
|
11878
|
+
// // "name": "${name}"
|
|
11879
|
+
// // },
|
|
11880
|
+
// "silent": false
|
|
11881
|
+
// }
|
|
11882
|
+
// return {
|
|
11883
|
+
// fillMapping,
|
|
11884
|
+
// // api
|
|
11885
|
+
// }
|
|
11886
|
+
// 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
|
|
11887
|
+
// 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
|
|
11888
|
+
return fillMapping;
|
|
11889
|
+
}
|
|
11890
|
+
}
|
|
11891
|
+
|
|
11764
11892
|
async function lookupToAmis(field, readonly, ctx){
|
|
11765
11893
|
if(!ctx){
|
|
11766
11894
|
ctx = {};
|
|
@@ -11844,6 +11972,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11844
11972
|
amisSchema = ___namespace.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
11845
11973
|
}
|
|
11846
11974
|
}
|
|
11975
|
+
const autoFill = await getAutoFill(field);
|
|
11976
|
+
if(autoFill){
|
|
11977
|
+
amisSchema.autoFill = autoFill;
|
|
11978
|
+
}
|
|
11847
11979
|
return amisSchema;
|
|
11848
11980
|
}
|
|
11849
11981
|
|
|
@@ -12019,6 +12151,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
12019
12151
|
{
|
|
12020
12152
|
"type": "editor",
|
|
12021
12153
|
"name": field.name,
|
|
12154
|
+
"labelClassName": "none",
|
|
12022
12155
|
"language": "markdown",
|
|
12023
12156
|
}
|
|
12024
12157
|
]
|
|
@@ -14071,6 +14204,7 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
14071
14204
|
async function getButtonActions(props, mode) {
|
|
14072
14205
|
let actions = [];
|
|
14073
14206
|
let primaryKey = getTablePrimaryKey(props);
|
|
14207
|
+
let tableServiceId = getComponentId("table_service", props.id);
|
|
14074
14208
|
let formId = getComponentId("form", props.id);
|
|
14075
14209
|
let dialogId = getComponentId("dialog", props.id);
|
|
14076
14210
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
@@ -14387,7 +14521,30 @@ async function getButtonActions(props, mode) {
|
|
|
14387
14521
|
// };
|
|
14388
14522
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
14389
14523
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
14390
|
-
|
|
14524
|
+
if (props.enableDialog === false) {
|
|
14525
|
+
actions = [
|
|
14526
|
+
{
|
|
14527
|
+
"actionType": "custom",
|
|
14528
|
+
"script": `
|
|
14529
|
+
let scope = event.context.scoped;
|
|
14530
|
+
let __wrapperServiceId = "${tableServiceId}";
|
|
14531
|
+
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
14532
|
+
let wrapperServiceData = wrapperService.getData();
|
|
14533
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
14534
|
+
lastestFieldValue.push({})
|
|
14535
|
+
doAction({
|
|
14536
|
+
"componentId": "${props.id}",
|
|
14537
|
+
"actionType": "setValue",
|
|
14538
|
+
"args": {
|
|
14539
|
+
"value": lastestFieldValue
|
|
14540
|
+
}
|
|
14541
|
+
});
|
|
14542
|
+
`
|
|
14543
|
+
}
|
|
14544
|
+
];
|
|
14545
|
+
}else {
|
|
14546
|
+
actions = [actionShowEditDialog];
|
|
14547
|
+
}
|
|
14391
14548
|
}
|
|
14392
14549
|
else if (mode == "edit") {
|
|
14393
14550
|
actions = [actionShowEditDialog];
|
|
@@ -14516,7 +14673,9 @@ async function getButtonNew(props) {
|
|
|
14516
14673
|
"actions": await getButtonActions(props, "new")
|
|
14517
14674
|
}
|
|
14518
14675
|
},
|
|
14519
|
-
"level": "
|
|
14676
|
+
"level": "link",
|
|
14677
|
+
"className": "text-gray-500",
|
|
14678
|
+
"size": "xs"
|
|
14520
14679
|
};
|
|
14521
14680
|
}
|
|
14522
14681
|
|
|
@@ -14526,6 +14685,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
14526
14685
|
"label": "",
|
|
14527
14686
|
"icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
|
|
14528
14687
|
"level": "link",
|
|
14688
|
+
"className": "text-gray-400",
|
|
14529
14689
|
"onEvent": {
|
|
14530
14690
|
"click": {
|
|
14531
14691
|
"actions": await getButtonActions(props, "edit")
|
|
@@ -14540,6 +14700,7 @@ async function getButtonView(props) {
|
|
|
14540
14700
|
"label": "",
|
|
14541
14701
|
"icon": "fa fa-expand-alt",//fa-external-link
|
|
14542
14702
|
"level": "link",
|
|
14703
|
+
"className": "text-gray-400",
|
|
14543
14704
|
"onEvent": {
|
|
14544
14705
|
"click": {
|
|
14545
14706
|
"actions": await getButtonActions(props, "readonly")
|
|
@@ -14552,6 +14713,7 @@ async function getButtonDelete(props) {
|
|
|
14552
14713
|
return {
|
|
14553
14714
|
"type": "dropdown-button",
|
|
14554
14715
|
"level": "link",
|
|
14716
|
+
"btnClassName": "text-gray-400",
|
|
14555
14717
|
"icon": "fa fa-trash-alt",
|
|
14556
14718
|
"size": "xs",
|
|
14557
14719
|
"hideCaret": true,
|
|
@@ -14614,31 +14776,34 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14614
14776
|
let inlineEditMode = props.inlineEditMode;
|
|
14615
14777
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
14616
14778
|
if (showOperation) {
|
|
14617
|
-
if (props.
|
|
14618
|
-
|
|
14619
|
-
|
|
14620
|
-
|
|
14621
|
-
|
|
14622
|
-
|
|
14623
|
-
|
|
14624
|
-
|
|
14625
|
-
|
|
14626
|
-
|
|
14627
|
-
|
|
14628
|
-
|
|
14779
|
+
if (props.enableDialog !== false) {
|
|
14780
|
+
if (props.editable) {
|
|
14781
|
+
let showEditButton = true;
|
|
14782
|
+
if (showAsInlineEditMode) {
|
|
14783
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
14784
|
+
showEditButton = true;
|
|
14785
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
14786
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
14787
|
+
// showEditButton = true;
|
|
14788
|
+
// }
|
|
14789
|
+
// else {
|
|
14790
|
+
// showEditButton = false;
|
|
14791
|
+
// }
|
|
14792
|
+
}
|
|
14793
|
+
// 编辑时显示编辑按钮
|
|
14794
|
+
if (showEditButton) {
|
|
14795
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
14796
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
14797
|
+
}
|
|
14629
14798
|
}
|
|
14630
|
-
|
|
14631
|
-
|
|
14632
|
-
|
|
14633
|
-
|
|
14799
|
+
else {
|
|
14800
|
+
// 只读时显示查看按钮
|
|
14801
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14802
|
+
let buttonViewSchema = await getButtonView(props);
|
|
14803
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14634
14804
|
}
|
|
14635
14805
|
}
|
|
14636
|
-
|
|
14637
|
-
// 只读时显示查看按钮
|
|
14638
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14639
|
-
let buttonViewSchema = await getButtonView(props);
|
|
14640
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14641
|
-
}
|
|
14806
|
+
|
|
14642
14807
|
if (props.removable) {
|
|
14643
14808
|
let buttonDeleteSchema = await getButtonDelete(props);
|
|
14644
14809
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
@@ -14786,6 +14951,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14786
14951
|
"labelAlign": props.labelAlign,
|
|
14787
14952
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14788
14953
|
"mode": props.mode || null,
|
|
14954
|
+
"visibleOn": props.$schema.visibleOn,
|
|
14955
|
+
"visible": props.$schema.visible,
|
|
14956
|
+
"hiddenOn": props.$schema.hiddenOn,
|
|
14957
|
+
"hidden": props.$schema.hidden,
|
|
14789
14958
|
className
|
|
14790
14959
|
};
|
|
14791
14960
|
// console.log("===schema===", schema);
|
|
@@ -17460,11 +17629,15 @@ exports.getButtonVisible = getButtonVisible;
|
|
|
17460
17629
|
exports.getButtonVisibleOn = getButtonVisibleOn;
|
|
17461
17630
|
exports.getButtons = getButtons;
|
|
17462
17631
|
exports.getCalendarSchema = getCalendarSchema;
|
|
17632
|
+
exports.getCreatedInfoTpl = getCreatedInfoTpl;
|
|
17633
|
+
exports.getDateTimeTpl = getDateTimeTpl;
|
|
17634
|
+
exports.getDateTpl = getDateTpl;
|
|
17463
17635
|
exports.getDefaultRenderData = getDefaultRenderData;
|
|
17464
17636
|
exports.getEnv = getEnv;
|
|
17465
17637
|
exports.getEnvs = getEnvs;
|
|
17466
17638
|
exports.getEvn = getEvn;
|
|
17467
17639
|
exports.getField = getField;
|
|
17640
|
+
exports.getFieldTpl = getFieldTpl;
|
|
17468
17641
|
exports.getFileSrc = getFileSrc;
|
|
17469
17642
|
exports.getFlowFormSchema = getFlowFormSchema;
|
|
17470
17643
|
exports.getFormPageInitSchema = getFormPageInitSchema;
|
|
@@ -17481,8 +17654,14 @@ exports.getListViewFilter = getListViewFilter;
|
|
|
17481
17654
|
exports.getListViewItemButtons = getListViewItemButtons;
|
|
17482
17655
|
exports.getListViewSort = getListViewSort;
|
|
17483
17656
|
exports.getListviewInitSchema = getListviewInitSchema;
|
|
17657
|
+
exports.getLocationTpl = getLocationTpl;
|
|
17484
17658
|
exports.getLookupSapceUserTreeSchema = getLookupSapceUserTreeSchema;
|
|
17659
|
+
exports.getLookupTpl = getLookupTpl;
|
|
17660
|
+
exports.getModifiedInfoTpl = getModifiedInfoTpl;
|
|
17661
|
+
exports.getNameTpl = getNameTpl;
|
|
17662
|
+
exports.getNameTplUrl = getNameTplUrl;
|
|
17485
17663
|
exports.getNotifications = getNotifications;
|
|
17664
|
+
exports.getNumberTpl = getNumberTpl;
|
|
17486
17665
|
exports.getObjectDetailButtons = getObjectDetailButtons;
|
|
17487
17666
|
exports.getObjectDetailButtonsSchemas = getObjectDetailButtonsSchemas;
|
|
17488
17667
|
exports.getObjectDetailMoreButtons = getObjectDetailMoreButtons;
|
|
@@ -17503,6 +17682,7 @@ exports.getObjectRelatedListButtons = getObjectRelatedListButtons;
|
|
|
17503
17682
|
exports.getObjectRelatedListHeader = getObjectRelatedListHeader;
|
|
17504
17683
|
exports.getObjectRelatedListsMiniSchema = getObjectRelatedListsMiniSchema;
|
|
17505
17684
|
exports.getPage = getPage;
|
|
17685
|
+
exports.getPasswordTpl = getPasswordTpl;
|
|
17506
17686
|
exports.getRecord = getRecord;
|
|
17507
17687
|
exports.getRecordDetailHeaderSchema = getRecordDetailHeaderSchema;
|
|
17508
17688
|
exports.getRecordDetailMiniSchema = getRecordDetailMiniSchema;
|
|
@@ -17511,21 +17691,29 @@ exports.getRecordDetailSchema = getRecordDetailSchema;
|
|
|
17511
17691
|
exports.getRecordPageInitSchema = getRecordPageInitSchema;
|
|
17512
17692
|
exports.getRecordPermissions = getRecordPermissions;
|
|
17513
17693
|
exports.getRecordServiceSchema = getRecordServiceSchema;
|
|
17694
|
+
exports.getRefObjectNameFieldName = getRefObjectNameFieldName;
|
|
17514
17695
|
exports.getReferenceTo = getReferenceTo;
|
|
17515
17696
|
exports.getReferenceToFieldSchema = getReferenceToFieldSchema;
|
|
17516
17697
|
exports.getReferenceToSync = getReferenceToSync;
|
|
17698
|
+
exports.getRelatedFieldTpl = getRelatedFieldTpl;
|
|
17517
17699
|
exports.getRelatedFieldValue = getRelatedFieldValue;
|
|
17518
17700
|
exports.getRelatedListSchema = getRelatedListSchema;
|
|
17519
17701
|
exports.getRelatedsCount = getRelatedsCount;
|
|
17520
17702
|
exports.getRootUrl = getRootUrl;
|
|
17703
|
+
exports.getSelectMap = getSelectMap;
|
|
17704
|
+
exports.getSelectTpl = getSelectTpl;
|
|
17521
17705
|
exports.getSelectUserSchema = getSelectUserSchema;
|
|
17522
17706
|
exports.getSpaceUsersPickerAmisSchema = getSpaceUsersPickerAmisSchema;
|
|
17523
17707
|
exports.getSpaceUsersPickerSchema = getSpaceUsersPickerSchema;
|
|
17524
17708
|
exports.getSteedosAuth = getSteedosAuth;
|
|
17709
|
+
exports.getSwitchTpl = getSwitchTpl;
|
|
17525
17710
|
exports.getTableSchema = getTableSchema;
|
|
17526
17711
|
exports.getTenantId = getTenantId;
|
|
17712
|
+
exports.getTimeTpl = getTimeTpl;
|
|
17527
17713
|
exports.getUISchema = getUISchema;
|
|
17528
17714
|
exports.getUISchemaSync = getUISchemaSync$1;
|
|
17715
|
+
exports.getUiFieldTpl = getUiFieldTpl;
|
|
17716
|
+
exports.getUiFileSizeTpl = getUiFileSizeTpl;
|
|
17529
17717
|
exports.getUserId = getUserId;
|
|
17530
17718
|
exports.getViewSchema = getViewSchema;
|
|
17531
17719
|
exports.isExpression = isExpression;
|