@steedos-widgets/amis-lib 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +115 -13
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +115 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +115 -13
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/index.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +14 -0
- package/dist/types/schema/standard_new.amis.d.ts +1 -0
- package/dist/types/standard/button.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1363,8 +1363,8 @@ var config = {
|
|
|
1363
1363
|
/*
|
|
1364
1364
|
* @Author: baozhoutao@steedos.com
|
|
1365
1365
|
* @Date: 2022-11-01 15:51:00
|
|
1366
|
-
* @LastEditors:
|
|
1367
|
-
* @LastEditTime: 2023-04-
|
|
1366
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1367
|
+
* @LastEditTime: 2023-04-16 17:04:16
|
|
1368
1368
|
* @Description:
|
|
1369
1369
|
*/
|
|
1370
1370
|
|
|
@@ -1442,6 +1442,7 @@ const getSchema$4 = async (uiSchema, ctx) => {
|
|
|
1442
1442
|
"context": "${context}",
|
|
1443
1443
|
"global": "${global}",
|
|
1444
1444
|
"listViewId": "${listViewId}",
|
|
1445
|
+
"displayAs": "${displayAs}",
|
|
1445
1446
|
"uiSchema": "${uiSchema}",
|
|
1446
1447
|
"isLookup": "${isLookup}",
|
|
1447
1448
|
"listName": "${listName}"
|
|
@@ -3740,7 +3741,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3740
3741
|
{
|
|
3741
3742
|
"type": "button",
|
|
3742
3743
|
"label": "重命名",
|
|
3743
|
-
"
|
|
3744
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3744
3745
|
"onEvent": {
|
|
3745
3746
|
"click": {
|
|
3746
3747
|
"weight": 0,
|
|
@@ -3795,7 +3796,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3795
3796
|
{
|
|
3796
3797
|
"type": "button",
|
|
3797
3798
|
"label": "共享设置",
|
|
3798
|
-
"
|
|
3799
|
+
"disabledOn": "!(global.user.is_space_admin && !!uiSchema.list_views[listName].owner)",
|
|
3799
3800
|
"onEvent": {
|
|
3800
3801
|
"click": {
|
|
3801
3802
|
"weight": 0,
|
|
@@ -3835,7 +3836,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3835
3836
|
{
|
|
3836
3837
|
"type": "button",
|
|
3837
3838
|
"label": "过滤设置",
|
|
3838
|
-
"
|
|
3839
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3839
3840
|
"onEvent": {
|
|
3840
3841
|
"click": {
|
|
3841
3842
|
"weight": 0,
|
|
@@ -3897,7 +3898,7 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3897
3898
|
{
|
|
3898
3899
|
"type": "button",
|
|
3899
3900
|
"label": "显示的列",
|
|
3900
|
-
"
|
|
3901
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3901
3902
|
"onEvent": {
|
|
3902
3903
|
"click": {
|
|
3903
3904
|
"weight": 0,
|
|
@@ -3956,10 +3957,74 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
3956
3957
|
}
|
|
3957
3958
|
}
|
|
3958
3959
|
},
|
|
3960
|
+
{
|
|
3961
|
+
"type": "button",
|
|
3962
|
+
"label": "默认排序规则",
|
|
3963
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3964
|
+
"onEvent": {
|
|
3965
|
+
"click": {
|
|
3966
|
+
"weight": 0,
|
|
3967
|
+
"actions": [
|
|
3968
|
+
{
|
|
3969
|
+
"dialog": {
|
|
3970
|
+
"type": "dialog",
|
|
3971
|
+
"title": "弹框标题",
|
|
3972
|
+
"data": {
|
|
3973
|
+
"&": "$$",
|
|
3974
|
+
"objectName": "${objectName}",
|
|
3975
|
+
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
3976
|
+
"listName": "${listName}",
|
|
3977
|
+
"appId": "${appId}"
|
|
3978
|
+
},
|
|
3979
|
+
"body": [
|
|
3980
|
+
{
|
|
3981
|
+
"type": "steedos-object-form",
|
|
3982
|
+
"label": "对象表单",
|
|
3983
|
+
"objectApiName": "object_listviews",
|
|
3984
|
+
"recordId": "${recordId}",
|
|
3985
|
+
"className": "",
|
|
3986
|
+
"id": "u:061f158b4c5a",
|
|
3987
|
+
"mode": "edit",
|
|
3988
|
+
"fields": [
|
|
3989
|
+
"sort",
|
|
3990
|
+
"sort.$.field_name",
|
|
3991
|
+
"sort.$.order"
|
|
3992
|
+
],
|
|
3993
|
+
"onEvent": {
|
|
3994
|
+
"submitSucc": {
|
|
3995
|
+
"weight": 0,
|
|
3996
|
+
"actions": [
|
|
3997
|
+
{
|
|
3998
|
+
"args": {
|
|
3999
|
+
"url": "${context.rootUrl}/app/${appId}/${objectName}/grid/${listName}",
|
|
4000
|
+
"blank": false
|
|
4001
|
+
},
|
|
4002
|
+
"actionType": "url"
|
|
4003
|
+
}
|
|
4004
|
+
]
|
|
4005
|
+
}
|
|
4006
|
+
},
|
|
4007
|
+
"fieldsExtend": "{\n \"sort\": {\n \"amis\": {\n \"type\": \"tabs-transfer\",\n \"sortable\": true,\n \"searchable\": true,\n \"source\": {\n \"method\": \"get\",\n \"url\": \"${context.rootUrl}/service/api/amis-metadata-objects/objects/${objectName}/sortFields/options\",\n \"headers\": {\n \"Authorization\": \"Bearer ${context.tenantId},${context.authToken}\"\n }\n }\n }\n }\n}",
|
|
4008
|
+
"initApiAdaptor": "let sort;\nif (recordId) {\n sort = payload.data.initialValues.sort;\n //数据格式转换\n if (sort instanceof Array) {\n sort = lodash.map(sort, (item) => {\n return item.field_name + ':' + (item.order || 'asc')\n });\n }\n}\npayload.data.initialValues.sort = sort;\ndelete payload.extensions;",
|
|
4009
|
+
"apiRequestAdaptor": "const recordId = api.body.recordId;\n//数据格式转换\nif (typeof formData.sort == 'string') {\n formData.sort = formData.sort?.split(',');\n}\nformData.sort = lodash.map(formData.sort, (item) => {\n const arr = item.split(':');\n return { field_name: arr[0], order: arr[1] };\n});\nif (recordId) {\n query = 'mutation{record: ' + objectName + '__update(id: \"' + recordId + '\", doc: {__saveData}){_id}}';\n}\n__saveData = JSON.stringify(JSON.stringify(formData));\napi.data = { query: query.replace('{__saveData}', __saveData) };\n"
|
|
4010
|
+
}
|
|
4011
|
+
],
|
|
4012
|
+
"showCloseButton": true,
|
|
4013
|
+
"showErrorMsg": true,
|
|
4014
|
+
"showLoading": true,
|
|
4015
|
+
"id": "u:d3f6947b6acf",
|
|
4016
|
+
"size": "lg"
|
|
4017
|
+
},
|
|
4018
|
+
"actionType": "dialog"
|
|
4019
|
+
}
|
|
4020
|
+
]
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
4023
|
+
},
|
|
3959
4024
|
{
|
|
3960
4025
|
"type": "button",
|
|
3961
4026
|
"label": "删除",
|
|
3962
|
-
"
|
|
4027
|
+
"disabledOn": "!((global.user.is_space_admin || global.userId == uiSchema.list_views[listName].owner) && !!uiSchema.list_views[listName].owner)",
|
|
3963
4028
|
"confirmText": "如果您删除此列表视图,该视图将为所有具备访问权限的用户永久删除。是否确定要删除?",
|
|
3964
4029
|
"onEvent": {
|
|
3965
4030
|
"click": {
|
|
@@ -4320,7 +4385,6 @@ function getLookupSapceUserTreeSchema(){
|
|
|
4320
4385
|
{
|
|
4321
4386
|
"actionType": "custom",
|
|
4322
4387
|
"script": `
|
|
4323
|
-
debugger;
|
|
4324
4388
|
const scope = event.context.scoped;
|
|
4325
4389
|
//TODO: 将form中的value一同加入筛选内
|
|
4326
4390
|
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
@@ -5804,7 +5868,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
5804
5868
|
|
|
5805
5869
|
const API_CACHE = 100;
|
|
5806
5870
|
|
|
5807
|
-
function getReadonlyFormAdaptor(fields){
|
|
5871
|
+
function getReadonlyFormAdaptor(object, fields){
|
|
5808
5872
|
let scriptStr = '';
|
|
5809
5873
|
const selectFields = _$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && ((field.type == 'select' && field.options) || ((field.type == 'lookup' || field.type == 'master_detail') && !field.reference_to))});
|
|
5810
5874
|
const gridAndObjectFieldsName = _$1.map(_$1.filter(fields, function(field){return field.name.indexOf('.') < 0 && (field.type === 'object' || field.type === 'grid')}), 'name');
|
|
@@ -5863,6 +5927,7 @@ function getReadonlyFormAdaptor(fields){
|
|
|
5863
5927
|
console.error(e)
|
|
5864
5928
|
}
|
|
5865
5929
|
payload.data = data;
|
|
5930
|
+
payload.data.__objectName = "${object.name}";
|
|
5866
5931
|
payload.data.__record = record;
|
|
5867
5932
|
window.postMessage(Object.assign({type: "record.loaded"}, {record: record}), "*")
|
|
5868
5933
|
}
|
|
@@ -5880,7 +5945,7 @@ async function getReadonlyFormInitApi(object, recordId, fields, options){
|
|
|
5880
5945
|
url: getApi$2()+"&recordId=${recordId}",
|
|
5881
5946
|
cache: API_CACHE,
|
|
5882
5947
|
// requestAdaptor: "console.log('getReadonlyFormInitApi requestAdaptor', api);return api;",
|
|
5883
|
-
adaptor: getReadonlyFormAdaptor(fields),
|
|
5948
|
+
adaptor: getReadonlyFormAdaptor(object, fields),
|
|
5884
5949
|
data: await getFindOneQuery$1(object, recordId, fields, options),
|
|
5885
5950
|
headers: {
|
|
5886
5951
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -6598,6 +6663,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
6598
6663
|
eventName: "recordLoaded"
|
|
6599
6664
|
},
|
|
6600
6665
|
data: {
|
|
6666
|
+
objectName: "${event.data.__objectName}",
|
|
6601
6667
|
record: "${event.data.__record}"
|
|
6602
6668
|
}
|
|
6603
6669
|
},
|
|
@@ -7034,7 +7100,7 @@ async function getTableApi(mainObject, fields, options){
|
|
|
7034
7100
|
const api = await getApi(mainObject, null, fields, {count: options.queryCount, alias: 'rows', limit: top, queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
7035
7101
|
|
|
7036
7102
|
if(options.isRelated){
|
|
7037
|
-
api.url += "&recordId=${recordId}";
|
|
7103
|
+
api.url += "&recordId=${_master.recordId}";
|
|
7038
7104
|
}
|
|
7039
7105
|
|
|
7040
7106
|
api.data.$term = "$term";
|
|
@@ -8278,8 +8344,8 @@ async function getRelatedListSchema(
|
|
|
8278
8344
|
/*
|
|
8279
8345
|
* @Author: baozhoutao@steedos.com
|
|
8280
8346
|
* @Date: 2022-07-05 15:55:39
|
|
8281
|
-
* @LastEditors:
|
|
8282
|
-
* @LastEditTime: 2023-04-
|
|
8347
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
8348
|
+
* @LastEditTime: 2023-04-14 11:10:07
|
|
8283
8349
|
* @Description:
|
|
8284
8350
|
*/
|
|
8285
8351
|
|
|
@@ -8765,6 +8831,41 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
8765
8831
|
}
|
|
8766
8832
|
}
|
|
8767
8833
|
|
|
8834
|
+
async function getRecordServiceSchema(objectName, appId, props = {}) {
|
|
8835
|
+
const uiSchema = await getUISchema(objectName);
|
|
8836
|
+
return {
|
|
8837
|
+
uiSchema,
|
|
8838
|
+
amisSchema: {
|
|
8839
|
+
"type": "service",
|
|
8840
|
+
"body": [],
|
|
8841
|
+
data: {
|
|
8842
|
+
"_master.objectName": "${objectName}",
|
|
8843
|
+
"_master.recordId": "${recordId}"
|
|
8844
|
+
},
|
|
8845
|
+
"style": {
|
|
8846
|
+
"padding": "var(--Page-body-padding)",
|
|
8847
|
+
...props.style
|
|
8848
|
+
},
|
|
8849
|
+
onEvent: {
|
|
8850
|
+
"recordLoaded": {
|
|
8851
|
+
"actions": [
|
|
8852
|
+
{
|
|
8853
|
+
"actionType": "reload",
|
|
8854
|
+
"data": {
|
|
8855
|
+
"name": `\${record.${uiSchema.NAME_FIELD_KEY || 'name'}}`,
|
|
8856
|
+
"_master.record": `\${record}`,
|
|
8857
|
+
// 不清楚reload 如何给对象下的某个key复制, 所以此处重复设置_master的objectName、recordId
|
|
8858
|
+
"_master.objectName": "${objectName}",
|
|
8859
|
+
"_master.recordId": "${recordId}"
|
|
8860
|
+
}
|
|
8861
|
+
}
|
|
8862
|
+
]
|
|
8863
|
+
},
|
|
8864
|
+
...props.onEvent
|
|
8865
|
+
}
|
|
8866
|
+
}
|
|
8867
|
+
}
|
|
8868
|
+
}
|
|
8768
8869
|
|
|
8769
8870
|
// 获取单个相关表
|
|
8770
8871
|
async function getObjectRelated(
|
|
@@ -11614,5 +11715,5 @@ const getInstanceInfo = async ({ instanceId, box }) => {
|
|
|
11614
11715
|
};
|
|
11615
11716
|
};
|
|
11616
11717
|
|
|
11617
|
-
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
|
|
11718
|
+
export { index as Field, Router, absoluteUrl, amisRender, amisRootClick, cloneObject, conditionsToFilters, createObject, defaultsDeep, deleteVariable, execute, executeButton, extendObject, fetchAPI, filtersToConditions, getApp, getApps, getAuthToken, getAuthorization, getButton, getButtonVisible, getButtonVisibleOn$1 as getButtonVisibleOn, getButtons, getCalendarSchema, getDefaultRenderData, getEnv, getEnvs, getEvn, getField, getFileSrc, getFlowFormSchema, getFormPageInitSchema, getFormSchema, getIdsPickerSchema, getImageSrc, getInstanceInfo, getListPageInitSchema, getListSchema, getListViewButtons, getListViewColumns, getListViewFilter, getListViewItemButtons, getListViewSort, getListviewInitSchema, getLookupSapceUserTreeSchema, getNotifications, getObjectDetailButtons, getObjectDetailMoreButtons, getObjectFieldsFilterBarSchema, getObjectFieldsFilterButtonSchema, getObjectFieldsFilterFormSchema, getObjectListHeader$1 as getObjectListHeader, getObjectListHeaderFieldsFilterBar, getObjectListHeaderFirstLine, getObjectListHeaderSecordLine, getObjectRecordDetailHeader, getObjectRecordDetailRelatedListHeader, getObjectRelated, getObjectRelatedList, getObjectRelatedListButtons, getObjectRelatedListHeader, getPage, getRecord, getRecordDetailHeaderSchema, getRecordDetailRelatedListSchema, getRecordDetailSchema, getRecordPageInitSchema, getRecordPermissions, getRecordServiceSchema, getRelatedFieldValue, getRelatedListSchema, getRelatedsCount, getRootUrl, getSelectUserSchema, getSpaceUsersPickerAmisSchema, getSpaceUsersPickerSchema, getSteedosAuth, getTableSchema, getTenantId, getUISchema, getUISchemaSync, getUserId, getViewSchema, isExpression, isObject, lookupToAmis, lookupToAmisIdsPicker, lookupToAmisPicker, lookupToAmisSelect, lookupToAmisSelectUser, markReadAll, parseSingleExpression, registerRemoteAssets, registerRenders, setEnv, setEnvs, setRootUrl, setSteedosAuth, setUISchemaFunction, setVariable, standardButtonsTodo };
|
|
11618
11719
|
//# sourceMappingURL=index.esm.js.map
|