@steedos-widgets/amis-object 1.2.2 → 1.2.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/amis/AmisObjectListview.d.ts +12 -4
- package/dist/amis-object.cjs.css +0 -8
- package/dist/amis-object.cjs.js +209 -194
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +0 -8
- package/dist/amis-object.esm.js +209 -195
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +0 -8
- package/dist/amis-object.umd.js +209 -194
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/dist/meta.js +395 -345
- 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.umd.js
CHANGED
|
@@ -719,14 +719,19 @@
|
|
|
719
719
|
* @Author: baozhoutao@steedos.com
|
|
720
720
|
* @Date: 2022-08-16 17:02:08
|
|
721
721
|
* @LastEditors: baozhoutao@steedos.com
|
|
722
|
-
* @LastEditTime: 2023-04-
|
|
722
|
+
* @LastEditTime: 2023-04-17 15:24:21
|
|
723
723
|
* @Description:
|
|
724
724
|
*/
|
|
725
725
|
|
|
726
726
|
|
|
727
727
|
const Router$1 = {
|
|
728
728
|
getTabDisplayAs(tab_id){
|
|
729
|
-
|
|
729
|
+
var urlSearch = new URLSearchParams(document.location.search);
|
|
730
|
+
if(urlSearch.has('display')){
|
|
731
|
+
return urlSearch.get('display')
|
|
732
|
+
}
|
|
733
|
+
// const key = `tab.${tab_id}.display`;
|
|
734
|
+
const key = `page.display`;
|
|
730
735
|
const value = localStorage.getItem(key);
|
|
731
736
|
return value ? value : 'grid'
|
|
732
737
|
},
|
|
@@ -3213,7 +3218,6 @@
|
|
|
3213
3218
|
function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
3214
3219
|
const { icon, label } = objectSchema;
|
|
3215
3220
|
const listViewButtonOptions = [];
|
|
3216
|
-
// let currentListView;
|
|
3217
3221
|
___default.each(
|
|
3218
3222
|
objectSchema.list_views,
|
|
3219
3223
|
(listView, name) => {
|
|
@@ -3221,19 +3225,11 @@
|
|
|
3221
3225
|
type: "button",
|
|
3222
3226
|
label: listView.label,
|
|
3223
3227
|
actionType: "link",
|
|
3224
|
-
// icon: "fa fa-plus",
|
|
3225
3228
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
3226
3229
|
});
|
|
3227
|
-
// if(name === listViewName){
|
|
3228
|
-
// currentListView = listView;
|
|
3229
|
-
// }
|
|
3230
3230
|
}
|
|
3231
3231
|
);
|
|
3232
3232
|
|
|
3233
|
-
// if(!currentListView){
|
|
3234
|
-
// return {};
|
|
3235
|
-
// }
|
|
3236
|
-
|
|
3237
3233
|
const buttons = getListViewButtons(objectSchema, {});
|
|
3238
3234
|
let amisButtonsSchema = ___default.map(buttons, (button) => {
|
|
3239
3235
|
return {
|
|
@@ -3244,34 +3240,7 @@
|
|
|
3244
3240
|
className: `button_${button.name}`
|
|
3245
3241
|
}
|
|
3246
3242
|
});
|
|
3247
|
-
|
|
3248
|
-
// const bulkDeleteScript = `
|
|
3249
|
-
// const data = event.data;
|
|
3250
|
-
// const listViewId = data.listViewId;
|
|
3251
|
-
// const uiSchema = data.uiSchema;
|
|
3252
|
-
// const scopeId = data.scopeId;
|
|
3253
|
-
// BuilderAmisObject.AmisLib.standardButtonsTodo.standard_delete_many.call({
|
|
3254
|
-
// listViewId,
|
|
3255
|
-
// uiSchema,
|
|
3256
|
-
// scopeId
|
|
3257
|
-
// })
|
|
3258
|
-
// `;
|
|
3259
|
-
// amisButtonsSchema.push({
|
|
3260
|
-
// type: 'button',
|
|
3261
|
-
// label: "删除",
|
|
3262
|
-
// className: `antd-Button antd-Button--default antd-Button--size-default`,
|
|
3263
|
-
// "onEvent": {
|
|
3264
|
-
// "click": {
|
|
3265
|
-
// "actions": [
|
|
3266
|
-
// {
|
|
3267
|
-
// "actionType": "custom",
|
|
3268
|
-
// "script": bulkDeleteScript
|
|
3269
|
-
// }
|
|
3270
|
-
// ]
|
|
3271
|
-
// }
|
|
3272
|
-
// }
|
|
3273
|
-
// });
|
|
3274
|
-
// }
|
|
3243
|
+
|
|
3275
3244
|
const reg = new RegExp('_', 'g');
|
|
3276
3245
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3277
3246
|
return {
|
|
@@ -3461,27 +3430,14 @@
|
|
|
3461
3430
|
* @param {*} objectSchema 对象UISchema
|
|
3462
3431
|
* @returns amisSchema
|
|
3463
3432
|
*/
|
|
3464
|
-
|
|
3433
|
+
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3465
3434
|
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
|
|
3466
|
-
// let secordLineSchema = await getObjectListHeaderSecordLine(objectSchema, listViewName, ctx);
|
|
3467
|
-
// let body = [firstLineSchema, secordLineSchema];
|
|
3468
3435
|
let body = [firstLineSchema];
|
|
3469
|
-
// let roundedCss = "";
|
|
3470
|
-
// if (ctx.onlyFirstLine) {
|
|
3471
|
-
// body = [firstLineSchema];
|
|
3472
|
-
// }
|
|
3473
|
-
// else if (ctx.onlySecordLine) {
|
|
3474
|
-
// // 列表视图自定义amisSchema时不能加圆角
|
|
3475
|
-
// roundedCss = "";
|
|
3476
|
-
// // body = [secordLineSchema];
|
|
3477
|
-
// }
|
|
3478
3436
|
let headerSchema = [{
|
|
3479
3437
|
"type": "wrapper",
|
|
3480
3438
|
"body": body,
|
|
3481
3439
|
"className": `bg-gray-100 sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
3482
3440
|
}];
|
|
3483
|
-
// const fieldsFilterBarSchema = await getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx);
|
|
3484
|
-
// headerSchema.push(fieldsFilterBarSchema);
|
|
3485
3441
|
return headerSchema;
|
|
3486
3442
|
}
|
|
3487
3443
|
|
|
@@ -3735,6 +3691,7 @@
|
|
|
3735
3691
|
"icon": "fa fa-table-columns",
|
|
3736
3692
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3737
3693
|
"align": "right",
|
|
3694
|
+
"visibleOn": "${formFactor !== 'SMALL'}",
|
|
3738
3695
|
"buttons": [
|
|
3739
3696
|
{
|
|
3740
3697
|
"label": "显示为",
|
|
@@ -3871,7 +3828,7 @@ setTimeout(()=>{
|
|
|
3871
3828
|
}
|
|
3872
3829
|
}
|
|
3873
3830
|
} : {},
|
|
3874
|
-
|
|
3831
|
+
getDisplayAsButton(mainObject?.name)
|
|
3875
3832
|
]
|
|
3876
3833
|
}else {
|
|
3877
3834
|
return [
|
|
@@ -4464,7 +4421,7 @@ setTimeout(()=>{
|
|
|
4464
4421
|
}
|
|
4465
4422
|
]
|
|
4466
4423
|
},
|
|
4467
|
-
|
|
4424
|
+
getDisplayAsButton(showDisplayAs)
|
|
4468
4425
|
// {
|
|
4469
4426
|
// "type": "search-box",
|
|
4470
4427
|
// "align": "right",
|
|
@@ -8729,8 +8686,8 @@ setTimeout(()=>{
|
|
|
8729
8686
|
/*
|
|
8730
8687
|
* @Author: baozhoutao@steedos.com
|
|
8731
8688
|
* @Date: 2022-07-05 15:55:39
|
|
8732
|
-
* @LastEditors:
|
|
8733
|
-
* @LastEditTime: 2023-04-
|
|
8689
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
8690
|
+
* @LastEditTime: 2023-04-17 15:26:17
|
|
8734
8691
|
* @Description:
|
|
8735
8692
|
*/
|
|
8736
8693
|
|
|
@@ -8943,6 +8900,7 @@ setTimeout(()=>{
|
|
|
8943
8900
|
return { uiSchema };
|
|
8944
8901
|
}
|
|
8945
8902
|
|
|
8903
|
+
// 直接返回自定义的列表视图schema
|
|
8946
8904
|
if(listView.enable_amis_schema && listView.amis_schema){
|
|
8947
8905
|
const amisSchema = ___default.isString(listView.amis_schema) ? JSON.parse(listView.amis_schema) : listView.amis_schema;
|
|
8948
8906
|
return {
|
|
@@ -8956,6 +8914,7 @@ setTimeout(()=>{
|
|
|
8956
8914
|
let sort = getListViewSort(listView);
|
|
8957
8915
|
let listviewFilter = getListViewFilter(listView);
|
|
8958
8916
|
let listview_filters = listView && listView._filters;
|
|
8917
|
+
// 返回 calendar 组件
|
|
8959
8918
|
if(listView.type === "calendar"){
|
|
8960
8919
|
const amisSchema = {
|
|
8961
8920
|
"type": "steedos-object-calendar",
|
|
@@ -8974,14 +8933,21 @@ setTimeout(()=>{
|
|
|
8974
8933
|
|
|
8975
8934
|
const defaults = ctx.defaults || {};
|
|
8976
8935
|
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8936
|
+
// // 未自定义header 且显示header的时候, 使用系统header
|
|
8937
|
+
// if(!defaults.headerSchema && ctx.showHeader){
|
|
8938
|
+
// defaults.headerSchema = getObjectListHeader(uiSchema, listViewName);
|
|
8939
|
+
// }
|
|
8940
|
+
|
|
8941
|
+
// // 如果不显示header,则清理掉
|
|
8942
|
+
// if(!ctx.showHeader){
|
|
8943
|
+
// defaults.headerSchema = null;
|
|
8944
|
+
// }
|
|
8980
8945
|
|
|
8981
|
-
|
|
8982
|
-
defaults.headerSchema = null;
|
|
8983
|
-
}
|
|
8946
|
+
defaults.headerSchema = null;
|
|
8984
8947
|
|
|
8948
|
+
/**
|
|
8949
|
+
* 本次存储代码段
|
|
8950
|
+
*/
|
|
8985
8951
|
try {
|
|
8986
8952
|
const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
|
|
8987
8953
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
@@ -9096,7 +9062,7 @@ setTimeout(()=>{
|
|
|
9096
9062
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
9097
9063
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
9098
9064
|
});
|
|
9099
|
-
|
|
9065
|
+
console.log('getTableSchema====>amisSchema', amisSchema);
|
|
9100
9066
|
// console.timeEnd('getTableSchema');
|
|
9101
9067
|
return {
|
|
9102
9068
|
uiSchema,
|
|
@@ -9294,6 +9260,7 @@ setTimeout(()=>{
|
|
|
9294
9260
|
if(typeof window != 'undefined'){
|
|
9295
9261
|
window.getUISchema = getUISchema;
|
|
9296
9262
|
window.getUISchemaSync = getUISchemaSync;
|
|
9263
|
+
window.getListSchema = getListSchema;
|
|
9297
9264
|
}
|
|
9298
9265
|
|
|
9299
9266
|
// import { getListSchema } from './objects';
|
|
@@ -12680,11 +12647,14 @@ setTimeout(()=>{
|
|
|
12680
12647
|
}); };
|
|
12681
12648
|
|
|
12682
12649
|
var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12683
|
-
var $schema, top, perPage, _a, showHeader,
|
|
12650
|
+
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;
|
|
12684
12651
|
return __generator(this, function (_f) {
|
|
12685
12652
|
switch (_f.label) {
|
|
12686
12653
|
case 0:
|
|
12687
|
-
|
|
12654
|
+
// console.time('AmisObjectListView')
|
|
12655
|
+
console.log("AmisObjectListView props", props);
|
|
12656
|
+
$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;
|
|
12657
|
+
headerSchema = props.headerSchema;
|
|
12688
12658
|
ctx = props.ctx;
|
|
12689
12659
|
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);
|
|
12690
12660
|
defaults = {};
|
|
@@ -12711,8 +12681,8 @@ setTimeout(()=>{
|
|
|
12711
12681
|
}
|
|
12712
12682
|
return [4 /*yield*/, getUISchema(objectApiName, false)];
|
|
12713
12683
|
case 1:
|
|
12714
|
-
|
|
12715
|
-
listView = ___default.find(
|
|
12684
|
+
uiSchema = _f.sent();
|
|
12685
|
+
listView = ___default.find(uiSchema.list_views, function (listView, name) {
|
|
12716
12686
|
// 传入listViewName空值则取第一个
|
|
12717
12687
|
if (!listName) {
|
|
12718
12688
|
listName = name;
|
|
@@ -12739,7 +12709,7 @@ setTimeout(()=>{
|
|
|
12739
12709
|
"actions": [
|
|
12740
12710
|
{
|
|
12741
12711
|
"args": {
|
|
12742
|
-
"url": "/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?display=${ls:
|
|
12712
|
+
"url": "/app/${appId}/${objectName}/view/${event.data.result.data.recordId}?display=${ls:page.display || 'grid'}&side_object=${objectName}&side_listview_id=${listName}",
|
|
12743
12713
|
"blank": false
|
|
12744
12714
|
},
|
|
12745
12715
|
"actionType": "link",
|
|
@@ -12755,58 +12725,62 @@ setTimeout(()=>{
|
|
|
12755
12725
|
listSchema: listSchema
|
|
12756
12726
|
};
|
|
12757
12727
|
}
|
|
12758
|
-
// 支持通过直接定义headerSchema属性来定制表头,而不一定要通过ctx.defaults.headerSchema传入
|
|
12759
|
-
if (headerSchema) {
|
|
12760
|
-
defaults.headerSchema = headerSchema;
|
|
12761
|
-
}
|
|
12762
12728
|
setDataToComponentId = ctx && ctx.setDataToComponentId;
|
|
12763
12729
|
if (!setDataToComponentId) {
|
|
12764
12730
|
setDataToComponentId = "service_listview_".concat(objectApiName);
|
|
12765
12731
|
}
|
|
12766
12732
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
12767
12733
|
listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
|
|
12768
|
-
|
|
12769
|
-
|
|
12770
|
-
|
|
12771
|
-
amisSchema = schema.amisSchema;
|
|
12772
|
-
uiSchema = schema.uiSchema;
|
|
12773
|
-
body = [amisSchema];
|
|
12774
|
-
if (schema.isCustomAmisSchema || schema.isCalendar) {
|
|
12775
|
-
firstLineSchema = getObjectListHeaderFirstLine(uiSchema);
|
|
12776
|
-
body.unshift({
|
|
12777
|
-
"type": "wrapper",
|
|
12778
|
-
"body": [firstLineSchema],
|
|
12779
|
-
"className": "bg-gray-100 pb-0 sm:rounded-tl sm:rounded-tr",
|
|
12780
|
-
});
|
|
12734
|
+
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 });
|
|
12735
|
+
if (!headerSchema) {
|
|
12736
|
+
headerSchema = getObjectListHeader$1(uiSchema);
|
|
12781
12737
|
}
|
|
12782
|
-
|
|
12783
|
-
body = [{
|
|
12784
|
-
"type": "wrapper",
|
|
12785
|
-
"size": "none",
|
|
12786
|
-
"className": "flex flex-1 overflow-hidden h-full",
|
|
12787
|
-
"body": [
|
|
12788
|
-
{
|
|
12789
|
-
"type": "wrapper",
|
|
12790
|
-
"size": "none",
|
|
12791
|
-
"className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
|
|
12792
|
-
"body": sideSchema
|
|
12793
|
-
},
|
|
12794
|
-
{
|
|
12795
|
-
"type": "wrapper",
|
|
12796
|
-
"size": "none",
|
|
12797
|
-
"className": "flex-1 focus:outline-none lg:order-last w-96 h-full",
|
|
12798
|
-
"body": body
|
|
12799
|
-
},
|
|
12800
|
-
]
|
|
12801
|
-
}];
|
|
12802
|
-
}
|
|
12803
|
-
serviceData = Object.assign({}, { listName: listName, uiSchema: uiSchema, showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12738
|
+
serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12804
12739
|
// console.timeEnd('AmisObjectListView')
|
|
12805
12740
|
return [2 /*return*/, {
|
|
12806
|
-
|
|
12807
|
-
|
|
12808
|
-
|
|
12809
|
-
|
|
12741
|
+
type: "service",
|
|
12742
|
+
data: serviceData,
|
|
12743
|
+
className: "".concat(className, " steedos-object-listview"),
|
|
12744
|
+
body: [{
|
|
12745
|
+
"type": "wrapper",
|
|
12746
|
+
"size": "none",
|
|
12747
|
+
"className": "flex flex-1 overflow-hidden h-full",
|
|
12748
|
+
body: [
|
|
12749
|
+
sideSchema ? {
|
|
12750
|
+
"type": "wrapper",
|
|
12751
|
+
"size": "none",
|
|
12752
|
+
"className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
|
|
12753
|
+
"body": sideSchema
|
|
12754
|
+
} : null,
|
|
12755
|
+
{
|
|
12756
|
+
"type": "wrapper",
|
|
12757
|
+
"size": "none",
|
|
12758
|
+
"className": sideSchema ? "flex-1 focus:outline-none lg:order-last w-96 h-full" : 'w-full h-full',
|
|
12759
|
+
"body": {
|
|
12760
|
+
type: "wrapper",
|
|
12761
|
+
className: "p-0 m-0 steedos-object-table h-full flex flex-col",
|
|
12762
|
+
body: __spreadArray(__spreadArray([], __read(headerSchema), false), [
|
|
12763
|
+
{
|
|
12764
|
+
"type": "service",
|
|
12765
|
+
"schemaApi": {
|
|
12766
|
+
"url": "${context.rootUrl}/graphql?listName=${listName}&display=${display}",
|
|
12767
|
+
"method": "post",
|
|
12768
|
+
"messages": {},
|
|
12769
|
+
"headers": {
|
|
12770
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
12771
|
+
},
|
|
12772
|
+
"requestAdaptor": "console.log('service listview schemaApi requestAdaptor======>');api.data={query: '{spaces__findOne(id: \"xxx\"){_id,name}}'};return api;",
|
|
12773
|
+
"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 ")
|
|
12774
|
+
},
|
|
12775
|
+
// "body": body,
|
|
12776
|
+
// "data": serviceData
|
|
12777
|
+
}
|
|
12778
|
+
], false)
|
|
12779
|
+
}
|
|
12780
|
+
}
|
|
12781
|
+
]
|
|
12782
|
+
}
|
|
12783
|
+
]
|
|
12810
12784
|
}];
|
|
12811
12785
|
}
|
|
12812
12786
|
});
|
|
@@ -12843,6 +12817,8 @@ setTimeout(()=>{
|
|
|
12843
12817
|
return __generator(this, function (_d) {
|
|
12844
12818
|
switch (_d.label) {
|
|
12845
12819
|
case 0:
|
|
12820
|
+
// console.time('AmisObjectTable')
|
|
12821
|
+
console.log("AmisObjectTable props", props);
|
|
12846
12822
|
$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;
|
|
12847
12823
|
ctx = props.ctx;
|
|
12848
12824
|
if (!ctx) {
|
|
@@ -12962,28 +12938,31 @@ setTimeout(()=>{
|
|
|
12962
12938
|
/*
|
|
12963
12939
|
* @Author: baozhoutao@steedos.com
|
|
12964
12940
|
* @Date: 2022-12-08 10:32:17
|
|
12965
|
-
* @LastEditors:
|
|
12966
|
-
* @LastEditTime: 2023-04-
|
|
12941
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12942
|
+
* @LastEditTime: 2023-04-13 18:40:42
|
|
12967
12943
|
* @Description:
|
|
12968
12944
|
*/
|
|
12969
12945
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12970
|
-
var className, appId, _a, objectApiName,
|
|
12946
|
+
var className, appId, _a, objectApiName, body, schema;
|
|
12971
12947
|
return __generator(this, function (_b) {
|
|
12972
12948
|
switch (_b.label) {
|
|
12973
12949
|
case 0:
|
|
12974
|
-
|
|
12950
|
+
console.log("AmisRecordDetail======>", props);
|
|
12951
|
+
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;
|
|
12975
12952
|
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
12976
12953
|
case 1:
|
|
12977
12954
|
schema = (_b.sent()).amisSchema;
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
|
|
12955
|
+
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
12956
|
+
// let recordDetailData: any = {};
|
|
12957
|
+
// if(recordId){
|
|
12958
|
+
// recordDetailData.recordId = recordId;
|
|
12959
|
+
// }
|
|
12960
|
+
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
12983
12961
|
schema.className = className;
|
|
12984
12962
|
if (body) {
|
|
12985
12963
|
schema.body = body;
|
|
12986
12964
|
}
|
|
12965
|
+
console.log("AmisRecordDetail====schema==>", schema);
|
|
12987
12966
|
return [2 /*return*/, schema];
|
|
12988
12967
|
}
|
|
12989
12968
|
});
|
|
@@ -14013,15 +13992,16 @@ setTimeout(()=>{
|
|
|
14013
13992
|
}); };
|
|
14014
13993
|
|
|
14015
13994
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14016
|
-
var
|
|
13995
|
+
var formFactor, appId, objectApiName, display, page, listSchema;
|
|
14017
13996
|
return __generator(this, function (_b) {
|
|
14018
13997
|
switch (_b.label) {
|
|
14019
13998
|
case 0:
|
|
14020
|
-
|
|
13999
|
+
// console.time('PageListView')
|
|
14000
|
+
console.log("PageListView====>", props);
|
|
14001
|
+
formFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.listviewId, display = props.display, props.$schema, props.listName;
|
|
14002
|
+
//TODO 此代码应该在object page template中处理
|
|
14021
14003
|
if (display)
|
|
14022
14004
|
Router$1.setTabDisplayAs(objectApiName, display);
|
|
14023
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : Router$1.getTabDisplayAs(objectApiName);
|
|
14024
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
14025
14005
|
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
14026
14006
|
case 1:
|
|
14027
14007
|
page = _b.sent();
|
|
@@ -14031,65 +14011,51 @@ setTimeout(()=>{
|
|
|
14031
14011
|
"show": true
|
|
14032
14012
|
}];
|
|
14033
14013
|
}
|
|
14034
|
-
listViewId = SteedosUI.getRefId({
|
|
14035
|
-
type: "listview",
|
|
14036
|
-
appId: appId,
|
|
14037
|
-
name: objectApiName,
|
|
14038
|
-
});
|
|
14039
14014
|
listSchema = page ? page.schema : {
|
|
14040
14015
|
"type": "steedos-object-listview",
|
|
14041
14016
|
"objectApiName": objectApiName,
|
|
14042
14017
|
"columnsTogglable": false,
|
|
14043
14018
|
"showHeader": true,
|
|
14044
|
-
"showDisplayAs": (
|
|
14045
|
-
"formFactor": formFactor,
|
|
14046
|
-
"className": (displayAs === 'split')
|
|
14019
|
+
// "showDisplayAs": (formFactor !== 'SMALL'),
|
|
14020
|
+
// "formFactor": formFactor,
|
|
14021
|
+
// "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'
|
|
14047
14022
|
};
|
|
14048
|
-
defData =
|
|
14049
|
-
|
|
14050
|
-
|
|
14051
|
-
|
|
14052
|
-
|
|
14053
|
-
|
|
14054
|
-
|
|
14055
|
-
|
|
14023
|
+
// const defData = {
|
|
14024
|
+
// ...$schema.data,
|
|
14025
|
+
// objectName: objectApiName,
|
|
14026
|
+
// listViewId: listViewId,
|
|
14027
|
+
// // listName: listName || listviewId,
|
|
14028
|
+
// appId: appId,
|
|
14029
|
+
// // formFactor: formFactor,
|
|
14030
|
+
// // displayAs: displayAs
|
|
14031
|
+
// };
|
|
14032
|
+
// if(listName){
|
|
14033
|
+
// defData.listName = listName || listviewId
|
|
14034
|
+
// }
|
|
14035
|
+
// console.log("defData====>", defData)
|
|
14036
|
+
// console.timeEnd('PageListView')
|
|
14037
|
+
// const pageGridClassName = listSchema.pageGridClassName || 'h-full sm:p-3'
|
|
14038
|
+
// const pageSplitClassName = listSchema.pageSplitClassName || 'p-0 flex flex-1 overflow-hidden h-full'
|
|
14056
14039
|
return [2 /*return*/, {
|
|
14057
14040
|
type: 'service',
|
|
14058
|
-
|
|
14059
|
-
|
|
14060
|
-
body: (displayAs === 'grid') ? ___default.defaultsDeep({ data: defData }, listSchema) : [
|
|
14061
|
-
{
|
|
14062
|
-
"type": "wrapper",
|
|
14063
|
-
"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",
|
|
14064
|
-
"body": ___default.defaultsDeep({ data: defData }, listSchema)
|
|
14065
|
-
},
|
|
14066
|
-
{
|
|
14067
|
-
"type": "wrapper",
|
|
14068
|
-
"className": 'p-0 flex-1 focus:outline-none xl:order-last',
|
|
14069
|
-
"body": []
|
|
14070
|
-
}
|
|
14071
|
-
]
|
|
14041
|
+
className: "h-full",
|
|
14042
|
+
body: listSchema
|
|
14072
14043
|
}];
|
|
14073
14044
|
}
|
|
14074
14045
|
});
|
|
14075
14046
|
}); };
|
|
14076
14047
|
|
|
14077
14048
|
var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14078
|
-
var defaultFormFactor, appId, objectApiName, display,
|
|
14049
|
+
var defaultFormFactor, appId, objectApiName, display, recordSchema, recordPage;
|
|
14079
14050
|
return __generator(this, function (_a) {
|
|
14080
14051
|
switch (_a.label) {
|
|
14081
14052
|
case 0:
|
|
14082
|
-
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display
|
|
14083
|
-
|
|
14084
|
-
|
|
14085
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : sideObject ? 'split' : Router$1.getTabDisplayAs(objectApiName);
|
|
14086
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
14087
|
-
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
14088
|
-
case 1:
|
|
14089
|
-
listPage = _a.sent();
|
|
14053
|
+
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display;
|
|
14054
|
+
//TODO 此代码应该在object page template中处理
|
|
14055
|
+
Router$1.setTabDisplayAs(objectApiName, display);
|
|
14090
14056
|
recordSchema = {};
|
|
14091
14057
|
return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
|
|
14092
|
-
case
|
|
14058
|
+
case 1:
|
|
14093
14059
|
recordPage = _a.sent();
|
|
14094
14060
|
recordSchema = recordPage ? recordPage.schema : {
|
|
14095
14061
|
"type": "wrapper",
|
|
@@ -14105,37 +14071,85 @@ setTimeout(()=>{
|
|
|
14105
14071
|
}
|
|
14106
14072
|
],
|
|
14107
14073
|
};
|
|
14108
|
-
_a.label =
|
|
14109
|
-
case
|
|
14110
|
-
|
|
14111
|
-
"
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
|
|
14122
|
-
|
|
14074
|
+
_a.label = 2;
|
|
14075
|
+
case 2: return [2 /*return*/, {
|
|
14076
|
+
type: 'service',
|
|
14077
|
+
"className": 'h-full',
|
|
14078
|
+
body: recordSchema
|
|
14079
|
+
}];
|
|
14080
|
+
}
|
|
14081
|
+
});
|
|
14082
|
+
}); };
|
|
14083
|
+
|
|
14084
|
+
var PageObject = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14085
|
+
var data, _a, $schema, uiSchema;
|
|
14086
|
+
return __generator(this, function (_b) {
|
|
14087
|
+
switch (_b.label) {
|
|
14088
|
+
case 0:
|
|
14089
|
+
data = props.data, _a = props.$schema, $schema = _a === void 0 ? {} : _a;
|
|
14090
|
+
return [4 /*yield*/, getUISchema($schema.data.objectName, false)];
|
|
14091
|
+
case 1:
|
|
14092
|
+
uiSchema = _b.sent();
|
|
14093
|
+
delete $schema.data.recordId;
|
|
14094
|
+
// 最外层的data是render data, 会被updateProps data覆盖, 所以组件data需要单开一个数据域. 所以此处有2层service
|
|
14123
14095
|
return [2 /*return*/, {
|
|
14124
|
-
type:
|
|
14125
|
-
data:
|
|
14126
|
-
|
|
14127
|
-
body:
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14096
|
+
type: "service",
|
|
14097
|
+
data: $schema.data,
|
|
14098
|
+
className: "h-full",
|
|
14099
|
+
body: {
|
|
14100
|
+
type: 'service',
|
|
14101
|
+
className: {
|
|
14102
|
+
'h-full': "${display != 'split'}",
|
|
14103
|
+
'flex flex-1 overflow-hidden h-full': "${display == 'split'}"
|
|
14132
14104
|
},
|
|
14133
|
-
{
|
|
14134
|
-
|
|
14135
|
-
|
|
14136
|
-
|
|
14137
|
-
|
|
14138
|
-
|
|
14105
|
+
data: {
|
|
14106
|
+
uiSchema: uiSchema
|
|
14107
|
+
},
|
|
14108
|
+
body: [
|
|
14109
|
+
{
|
|
14110
|
+
"type": "wrapper",
|
|
14111
|
+
"size": "none",
|
|
14112
|
+
"className": {
|
|
14113
|
+
"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'}",
|
|
14114
|
+
'h-full': "${display != 'split'}",
|
|
14115
|
+
},
|
|
14116
|
+
"body": {
|
|
14117
|
+
"name": "".concat(data.objectName, "-listview-").concat(data.listViewId),
|
|
14118
|
+
"type": "steedos-page-listview",
|
|
14119
|
+
"showHeader": true,
|
|
14120
|
+
"objectApiName": data.objectName,
|
|
14121
|
+
"appId": data.appId,
|
|
14122
|
+
"display": data.display,
|
|
14123
|
+
"columnsTogglable": false
|
|
14124
|
+
},
|
|
14125
|
+
"visibleOn": "${pageType === 'list' || (pageType === 'record' && display == 'split')}"
|
|
14126
|
+
},
|
|
14127
|
+
{
|
|
14128
|
+
"type": "wrapper",
|
|
14129
|
+
"size": "none",
|
|
14130
|
+
"className": {
|
|
14131
|
+
"overflow-y-auto p-0 flex-1 focus:outline-none lg:order-last h-full": "${display == 'split'}",
|
|
14132
|
+
'h-full': "${display != 'split'}",
|
|
14133
|
+
},
|
|
14134
|
+
"body": {
|
|
14135
|
+
"name": "".concat(data.objectName, "-recordDetail-").concat(data.recordId),
|
|
14136
|
+
"type": "steedos-page-record-detail",
|
|
14137
|
+
"objectApiName": data.objectName,
|
|
14138
|
+
"sideObject": data.sideObject,
|
|
14139
|
+
"sideListviewId": data.sideListviewId,
|
|
14140
|
+
// "recordId": recordId,
|
|
14141
|
+
"display": data.display,
|
|
14142
|
+
"appId": data.appId
|
|
14143
|
+
},
|
|
14144
|
+
"visibleOn": "${pageType === 'record'}"
|
|
14145
|
+
},
|
|
14146
|
+
{
|
|
14147
|
+
"type": "tpl",
|
|
14148
|
+
"tpl": "无效的页面类型: ${pageType}",
|
|
14149
|
+
"visibleOn": "${pageType !== 'record' && pageType !== 'list'}"
|
|
14150
|
+
}
|
|
14151
|
+
]
|
|
14152
|
+
}
|
|
14139
14153
|
}];
|
|
14140
14154
|
}
|
|
14141
14155
|
});
|
|
@@ -14172,6 +14186,7 @@ setTimeout(()=>{
|
|
|
14172
14186
|
exports.AmisSteedosField = AmisSteedosField;
|
|
14173
14187
|
exports.FromNow = FromNow;
|
|
14174
14188
|
exports.PageListView = PageListView;
|
|
14189
|
+
exports.PageObject = PageObject;
|
|
14175
14190
|
exports.PageRecordDetail = PageRecordDetail;
|
|
14176
14191
|
exports.SteedosBadge = SteedosBadge;
|
|
14177
14192
|
exports.SteedosBadgeRibbon = SteedosBadgeRibbon;
|