@steedos-widgets/amis-object 1.2.1 → 1.2.3-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/amis/AmisObjectListview.d.ts +12 -4
- package/dist/amis/AmisRecordService.d.ts +10 -0
- package/dist/amis/index.d.ts +1 -0
- package/dist/amis-object.cjs.css +0 -8
- package/dist/amis-object.cjs.js +357 -206
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +0 -8
- package/dist/amis-object.esm.js +356 -207
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +0 -8
- package/dist/amis-object.umd.js +357 -206
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/dist/meta.js +487 -332
- package/dist/metas/AmisRecordService.d.ts +2 -0
- package/dist/pages/PageListView.d.ts +1 -3
- package/dist/pages/PageObject.d.ts +65 -0
- package/dist/pages/PageObject.meta.d.ts +2 -0
- package/dist/pages/PageRecordDetail.d.ts +1 -2
- package/dist/pages/index.d.ts +1 -0
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -693,14 +693,19 @@ const getSteedosAuth = () => {
|
|
|
693
693
|
* @Author: baozhoutao@steedos.com
|
|
694
694
|
* @Date: 2022-08-16 17:02:08
|
|
695
695
|
* @LastEditors: baozhoutao@steedos.com
|
|
696
|
-
* @LastEditTime: 2023-04-
|
|
696
|
+
* @LastEditTime: 2023-04-17 15:24:21
|
|
697
697
|
* @Description:
|
|
698
698
|
*/
|
|
699
699
|
|
|
700
700
|
|
|
701
701
|
const Router$1 = {
|
|
702
702
|
getTabDisplayAs(tab_id){
|
|
703
|
-
|
|
703
|
+
var urlSearch = new URLSearchParams(document.location.search);
|
|
704
|
+
if(urlSearch.has('display')){
|
|
705
|
+
return urlSearch.get('display')
|
|
706
|
+
}
|
|
707
|
+
// const key = `tab.${tab_id}.display`;
|
|
708
|
+
const key = `page.display`;
|
|
704
709
|
const value = localStorage.getItem(key);
|
|
705
710
|
return value ? value : 'grid'
|
|
706
711
|
},
|
|
@@ -1722,8 +1727,8 @@ var config = {
|
|
|
1722
1727
|
/*
|
|
1723
1728
|
* @Author: baozhoutao@steedos.com
|
|
1724
1729
|
* @Date: 2022-11-01 15:51:00
|
|
1725
|
-
* @LastEditors:
|
|
1726
|
-
* @LastEditTime: 2023-04-
|
|
1730
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1731
|
+
* @LastEditTime: 2023-04-16 17:04:16
|
|
1727
1732
|
* @Description:
|
|
1728
1733
|
*/
|
|
1729
1734
|
|
|
@@ -1801,6 +1806,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1801
1806
|
"context": "${context}",
|
|
1802
1807
|
"global": "${global}",
|
|
1803
1808
|
"listViewId": "${listViewId}",
|
|
1809
|
+
"displayAs": "${displayAs}",
|
|
1804
1810
|
"uiSchema": "${uiSchema}",
|
|
1805
1811
|
"isLookup": "${isLookup}",
|
|
1806
1812
|
"listName": "${listName}"
|
|
@@ -3186,7 +3192,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, fields, ctx) {
|
|
|
3186
3192
|
function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
3187
3193
|
const { icon, label } = objectSchema;
|
|
3188
3194
|
const listViewButtonOptions = [];
|
|
3189
|
-
// let currentListView;
|
|
3190
3195
|
each(
|
|
3191
3196
|
objectSchema.list_views,
|
|
3192
3197
|
(listView, name) => {
|
|
@@ -3194,19 +3199,11 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3194
3199
|
type: "button",
|
|
3195
3200
|
label: listView.label,
|
|
3196
3201
|
actionType: "link",
|
|
3197
|
-
// icon: "fa fa-plus",
|
|
3198
3202
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
3199
3203
|
});
|
|
3200
|
-
// if(name === listViewName){
|
|
3201
|
-
// currentListView = listView;
|
|
3202
|
-
// }
|
|
3203
3204
|
}
|
|
3204
3205
|
);
|
|
3205
3206
|
|
|
3206
|
-
// if(!currentListView){
|
|
3207
|
-
// return {};
|
|
3208
|
-
// }
|
|
3209
|
-
|
|
3210
3207
|
const buttons = getListViewButtons(objectSchema, {});
|
|
3211
3208
|
let amisButtonsSchema = map(buttons, (button) => {
|
|
3212
3209
|
return {
|
|
@@ -3217,34 +3214,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3217
3214
|
className: `button_${button.name}`
|
|
3218
3215
|
}
|
|
3219
3216
|
});
|
|
3220
|
-
|
|
3221
|
-
// const bulkDeleteScript = `
|
|
3222
|
-
// const data = event.data;
|
|
3223
|
-
// const listViewId = data.listViewId;
|
|
3224
|
-
// const uiSchema = data.uiSchema;
|
|
3225
|
-
// const scopeId = data.scopeId;
|
|
3226
|
-
// BuilderAmisObject.AmisLib.standardButtonsTodo.standard_delete_many.call({
|
|
3227
|
-
// listViewId,
|
|
3228
|
-
// uiSchema,
|
|
3229
|
-
// scopeId
|
|
3230
|
-
// })
|
|
3231
|
-
// `;
|
|
3232
|
-
// amisButtonsSchema.push({
|
|
3233
|
-
// type: 'button',
|
|
3234
|
-
// label: "删除",
|
|
3235
|
-
// className: `antd-Button antd-Button--default antd-Button--size-default`,
|
|
3236
|
-
// "onEvent": {
|
|
3237
|
-
// "click": {
|
|
3238
|
-
// "actions": [
|
|
3239
|
-
// {
|
|
3240
|
-
// "actionType": "custom",
|
|
3241
|
-
// "script": bulkDeleteScript
|
|
3242
|
-
// }
|
|
3243
|
-
// ]
|
|
3244
|
-
// }
|
|
3245
|
-
// }
|
|
3246
|
-
// });
|
|
3247
|
-
// }
|
|
3217
|
+
|
|
3248
3218
|
const reg = new RegExp('_', 'g');
|
|
3249
3219
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3250
3220
|
return {
|
|
@@ -3434,27 +3404,14 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
|
|
|
3434
3404
|
* @param {*} objectSchema 对象UISchema
|
|
3435
3405
|
* @returns amisSchema
|
|
3436
3406
|
*/
|
|
3437
|
-
|
|
3407
|
+
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3438
3408
|
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
|
|
3439
|
-
// let secordLineSchema = await getObjectListHeaderSecordLine(objectSchema, listViewName, ctx);
|
|
3440
|
-
// let body = [firstLineSchema, secordLineSchema];
|
|
3441
3409
|
let body = [firstLineSchema];
|
|
3442
|
-
// let roundedCss = "";
|
|
3443
|
-
// if (ctx.onlyFirstLine) {
|
|
3444
|
-
// body = [firstLineSchema];
|
|
3445
|
-
// }
|
|
3446
|
-
// else if (ctx.onlySecordLine) {
|
|
3447
|
-
// // 列表视图自定义amisSchema时不能加圆角
|
|
3448
|
-
// roundedCss = "";
|
|
3449
|
-
// // body = [secordLineSchema];
|
|
3450
|
-
// }
|
|
3451
3410
|
let headerSchema = [{
|
|
3452
3411
|
"type": "wrapper",
|
|
3453
3412
|
"body": body,
|
|
3454
3413
|
"className": `bg-gray-100 sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
3455
3414
|
}];
|
|
3456
|
-
// const fieldsFilterBarSchema = await getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx);
|
|
3457
|
-
// headerSchema.push(fieldsFilterBarSchema);
|
|
3458
3415
|
return headerSchema;
|
|
3459
3416
|
}
|
|
3460
3417
|
|
|
@@ -3708,6 +3665,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
3708
3665
|
"icon": "fa fa-table-columns",
|
|
3709
3666
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3710
3667
|
"align": "right",
|
|
3668
|
+
"visibleOn": "${formFactor !== 'SMALL'}",
|
|
3711
3669
|
"buttons": [
|
|
3712
3670
|
{
|
|
3713
3671
|
"label": "显示为",
|
|
@@ -3844,7 +3802,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3844
3802
|
}
|
|
3845
3803
|
}
|
|
3846
3804
|
} : {},
|
|
3847
|
-
|
|
3805
|
+
getDisplayAsButton(mainObject?.name)
|
|
3848
3806
|
]
|
|
3849
3807
|
}else {
|
|
3850
3808
|
return [
|
|
@@ -4099,7 +4057,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4099
4057
|
{
|
|
4100
4058
|
"type": "button",
|
|
4101
4059
|
"label": "重命名",
|
|
4102
|
-
"
|
|
4060
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4103
4061
|
"onEvent": {
|
|
4104
4062
|
"click": {
|
|
4105
4063
|
"weight": 0,
|
|
@@ -4154,7 +4112,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4154
4112
|
{
|
|
4155
4113
|
"type": "button",
|
|
4156
4114
|
"label": "共享设置",
|
|
4157
|
-
"
|
|
4115
|
+
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
4158
4116
|
"onEvent": {
|
|
4159
4117
|
"click": {
|
|
4160
4118
|
"weight": 0,
|
|
@@ -4194,7 +4152,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4194
4152
|
{
|
|
4195
4153
|
"type": "button",
|
|
4196
4154
|
"label": "过滤设置",
|
|
4197
|
-
"
|
|
4155
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4198
4156
|
"onEvent": {
|
|
4199
4157
|
"click": {
|
|
4200
4158
|
"weight": 0,
|
|
@@ -4256,7 +4214,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4256
4214
|
{
|
|
4257
4215
|
"type": "button",
|
|
4258
4216
|
"label": "显示的列",
|
|
4259
|
-
"
|
|
4217
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4260
4218
|
"onEvent": {
|
|
4261
4219
|
"click": {
|
|
4262
4220
|
"weight": 0,
|
|
@@ -4315,10 +4273,74 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4315
4273
|
}
|
|
4316
4274
|
}
|
|
4317
4275
|
},
|
|
4276
|
+
{
|
|
4277
|
+
"type": "button",
|
|
4278
|
+
"label": "默认排序规则",
|
|
4279
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4280
|
+
"onEvent": {
|
|
4281
|
+
"click": {
|
|
4282
|
+
"weight": 0,
|
|
4283
|
+
"actions": [
|
|
4284
|
+
{
|
|
4285
|
+
"dialog": {
|
|
4286
|
+
"type": "dialog",
|
|
4287
|
+
"title": "弹框标题",
|
|
4288
|
+
"data": {
|
|
4289
|
+
"&": "$$",
|
|
4290
|
+
"objectName": "${objectName}",
|
|
4291
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4292
|
+
"listName": "${listName}",
|
|
4293
|
+
"appId": "${appId}"
|
|
4294
|
+
},
|
|
4295
|
+
"body": [
|
|
4296
|
+
{
|
|
4297
|
+
"type": "steedos-object-form",
|
|
4298
|
+
"label": "对象表单",
|
|
4299
|
+
"objectApiName": "object_listviews",
|
|
4300
|
+
"recordId": "${recordId}",
|
|
4301
|
+
"className": "",
|
|
4302
|
+
"id": "u:061f158b4c5a",
|
|
4303
|
+
"mode": "edit",
|
|
4304
|
+
"fields": [
|
|
4305
|
+
"sort",
|
|
4306
|
+
"sort.$.field_name",
|
|
4307
|
+
"sort.$.order"
|
|
4308
|
+
],
|
|
4309
|
+
"onEvent": {
|
|
4310
|
+
"submitSucc": {
|
|
4311
|
+
"weight": 0,
|
|
4312
|
+
"actions": [
|
|
4313
|
+
{
|
|
4314
|
+
"args": {
|
|
4315
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
|
|
4316
|
+
"blank": false
|
|
4317
|
+
},
|
|
4318
|
+
"actionType": "url"
|
|
4319
|
+
}
|
|
4320
|
+
]
|
|
4321
|
+
}
|
|
4322
|
+
},
|
|
4323
|
+
"fieldsExtend": "{\n \"sort\": {\n \"amis\": {\n \"type\": \"tabs-transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/sortFields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
4324
|
+
"initApiAdaptor": "let sort;\nif (recordId) {\n sort = payload.data.initialValues.sort;\n //数据格式转换\n if (sort instanceof Array) {\n sort = lodash.map(sort, (item) => {\n return item.field_name + ':' + (item.order || 'asc')\n });\n }\n}\npayload.data.initialValues.sort = sort;\ndelete payload.extensions;",
|
|
4325
|
+
"apiRequestAdaptor": "const recordId = api.body.recordId;\n//数据格式转换\nif (typeof formData.sort == 'string') {\n formData.sort = formData.sort?.split(',');\n}\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\nif (recordId) {\n query = 'mutation{record: ' + objectName + '__update(id: \"' + recordId + '\", doc: {__saveData}){_id}}';\n}\n__saveData = JSON.stringify(JSON.stringify(formData));\napi.data = { query: query.replace('{__saveData}', __saveData) };\n"
|
|
4326
|
+
}
|
|
4327
|
+
],
|
|
4328
|
+
"showCloseButton": true,
|
|
4329
|
+
"showErrorMsg": true,
|
|
4330
|
+
"showLoading": true,
|
|
4331
|
+
"id": "u:d3f6947b6acf",
|
|
4332
|
+
"size": "lg"
|
|
4333
|
+
},
|
|
4334
|
+
"actionType": "dialog"
|
|
4335
|
+
}
|
|
4336
|
+
]
|
|
4337
|
+
}
|
|
4338
|
+
}
|
|
4339
|
+
},
|
|
4318
4340
|
{
|
|
4319
4341
|
"type": "button",
|
|
4320
4342
|
"label": "删除",
|
|
4321
|
-
"
|
|
4343
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
4322
4344
|
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
4323
4345
|
"onEvent": {
|
|
4324
4346
|
"click": {
|
|
@@ -4373,7 +4395,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4373
4395
|
}
|
|
4374
4396
|
]
|
|
4375
4397
|
},
|
|
4376
|
-
|
|
4398
|
+
getDisplayAsButton(showDisplayAs)
|
|
4377
4399
|
// {
|
|
4378
4400
|
// "type": "search-box",
|
|
4379
4401
|
// "align": "right",
|
|
@@ -4679,7 +4701,6 @@ function getLookupSapceUserTreeSchema(){
|
|
|
4679
4701
|
{
|
|
4680
4702
|
"actionType": "custom",
|
|
4681
4703
|
"script": `
|
|
4682
|
-
debugger;
|
|
4683
4704
|
const scope = event.context.scoped;
|
|
4684
4705
|
//TODO: 将form中的value一同加入筛选内
|
|
4685
4706
|
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
@@ -6163,7 +6184,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6163
6184
|
|
|
6164
6185
|
const API_CACHE = 100;
|
|
6165
6186
|
|
|
6166
|
-
function getReadonlyFormAdaptor(fields){
|
|
6187
|
+
function getReadonlyFormAdaptor(object, fields){
|
|
6167
6188
|
let scriptStr = '';
|
|
6168
6189
|
const selectFields = ___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
|
|
6169
6190
|
const gridAndObjectFieldsName = ___default.map(___default.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
|
|
@@ -6222,6 +6243,7 @@ function getReadonlyFormAdaptor(fields){
|
|
|
6222
6243
|
console.error(e)
|
|
6223
6244
|
}
|
|
6224
6245
|
payload.data = data;
|
|
6246
|
+
payload.data.__objectName = "${object.name}";
|
|
6225
6247
|
payload.data.__record = record;
|
|
6226
6248
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
6227
6249
|
}
|
|
@@ -6239,7 +6261,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
|
6239
6261
|
url: getApi$2()+"&recordId=${recordId}",
|
|
6240
6262
|
cache: API_CACHE,
|
|
6241
6263
|
// requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
|
|
6242
|
-
adaptor: getReadonlyFormAdaptor(fields),
|
|
6264
|
+
adaptor: getReadonlyFormAdaptor(object, fields),
|
|
6243
6265
|
data: await getFindOneQuery$1(object, recordId, fields, options),
|
|
6244
6266
|
headers: {
|
|
6245
6267
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -6957,6 +6979,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
6957
6979
|
eventName: "recordLoaded"
|
|
6958
6980
|
},
|
|
6959
6981
|
data: {
|
|
6982
|
+
objectName: "${event.data.__objectName}",
|
|
6960
6983
|
record: "${event.data.__record}"
|
|
6961
6984
|
}
|
|
6962
6985
|
},
|
|
@@ -7393,7 +7416,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7393
7416
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
7394
7417
|
|
|
7395
7418
|
if(options.isRelated){
|
|
7396
|
-
api.url += "&recordId=${recordId}";
|
|
7419
|
+
api.url += "&recordId=${_master.recordId}";
|
|
7397
7420
|
}
|
|
7398
7421
|
|
|
7399
7422
|
api.data.$term = "$term";
|
|
@@ -8638,7 +8661,7 @@ async function getRelatedListSchema(
|
|
|
8638
8661
|
* @Author: baozhoutao@steedos.com
|
|
8639
8662
|
* @Date: 2022-07-05 15:55:39
|
|
8640
8663
|
* @LastEditors: baozhoutao@steedos.com
|
|
8641
|
-
* @LastEditTime: 2023-04-
|
|
8664
|
+
* @LastEditTime: 2023-04-17 15:26:17
|
|
8642
8665
|
* @Description:
|
|
8643
8666
|
*/
|
|
8644
8667
|
|
|
@@ -8851,6 +8874,7 @@ async function getListSchema(
|
|
|
8851
8874
|
return { uiSchema };
|
|
8852
8875
|
}
|
|
8853
8876
|
|
|
8877
|
+
// 直接返回自定义的列表视图schema
|
|
8854
8878
|
if(listView.enable_amis_schema && listView.amis_schema){
|
|
8855
8879
|
const amisSchema = isString(listView.amis_schema) ? JSON.parse(listView.amis_schema) : listView.amis_schema;
|
|
8856
8880
|
return {
|
|
@@ -8864,6 +8888,7 @@ async function getListSchema(
|
|
|
8864
8888
|
let sort = getListViewSort(listView);
|
|
8865
8889
|
let listviewFilter = getListViewFilter(listView);
|
|
8866
8890
|
let listview_filters = listView && listView._filters;
|
|
8891
|
+
// 返回 calendar 组件
|
|
8867
8892
|
if(listView.type === "calendar"){
|
|
8868
8893
|
const amisSchema = {
|
|
8869
8894
|
"type": "steedos-object-calendar",
|
|
@@ -8882,14 +8907,21 @@ async function getListSchema(
|
|
|
8882
8907
|
|
|
8883
8908
|
const defaults = ctx.defaults || {};
|
|
8884
8909
|
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8910
|
+
// // 未自定义header 且显示header的时候, 使用系统header
|
|
8911
|
+
// if(!defaults.headerSchema && ctx.showHeader){
|
|
8912
|
+
// defaults.headerSchema = getObjectListHeader(uiSchema, listViewName);
|
|
8913
|
+
// }
|
|
8914
|
+
|
|
8915
|
+
// // 如果不显示header,则清理掉
|
|
8916
|
+
// if(!ctx.showHeader){
|
|
8917
|
+
// defaults.headerSchema = null;
|
|
8918
|
+
// }
|
|
8888
8919
|
|
|
8889
|
-
|
|
8890
|
-
defaults.headerSchema = null;
|
|
8891
|
-
}
|
|
8920
|
+
defaults.headerSchema = null;
|
|
8892
8921
|
|
|
8922
|
+
/**
|
|
8923
|
+
* 本次存储代码段
|
|
8924
|
+
*/
|
|
8893
8925
|
try {
|
|
8894
8926
|
const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
|
|
8895
8927
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
@@ -9004,7 +9036,7 @@ async function getTableSchema(
|
|
|
9004
9036
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
9005
9037
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
9006
9038
|
});
|
|
9007
|
-
|
|
9039
|
+
console.log('getTableSchema====>amisSchema', amisSchema);
|
|
9008
9040
|
// console.timeEnd('getTableSchema');
|
|
9009
9041
|
return {
|
|
9010
9042
|
uiSchema,
|
|
@@ -9124,6 +9156,41 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9124
9156
|
}
|
|
9125
9157
|
}
|
|
9126
9158
|
|
|
9159
|
+
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
9160
|
+
const uiSchema = await getUISchema(objectName);
|
|
9161
|
+
return {
|
|
9162
|
+
uiSchema,
|
|
9163
|
+
amisSchema: {
|
|
9164
|
+
"type": "service",
|
|
9165
|
+
"body": [],
|
|
9166
|
+
data: {
|
|
9167
|
+
"_master.objectName": "${objectName}",
|
|
9168
|
+
"_master.recordId": "${recordId}"
|
|
9169
|
+
},
|
|
9170
|
+
"style": {
|
|
9171
|
+
"padding": "var(--Page-body-padding)",
|
|
9172
|
+
...props.style
|
|
9173
|
+
},
|
|
9174
|
+
onEvent: {
|
|
9175
|
+
"recordLoaded": {
|
|
9176
|
+
"actions": [
|
|
9177
|
+
{
|
|
9178
|
+
"actionType": "reload",
|
|
9179
|
+
"data": {
|
|
9180
|
+
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
9181
|
+
"_master.record": `\${record}`,
|
|
9182
|
+
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
9183
|
+
"_master.objectName": "${objectName}",
|
|
9184
|
+
"_master.recordId": "${recordId}"
|
|
9185
|
+
}
|
|
9186
|
+
}
|
|
9187
|
+
]
|
|
9188
|
+
},
|
|
9189
|
+
...props.onEvent
|
|
9190
|
+
}
|
|
9191
|
+
}
|
|
9192
|
+
}
|
|
9193
|
+
}
|
|
9127
9194
|
|
|
9128
9195
|
// 获取单个相关表
|
|
9129
9196
|
async function getObjectRelated(
|
|
@@ -9167,6 +9234,7 @@ async function getObjectRelated(
|
|
|
9167
9234
|
if(typeof window != 'undefined'){
|
|
9168
9235
|
window.getUISchema = getUISchema;
|
|
9169
9236
|
window.getUISchemaSync = getUISchemaSync;
|
|
9237
|
+
window.getListSchema = getListSchema;
|
|
9170
9238
|
}
|
|
9171
9239
|
|
|
9172
9240
|
// import { getListSchema } from './objects';
|
|
@@ -12043,6 +12111,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
12043
12111
|
getRecordDetailSchema: getRecordDetailSchema,
|
|
12044
12112
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
12045
12113
|
getRecordPermissions: getRecordPermissions,
|
|
12114
|
+
getRecordServiceSchema: getRecordServiceSchema,
|
|
12046
12115
|
getRelatedFieldValue: getRelatedFieldValue,
|
|
12047
12116
|
getRelatedListSchema: getRelatedListSchema,
|
|
12048
12117
|
getRelatedsCount: getRelatedsCount,
|
|
@@ -12522,6 +12591,8 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12522
12591
|
schema = _d.sent();
|
|
12523
12592
|
amisSchema = schema.amisSchema;
|
|
12524
12593
|
if (defaultData) {
|
|
12594
|
+
// 让ObjectForm支持props中的dafaultData属性与上层组件配置的defaultData混合
|
|
12595
|
+
// 为了解决相关表新建时如果是表单类型微页面,因为找不到ObjectForm在哪层而造成无法设置ObjectForm的defaultData的问题
|
|
12525
12596
|
amisSchema.data.defaultData = __assign$2({ "&": "${defaultData}" }, defaultData);
|
|
12526
12597
|
}
|
|
12527
12598
|
uiSchema = schema.uiSchema;
|
|
@@ -12550,11 +12621,14 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12550
12621
|
}); };
|
|
12551
12622
|
|
|
12552
12623
|
var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12553
|
-
var $schema, top, perPage, _a, showHeader,
|
|
12624
|
+
var $schema, top, perPage, _a, showHeader, data, defaultData, _b, className, crudClassName, _c, showDisplayAs, sideSchema, _e, filterVisible, headerToolbarItems, headerSchema, ctx, listName, defaults, objectApiName, displayAs, formFactor, isMobile, uiSchema, listView, schemaKeys, listSchema, setDataToComponentId, amisSchemaData, listViewId, listViewSchemaProps, serviceData;
|
|
12554
12625
|
return __generator(this, function (_f) {
|
|
12555
12626
|
switch (_f.label) {
|
|
12556
12627
|
case 0:
|
|
12557
|
-
|
|
12628
|
+
// console.time('AmisObjectListView')
|
|
12629
|
+
console.log("AmisObjectListView props", props);
|
|
12630
|
+
$schema = props.$schema, top = props.top, perPage = props.perPage, _a = props.showHeader, showHeader = _a === void 0 ? true : _a, data = props.data, defaultData = props.defaultData, _b = props.className, className = _b === void 0 ? "" : _b, crudClassName = props.crudClassName, _c = props.showDisplayAs, showDisplayAs = _c === void 0 ? false : _c, sideSchema = props.sideSchema, props.columnsTogglable, _e = props.filterVisible, filterVisible = _e === void 0 ? true : _e, headerToolbarItems = props.headerToolbarItems;
|
|
12631
|
+
headerSchema = props.headerSchema;
|
|
12558
12632
|
ctx = props.ctx;
|
|
12559
12633
|
listName = (defaultData === null || defaultData === void 0 ? void 0 : defaultData.listName) || (data === null || data === void 0 ? void 0 : data.listName) || (props === null || props === void 0 ? void 0 : props.listName);
|
|
12560
12634
|
defaults = {};
|
|
@@ -12581,8 +12655,8 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12581
12655
|
}
|
|
12582
12656
|
return [4 /*yield*/, getUISchema(objectApiName, false)];
|
|
12583
12657
|
case 1:
|
|
12584
|
-
|
|
12585
|
-
listView = find(
|
|
12658
|
+
uiSchema = _f.sent();
|
|
12659
|
+
listView = find(uiSchema.list_views, function (listView, name) {
|
|
12586
12660
|
// 传入listViewName空值则取第一个
|
|
12587
12661
|
if (!listName) {
|
|
12588
12662
|
listName = name;
|
|
@@ -12609,7 +12683,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12609
12683
|
"actions": [
|
|
12610
12684
|
{
|
|
12611
12685
|
"args": {
|
|
12612
|
-
"url": "/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?display=${ls:
|
|
12686
|
+
"url": "/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?display=${ls:page.display || 'grid'}&side_object=${objectName}&side_listview_id=${listName}",
|
|
12613
12687
|
"blank": false
|
|
12614
12688
|
},
|
|
12615
12689
|
"actionType": "link",
|
|
@@ -12617,7 +12691,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12617
12691
|
},
|
|
12618
12692
|
{
|
|
12619
12693
|
"actionType": "reload",
|
|
12620
|
-
"expression": "${(event.data.recordId || event.data.__deletedRecord === true) && event.data._isRelated != true}" //不是新建, 则刷新列表
|
|
12694
|
+
"expression": "${(event.data.recordId || event.data.__deletedRecord === true || event.data.displayAs === 'split') && event.data._isRelated != true}" //不是新建, 或分栏模式下新建主对象记录, 则刷新列表
|
|
12621
12695
|
}
|
|
12622
12696
|
]
|
|
12623
12697
|
};
|
|
@@ -12625,58 +12699,62 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12625
12699
|
listSchema: listSchema
|
|
12626
12700
|
};
|
|
12627
12701
|
}
|
|
12628
|
-
// 支持通过直接定义headerSchema属性来定制表头,而不一定要通过ctx.defaults.headerSchema传入
|
|
12629
|
-
if (headerSchema) {
|
|
12630
|
-
defaults.headerSchema = headerSchema;
|
|
12631
|
-
}
|
|
12632
12702
|
setDataToComponentId = ctx && ctx.setDataToComponentId;
|
|
12633
12703
|
if (!setDataToComponentId) {
|
|
12634
12704
|
setDataToComponentId = "service_listview_".concat(objectApiName);
|
|
12635
12705
|
}
|
|
12636
12706
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
12637
12707
|
listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
|
|
12638
|
-
|
|
12639
|
-
|
|
12640
|
-
|
|
12641
|
-
amisSchema = schema.amisSchema;
|
|
12642
|
-
uiSchema = schema.uiSchema;
|
|
12643
|
-
body = [amisSchema];
|
|
12644
|
-
if (schema.isCustomAmisSchema || schema.isCalendar) {
|
|
12645
|
-
firstLineSchema = getObjectListHeaderFirstLine(uiSchema);
|
|
12646
|
-
body.unshift({
|
|
12647
|
-
"type": "wrapper",
|
|
12648
|
-
"body": [firstLineSchema],
|
|
12649
|
-
"className": "bg-gray-100 pb-0 sm:rounded-tl sm:rounded-tr",
|
|
12650
|
-
});
|
|
12708
|
+
listViewSchemaProps = __assign$2(__assign$2({ top: top, perPage: perPage, showHeader: showHeader, defaults: defaults }, ctx), { listViewId: listViewId, setDataToComponentId: setDataToComponentId, filterVisible: filterVisible, showDisplayAs: showDisplayAs, displayAs: displayAs, headerToolbarItems: headerToolbarItems });
|
|
12709
|
+
if (!headerSchema) {
|
|
12710
|
+
headerSchema = getObjectListHeader$1(uiSchema);
|
|
12651
12711
|
}
|
|
12652
|
-
|
|
12653
|
-
body = [{
|
|
12654
|
-
"type": "wrapper",
|
|
12655
|
-
"size": "none",
|
|
12656
|
-
"className": "flex flex-1 overflow-hidden h-full",
|
|
12657
|
-
"body": [
|
|
12658
|
-
{
|
|
12659
|
-
"type": "wrapper",
|
|
12660
|
-
"size": "none",
|
|
12661
|
-
"className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
|
|
12662
|
-
"body": sideSchema
|
|
12663
|
-
},
|
|
12664
|
-
{
|
|
12665
|
-
"type": "wrapper",
|
|
12666
|
-
"size": "none",
|
|
12667
|
-
"className": "flex-1 focus:outline-none lg:order-last w-96 h-full",
|
|
12668
|
-
"body": body
|
|
12669
|
-
},
|
|
12670
|
-
]
|
|
12671
|
-
}];
|
|
12672
|
-
}
|
|
12673
|
-
serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12712
|
+
serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12674
12713
|
// console.timeEnd('AmisObjectListView')
|
|
12675
12714
|
return [2 /*return*/, {
|
|
12676
|
-
|
|
12677
|
-
|
|
12678
|
-
|
|
12679
|
-
|
|
12715
|
+
type: "service",
|
|
12716
|
+
data: serviceData,
|
|
12717
|
+
className: "".concat(className, " steedos-object-listview"),
|
|
12718
|
+
body: [{
|
|
12719
|
+
"type": "wrapper",
|
|
12720
|
+
"size": "none",
|
|
12721
|
+
"className": "flex flex-1 overflow-hidden h-full",
|
|
12722
|
+
body: [
|
|
12723
|
+
sideSchema ? {
|
|
12724
|
+
"type": "wrapper",
|
|
12725
|
+
"size": "none",
|
|
12726
|
+
"className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
|
|
12727
|
+
"body": sideSchema
|
|
12728
|
+
} : null,
|
|
12729
|
+
{
|
|
12730
|
+
"type": "wrapper",
|
|
12731
|
+
"size": "none",
|
|
12732
|
+
"className": sideSchema ? "flex-1 focus:outline-none lg:order-last w-96 h-full" : 'w-full h-full',
|
|
12733
|
+
"body": {
|
|
12734
|
+
type: "wrapper",
|
|
12735
|
+
className: "p-0 m-0 steedos-object-table h-full flex flex-col",
|
|
12736
|
+
body: __spreadArray(__spreadArray([], __read(headerSchema), false), [
|
|
12737
|
+
{
|
|
12738
|
+
"type": "service",
|
|
12739
|
+
"schemaApi": {
|
|
12740
|
+
"url": "${context.rootUrl}/graphql?listName=${listName}&display=${display}",
|
|
12741
|
+
"method": "post",
|
|
12742
|
+
"messages": {},
|
|
12743
|
+
"headers": {
|
|
12744
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12745
|
+
},
|
|
12746
|
+
"requestAdaptor": "console.log('service listview schemaApi requestAdaptor======>');api.data={query: '{spaces__findOne(id: \"xxx\"){_id,name}}'};return api;",
|
|
12747
|
+
"adaptor": "\n console.log('service listview schemaApi adaptor....', api.body); \n const { appId, objectName, listName, display, formFactor: defaultFormFactor} = api.body;\n return new Promise((resolve)=>{\n const listViewSchemaProps = ".concat(JSON.stringify(listViewSchemaProps), ";\n const formFactor = ([\"split\"].indexOf(display) > -1) ? 'SMALL': defaultFormFactor;\n listViewSchemaProps.formFactor = formFactor;\n // console.log(\"====listViewSchemaProps===>\", listViewSchemaProps)\n window.getListSchema(appId, objectName, listName, listViewSchemaProps).then((schema)=>{\n payload.data = schema.amisSchema;\n resolve(payload)\n });\n });\n ")
|
|
12748
|
+
},
|
|
12749
|
+
// "body": body,
|
|
12750
|
+
// "data": serviceData
|
|
12751
|
+
}
|
|
12752
|
+
], false)
|
|
12753
|
+
}
|
|
12754
|
+
}
|
|
12755
|
+
]
|
|
12756
|
+
}
|
|
12757
|
+
]
|
|
12680
12758
|
}];
|
|
12681
12759
|
}
|
|
12682
12760
|
});
|
|
@@ -12713,6 +12791,8 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
12713
12791
|
return __generator(this, function (_d) {
|
|
12714
12792
|
switch (_d.label) {
|
|
12715
12793
|
case 0:
|
|
12794
|
+
// console.time('AmisObjectTable')
|
|
12795
|
+
console.log("AmisObjectTable props", props);
|
|
12716
12796
|
$schema = props.$schema, filters = props.filters, filtersFunction = props.filtersFunction, amisCondition = props.amisCondition, top = props.top, headerSchema = props.headerSchema, includedFields = props.fields, fieldsExtend = props.fieldsExtend, sort = props.sort, sortField = props.sortField, sortOrder = props.sortOrder, extraColumns = props.extraColumns, data = props.data, defaultData = props.defaultData, _a = props.formFactor, formFactor = _a === void 0 ? window.innerWidth < 768 ? 'SMALL' : 'LARGE' : _a, _b = props.className, className = _b === void 0 ? "" : _b, requestAdaptor = props.requestAdaptor, adaptor = props.adaptor, _c = props.filterVisible, filterVisible = _c === void 0 ? true : _c, headerToolbarItems = props.headerToolbarItems;
|
|
12717
12797
|
ctx = props.ctx;
|
|
12718
12798
|
if (!ctx) {
|
|
@@ -12811,7 +12891,8 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12811
12891
|
"_id": "\${event.data.record._id}",
|
|
12812
12892
|
"recordId": "\${event.data.record._id}",
|
|
12813
12893
|
"recordLoaded": true,
|
|
12814
|
-
}
|
|
12894
|
+
},
|
|
12895
|
+
"expression": "${event.data.objectName == '".concat(objectUiSchema === null || objectUiSchema === void 0 ? void 0 : objectUiSchema.name, "'}")
|
|
12815
12896
|
}
|
|
12816
12897
|
]
|
|
12817
12898
|
}
|
|
@@ -12831,28 +12912,61 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12831
12912
|
/*
|
|
12832
12913
|
* @Author: baozhoutao@steedos.com
|
|
12833
12914
|
* @Date: 2022-12-08 10:32:17
|
|
12834
|
-
* @LastEditors:
|
|
12835
|
-
* @LastEditTime: 2023-04-
|
|
12915
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12916
|
+
* @LastEditTime: 2023-04-13 18:40:42
|
|
12836
12917
|
* @Description:
|
|
12837
12918
|
*/
|
|
12838
12919
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12839
|
-
var className, appId, _a, objectApiName,
|
|
12920
|
+
var className, appId, _a, objectApiName, body, schema;
|
|
12840
12921
|
return __generator(this, function (_b) {
|
|
12841
12922
|
switch (_b.label) {
|
|
12842
12923
|
case 0:
|
|
12843
|
-
|
|
12924
|
+
console.log("AmisRecordDetail======>", props);
|
|
12925
|
+
className = props.className, props.$schema, appId = props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.onEvent, props.defaultData, body = props.body;
|
|
12844
12926
|
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
12845
12927
|
case 1:
|
|
12846
12928
|
schema = (_b.sent()).amisSchema;
|
|
12847
|
-
|
|
12848
|
-
|
|
12849
|
-
|
|
12850
|
-
|
|
12851
|
-
|
|
12929
|
+
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
12930
|
+
// let recordDetailData: any = {};
|
|
12931
|
+
// if(recordId){
|
|
12932
|
+
// recordDetailData.recordId = recordId;
|
|
12933
|
+
// }
|
|
12934
|
+
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
12852
12935
|
schema.className = className;
|
|
12853
12936
|
if (body) {
|
|
12854
12937
|
schema.body = body;
|
|
12855
12938
|
}
|
|
12939
|
+
console.log("AmisRecordDetail====schema==>", schema);
|
|
12940
|
+
return [2 /*return*/, schema];
|
|
12941
|
+
}
|
|
12942
|
+
});
|
|
12943
|
+
}); };
|
|
12944
|
+
|
|
12945
|
+
/*
|
|
12946
|
+
* @Author: baozhoutao@steedos.com
|
|
12947
|
+
* @Date: 2022-12-08 10:32:17
|
|
12948
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12949
|
+
* @LastEditTime: 2023-04-14 11:30:21
|
|
12950
|
+
* @Description:
|
|
12951
|
+
*/
|
|
12952
|
+
var AmisRecordService = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12953
|
+
var className, _a, objectApiName, body, style, schema;
|
|
12954
|
+
return __generator(this, function (_b) {
|
|
12955
|
+
switch (_b.label) {
|
|
12956
|
+
case 0:
|
|
12957
|
+
className = props.className, props.$schema, props.appId, _a = props.objectApiName, objectApiName = _a === void 0 ? "space_users" : _a, props.recordId, props.fields, body = props.body, style = props.style;
|
|
12958
|
+
return [4 /*yield*/, getRecordServiceSchema(objectApiName)];
|
|
12959
|
+
case 1:
|
|
12960
|
+
schema = (_b.sent()).amisSchema;
|
|
12961
|
+
if (body) {
|
|
12962
|
+
schema.body = body;
|
|
12963
|
+
}
|
|
12964
|
+
if (className) {
|
|
12965
|
+
schema.className = className;
|
|
12966
|
+
}
|
|
12967
|
+
if (style) {
|
|
12968
|
+
Object.assign(schema.style, style);
|
|
12969
|
+
}
|
|
12856
12970
|
return [2 /*return*/, schema];
|
|
12857
12971
|
}
|
|
12858
12972
|
});
|
|
@@ -13852,15 +13966,16 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
13852
13966
|
}); };
|
|
13853
13967
|
|
|
13854
13968
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13855
|
-
var
|
|
13969
|
+
var formFactor, appId, objectApiName, display, page, listSchema;
|
|
13856
13970
|
return __generator(this, function (_b) {
|
|
13857
13971
|
switch (_b.label) {
|
|
13858
13972
|
case 0:
|
|
13859
|
-
|
|
13973
|
+
// console.time('PageListView')
|
|
13974
|
+
console.log("PageListView====>", props);
|
|
13975
|
+
formFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.listviewId, display = props.display, props.$schema, props.listName;
|
|
13976
|
+
//TODO 此代码应该在object page template中处理
|
|
13860
13977
|
if (display)
|
|
13861
13978
|
Router$1.setTabDisplayAs(objectApiName, display);
|
|
13862
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : Router$1.getTabDisplayAs(objectApiName);
|
|
13863
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
13864
13979
|
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
13865
13980
|
case 1:
|
|
13866
13981
|
page = _b.sent();
|
|
@@ -13870,65 +13985,51 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
13870
13985
|
"show": true
|
|
13871
13986
|
}];
|
|
13872
13987
|
}
|
|
13873
|
-
listViewId = SteedosUI.getRefId({
|
|
13874
|
-
type: "listview",
|
|
13875
|
-
appId: appId,
|
|
13876
|
-
name: objectApiName,
|
|
13877
|
-
});
|
|
13878
13988
|
listSchema = page ? page.schema : {
|
|
13879
13989
|
"type": "steedos-object-listview",
|
|
13880
13990
|
"objectApiName": objectApiName,
|
|
13881
13991
|
"columnsTogglable": false,
|
|
13882
13992
|
"showHeader": true,
|
|
13883
|
-
"showDisplayAs": (
|
|
13884
|
-
"formFactor": formFactor,
|
|
13885
|
-
"className": (displayAs === 'split')
|
|
13993
|
+
// "showDisplayAs": (formFactor !== 'SMALL'),
|
|
13994
|
+
// "formFactor": formFactor,
|
|
13995
|
+
// "className": (displayAs === 'split')? 'w-full': 'p-0 flex-1 m-0 sm:border sm:shadow sm:rounded border-slate-300 border-solid bg-gray-100'
|
|
13886
13996
|
};
|
|
13887
|
-
defData =
|
|
13888
|
-
|
|
13889
|
-
|
|
13890
|
-
|
|
13891
|
-
|
|
13892
|
-
|
|
13893
|
-
|
|
13894
|
-
|
|
13997
|
+
// const defData = {
|
|
13998
|
+
// ...$schema.data,
|
|
13999
|
+
// objectName: objectApiName,
|
|
14000
|
+
// listViewId: listViewId,
|
|
14001
|
+
// // listName: listName || listviewId,
|
|
14002
|
+
// appId: appId,
|
|
14003
|
+
// // formFactor: formFactor,
|
|
14004
|
+
// // displayAs: displayAs
|
|
14005
|
+
// };
|
|
14006
|
+
// if(listName){
|
|
14007
|
+
// defData.listName = listName || listviewId
|
|
14008
|
+
// }
|
|
14009
|
+
// console.log("defData====>", defData)
|
|
14010
|
+
// console.timeEnd('PageListView')
|
|
14011
|
+
// const pageGridClassName = listSchema.pageGridClassName || 'h-full sm:p-3'
|
|
14012
|
+
// const pageSplitClassName = listSchema.pageSplitClassName || 'p-0 flex flex-1 overflow-hidden h-full'
|
|
13895
14013
|
return [2 /*return*/, {
|
|
13896
14014
|
type: 'service',
|
|
13897
|
-
|
|
13898
|
-
|
|
13899
|
-
body: (displayAs === 'grid') ? defaultsDeep$1({ data: defData }, listSchema) : [
|
|
13900
|
-
{
|
|
13901
|
-
"type": "wrapper",
|
|
13902
|
-
"className": "p-0 flex-shrink-0 min-w-[388px] border-r border-gray-300 bg-gray-100 shadow lg:order-first lg:flex lg:flex-col",
|
|
13903
|
-
"body": defaultsDeep$1({ data: defData }, listSchema)
|
|
13904
|
-
},
|
|
13905
|
-
{
|
|
13906
|
-
"type": "wrapper",
|
|
13907
|
-
"className": 'p-0 flex-1 focus:outline-none xl:order-last',
|
|
13908
|
-
"body": []
|
|
13909
|
-
}
|
|
13910
|
-
]
|
|
14015
|
+
className: "h-full",
|
|
14016
|
+
body: listSchema
|
|
13911
14017
|
}];
|
|
13912
14018
|
}
|
|
13913
14019
|
});
|
|
13914
14020
|
}); };
|
|
13915
14021
|
|
|
13916
14022
|
var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13917
|
-
var defaultFormFactor, appId, objectApiName, display,
|
|
14023
|
+
var defaultFormFactor, appId, objectApiName, display, recordSchema, recordPage;
|
|
13918
14024
|
return __generator(this, function (_a) {
|
|
13919
14025
|
switch (_a.label) {
|
|
13920
14026
|
case 0:
|
|
13921
|
-
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display
|
|
13922
|
-
|
|
13923
|
-
|
|
13924
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : sideObject ? 'split' : Router$1.getTabDisplayAs(objectApiName);
|
|
13925
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
13926
|
-
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
13927
|
-
case 1:
|
|
13928
|
-
listPage = _a.sent();
|
|
14027
|
+
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display;
|
|
14028
|
+
//TODO 此代码应该在object page template中处理
|
|
14029
|
+
Router$1.setTabDisplayAs(objectApiName, display);
|
|
13929
14030
|
recordSchema = {};
|
|
13930
14031
|
return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
|
|
13931
|
-
case
|
|
14032
|
+
case 1:
|
|
13932
14033
|
recordPage = _a.sent();
|
|
13933
14034
|
recordSchema = recordPage ? recordPage.schema : {
|
|
13934
14035
|
"type": "wrapper",
|
|
@@ -13944,37 +14045,85 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
13944
14045
|
}
|
|
13945
14046
|
],
|
|
13946
14047
|
};
|
|
13947
|
-
_a.label =
|
|
13948
|
-
case
|
|
13949
|
-
|
|
13950
|
-
"
|
|
13951
|
-
|
|
13952
|
-
|
|
13953
|
-
|
|
13954
|
-
|
|
13955
|
-
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
14048
|
+
_a.label = 2;
|
|
14049
|
+
case 2: return [2 /*return*/, {
|
|
14050
|
+
type: 'service',
|
|
14051
|
+
"className": 'h-full',
|
|
14052
|
+
body: recordSchema
|
|
14053
|
+
}];
|
|
14054
|
+
}
|
|
14055
|
+
});
|
|
14056
|
+
}); };
|
|
14057
|
+
|
|
14058
|
+
var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14059
|
+
var data, _a, $schema, uiSchema;
|
|
14060
|
+
return __generator(this, function (_b) {
|
|
14061
|
+
switch (_b.label) {
|
|
14062
|
+
case 0:
|
|
14063
|
+
data = props.data, _a = props.$schema, $schema = _a === void 0 ? {} : _a;
|
|
14064
|
+
return [4 /*yield*/, getUISchema($schema.data.objectName, false)];
|
|
14065
|
+
case 1:
|
|
14066
|
+
uiSchema = _b.sent();
|
|
14067
|
+
delete $schema.data.recordId;
|
|
14068
|
+
// 最外层的data是render data, 会被updateProps data覆盖, 所以组件data需要单开一个数据域. 所以此处有2层service
|
|
13962
14069
|
return [2 /*return*/, {
|
|
13963
|
-
type:
|
|
13964
|
-
data:
|
|
13965
|
-
|
|
13966
|
-
body:
|
|
13967
|
-
|
|
13968
|
-
|
|
13969
|
-
|
|
13970
|
-
|
|
14070
|
+
type: "service",
|
|
14071
|
+
data: $schema.data,
|
|
14072
|
+
className: "h-full",
|
|
14073
|
+
body: {
|
|
14074
|
+
type: 'service',
|
|
14075
|
+
className: {
|
|
14076
|
+
'h-full': "${display != 'split'}",
|
|
14077
|
+
'flex flex-1 overflow-hidden h-full': "${display == 'split'}"
|
|
13971
14078
|
},
|
|
13972
|
-
{
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
|
|
14079
|
+
data: {
|
|
14080
|
+
uiSchema: uiSchema
|
|
14081
|
+
},
|
|
14082
|
+
body: [
|
|
14083
|
+
{
|
|
14084
|
+
"type": "wrapper",
|
|
14085
|
+
"size": "none",
|
|
14086
|
+
"className": {
|
|
14087
|
+
"p-0 flex-shrink-0 min-w-[388px] border-r border-gray-300 bg-gray-100 shadow lg:order-first lg:flex lg:flex-col": "${display == 'split'}",
|
|
14088
|
+
'h-full': "${display != 'split'}",
|
|
14089
|
+
},
|
|
14090
|
+
"body": {
|
|
14091
|
+
"name": "".concat(data.objectName, "-listview-").concat(data.listViewId),
|
|
14092
|
+
"type": "steedos-page-listview",
|
|
14093
|
+
"showHeader": true,
|
|
14094
|
+
"objectApiName": data.objectName,
|
|
14095
|
+
"appId": data.appId,
|
|
14096
|
+
"display": data.display,
|
|
14097
|
+
"columnsTogglable": false
|
|
14098
|
+
},
|
|
14099
|
+
"visibleOn": "${pageType === 'list' || (pageType === 'record' && display == 'split')}"
|
|
14100
|
+
},
|
|
14101
|
+
{
|
|
14102
|
+
"type": "wrapper",
|
|
14103
|
+
"size": "none",
|
|
14104
|
+
"className": {
|
|
14105
|
+
"overflow-y-auto p-0 flex-1 focus:outline-none lg:order-last h-full": "${display == 'split'}",
|
|
14106
|
+
'h-full': "${display != 'split'}",
|
|
14107
|
+
},
|
|
14108
|
+
"body": {
|
|
14109
|
+
"name": "".concat(data.objectName, "-recordDetail-").concat(data.recordId),
|
|
14110
|
+
"type": "steedos-page-record-detail",
|
|
14111
|
+
"objectApiName": data.objectName,
|
|
14112
|
+
"sideObject": data.sideObject,
|
|
14113
|
+
"sideListviewId": data.sideListviewId,
|
|
14114
|
+
// "recordId": recordId,
|
|
14115
|
+
"display": data.display,
|
|
14116
|
+
"appId": data.appId
|
|
14117
|
+
},
|
|
14118
|
+
"visibleOn": "${pageType === 'record'}"
|
|
14119
|
+
},
|
|
14120
|
+
{
|
|
14121
|
+
"type": "tpl",
|
|
14122
|
+
"tpl": "无效的页面类型: ${pageType}",
|
|
14123
|
+
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
14124
|
+
}
|
|
14125
|
+
]
|
|
14126
|
+
}
|
|
13978
14127
|
}];
|
|
13979
14128
|
}
|
|
13980
14129
|
});
|
|
@@ -13988,5 +14137,5 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
13988
14137
|
SteedosUI: SteedosUI$1
|
|
13989
14138
|
});
|
|
13990
14139
|
|
|
13991
|
-
export { AmisAppLauncher, AmisAppMenu, AmisGlobalHeader, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading, SteedosSkeleton };
|
|
14140
|
+
export { AmisAppLauncher, AmisAppMenu, AmisGlobalHeader, AmisInstanceDetail, index_esm$1 as AmisLib, AmisLogo, AmisObjectButton, AmisObjectCalendar, AmisObjectFieldLookup, AmisObjectForm, AmisObjectListView, AmisObjectTable, AmisProvider, AmisRecordDetail, AmisRecordDetailHeader, AmisRecordDetailRelatedList, AmisRecordDetailRelatedLists, AmisRecordService, AmisSelectFlow, AmisSelectUser, AmisSteedosField, FromNow, PageListView, PageObject, PageRecordDetail, SteedosBadge, SteedosBadgeRibbon, SteedosDropdown, SteedosDropdownButton, SteedosIcon, index_esm as SteedosLib, SteedosLoading, SteedosSkeleton };
|
|
13992
14141
|
//# sourceMappingURL=amis-object.esm.js.map
|