@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.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
|
},
|
|
@@ -3187,7 +3192,6 @@ async function getObjectFieldsFilterBarSchema(objectSchema, fields, ctx) {
|
|
|
3187
3192
|
function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
3188
3193
|
const { icon, label } = objectSchema;
|
|
3189
3194
|
const listViewButtonOptions = [];
|
|
3190
|
-
// let currentListView;
|
|
3191
3195
|
each(
|
|
3192
3196
|
objectSchema.list_views,
|
|
3193
3197
|
(listView, name) => {
|
|
@@ -3195,19 +3199,11 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3195
3199
|
type: "button",
|
|
3196
3200
|
label: listView.label,
|
|
3197
3201
|
actionType: "link",
|
|
3198
|
-
// icon: "fa fa-plus",
|
|
3199
3202
|
link: `/app/\${appId}/${objectSchema.name}/grid/${name}`
|
|
3200
3203
|
});
|
|
3201
|
-
// if(name === listViewName){
|
|
3202
|
-
// currentListView = listView;
|
|
3203
|
-
// }
|
|
3204
3204
|
}
|
|
3205
3205
|
);
|
|
3206
3206
|
|
|
3207
|
-
// if(!currentListView){
|
|
3208
|
-
// return {};
|
|
3209
|
-
// }
|
|
3210
|
-
|
|
3211
3207
|
const buttons = getListViewButtons(objectSchema, {});
|
|
3212
3208
|
let amisButtonsSchema = map(buttons, (button) => {
|
|
3213
3209
|
return {
|
|
@@ -3218,34 +3214,7 @@ function getObjectListHeaderFirstLine(objectSchema, listViewName, ctx) {
|
|
|
3218
3214
|
className: `button_${button.name}`
|
|
3219
3215
|
}
|
|
3220
3216
|
});
|
|
3221
|
-
|
|
3222
|
-
// const bulkDeleteScript = `
|
|
3223
|
-
// const data = event.data;
|
|
3224
|
-
// const listViewId = data.listViewId;
|
|
3225
|
-
// const uiSchema = data.uiSchema;
|
|
3226
|
-
// const scopeId = data.scopeId;
|
|
3227
|
-
// BuilderAmisObject.AmisLib.standardButtonsTodo.standard_delete_many.call({
|
|
3228
|
-
// listViewId,
|
|
3229
|
-
// uiSchema,
|
|
3230
|
-
// scopeId
|
|
3231
|
-
// })
|
|
3232
|
-
// `;
|
|
3233
|
-
// amisButtonsSchema.push({
|
|
3234
|
-
// type: 'button',
|
|
3235
|
-
// label: "删除",
|
|
3236
|
-
// className: `antd-Button antd-Button--default antd-Button--size-default`,
|
|
3237
|
-
// "onEvent": {
|
|
3238
|
-
// "click": {
|
|
3239
|
-
// "actions": [
|
|
3240
|
-
// {
|
|
3241
|
-
// "actionType": "custom",
|
|
3242
|
-
// "script": bulkDeleteScript
|
|
3243
|
-
// }
|
|
3244
|
-
// ]
|
|
3245
|
-
// }
|
|
3246
|
-
// }
|
|
3247
|
-
// });
|
|
3248
|
-
// }
|
|
3217
|
+
|
|
3249
3218
|
const reg = new RegExp('_', 'g');
|
|
3250
3219
|
const standardIcon = icon && icon.replace(reg, '-');
|
|
3251
3220
|
return {
|
|
@@ -3435,27 +3404,14 @@ async function getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ct
|
|
|
3435
3404
|
* @param {*} objectSchema 对象UISchema
|
|
3436
3405
|
* @returns amisSchema
|
|
3437
3406
|
*/
|
|
3438
|
-
|
|
3407
|
+
function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
3439
3408
|
let firstLineSchema = getObjectListHeaderFirstLine(objectSchema);
|
|
3440
|
-
// let secordLineSchema = await getObjectListHeaderSecordLine(objectSchema, listViewName, ctx);
|
|
3441
|
-
// let body = [firstLineSchema, secordLineSchema];
|
|
3442
3409
|
let body = [firstLineSchema];
|
|
3443
|
-
// let roundedCss = "";
|
|
3444
|
-
// if (ctx.onlyFirstLine) {
|
|
3445
|
-
// body = [firstLineSchema];
|
|
3446
|
-
// }
|
|
3447
|
-
// else if (ctx.onlySecordLine) {
|
|
3448
|
-
// // 列表视图自定义amisSchema时不能加圆角
|
|
3449
|
-
// roundedCss = "";
|
|
3450
|
-
// // body = [secordLineSchema];
|
|
3451
|
-
// }
|
|
3452
3410
|
let headerSchema = [{
|
|
3453
3411
|
"type": "wrapper",
|
|
3454
3412
|
"body": body,
|
|
3455
3413
|
"className": `bg-gray-100 sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
3456
3414
|
}];
|
|
3457
|
-
// const fieldsFilterBarSchema = await getObjectListHeaderFieldsFilterBar(objectSchema, listViewName, ctx);
|
|
3458
|
-
// headerSchema.push(fieldsFilterBarSchema);
|
|
3459
3415
|
return headerSchema;
|
|
3460
3416
|
}
|
|
3461
3417
|
|
|
@@ -3709,6 +3665,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
3709
3665
|
"icon": "fa fa-table-columns",
|
|
3710
3666
|
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
3711
3667
|
"align": "right",
|
|
3668
|
+
"visibleOn": "${formFactor !== 'SMALL'}",
|
|
3712
3669
|
"buttons": [
|
|
3713
3670
|
{
|
|
3714
3671
|
"label": "显示为",
|
|
@@ -3845,7 +3802,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3845
3802
|
}
|
|
3846
3803
|
}
|
|
3847
3804
|
} : {},
|
|
3848
|
-
|
|
3805
|
+
getDisplayAsButton(mainObject?.name)
|
|
3849
3806
|
]
|
|
3850
3807
|
}else {
|
|
3851
3808
|
return [
|
|
@@ -4438,7 +4395,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
4438
4395
|
}
|
|
4439
4396
|
]
|
|
4440
4397
|
},
|
|
4441
|
-
|
|
4398
|
+
getDisplayAsButton(showDisplayAs)
|
|
4442
4399
|
// {
|
|
4443
4400
|
// "type": "search-box",
|
|
4444
4401
|
// "align": "right",
|
|
@@ -8703,8 +8660,8 @@ async function getRelatedListSchema(
|
|
|
8703
8660
|
/*
|
|
8704
8661
|
* @Author: baozhoutao@steedos.com
|
|
8705
8662
|
* @Date: 2022-07-05 15:55:39
|
|
8706
|
-
* @LastEditors:
|
|
8707
|
-
* @LastEditTime: 2023-04-
|
|
8663
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
8664
|
+
* @LastEditTime: 2023-04-17 15:26:17
|
|
8708
8665
|
* @Description:
|
|
8709
8666
|
*/
|
|
8710
8667
|
|
|
@@ -8917,6 +8874,7 @@ async function getListSchema(
|
|
|
8917
8874
|
return { uiSchema };
|
|
8918
8875
|
}
|
|
8919
8876
|
|
|
8877
|
+
// 直接返回自定义的列表视图schema
|
|
8920
8878
|
if(listView.enable_amis_schema && listView.amis_schema){
|
|
8921
8879
|
const amisSchema = isString(listView.amis_schema) ? JSON.parse(listView.amis_schema) : listView.amis_schema;
|
|
8922
8880
|
return {
|
|
@@ -8930,6 +8888,7 @@ async function getListSchema(
|
|
|
8930
8888
|
let sort = getListViewSort(listView);
|
|
8931
8889
|
let listviewFilter = getListViewFilter(listView);
|
|
8932
8890
|
let listview_filters = listView && listView._filters;
|
|
8891
|
+
// 返回 calendar 组件
|
|
8933
8892
|
if(listView.type === "calendar"){
|
|
8934
8893
|
const amisSchema = {
|
|
8935
8894
|
"type": "steedos-object-calendar",
|
|
@@ -8948,14 +8907,21 @@ async function getListSchema(
|
|
|
8948
8907
|
|
|
8949
8908
|
const defaults = ctx.defaults || {};
|
|
8950
8909
|
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
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
|
+
// }
|
|
8954
8919
|
|
|
8955
|
-
|
|
8956
|
-
defaults.headerSchema = null;
|
|
8957
|
-
}
|
|
8920
|
+
defaults.headerSchema = null;
|
|
8958
8921
|
|
|
8922
|
+
/**
|
|
8923
|
+
* 本次存储代码段
|
|
8924
|
+
*/
|
|
8959
8925
|
try {
|
|
8960
8926
|
const listViewPropsStoreKey = location.pathname + "/crud/" + ctx.listViewId;
|
|
8961
8927
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
@@ -9070,7 +9036,7 @@ async function getTableSchema(
|
|
|
9070
9036
|
headerToolbarItems: ctx.headerToolbarItems,
|
|
9071
9037
|
buttons: await getListViewItemButtons(uiSchema, ctx)
|
|
9072
9038
|
});
|
|
9073
|
-
|
|
9039
|
+
console.log('getTableSchema====>amisSchema', amisSchema);
|
|
9074
9040
|
// console.timeEnd('getTableSchema');
|
|
9075
9041
|
return {
|
|
9076
9042
|
uiSchema,
|
|
@@ -9268,6 +9234,7 @@ async function getObjectRelated(
|
|
|
9268
9234
|
if(typeof window != 'undefined'){
|
|
9269
9235
|
window.getUISchema = getUISchema;
|
|
9270
9236
|
window.getUISchemaSync = getUISchemaSync;
|
|
9237
|
+
window.getListSchema = getListSchema;
|
|
9271
9238
|
}
|
|
9272
9239
|
|
|
9273
9240
|
// import { getListSchema } from './objects';
|
|
@@ -12654,11 +12621,14 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
12654
12621
|
}); };
|
|
12655
12622
|
|
|
12656
12623
|
var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12657
|
-
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;
|
|
12658
12625
|
return __generator(this, function (_f) {
|
|
12659
12626
|
switch (_f.label) {
|
|
12660
12627
|
case 0:
|
|
12661
|
-
|
|
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;
|
|
12662
12632
|
ctx = props.ctx;
|
|
12663
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);
|
|
12664
12634
|
defaults = {};
|
|
@@ -12685,8 +12655,8 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12685
12655
|
}
|
|
12686
12656
|
return [4 /*yield*/, getUISchema(objectApiName, false)];
|
|
12687
12657
|
case 1:
|
|
12688
|
-
|
|
12689
|
-
listView = find(
|
|
12658
|
+
uiSchema = _f.sent();
|
|
12659
|
+
listView = find(uiSchema.list_views, function (listView, name) {
|
|
12690
12660
|
// 传入listViewName空值则取第一个
|
|
12691
12661
|
if (!listName) {
|
|
12692
12662
|
listName = name;
|
|
@@ -12713,7 +12683,7 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12713
12683
|
"actions": [
|
|
12714
12684
|
{
|
|
12715
12685
|
"args": {
|
|
12716
|
-
"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}",
|
|
12717
12687
|
"blank": false
|
|
12718
12688
|
},
|
|
12719
12689
|
"actionType": "link",
|
|
@@ -12729,58 +12699,62 @@ var AmisObjectListView = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
12729
12699
|
listSchema: listSchema
|
|
12730
12700
|
};
|
|
12731
12701
|
}
|
|
12732
|
-
// 支持通过直接定义headerSchema属性来定制表头,而不一定要通过ctx.defaults.headerSchema传入
|
|
12733
|
-
if (headerSchema) {
|
|
12734
|
-
defaults.headerSchema = headerSchema;
|
|
12735
|
-
}
|
|
12736
12702
|
setDataToComponentId = ctx && ctx.setDataToComponentId;
|
|
12737
12703
|
if (!setDataToComponentId) {
|
|
12738
12704
|
setDataToComponentId = "service_listview_".concat(objectApiName);
|
|
12739
12705
|
}
|
|
12740
12706
|
amisSchemaData = Object.assign({}, data, defaultData);
|
|
12741
12707
|
listViewId = (ctx === null || ctx === void 0 ? void 0 : ctx.listViewId) || amisSchemaData.listViewId;
|
|
12742
|
-
|
|
12743
|
-
|
|
12744
|
-
|
|
12745
|
-
amisSchema = schema.amisSchema;
|
|
12746
|
-
uiSchema = schema.uiSchema;
|
|
12747
|
-
body = [amisSchema];
|
|
12748
|
-
if (schema.isCustomAmisSchema || schema.isCalendar) {
|
|
12749
|
-
firstLineSchema = getObjectListHeaderFirstLine(uiSchema);
|
|
12750
|
-
body.unshift({
|
|
12751
|
-
"type": "wrapper",
|
|
12752
|
-
"body": [firstLineSchema],
|
|
12753
|
-
"className": "bg-gray-100 pb-0 sm:rounded-tl sm:rounded-tr",
|
|
12754
|
-
});
|
|
12755
|
-
}
|
|
12756
|
-
if (sideSchema) {
|
|
12757
|
-
body = [{
|
|
12758
|
-
"type": "wrapper",
|
|
12759
|
-
"size": "none",
|
|
12760
|
-
"className": "flex flex-1 overflow-hidden h-full",
|
|
12761
|
-
"body": [
|
|
12762
|
-
{
|
|
12763
|
-
"type": "wrapper",
|
|
12764
|
-
"size": "none",
|
|
12765
|
-
"className": "flex-shrink-0 min-w-[200px] h-full border-r border-gray-200 lg:order-first lg:flex lg:flex-col",
|
|
12766
|
-
"body": sideSchema
|
|
12767
|
-
},
|
|
12768
|
-
{
|
|
12769
|
-
"type": "wrapper",
|
|
12770
|
-
"size": "none",
|
|
12771
|
-
"className": "flex-1 focus:outline-none lg:order-last w-96 h-full",
|
|
12772
|
-
"body": body
|
|
12773
|
-
},
|
|
12774
|
-
]
|
|
12775
|
-
}];
|
|
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);
|
|
12776
12711
|
}
|
|
12777
|
-
serviceData = Object.assign({}, {
|
|
12712
|
+
serviceData = Object.assign({}, { showDisplayAs: showDisplayAs, displayAs: displayAs, recordPermissions: uiSchema.permissions, _id: null, $listviewId: listName });
|
|
12778
12713
|
// console.timeEnd('AmisObjectListView')
|
|
12779
12714
|
return [2 /*return*/, {
|
|
12780
|
-
|
|
12781
|
-
|
|
12782
|
-
|
|
12783
|
-
|
|
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
|
+
]
|
|
12784
12758
|
}];
|
|
12785
12759
|
}
|
|
12786
12760
|
});
|
|
@@ -12817,6 +12791,8 @@ var AmisObjectTable = function (props) { return __awaiter(void 0, void 0, void 0
|
|
|
12817
12791
|
return __generator(this, function (_d) {
|
|
12818
12792
|
switch (_d.label) {
|
|
12819
12793
|
case 0:
|
|
12794
|
+
// console.time('AmisObjectTable')
|
|
12795
|
+
console.log("AmisObjectTable props", props);
|
|
12820
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;
|
|
12821
12797
|
ctx = props.ctx;
|
|
12822
12798
|
if (!ctx) {
|
|
@@ -12936,28 +12912,31 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
12936
12912
|
/*
|
|
12937
12913
|
* @Author: baozhoutao@steedos.com
|
|
12938
12914
|
* @Date: 2022-12-08 10:32:17
|
|
12939
|
-
* @LastEditors:
|
|
12940
|
-
* @LastEditTime: 2023-04-
|
|
12915
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
12916
|
+
* @LastEditTime: 2023-04-13 18:40:42
|
|
12941
12917
|
* @Description:
|
|
12942
12918
|
*/
|
|
12943
12919
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
12944
|
-
var className, appId, _a, objectApiName,
|
|
12920
|
+
var className, appId, _a, objectApiName, body, schema;
|
|
12945
12921
|
return __generator(this, function (_b) {
|
|
12946
12922
|
switch (_b.label) {
|
|
12947
12923
|
case 0:
|
|
12948
|
-
|
|
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;
|
|
12949
12926
|
return [4 /*yield*/, getRecordDetailSchema(objectApiName, appId)];
|
|
12950
12927
|
case 1:
|
|
12951
12928
|
schema = (_b.sent()).amisSchema;
|
|
12952
|
-
|
|
12953
|
-
|
|
12954
|
-
|
|
12955
|
-
|
|
12956
|
-
|
|
12929
|
+
// 在非记录页组件下全局作用域下无recordId,会导致表单接口sendOn始终为false,无法发起请求。
|
|
12930
|
+
// let recordDetailData: any = {};
|
|
12931
|
+
// if(recordId){
|
|
12932
|
+
// recordDetailData.recordId = recordId;
|
|
12933
|
+
// }
|
|
12934
|
+
// schema.data = Object.assign({}, schema.data, recordDetailData);
|
|
12957
12935
|
schema.className = className;
|
|
12958
12936
|
if (body) {
|
|
12959
12937
|
schema.body = body;
|
|
12960
12938
|
}
|
|
12939
|
+
console.log("AmisRecordDetail====schema==>", schema);
|
|
12961
12940
|
return [2 /*return*/, schema];
|
|
12962
12941
|
}
|
|
12963
12942
|
});
|
|
@@ -13987,15 +13966,16 @@ var AmisInstanceDetail = function (props) { return __awaiter(void 0, void 0, voi
|
|
|
13987
13966
|
}); };
|
|
13988
13967
|
|
|
13989
13968
|
var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13990
|
-
var
|
|
13969
|
+
var formFactor, appId, objectApiName, display, page, listSchema;
|
|
13991
13970
|
return __generator(this, function (_b) {
|
|
13992
13971
|
switch (_b.label) {
|
|
13993
13972
|
case 0:
|
|
13994
|
-
|
|
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中处理
|
|
13995
13977
|
if (display)
|
|
13996
13978
|
Router$1.setTabDisplayAs(objectApiName, display);
|
|
13997
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : Router$1.getTabDisplayAs(objectApiName);
|
|
13998
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
13999
13979
|
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
14000
13980
|
case 1:
|
|
14001
13981
|
page = _b.sent();
|
|
@@ -14005,65 +13985,51 @@ var PageListView = function (props) { return __awaiter(void 0, void 0, void 0, f
|
|
|
14005
13985
|
"show": true
|
|
14006
13986
|
}];
|
|
14007
13987
|
}
|
|
14008
|
-
listViewId = SteedosUI.getRefId({
|
|
14009
|
-
type: "listview",
|
|
14010
|
-
appId: appId,
|
|
14011
|
-
name: objectApiName,
|
|
14012
|
-
});
|
|
14013
13988
|
listSchema = page ? page.schema : {
|
|
14014
13989
|
"type": "steedos-object-listview",
|
|
14015
13990
|
"objectApiName": objectApiName,
|
|
14016
13991
|
"columnsTogglable": false,
|
|
14017
13992
|
"showHeader": true,
|
|
14018
|
-
"showDisplayAs": (
|
|
14019
|
-
"formFactor": formFactor,
|
|
14020
|
-
"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'
|
|
14021
13996
|
};
|
|
14022
|
-
defData =
|
|
14023
|
-
|
|
14024
|
-
|
|
14025
|
-
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
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'
|
|
14030
14013
|
return [2 /*return*/, {
|
|
14031
14014
|
type: 'service',
|
|
14032
|
-
|
|
14033
|
-
|
|
14034
|
-
body: (displayAs === 'grid') ? defaultsDeep$1({ data: defData }, listSchema) : [
|
|
14035
|
-
{
|
|
14036
|
-
"type": "wrapper",
|
|
14037
|
-
"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",
|
|
14038
|
-
"body": defaultsDeep$1({ data: defData }, listSchema)
|
|
14039
|
-
},
|
|
14040
|
-
{
|
|
14041
|
-
"type": "wrapper",
|
|
14042
|
-
"className": 'p-0 flex-1 focus:outline-none xl:order-last',
|
|
14043
|
-
"body": []
|
|
14044
|
-
}
|
|
14045
|
-
]
|
|
14015
|
+
className: "h-full",
|
|
14016
|
+
body: listSchema
|
|
14046
14017
|
}];
|
|
14047
14018
|
}
|
|
14048
14019
|
});
|
|
14049
14020
|
}); };
|
|
14050
14021
|
|
|
14051
14022
|
var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
14052
|
-
var defaultFormFactor, appId, objectApiName, display,
|
|
14023
|
+
var defaultFormFactor, appId, objectApiName, display, recordSchema, recordPage;
|
|
14053
14024
|
return __generator(this, function (_a) {
|
|
14054
14025
|
switch (_a.label) {
|
|
14055
14026
|
case 0:
|
|
14056
|
-
defaultFormFactor = props.formFactor, appId = props.appId, objectApiName = props.objectApiName, props.recordId, display = props.display
|
|
14057
|
-
|
|
14058
|
-
|
|
14059
|
-
displayAs = (defaultFormFactor === 'SMALL') ? 'grid' : display ? display : sideObject ? 'split' : Router$1.getTabDisplayAs(objectApiName);
|
|
14060
|
-
formFactor = (["split"].indexOf(displayAs) > -1) ? 'SMALL' : defaultFormFactor;
|
|
14061
|
-
return [4 /*yield*/, getPage({ type: 'list', appId: appId, objectName: objectApiName, formFactor: formFactor })];
|
|
14062
|
-
case 1:
|
|
14063
|
-
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);
|
|
14064
14030
|
recordSchema = {};
|
|
14065
14031
|
return [4 /*yield*/, getPage({ type: 'record', appId: appId, objectName: objectApiName, formFactor: defaultFormFactor })];
|
|
14066
|
-
case
|
|
14032
|
+
case 1:
|
|
14067
14033
|
recordPage = _a.sent();
|
|
14068
14034
|
recordSchema = recordPage ? recordPage.schema : {
|
|
14069
14035
|
"type": "wrapper",
|
|
@@ -14079,37 +14045,85 @@ var PageRecordDetail = function (props) { return __awaiter(void 0, void 0, void
|
|
|
14079
14045
|
}
|
|
14080
14046
|
],
|
|
14081
14047
|
};
|
|
14082
|
-
_a.label =
|
|
14083
|
-
case
|
|
14084
|
-
|
|
14085
|
-
"
|
|
14086
|
-
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
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
|
|
14097
14069
|
return [2 /*return*/, {
|
|
14098
|
-
type:
|
|
14099
|
-
data:
|
|
14100
|
-
|
|
14101
|
-
body:
|
|
14102
|
-
|
|
14103
|
-
|
|
14104
|
-
|
|
14105
|
-
|
|
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'}"
|
|
14106
14078
|
},
|
|
14107
|
-
{
|
|
14108
|
-
|
|
14109
|
-
|
|
14110
|
-
|
|
14111
|
-
|
|
14112
|
-
|
|
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
|
+
}
|
|
14113
14127
|
}];
|
|
14114
14128
|
}
|
|
14115
14129
|
});
|
|
@@ -14123,5 +14137,5 @@ var index_esm = /*#__PURE__*/Object.freeze({
|
|
|
14123
14137
|
SteedosUI: SteedosUI$1
|
|
14124
14138
|
});
|
|
14125
14139
|
|
|
14126
|
-
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, 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 };
|
|
14127
14141
|
//# sourceMappingURL=amis-object.esm.js.map
|