@steedos-widgets/amis-lib 1.3.4-beta.16 → 1.3.4-beta.18
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 +99 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +99 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +78 -72
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/file.d.ts +4 -8
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +4 -0
- package/dist/types/lib/converter/amis/fields/table.d.ts +2 -0
- package/dist/types/lib/converter/amis/index.d.ts +1 -3
- package/dist/types/lib/converter/amis/toolbars/setting_listview/copy.d.ts +1 -0
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +1 -0
- package/dist/types/lib/objects.d.ts +1 -3
- package/dist/types/lib/objectsRelated.d.ts +3 -0
- package/dist/types/lib/page_init.d.ts +1 -3
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1791,6 +1791,13 @@ async function getSelectUserSchema(field, readonly, ctx) {
|
|
|
1791
1791
|
return amisSchema;
|
|
1792
1792
|
}
|
|
1793
1793
|
|
|
1794
|
+
/*
|
|
1795
|
+
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
1796
|
+
* @Date: 2023-03-22 09:31:21
|
|
1797
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
1798
|
+
* @LastEditTime: 2023-10-25 17:40:14
|
|
1799
|
+
*/
|
|
1800
|
+
|
|
1794
1801
|
const globalTag = '__G_L_O_B_A_L__';
|
|
1795
1802
|
|
|
1796
1803
|
const getParentPath = function (path) {
|
|
@@ -1830,7 +1837,29 @@ const isExpression = function (func) {
|
|
|
1830
1837
|
return false;
|
|
1831
1838
|
};
|
|
1832
1839
|
|
|
1840
|
+
const getMoment$1 = () => {
|
|
1841
|
+
if (window.amisRequire) {
|
|
1842
|
+
return window.amisRequire("moment");
|
|
1843
|
+
} else if (window.moment) {
|
|
1844
|
+
return window.moment;
|
|
1845
|
+
}
|
|
1846
|
+
};
|
|
1847
|
+
|
|
1833
1848
|
const parseSingleExpression = function (func, formData, dataPath, global, userSession = {}) {
|
|
1849
|
+
if (global) {
|
|
1850
|
+
let now = new Date();
|
|
1851
|
+
let moment = getMoment$1();
|
|
1852
|
+
let today = moment().utc();
|
|
1853
|
+
today.set("hours", 0);
|
|
1854
|
+
today.set("minutes", 0);
|
|
1855
|
+
today.set("seconds", 0);
|
|
1856
|
+
today = today.toDate();
|
|
1857
|
+
Object.assign(global, {
|
|
1858
|
+
now,
|
|
1859
|
+
today
|
|
1860
|
+
});
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1834
1863
|
var error, funcBody, parent, parentPath, str;
|
|
1835
1864
|
|
|
1836
1865
|
if (formData === void 0) {
|
|
@@ -4390,7 +4419,8 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
4390
4419
|
"&": "${list_view}",
|
|
4391
4420
|
"name":"",
|
|
4392
4421
|
"label": i18next__default["default"].t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + i18next__default["default"].t('frontend_listview_control_clone_defaultData_label_end'),
|
|
4393
|
-
"shared":false
|
|
4422
|
+
"shared":false,
|
|
4423
|
+
"object_name": "${targetObjectName}",
|
|
4394
4424
|
},
|
|
4395
4425
|
"fieldsExtend": fieldsExtend$3(),
|
|
4396
4426
|
"fields": fields(),
|
|
@@ -6098,7 +6128,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6098
6128
|
pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
|
|
6099
6129
|
const isAllowCreate = refObjectConfig.permissions.allowCreate;
|
|
6100
6130
|
const isCreate = ___namespace.isBoolean(field.create) ? field.create : true;
|
|
6101
|
-
|
|
6131
|
+
// lookup字段配置过滤条件就强制不显示新建按钮
|
|
6132
|
+
let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
|
|
6133
|
+
if (isAllowCreate && isCreate && !isHasFilters) {
|
|
6102
6134
|
const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
|
|
6103
6135
|
new_button.align = "right";
|
|
6104
6136
|
// 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
|
|
@@ -6475,7 +6507,7 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
6475
6507
|
// 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
|
|
6476
6508
|
// 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
|
|
6477
6509
|
// TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
|
|
6478
|
-
if(refObject.enable_enhanced_lookup == true
|
|
6510
|
+
if(refObject.enable_enhanced_lookup == true){
|
|
6479
6511
|
return await lookupToAmisPicker(field, readonly, ctx);
|
|
6480
6512
|
}else if(refObject.enable_tree) {
|
|
6481
6513
|
return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
|
|
@@ -6792,8 +6824,8 @@ function getAmisStaticFieldType(type, readonly, options){
|
|
|
6792
6824
|
/*
|
|
6793
6825
|
* @Author: baozhoutao@steedos.com
|
|
6794
6826
|
* @Date: 2022-10-28 14:15:09
|
|
6795
|
-
* @LastEditors:
|
|
6796
|
-
* @LastEditTime:
|
|
6827
|
+
* @LastEditors: liaodaxue
|
|
6828
|
+
* @LastEditTime: 2023-10-30 17:51:54
|
|
6797
6829
|
* @Description:
|
|
6798
6830
|
*/
|
|
6799
6831
|
|
|
@@ -6844,11 +6876,26 @@ const getAmisFileEditSchema = (steedosField)=>{
|
|
|
6844
6876
|
useChunk: false, // 关闭分块上传
|
|
6845
6877
|
receiver: {
|
|
6846
6878
|
method: "post",
|
|
6879
|
+
dataType: "form-data",
|
|
6847
6880
|
url: `\${context.rootUrl}/s3/${tableName}`,
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6881
|
+
requestAdaptor: `
|
|
6882
|
+
const { _master, global,context } = api.body;
|
|
6883
|
+
// const { recordId, objectName } = _master;
|
|
6884
|
+
const { spaceId, userId, user } = global;
|
|
6885
|
+
/*
|
|
6886
|
+
record_id: recordId,
|
|
6887
|
+
parent: recordId,
|
|
6888
|
+
object_name: objectName,
|
|
6889
|
+
owner_name: user.name,
|
|
6890
|
+
space: spaceId,
|
|
6891
|
+
owner: userId
|
|
6892
|
+
*/
|
|
6893
|
+
// 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
|
|
6894
|
+
api.data.append('space', spaceId);
|
|
6895
|
+
api.data.append('owner', userId);
|
|
6896
|
+
|
|
6897
|
+
return api;
|
|
6898
|
+
`,
|
|
6852
6899
|
adaptor: `
|
|
6853
6900
|
const { context } = api.body;
|
|
6854
6901
|
var rootUrl = context.rootUrl + "/api/files/${tableName}/";
|
|
@@ -8012,7 +8059,7 @@ async function getTableColumns(fields, options){
|
|
|
8012
8059
|
{
|
|
8013
8060
|
"args": {
|
|
8014
8061
|
"api": {
|
|
8015
|
-
"url": "${context.rootUrl
|
|
8062
|
+
"url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
|
|
8016
8063
|
"method": "get",
|
|
8017
8064
|
"headers": {
|
|
8018
8065
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
@@ -8492,6 +8539,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8492
8539
|
}
|
|
8493
8540
|
return {
|
|
8494
8541
|
mode: "cards",
|
|
8542
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
8495
8543
|
name: "thelist",
|
|
8496
8544
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8497
8545
|
className: "",
|
|
@@ -8514,6 +8562,7 @@ async function getTableSchema$1(fields, options){
|
|
|
8514
8562
|
|
|
8515
8563
|
return {
|
|
8516
8564
|
mode: "table",
|
|
8565
|
+
perPageAvailable: [5, 10, 20, 50, 100, 500],
|
|
8517
8566
|
name: "thelist",
|
|
8518
8567
|
headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
|
|
8519
8568
|
className: "",
|
|
@@ -9148,7 +9197,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
9148
9197
|
${getScriptForRewriteValueForFileFields(fields)}
|
|
9149
9198
|
|
|
9150
9199
|
_.each(dataKeys, function(key){
|
|
9151
|
-
if(fieldKeys.indexOf(key)<0){
|
|
9200
|
+
if(fieldKeys.indexOf(key)<0 && key !== "_display"){
|
|
9152
9201
|
delete data[key];
|
|
9153
9202
|
}
|
|
9154
9203
|
})
|
|
@@ -10488,8 +10537,29 @@ const getFormFields = (objectSchema, formProps)=>{
|
|
|
10488
10537
|
return lodash.sortBy(___default["default"].values(fields), "sort_no");
|
|
10489
10538
|
};
|
|
10490
10539
|
|
|
10540
|
+
async function getFormSchemaWithDataFilter(form, options = {}){
|
|
10541
|
+
const { formDataFilter, amisData, env } = options;
|
|
10542
|
+
let onFormDataFilter = options.onFormDataFilter;
|
|
10543
|
+
if (!onFormDataFilter && typeof formDataFilter === 'string') {
|
|
10544
|
+
onFormDataFilter = new Function(
|
|
10545
|
+
'form',
|
|
10546
|
+
'env',
|
|
10547
|
+
'data',
|
|
10548
|
+
formDataFilter
|
|
10549
|
+
);
|
|
10550
|
+
}
|
|
10551
|
+
|
|
10552
|
+
try {
|
|
10553
|
+
onFormDataFilter && (form = await onFormDataFilter(form, env, amisData) || form);
|
|
10554
|
+
} catch (e) {
|
|
10555
|
+
console.warn(e);
|
|
10556
|
+
}
|
|
10557
|
+
return form;
|
|
10558
|
+
}
|
|
10559
|
+
|
|
10491
10560
|
async function getObjectForm(objectSchema, ctx){
|
|
10492
|
-
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults, submitSuccActions = []
|
|
10561
|
+
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
10562
|
+
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
10493
10563
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
10494
10564
|
const formFields = getFormFields(objectSchema, ctx);
|
|
10495
10565
|
const formSchema = defaults && defaults.formSchema || {};
|
|
@@ -10506,7 +10576,8 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
10506
10576
|
name: `page_edit_${recordId}`,
|
|
10507
10577
|
api: await getEditFormInitApi(objectSchema, recordId, fields, ctx),
|
|
10508
10578
|
data:{
|
|
10509
|
-
editFormInited: false
|
|
10579
|
+
editFormInited: false,
|
|
10580
|
+
...amisData
|
|
10510
10581
|
},
|
|
10511
10582
|
// data: {global: getGlobalData('edit'), recordId: recordId, objectName: objectSchema.name, context: {rootUrl: getRootUrl(), tenantId: getTenantId(), authToken: getAuthToken()}},
|
|
10512
10583
|
initApi: null,
|
|
@@ -10573,15 +10644,17 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
10573
10644
|
}
|
|
10574
10645
|
})]
|
|
10575
10646
|
};
|
|
10647
|
+
amisSchema.body[0] = await getFormSchemaWithDataFilter(amisSchema.body[0], { formDataFilter, onFormDataFilter, amisData, env });
|
|
10576
10648
|
return amisSchema;
|
|
10577
10649
|
}
|
|
10578
10650
|
|
|
10579
10651
|
async function getObjectDetail(objectSchema, recordId, ctx){
|
|
10580
|
-
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign
|
|
10652
|
+
const { formFactor, layout = formFactor === 'SMALL' ? 'normal' : "normal", labelAlign,
|
|
10653
|
+
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
10581
10654
|
const fields = ___default["default"].values(objectSchema.fields);
|
|
10582
10655
|
const formFields = getFormFields(objectSchema, ctx);
|
|
10583
10656
|
const serviceId = `service_detail_page`;
|
|
10584
|
-
|
|
10657
|
+
const amisSchema = {
|
|
10585
10658
|
type: 'service',
|
|
10586
10659
|
name: `page_readonly_${recordId}`,
|
|
10587
10660
|
id: serviceId,
|
|
@@ -10663,7 +10736,10 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
10663
10736
|
]
|
|
10664
10737
|
}
|
|
10665
10738
|
}
|
|
10666
|
-
}
|
|
10739
|
+
};
|
|
10740
|
+
|
|
10741
|
+
amisSchema.body[0].body = await getFormSchemaWithDataFilter(amisSchema.body[0].body, { formDataFilter, onFormDataFilter, amisData, env });
|
|
10742
|
+
return amisSchema;
|
|
10667
10743
|
}
|
|
10668
10744
|
|
|
10669
10745
|
/*
|
|
@@ -10743,7 +10819,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
10743
10819
|
* @Author: baozhoutao@steedos.com
|
|
10744
10820
|
* @Date: 2022-07-05 15:55:39
|
|
10745
10821
|
* @LastEditors: liaodaxue
|
|
10746
|
-
* @LastEditTime: 2023-
|
|
10822
|
+
* @LastEditTime: 2023-10-23 15:55:46
|
|
10747
10823
|
* @Description:
|
|
10748
10824
|
*/
|
|
10749
10825
|
|
|
@@ -11034,11 +11110,15 @@ async function getRelatedListSchema(
|
|
|
11034
11110
|
ctx
|
|
11035
11111
|
) {
|
|
11036
11112
|
const uiSchema = await getUISchema(objectName);
|
|
11113
|
+
if(!uiSchema){
|
|
11114
|
+
return {}
|
|
11115
|
+
}
|
|
11116
|
+
const listViewNames = _$1.map(uiSchema.list_views, 'name');
|
|
11037
11117
|
const listView = _$1.find(
|
|
11038
11118
|
uiSchema.list_views,
|
|
11039
11119
|
(listView, name) => {
|
|
11040
|
-
// 传入listViewName
|
|
11041
|
-
if(!listViewName){
|
|
11120
|
+
// 传入listViewName空值 或者 不存在 则取第一个
|
|
11121
|
+
if(!listViewName || listViewNames.indexOf(listViewName)<0){
|
|
11042
11122
|
listViewName = name;
|
|
11043
11123
|
}
|
|
11044
11124
|
return name === listViewName || listView._id === listViewName;
|