@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.esm.js
CHANGED
|
@@ -484,7 +484,7 @@ function getComparableAmisVersion() {
|
|
|
484
484
|
* @Author: baozhoutao@steedos.com
|
|
485
485
|
* @Date: 2022-05-23 09:53:08
|
|
486
486
|
* @LastEditors: baozhoutao@steedos.com
|
|
487
|
-
* @LastEditTime: 2024-02-
|
|
487
|
+
* @LastEditTime: 2024-02-21 17:19:30
|
|
488
488
|
* @Description:
|
|
489
489
|
*/
|
|
490
490
|
|
|
@@ -570,7 +570,7 @@ function getNameTpl(field, ctx){
|
|
|
570
570
|
if(ctx && ctx.isLookup){
|
|
571
571
|
linkTarget = "target='_blank'";
|
|
572
572
|
}
|
|
573
|
-
if(ctx.isRelated){
|
|
573
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
574
574
|
return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
|
|
575
575
|
}else {
|
|
576
576
|
return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
|
|
@@ -628,7 +628,7 @@ function getRelatedFieldTpl(field, ctx){
|
|
|
628
628
|
const href = Router.getObjectDetailPath({
|
|
629
629
|
formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
|
|
630
630
|
});
|
|
631
|
-
if(ctx.isRelated){
|
|
631
|
+
if(ctx.isRelated && window.innerWidth >= 768){
|
|
632
632
|
labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
|
|
633
633
|
}else {
|
|
634
634
|
labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
|
|
@@ -2285,7 +2285,7 @@ async function getTableColumns(fields, options){
|
|
|
2285
2285
|
columnItem.defaultColor = null;
|
|
2286
2286
|
}
|
|
2287
2287
|
|
|
2288
|
-
if(((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && _$1.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
|
|
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
2289
|
|
|
2290
2290
|
const drawerRecordDetailSchema = {
|
|
2291
2291
|
"type": "steedos-record-detail",
|
|
@@ -2313,16 +2313,17 @@ async function getTableColumns(fields, options){
|
|
|
2313
2313
|
"drawer": {
|
|
2314
2314
|
"type": "drawer",
|
|
2315
2315
|
"title": " ",
|
|
2316
|
-
"headerClassName": "",
|
|
2316
|
+
"headerClassName": "hidden",
|
|
2317
2317
|
"size": "lg",
|
|
2318
|
-
"bodyClassName": "p-0 m-0
|
|
2318
|
+
"bodyClassName": "p-0 m-0",
|
|
2319
2319
|
"closeOnEsc": true,
|
|
2320
|
+
"closeOnOutside": true,
|
|
2320
2321
|
"resizable": true,
|
|
2321
2322
|
"actions": [],
|
|
2322
2323
|
"body": [
|
|
2323
2324
|
drawerRecordDetailSchema
|
|
2324
2325
|
],
|
|
2325
|
-
"className": "app-popover",
|
|
2326
|
+
"className": "steedos-record-detail-drawer app-popover",
|
|
2326
2327
|
"id": "u:fc5f055afa8c"
|
|
2327
2328
|
},
|
|
2328
2329
|
"preventDefault": true
|
|
@@ -2380,7 +2381,7 @@ function getMobileLines(tpls){
|
|
|
2380
2381
|
let isNewLine = false;
|
|
2381
2382
|
let isLeft = true;
|
|
2382
2383
|
let lineChildrenClassName = "";
|
|
2383
|
-
let lineClassName = "flex items-center justify-between";
|
|
2384
|
+
let lineClassName = "flex items-center justify-between mb-1";
|
|
2384
2385
|
tpls.forEach(function(item){
|
|
2385
2386
|
if(isNewLine && lines.length < maxLineCount){
|
|
2386
2387
|
lines.push({
|
|
@@ -5680,44 +5681,46 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5680
5681
|
}
|
|
5681
5682
|
});
|
|
5682
5683
|
|
|
5683
|
-
return
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5701
|
-
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
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": []
|
|
5707
5717
|
}
|
|
5708
|
-
|
|
5709
|
-
|
|
5710
|
-
"closeOnOutside": true,
|
|
5711
|
-
"resizable": false,
|
|
5712
|
-
"className": "buttons-drawer",
|
|
5713
|
-
"bodyClassName": "m-none p-none",
|
|
5714
|
-
"actions": []
|
|
5715
|
-
}
|
|
5718
|
+
}
|
|
5719
|
+
]
|
|
5716
5720
|
}
|
|
5717
|
-
|
|
5721
|
+
}
|
|
5718
5722
|
}
|
|
5719
|
-
|
|
5720
|
-
}
|
|
5723
|
+
]
|
|
5721
5724
|
}else {
|
|
5722
5725
|
if(moreButtons.length > 0){
|
|
5723
5726
|
const dropdownButtonsSchema = {
|
|
@@ -6786,6 +6789,33 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6786
6789
|
amisButtonsSchema = getObjectDetailButtonsSchemas(objectSchema, recordId, options);
|
|
6787
6790
|
}
|
|
6788
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
|
+
|
|
6789
6819
|
let backButtonsSchema = null;
|
|
6790
6820
|
|
|
6791
6821
|
if(options.showBackButton != false){
|
|
@@ -6806,7 +6836,32 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6806
6836
|
"columns": [
|
|
6807
6837
|
{
|
|
6808
6838
|
"body": [
|
|
6809
|
-
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
|
+
}
|
|
6810
6865
|
,{
|
|
6811
6866
|
"type": "tpl",
|
|
6812
6867
|
"className": "block",
|
|
@@ -7021,10 +7076,10 @@ async function getObjectRecordDetailRelatedListHeader(relatedObjectSchema, relat
|
|
|
7021
7076
|
"md": "auto"
|
|
7022
7077
|
}
|
|
7023
7078
|
],
|
|
7024
|
-
"className": "flex justify-between"
|
|
7079
|
+
"className": "flex justify-between min-h-8 items-center"
|
|
7025
7080
|
}
|
|
7026
7081
|
],
|
|
7027
|
-
"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"
|
|
7028
7083
|
};
|
|
7029
7084
|
return recordRelatedListHeader;
|
|
7030
7085
|
}
|
|
@@ -10617,7 +10672,22 @@ async function getSelectUserSchema(field, readonly, ctx) {
|
|
|
10617
10672
|
async function getSource(field, ctx) {
|
|
10618
10673
|
// 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} }"
|
|
10619
10674
|
const refObjectName = ctx.objectName;
|
|
10620
|
-
|
|
10675
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10676
|
+
let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
|
|
10677
|
+
|
|
10678
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10679
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10680
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10681
|
+
autoFillMapping.forEach(function (item) {
|
|
10682
|
+
if(item.from !== "children"){
|
|
10683
|
+
optionQueryFields.push({ name: item.from });
|
|
10684
|
+
}
|
|
10685
|
+
defaultOptionQueryFields.push({ name: item.from });
|
|
10686
|
+
});
|
|
10687
|
+
}
|
|
10688
|
+
|
|
10689
|
+
const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
|
|
10690
|
+
expand: false,
|
|
10621
10691
|
alias: "options",
|
|
10622
10692
|
filters: "{__filters}"
|
|
10623
10693
|
});
|
|
@@ -10628,7 +10698,8 @@ async function getSource(field, ctx) {
|
|
|
10628
10698
|
// });
|
|
10629
10699
|
// childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
|
|
10630
10700
|
// data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
|
|
10631
|
-
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null,
|
|
10701
|
+
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
|
|
10702
|
+
expand: false,
|
|
10632
10703
|
alias: "defaultValueOptions",
|
|
10633
10704
|
filters: "{__options_filters}"
|
|
10634
10705
|
});
|
|
@@ -10695,7 +10766,20 @@ async function getSource(field, ctx) {
|
|
|
10695
10766
|
async function getDeferApi(field, ctx) {
|
|
10696
10767
|
// data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
|
|
10697
10768
|
const refObjectName = ctx.objectName;
|
|
10698
|
-
|
|
10769
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
10770
|
+
|
|
10771
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
10772
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
10773
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
10774
|
+
autoFillMapping.forEach(function (item) {
|
|
10775
|
+
if(item.from !== "children"){
|
|
10776
|
+
optionQueryFields.push({ name: item.from });
|
|
10777
|
+
}
|
|
10778
|
+
});
|
|
10779
|
+
}
|
|
10780
|
+
|
|
10781
|
+
const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
|
|
10782
|
+
expand: false,
|
|
10699
10783
|
alias: "options",
|
|
10700
10784
|
// filters: "{__filters}",
|
|
10701
10785
|
queryOptions: `filters: {__filters}, sort: "{__sort}"`
|
|
@@ -10710,8 +10794,6 @@ async function getDeferApi(field, ctx) {
|
|
|
10710
10794
|
filters = filters(field);
|
|
10711
10795
|
}
|
|
10712
10796
|
data.query = data.query.replace(/,count\:.+/, "}");
|
|
10713
|
-
// 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
|
|
10714
|
-
data.query = data.query.replace("{_id}", "{{__fields}}");
|
|
10715
10797
|
const requestAdaptor = `
|
|
10716
10798
|
var dep = api.query.dep;
|
|
10717
10799
|
var term = api.query.term;
|
|
@@ -10721,11 +10803,10 @@ async function getDeferApi(field, ctx) {
|
|
|
10721
10803
|
var sort = "";
|
|
10722
10804
|
if (dep) {
|
|
10723
10805
|
objectName = "${refObjectName}";
|
|
10724
|
-
fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
|
|
10725
10806
|
filters = [['parent', '=', dep]];
|
|
10726
10807
|
sort = "${ctx.sort}";
|
|
10727
10808
|
}
|
|
10728
|
-
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{
|
|
10809
|
+
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
|
|
10729
10810
|
return api;
|
|
10730
10811
|
`;
|
|
10731
10812
|
const adaptor = `
|
|
@@ -11079,6 +11160,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11079
11160
|
}
|
|
11080
11161
|
});
|
|
11081
11162
|
|
|
11163
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11164
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11165
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11166
|
+
autoFillMapping.forEach(function (item) {
|
|
11167
|
+
if(!_$1.find(tableFields, function(f){
|
|
11168
|
+
return f.name === item.from
|
|
11169
|
+
})){
|
|
11170
|
+
tableFields.push(refObjectConfig.fields[item.from]);
|
|
11171
|
+
}
|
|
11172
|
+
});
|
|
11173
|
+
}
|
|
11174
|
+
|
|
11082
11175
|
_$1.each(refObjectConfig.fields, function (field) {
|
|
11083
11176
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
11084
11177
|
searchableFields.push(field.name);
|
|
@@ -11510,22 +11603,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11510
11603
|
|
|
11511
11604
|
let apiInfo;
|
|
11512
11605
|
let defaultValueOptionsQueryData;
|
|
11606
|
+
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11513
11607
|
if(referenceTo){
|
|
11514
|
-
|
|
11515
|
-
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
11608
|
+
let queryFields = [
|
|
11516
11609
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11517
11610
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11518
|
-
]
|
|
11611
|
+
];
|
|
11612
|
+
|
|
11613
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
11614
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11615
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11616
|
+
autoFillMapping.forEach(function (item) {
|
|
11617
|
+
queryFields.push(refObjectConfig.fields[item.from]);
|
|
11618
|
+
});
|
|
11619
|
+
}
|
|
11620
|
+
|
|
11621
|
+
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
11622
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
|
|
11623
|
+
expand: false,
|
|
11519
11624
|
alias: "defaultValueOptions",
|
|
11520
11625
|
filters: "{__options_filters}",
|
|
11521
11626
|
count: false
|
|
11522
11627
|
});
|
|
11523
11628
|
apiInfo = await getApi({
|
|
11524
11629
|
name: referenceTo.objectName
|
|
11525
|
-
}, null,
|
|
11526
|
-
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
11527
|
-
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
11528
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11630
|
+
}, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
11529
11631
|
|
|
11530
11632
|
apiInfo.adaptor = `
|
|
11531
11633
|
const data = payload.data;
|
|
@@ -11549,7 +11651,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11549
11651
|
};
|
|
11550
11652
|
}
|
|
11551
11653
|
|
|
11552
|
-
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11553
11654
|
let listView = getLookupListView(refObjectConfig);
|
|
11554
11655
|
|
|
11555
11656
|
let listviewFilter = getListViewFilter(listView);
|
|
@@ -11734,6 +11835,33 @@ async function getApi(object, recordId, fields, options){
|
|
|
11734
11835
|
}
|
|
11735
11836
|
}
|
|
11736
11837
|
|
|
11838
|
+
async function getAutoFill(field, refObject) {
|
|
11839
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
11840
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
11841
|
+
let fillMapping = {};
|
|
11842
|
+
// let fieldsForApi = [];
|
|
11843
|
+
autoFillMapping.forEach(function (item) {
|
|
11844
|
+
fillMapping[item.to] = `\${${item.from}}`;
|
|
11845
|
+
// fieldsForApi.push(item.from);
|
|
11846
|
+
});
|
|
11847
|
+
// let api = {
|
|
11848
|
+
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
|
11849
|
+
// "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
|
|
11850
|
+
// // "responseData": {
|
|
11851
|
+
// // "name": "${name}"
|
|
11852
|
+
// // },
|
|
11853
|
+
// "silent": false
|
|
11854
|
+
// }
|
|
11855
|
+
// return {
|
|
11856
|
+
// fillMapping,
|
|
11857
|
+
// // api
|
|
11858
|
+
// }
|
|
11859
|
+
// 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
|
|
11860
|
+
// 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
|
|
11861
|
+
return fillMapping;
|
|
11862
|
+
}
|
|
11863
|
+
}
|
|
11864
|
+
|
|
11737
11865
|
async function lookupToAmis(field, readonly, ctx){
|
|
11738
11866
|
if(!ctx){
|
|
11739
11867
|
ctx = {};
|
|
@@ -11817,6 +11945,10 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
11817
11945
|
amisSchema = _$1.defaultsDeep({}, pageAmisSchema, amisSchema);
|
|
11818
11946
|
}
|
|
11819
11947
|
}
|
|
11948
|
+
const autoFill = await getAutoFill(field);
|
|
11949
|
+
if(autoFill){
|
|
11950
|
+
amisSchema.autoFill = autoFill;
|
|
11951
|
+
}
|
|
11820
11952
|
return amisSchema;
|
|
11821
11953
|
}
|
|
11822
11954
|
|
|
@@ -11992,6 +12124,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
11992
12124
|
{
|
|
11993
12125
|
"type": "editor",
|
|
11994
12126
|
"name": field.name,
|
|
12127
|
+
"labelClassName": "none",
|
|
11995
12128
|
"language": "markdown",
|
|
11996
12129
|
}
|
|
11997
12130
|
]
|
|
@@ -14044,6 +14177,7 @@ async function getForm(props, mode = "edit", formId) {
|
|
|
14044
14177
|
async function getButtonActions(props, mode) {
|
|
14045
14178
|
let actions = [];
|
|
14046
14179
|
let primaryKey = getTablePrimaryKey(props);
|
|
14180
|
+
let tableServiceId = getComponentId("table_service", props.id);
|
|
14047
14181
|
let formId = getComponentId("form", props.id);
|
|
14048
14182
|
let dialogId = getComponentId("dialog", props.id);
|
|
14049
14183
|
let buttonNextId = getComponentId("button_next", props.id);
|
|
@@ -14360,7 +14494,30 @@ async function getButtonActions(props, mode) {
|
|
|
14360
14494
|
// };
|
|
14361
14495
|
// 新增行时不需要在弹出编辑表单前先加一行,因为会在编辑表单所在service初始化时判断到是新增就自动增加一行,因为这里拿不到event.data.__tableItems,也无法变更其值
|
|
14362
14496
|
// actions = [actionNewLine, actionShowEditDialog];
|
|
14363
|
-
|
|
14497
|
+
if (props.enableDialog === false) {
|
|
14498
|
+
actions = [
|
|
14499
|
+
{
|
|
14500
|
+
"actionType": "custom",
|
|
14501
|
+
"script": `
|
|
14502
|
+
let scope = event.context.scoped;
|
|
14503
|
+
let __wrapperServiceId = "${tableServiceId}";
|
|
14504
|
+
let wrapperService = scope.getComponentById(__wrapperServiceId);
|
|
14505
|
+
let wrapperServiceData = wrapperService.getData();
|
|
14506
|
+
let lastestFieldValue = _.clone(wrapperServiceData["${props.name}"] || []);
|
|
14507
|
+
lastestFieldValue.push({})
|
|
14508
|
+
doAction({
|
|
14509
|
+
"componentId": "${props.id}",
|
|
14510
|
+
"actionType": "setValue",
|
|
14511
|
+
"args": {
|
|
14512
|
+
"value": lastestFieldValue
|
|
14513
|
+
}
|
|
14514
|
+
});
|
|
14515
|
+
`
|
|
14516
|
+
}
|
|
14517
|
+
];
|
|
14518
|
+
}else {
|
|
14519
|
+
actions = [actionShowEditDialog];
|
|
14520
|
+
}
|
|
14364
14521
|
}
|
|
14365
14522
|
else if (mode == "edit") {
|
|
14366
14523
|
actions = [actionShowEditDialog];
|
|
@@ -14489,7 +14646,9 @@ async function getButtonNew(props) {
|
|
|
14489
14646
|
"actions": await getButtonActions(props, "new")
|
|
14490
14647
|
}
|
|
14491
14648
|
},
|
|
14492
|
-
"level": "
|
|
14649
|
+
"level": "link",
|
|
14650
|
+
"className": "text-gray-500",
|
|
14651
|
+
"size": "xs"
|
|
14493
14652
|
};
|
|
14494
14653
|
}
|
|
14495
14654
|
|
|
@@ -14499,6 +14658,7 @@ async function getButtonEdit(props, showAsInlineEditMode) {
|
|
|
14499
14658
|
"label": "",
|
|
14500
14659
|
"icon": `fa fa-${showAsInlineEditMode ? "expand-alt" : "pencil"}`,//inline edit模式时显示为放开按钮,只读时显示为笔按钮
|
|
14501
14660
|
"level": "link",
|
|
14661
|
+
"className": "text-gray-400",
|
|
14502
14662
|
"onEvent": {
|
|
14503
14663
|
"click": {
|
|
14504
14664
|
"actions": await getButtonActions(props, "edit")
|
|
@@ -14513,6 +14673,7 @@ async function getButtonView(props) {
|
|
|
14513
14673
|
"label": "",
|
|
14514
14674
|
"icon": "fa fa-expand-alt",//fa-external-link
|
|
14515
14675
|
"level": "link",
|
|
14676
|
+
"className": "text-gray-400",
|
|
14516
14677
|
"onEvent": {
|
|
14517
14678
|
"click": {
|
|
14518
14679
|
"actions": await getButtonActions(props, "readonly")
|
|
@@ -14525,6 +14686,7 @@ async function getButtonDelete(props) {
|
|
|
14525
14686
|
return {
|
|
14526
14687
|
"type": "dropdown-button",
|
|
14527
14688
|
"level": "link",
|
|
14689
|
+
"btnClassName": "text-gray-400",
|
|
14528
14690
|
"icon": "fa fa-trash-alt",
|
|
14529
14691
|
"size": "xs",
|
|
14530
14692
|
"hideCaret": true,
|
|
@@ -14587,31 +14749,34 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14587
14749
|
let inlineEditMode = props.inlineEditMode;
|
|
14588
14750
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
14589
14751
|
if (showOperation) {
|
|
14590
|
-
if (props.
|
|
14591
|
-
|
|
14592
|
-
|
|
14593
|
-
|
|
14594
|
-
|
|
14595
|
-
|
|
14596
|
-
|
|
14597
|
-
|
|
14598
|
-
|
|
14599
|
-
|
|
14600
|
-
|
|
14601
|
-
|
|
14752
|
+
if (props.enableDialog !== false) {
|
|
14753
|
+
if (props.editable) {
|
|
14754
|
+
let showEditButton = true;
|
|
14755
|
+
if (showAsInlineEditMode) {
|
|
14756
|
+
// 始终显示弹出子表表单按钮,如果需要判断只在有列被隐藏时才需要显示弹出表单按钮放开下面的if逻辑就好
|
|
14757
|
+
showEditButton = true;
|
|
14758
|
+
// // inline edit模式下只在有列被隐藏时才需要显示编辑按钮
|
|
14759
|
+
// if (props.columns && props.columns.length > 0 && props.columns.length < fields.length) {
|
|
14760
|
+
// showEditButton = true;
|
|
14761
|
+
// }
|
|
14762
|
+
// else {
|
|
14763
|
+
// showEditButton = false;
|
|
14764
|
+
// }
|
|
14765
|
+
}
|
|
14766
|
+
// 编辑时显示编辑按钮
|
|
14767
|
+
if (showEditButton) {
|
|
14768
|
+
let buttonEditSchema = await getButtonEdit(props, showAsInlineEditMode);
|
|
14769
|
+
buttonsForColumnOperations.push(buttonEditSchema);
|
|
14770
|
+
}
|
|
14602
14771
|
}
|
|
14603
|
-
|
|
14604
|
-
|
|
14605
|
-
|
|
14606
|
-
|
|
14772
|
+
else {
|
|
14773
|
+
// 只读时显示查看按钮
|
|
14774
|
+
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14775
|
+
let buttonViewSchema = await getButtonView(props);
|
|
14776
|
+
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14607
14777
|
}
|
|
14608
14778
|
}
|
|
14609
|
-
|
|
14610
|
-
// 只读时显示查看按钮
|
|
14611
|
-
// 如果想只在有列被隐藏时才需要显示查看按钮可以加上判断:if (props.columns && props.columns.length > 0 && props.columns.length < fields.length)
|
|
14612
|
-
let buttonViewSchema = await getButtonView(props);
|
|
14613
|
-
buttonsForColumnOperations.push(buttonViewSchema);
|
|
14614
|
-
}
|
|
14779
|
+
|
|
14615
14780
|
if (props.removable) {
|
|
14616
14781
|
let buttonDeleteSchema = await getButtonDelete(props);
|
|
14617
14782
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
@@ -14759,6 +14924,10 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14759
14924
|
"labelAlign": props.labelAlign,
|
|
14760
14925
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14761
14926
|
"mode": props.mode || null,
|
|
14927
|
+
"visibleOn": props.$schema.visibleOn,
|
|
14928
|
+
"visible": props.$schema.visible,
|
|
14929
|
+
"hiddenOn": props.$schema.hiddenOn,
|
|
14930
|
+
"hidden": props.$schema.hidden,
|
|
14762
14931
|
className
|
|
14763
14932
|
};
|
|
14764
14933
|
// console.log("===schema===", schema);
|
|
@@ -17404,5 +17573,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
17404
17573
|
};
|
|
17405
17574
|
};
|
|
17406
17575
|
|
|
17407
|
-
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 };
|
|
17576
|
+
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 };
|
|
17408
17577
|
//# sourceMappingURL=index.esm.js.map
|