@steedos-widgets/amis-lib 1.2.32 → 1.2.33
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 +82 -36
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +82 -36
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +82 -36
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/editor.d.ts +24 -15
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +4 -0
- package/dist/types/lib/converter/amis/toolbars/export_excel.d.ts +0 -1
- package/dist/types/lib/converter/amis/toolbars/setting_listview.d.ts +0 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -5112,7 +5112,8 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
5112
5112
|
"type": "dropdown-button",
|
|
5113
5113
|
"trigger": "click",
|
|
5114
5114
|
"icon": "fa fa-cog",
|
|
5115
|
-
|
|
5115
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5116
|
+
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
5116
5117
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5117
5118
|
"align": "right",
|
|
5118
5119
|
"visibleOn": "${!isLookup}",
|
|
@@ -5152,11 +5153,12 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
5152
5153
|
"rightIconClassName": "m-l-sm"
|
|
5153
5154
|
}
|
|
5154
5155
|
];
|
|
5155
|
-
|
|
5156
|
+
displayAs === 'split'? i18next.t('frontend_display_type_is_split') : i18next.t('frontend_display_type_is_table');
|
|
5156
5157
|
return {
|
|
5157
5158
|
"type": "dropdown-button",
|
|
5158
5159
|
"icon": "fa fa-table-columns",
|
|
5159
|
-
|
|
5160
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5161
|
+
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
5160
5162
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5161
5163
|
"align": "right",
|
|
5162
5164
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -5238,7 +5240,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5238
5240
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5239
5241
|
"type": "button",
|
|
5240
5242
|
"align": "right",
|
|
5241
|
-
|
|
5243
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5244
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5242
5245
|
"tooltipPlacement": "top",
|
|
5243
5246
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5244
5247
|
"label": "",
|
|
@@ -5260,7 +5263,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5260
5263
|
"icon": "fa fa-search",
|
|
5261
5264
|
"type": "button",
|
|
5262
5265
|
"tooltipPlacement": "top",
|
|
5263
|
-
|
|
5266
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5267
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5264
5268
|
"badge": {
|
|
5265
5269
|
"offset": [
|
|
5266
5270
|
-5,
|
|
@@ -5305,7 +5309,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5305
5309
|
{
|
|
5306
5310
|
"type": "reload",
|
|
5307
5311
|
"align": "right",
|
|
5308
|
-
|
|
5312
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5313
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5314
|
+
"tooltip":"",
|
|
5309
5315
|
"tooltipPlacement": "top",
|
|
5310
5316
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5311
5317
|
},
|
|
@@ -5315,8 +5321,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5315
5321
|
filterVisible ? {
|
|
5316
5322
|
"label": i18next.t('frontend_button_search_tooltip'),
|
|
5317
5323
|
"icon": "fa fa-search",
|
|
5318
|
-
|
|
5319
|
-
"
|
|
5324
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5325
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5326
|
+
// "tooltipPlacement": "top",
|
|
5320
5327
|
"type": "button",
|
|
5321
5328
|
"badge": {
|
|
5322
5329
|
"offset": [
|
|
@@ -5422,9 +5429,16 @@ async function getSource(field, ctx) {
|
|
|
5422
5429
|
valueField = `${ctx.fieldNamePrefix}${valueField}`;
|
|
5423
5430
|
}
|
|
5424
5431
|
data.$value = `$${valueField}`;
|
|
5425
|
-
|
|
5432
|
+
data['$'] = `$$`;
|
|
5426
5433
|
const requestAdaptor = `
|
|
5427
5434
|
var filters = [['parent', '=', null]];
|
|
5435
|
+
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5436
|
+
if(filtersFunction){
|
|
5437
|
+
const _filters = filtersFunction(filters, api.data.$);
|
|
5438
|
+
if(_filters && _filters.length > 0){
|
|
5439
|
+
filters.push(_filters);
|
|
5440
|
+
}
|
|
5441
|
+
}
|
|
5428
5442
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
5429
5443
|
var defaultValue = api.data.$value;
|
|
5430
5444
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
@@ -6046,6 +6060,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6046
6060
|
modalTitle: i18next.t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
6047
6061
|
labelField: referenceTo.labelField.name,
|
|
6048
6062
|
valueField: referenceTo.valueField.name,
|
|
6063
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6064
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6049
6065
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
6050
6066
|
source: source,
|
|
6051
6067
|
size: "lg",
|
|
@@ -6226,6 +6242,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6226
6242
|
joinValues: false,
|
|
6227
6243
|
extractValue: true,
|
|
6228
6244
|
clearable: true,
|
|
6245
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6246
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6229
6247
|
// labelField: labelField,
|
|
6230
6248
|
// valueField: valueField,
|
|
6231
6249
|
source: apiInfo,
|
|
@@ -6410,6 +6428,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6410
6428
|
valueField: referenceTo.valueField.name,
|
|
6411
6429
|
modalMode: 'dialog',
|
|
6412
6430
|
source: source,
|
|
6431
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6432
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6413
6433
|
size: "lg",
|
|
6414
6434
|
pickerSchema: pickerSchema,
|
|
6415
6435
|
joinValues: false,
|
|
@@ -6438,7 +6458,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6438
6458
|
* @Author: baozhoutao@steedos.com
|
|
6439
6459
|
* @Date: 2023-01-13 17:27:54
|
|
6440
6460
|
* @LastEditors: liaodaxue
|
|
6441
|
-
* @LastEditTime: 2023-
|
|
6461
|
+
* @LastEditTime: 2023-07-24 15:23:12
|
|
6442
6462
|
* @Description:
|
|
6443
6463
|
*/
|
|
6444
6464
|
|
|
@@ -6460,21 +6480,39 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6460
6480
|
}
|
|
6461
6481
|
}else {
|
|
6462
6482
|
return {
|
|
6463
|
-
"type": "
|
|
6483
|
+
"type": "control",
|
|
6484
|
+
"label": field.label,
|
|
6464
6485
|
"body": [
|
|
6465
6486
|
{
|
|
6466
|
-
"type": "
|
|
6467
|
-
"
|
|
6468
|
-
"
|
|
6469
|
-
|
|
6470
|
-
|
|
6471
|
-
|
|
6472
|
-
|
|
6473
|
-
|
|
6474
|
-
|
|
6475
|
-
|
|
6476
|
-
|
|
6477
|
-
|
|
6487
|
+
"type": "tabs",
|
|
6488
|
+
"tabsMode": "strong",
|
|
6489
|
+
"className": "steedos-markdown",
|
|
6490
|
+
"tabs": [
|
|
6491
|
+
{
|
|
6492
|
+
"title": "Write",
|
|
6493
|
+
"tab": [
|
|
6494
|
+
{
|
|
6495
|
+
"type": "editor",
|
|
6496
|
+
"name": field.name,
|
|
6497
|
+
"language": "markdown",
|
|
6498
|
+
}
|
|
6499
|
+
]
|
|
6500
|
+
},
|
|
6501
|
+
{
|
|
6502
|
+
"title": "Preview",
|
|
6503
|
+
"tab": [
|
|
6504
|
+
{
|
|
6505
|
+
"type": "markdown",
|
|
6506
|
+
"name": field.name,
|
|
6507
|
+
"options": {
|
|
6508
|
+
"linkify": true,
|
|
6509
|
+
"html": true,
|
|
6510
|
+
"breaks": true
|
|
6511
|
+
}
|
|
6512
|
+
}
|
|
6513
|
+
]
|
|
6514
|
+
}
|
|
6515
|
+
]
|
|
6478
6516
|
}
|
|
6479
6517
|
]
|
|
6480
6518
|
}
|
|
@@ -7549,10 +7587,25 @@ async function getQuickEditSchema(field, options){
|
|
|
7549
7587
|
return quickEditSchema;
|
|
7550
7588
|
}
|
|
7551
7589
|
|
|
7590
|
+
function getFieldWidth(width){
|
|
7591
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7592
|
+
if(typeof width == 'string'){
|
|
7593
|
+
if(isNaN(width)){
|
|
7594
|
+
return width;
|
|
7595
|
+
}else {
|
|
7596
|
+
return Number(width);
|
|
7597
|
+
}
|
|
7598
|
+
}else if(typeof width == 'number'){
|
|
7599
|
+
return width;
|
|
7600
|
+
}else {
|
|
7601
|
+
return defaultWidth;
|
|
7602
|
+
}
|
|
7603
|
+
}
|
|
7604
|
+
|
|
7552
7605
|
async function getTableColumns(fields, options){
|
|
7553
7606
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7554
7607
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7555
|
-
|
|
7608
|
+
|
|
7556
7609
|
for (const field of fields) {
|
|
7557
7610
|
//增加quickEdit属性,实现快速编辑
|
|
7558
7611
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7600,7 +7653,7 @@ async function getTableColumns(fields, options){
|
|
|
7600
7653
|
type: "switch",
|
|
7601
7654
|
name: field.name,
|
|
7602
7655
|
label: field.label,
|
|
7603
|
-
width: field.width
|
|
7656
|
+
width: getFieldWidth(field.width),
|
|
7604
7657
|
toggled: field.toggled,
|
|
7605
7658
|
static: true,
|
|
7606
7659
|
className:"whitespace-nowrap",
|
|
@@ -7611,7 +7664,7 @@ async function getTableColumns(fields, options){
|
|
|
7611
7664
|
type: "switch",
|
|
7612
7665
|
name: field.name,
|
|
7613
7666
|
label: field.label,
|
|
7614
|
-
width: field.width
|
|
7667
|
+
width: getFieldWidth(field.width),
|
|
7615
7668
|
toggled: field.toggled,
|
|
7616
7669
|
quickEdit: quickEditSchema,
|
|
7617
7670
|
static: true,
|
|
@@ -7631,7 +7684,7 @@ async function getTableColumns(fields, options){
|
|
|
7631
7684
|
label: field.label,
|
|
7632
7685
|
map: map,
|
|
7633
7686
|
sortable: field.sortable,
|
|
7634
|
-
width: field.width
|
|
7687
|
+
width: getFieldWidth(field.width),
|
|
7635
7688
|
toggled: field.toggled,
|
|
7636
7689
|
className,
|
|
7637
7690
|
static: true,
|
|
@@ -7665,7 +7718,7 @@ async function getTableColumns(fields, options){
|
|
|
7665
7718
|
label: field.label,
|
|
7666
7719
|
sortable: field.sortable,
|
|
7667
7720
|
// searchable: field.searchable,
|
|
7668
|
-
width: field.width
|
|
7721
|
+
width: getFieldWidth(field.width),
|
|
7669
7722
|
type: type,
|
|
7670
7723
|
tpl: tpl,
|
|
7671
7724
|
toggled: field.toggled,
|
|
@@ -7963,14 +8016,7 @@ async function getTableOperation(ctx){
|
|
|
7963
8016
|
onOpenApi: {
|
|
7964
8017
|
url: `\${context.rootUrl}/service/api/@\${objectName}/recordPermissions/\${_id}`,
|
|
7965
8018
|
method: "get",
|
|
7966
|
-
|
|
7967
|
-
$: "$$",
|
|
7968
|
-
objectName: "${objectName}",
|
|
7969
|
-
listViewId: "${listViewId}",
|
|
7970
|
-
appId: "${appId}",
|
|
7971
|
-
formFactor: "${formFactor}",
|
|
7972
|
-
context: `\${context}`
|
|
7973
|
-
},
|
|
8019
|
+
requestAdaptor: "api.data={}; return api;",
|
|
7974
8020
|
headers: {
|
|
7975
8021
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
7976
8022
|
},
|