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