@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.umd.js
CHANGED
|
@@ -5136,7 +5136,8 @@
|
|
|
5136
5136
|
"type": "dropdown-button",
|
|
5137
5137
|
"trigger": "click",
|
|
5138
5138
|
"icon": "fa fa-cog",
|
|
5139
|
-
|
|
5139
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5140
|
+
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
5140
5141
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5141
5142
|
"align": "right",
|
|
5142
5143
|
"visibleOn": "${!isLookup}",
|
|
@@ -5176,11 +5177,12 @@
|
|
|
5176
5177
|
"rightIconClassName": "m-l-sm"
|
|
5177
5178
|
}
|
|
5178
5179
|
];
|
|
5179
|
-
|
|
5180
|
+
displayAs === 'split'? i18next__default["default"].t('frontend_display_type_is_split') : i18next__default["default"].t('frontend_display_type_is_table');
|
|
5180
5181
|
return {
|
|
5181
5182
|
"type": "dropdown-button",
|
|
5182
5183
|
"icon": "fa fa-table-columns",
|
|
5183
|
-
|
|
5184
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5185
|
+
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
5184
5186
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5185
5187
|
"align": "right",
|
|
5186
5188
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -5262,7 +5264,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5262
5264
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5263
5265
|
"type": "button",
|
|
5264
5266
|
"align": "right",
|
|
5265
|
-
|
|
5267
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5268
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5266
5269
|
"tooltipPlacement": "top",
|
|
5267
5270
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5268
5271
|
"label": "",
|
|
@@ -5284,7 +5287,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5284
5287
|
"icon": "fa fa-search",
|
|
5285
5288
|
"type": "button",
|
|
5286
5289
|
"tooltipPlacement": "top",
|
|
5287
|
-
|
|
5290
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5291
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5288
5292
|
"badge": {
|
|
5289
5293
|
"offset": [
|
|
5290
5294
|
-5,
|
|
@@ -5329,7 +5333,9 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5329
5333
|
{
|
|
5330
5334
|
"type": "reload",
|
|
5331
5335
|
"align": "right",
|
|
5332
|
-
|
|
5336
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5337
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5338
|
+
"tooltip":"",
|
|
5333
5339
|
"tooltipPlacement": "top",
|
|
5334
5340
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5335
5341
|
},
|
|
@@ -5339,8 +5345,9 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5339
5345
|
filterVisible ? {
|
|
5340
5346
|
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5341
5347
|
"icon": "fa fa-search",
|
|
5342
|
-
|
|
5343
|
-
"
|
|
5348
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5349
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5350
|
+
// "tooltipPlacement": "top",
|
|
5344
5351
|
"type": "button",
|
|
5345
5352
|
"badge": {
|
|
5346
5353
|
"offset": [
|
|
@@ -5446,9 +5453,16 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
5446
5453
|
valueField = `${ctx.fieldNamePrefix}${valueField}`;
|
|
5447
5454
|
}
|
|
5448
5455
|
data.$value = `$${valueField}`;
|
|
5449
|
-
|
|
5456
|
+
data['$'] = `$$`;
|
|
5450
5457
|
const requestAdaptor = `
|
|
5451
5458
|
var filters = [['parent', '=', null]];
|
|
5459
|
+
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5460
|
+
if(filtersFunction){
|
|
5461
|
+
const _filters = filtersFunction(filters, api.data.$);
|
|
5462
|
+
if(_filters && _filters.length > 0){
|
|
5463
|
+
filters.push(_filters);
|
|
5464
|
+
}
|
|
5465
|
+
}
|
|
5452
5466
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
5453
5467
|
var defaultValue = api.data.$value;
|
|
5454
5468
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
@@ -6070,6 +6084,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6070
6084
|
modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
6071
6085
|
labelField: referenceTo.labelField.name,
|
|
6072
6086
|
valueField: referenceTo.valueField.name,
|
|
6087
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6088
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6073
6089
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
6074
6090
|
source: source,
|
|
6075
6091
|
size: "lg",
|
|
@@ -6250,6 +6266,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6250
6266
|
joinValues: false,
|
|
6251
6267
|
extractValue: true,
|
|
6252
6268
|
clearable: true,
|
|
6269
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6270
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6253
6271
|
// labelField: labelField,
|
|
6254
6272
|
// valueField: valueField,
|
|
6255
6273
|
source: apiInfo,
|
|
@@ -6434,6 +6452,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6434
6452
|
valueField: referenceTo.valueField.name,
|
|
6435
6453
|
modalMode: 'dialog',
|
|
6436
6454
|
source: source,
|
|
6455
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6456
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6437
6457
|
size: "lg",
|
|
6438
6458
|
pickerSchema: pickerSchema,
|
|
6439
6459
|
joinValues: false,
|
|
@@ -6462,7 +6482,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6462
6482
|
* @Author: baozhoutao@steedos.com
|
|
6463
6483
|
* @Date: 2023-01-13 17:27:54
|
|
6464
6484
|
* @LastEditors: liaodaxue
|
|
6465
|
-
* @LastEditTime: 2023-
|
|
6485
|
+
* @LastEditTime: 2023-07-24 15:23:12
|
|
6466
6486
|
* @Description:
|
|
6467
6487
|
*/
|
|
6468
6488
|
|
|
@@ -6484,21 +6504,39 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6484
6504
|
}
|
|
6485
6505
|
}else {
|
|
6486
6506
|
return {
|
|
6487
|
-
"type": "
|
|
6507
|
+
"type": "control",
|
|
6508
|
+
"label": field.label,
|
|
6488
6509
|
"body": [
|
|
6489
6510
|
{
|
|
6490
|
-
"type": "
|
|
6491
|
-
"
|
|
6492
|
-
"
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6511
|
+
"type": "tabs",
|
|
6512
|
+
"tabsMode": "strong",
|
|
6513
|
+
"className": "steedos-markdown",
|
|
6514
|
+
"tabs": [
|
|
6515
|
+
{
|
|
6516
|
+
"title": "Write",
|
|
6517
|
+
"tab": [
|
|
6518
|
+
{
|
|
6519
|
+
"type": "editor",
|
|
6520
|
+
"name": field.name,
|
|
6521
|
+
"language": "markdown",
|
|
6522
|
+
}
|
|
6523
|
+
]
|
|
6524
|
+
},
|
|
6525
|
+
{
|
|
6526
|
+
"title": "Preview",
|
|
6527
|
+
"tab": [
|
|
6528
|
+
{
|
|
6529
|
+
"type": "markdown",
|
|
6530
|
+
"name": field.name,
|
|
6531
|
+
"options": {
|
|
6532
|
+
"linkify": true,
|
|
6533
|
+
"html": true,
|
|
6534
|
+
"breaks": true
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
]
|
|
6538
|
+
}
|
|
6539
|
+
]
|
|
6502
6540
|
}
|
|
6503
6541
|
]
|
|
6504
6542
|
}
|
|
@@ -7573,10 +7611,25 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7573
7611
|
return quickEditSchema;
|
|
7574
7612
|
}
|
|
7575
7613
|
|
|
7614
|
+
function getFieldWidth(width){
|
|
7615
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7616
|
+
if(typeof width == 'string'){
|
|
7617
|
+
if(isNaN(width)){
|
|
7618
|
+
return width;
|
|
7619
|
+
}else {
|
|
7620
|
+
return Number(width);
|
|
7621
|
+
}
|
|
7622
|
+
}else if(typeof width == 'number'){
|
|
7623
|
+
return width;
|
|
7624
|
+
}else {
|
|
7625
|
+
return defaultWidth;
|
|
7626
|
+
}
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7576
7629
|
async function getTableColumns(fields, options){
|
|
7577
7630
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7578
7631
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7579
|
-
|
|
7632
|
+
|
|
7580
7633
|
for (const field of fields) {
|
|
7581
7634
|
//增加quickEdit属性,实现快速编辑
|
|
7582
7635
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7624,7 +7677,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7624
7677
|
type: "switch",
|
|
7625
7678
|
name: field.name,
|
|
7626
7679
|
label: field.label,
|
|
7627
|
-
width: field.width
|
|
7680
|
+
width: getFieldWidth(field.width),
|
|
7628
7681
|
toggled: field.toggled,
|
|
7629
7682
|
static: true,
|
|
7630
7683
|
className:"whitespace-nowrap",
|
|
@@ -7635,7 +7688,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7635
7688
|
type: "switch",
|
|
7636
7689
|
name: field.name,
|
|
7637
7690
|
label: field.label,
|
|
7638
|
-
width: field.width
|
|
7691
|
+
width: getFieldWidth(field.width),
|
|
7639
7692
|
toggled: field.toggled,
|
|
7640
7693
|
quickEdit: quickEditSchema,
|
|
7641
7694
|
static: true,
|
|
@@ -7655,7 +7708,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7655
7708
|
label: field.label,
|
|
7656
7709
|
map: map,
|
|
7657
7710
|
sortable: field.sortable,
|
|
7658
|
-
width: field.width
|
|
7711
|
+
width: getFieldWidth(field.width),
|
|
7659
7712
|
toggled: field.toggled,
|
|
7660
7713
|
className,
|
|
7661
7714
|
static: true,
|
|
@@ -7689,7 +7742,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7689
7742
|
label: field.label,
|
|
7690
7743
|
sortable: field.sortable,
|
|
7691
7744
|
// searchable: field.searchable,
|
|
7692
|
-
width: field.width
|
|
7745
|
+
width: getFieldWidth(field.width),
|
|
7693
7746
|
type: type,
|
|
7694
7747
|
tpl: tpl,
|
|
7695
7748
|
toggled: field.toggled,
|
|
@@ -7987,14 +8040,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7987
8040
|
onOpenApi: {
|
|
7988
8041
|
url: `\${context.rootUrl}/service/api/@\${objectName}/recordPermissions/\${_id}`,
|
|
7989
8042
|
method: "get",
|
|
7990
|
-
|
|
7991
|
-
$: "$$",
|
|
7992
|
-
objectName: "${objectName}",
|
|
7993
|
-
listViewId: "${listViewId}",
|
|
7994
|
-
appId: "${appId}",
|
|
7995
|
-
formFactor: "${formFactor}",
|
|
7996
|
-
context: `\${context}`
|
|
7997
|
-
},
|
|
8043
|
+
requestAdaptor: "api.data={}; return api;",
|
|
7998
8044
|
headers: {
|
|
7999
8045
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
8000
8046
|
},
|