@steedos-widgets/amis-lib 3.6.3-beta.1 → 3.6.4-beta.1
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 +111 -38
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +111 -38
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +23 -21
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/objects.d.ts +5 -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-19 11:57:49
|
|
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){
|
|
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){
|
|
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
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
fieldsName.push(`${field.name}`);
|
|
770
|
+
objectFieldName = field.name.split('.')[0];
|
|
771
|
+
fieldsName.push(objectFieldName);
|
|
772
|
+
displayFields.push(objectFieldName);
|
|
752
773
|
}
|
|
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,54 @@ async function getTableColumns(fields, options){
|
|
|
2270
2284
|
columnItem.type = 'color';
|
|
2271
2285
|
columnItem.defaultColor = null;
|
|
2272
2286
|
}
|
|
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){
|
|
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": "",
|
|
2317
|
+
"size": "lg",
|
|
2318
|
+
"bodyClassName": "p-0 m-0 border-t",
|
|
2319
|
+
"closeOnEsc": true,
|
|
2320
|
+
"resizable": true,
|
|
2321
|
+
"actions": [],
|
|
2322
|
+
"body": [
|
|
2323
|
+
drawerRecordDetailSchema
|
|
2324
|
+
],
|
|
2325
|
+
"className": "app-popover",
|
|
2326
|
+
"id": "u:fc5f055afa8c"
|
|
2327
|
+
},
|
|
2328
|
+
"preventDefault": true
|
|
2329
|
+
}
|
|
2330
|
+
]
|
|
2331
|
+
}
|
|
2332
|
+
};
|
|
2333
|
+
}
|
|
2334
|
+
|
|
2273
2335
|
}
|
|
2274
2336
|
}
|
|
2275
2337
|
if(columnItem){
|
|
@@ -4502,8 +4564,8 @@ const parseSingleExpression = function (func, formData, dataPath, global, userSe
|
|
|
4502
4564
|
/*
|
|
4503
4565
|
* @Author: baozhoutao@steedos.com
|
|
4504
4566
|
* @Date: 2022-11-01 15:51:00
|
|
4505
|
-
* @LastEditors:
|
|
4506
|
-
* @LastEditTime:
|
|
4567
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4568
|
+
* @LastEditTime: 2024-02-18 18:37:35
|
|
4507
4569
|
* @Description:
|
|
4508
4570
|
*/
|
|
4509
4571
|
|
|
@@ -4543,13 +4605,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
|
|
|
4543
4605
|
const recordId = _master.recordId;
|
|
4544
4606
|
let relatedKeySaveValue = recordId;
|
|
4545
4607
|
const relatedField = fields[relatedKey];
|
|
4546
|
-
if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4608
|
+
if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
|
|
4547
4609
|
relatedKeySaveValue = _master.record[relatedField.reference_to_field];
|
|
4548
4610
|
}
|
|
4549
4611
|
let relatedKeyValue;
|
|
4550
|
-
if(!_.isString(relatedField.reference_to)){
|
|
4612
|
+
if(relatedField && !_.isString(relatedField.reference_to)){
|
|
4551
4613
|
relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
|
|
4552
|
-
}else if (relatedField.multiple) {
|
|
4614
|
+
}else if (relatedField && relatedField.multiple) {
|
|
4553
4615
|
relatedKeyValue = [relatedKeySaveValue];
|
|
4554
4616
|
} else {
|
|
4555
4617
|
relatedKeyValue = relatedKeySaveValue;
|
|
@@ -4833,8 +4895,8 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
4833
4895
|
/*
|
|
4834
4896
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
4835
4897
|
* @Date: 2023-03-22 09:31:21
|
|
4836
|
-
* @LastEditors:
|
|
4837
|
-
* @LastEditTime:
|
|
4898
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
4899
|
+
* @LastEditTime: 2024-02-18 16:06:21
|
|
4838
4900
|
*/
|
|
4839
4901
|
const getSchema$3 = (uiSchema)=>{
|
|
4840
4902
|
return {
|
|
@@ -4880,7 +4942,8 @@ const getSchema$3 = (uiSchema)=>{
|
|
|
4880
4942
|
},
|
|
4881
4943
|
"data": {
|
|
4882
4944
|
"objectName": `${uiSchema.name}`,
|
|
4883
|
-
"__deletedRecord": true
|
|
4945
|
+
"__deletedRecord": true,
|
|
4946
|
+
"_inDrawer": "${_inDrawer}"
|
|
4884
4947
|
}
|
|
4885
4948
|
},
|
|
4886
4949
|
{
|
|
@@ -9165,8 +9228,8 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
9165
9228
|
/*
|
|
9166
9229
|
* @Author: baozhoutao@steedos.com
|
|
9167
9230
|
* @Date: 2022-07-05 15:55:39
|
|
9168
|
-
* @LastEditors:
|
|
9169
|
-
* @LastEditTime: 2024-02-
|
|
9231
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9232
|
+
* @LastEditTime: 2024-02-18 14:46:50
|
|
9170
9233
|
* @Description:
|
|
9171
9234
|
*/
|
|
9172
9235
|
|
|
@@ -9300,7 +9363,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9300
9363
|
// globalFilter = [`${relatedKey}`, "=", relatedValue];
|
|
9301
9364
|
// }
|
|
9302
9365
|
const recordRelatedListHeader = await getObjectRecordDetailRelatedListHeader(relatedObjectUiSchema, relatedLabel, ctx);
|
|
9303
|
-
const componentId = `steedos-record-related-list-${relatedObjectName}`;
|
|
9366
|
+
const componentId = `steedos-record-related-list-${relatedObjectName}_${new Date().getTime()}`;
|
|
9304
9367
|
const isMobile = window.innerWidth < 768;
|
|
9305
9368
|
let headerToolbar = [];
|
|
9306
9369
|
if(!isMobile){
|
|
@@ -9574,8 +9637,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9574
9637
|
/*
|
|
9575
9638
|
* @Author: baozhoutao@steedos.com
|
|
9576
9639
|
* @Date: 2022-07-05 15:55:39
|
|
9577
|
-
* @LastEditors:
|
|
9578
|
-
* @LastEditTime: 2024-02-
|
|
9640
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
9641
|
+
* @LastEditTime: 2024-02-18 16:05:21
|
|
9579
9642
|
* @Description:
|
|
9580
9643
|
*/
|
|
9581
9644
|
|
|
@@ -10144,10 +10207,14 @@ async function getRecordServiceSchema(objectName, appId, props = {}, body) {
|
|
|
10144
10207
|
"componentId": serviceId,
|
|
10145
10208
|
"expression": "this.__deletedRecord != true"
|
|
10146
10209
|
},
|
|
10210
|
+
{
|
|
10211
|
+
"actionType": "closeDialog",
|
|
10212
|
+
"expression": "this.__deletedRecord === true && this._inDrawer === true"
|
|
10213
|
+
},
|
|
10147
10214
|
{
|
|
10148
10215
|
"actionType": "custom",
|
|
10149
10216
|
"script": "window.goBack()",
|
|
10150
|
-
"expression": "this.__deletedRecord === true"
|
|
10217
|
+
"expression": "this.__deletedRecord === true && this._inDrawer != true"
|
|
10151
10218
|
}
|
|
10152
10219
|
]
|
|
10153
10220
|
},
|
|
@@ -12562,8 +12629,9 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12562
12629
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12563
12630
|
},
|
|
12564
12631
|
"adaptor": `
|
|
12565
|
-
|
|
12632
|
+
var tempValue = payload.data && payload.data.autonumber;
|
|
12566
12633
|
delete payload.data.autonumber;
|
|
12634
|
+
payload.data["${field.name}"] = tempValue;
|
|
12567
12635
|
return payload;
|
|
12568
12636
|
`
|
|
12569
12637
|
},
|
|
@@ -13115,6 +13183,11 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
13115
13183
|
section.visibleOn = groupVisibleOn;
|
|
13116
13184
|
}
|
|
13117
13185
|
}
|
|
13186
|
+
|
|
13187
|
+
let groupCollapsed = group && group.collapsed;
|
|
13188
|
+
if(groupCollapsed === true) {
|
|
13189
|
+
section.collapsed = true;
|
|
13190
|
+
}
|
|
13118
13191
|
return section
|
|
13119
13192
|
};
|
|
13120
13193
|
|