@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.cjs.js
CHANGED
|
@@ -5139,7 +5139,8 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
5139
5139
|
"type": "dropdown-button",
|
|
5140
5140
|
"trigger": "click",
|
|
5141
5141
|
"icon": "fa fa-cog",
|
|
5142
|
-
|
|
5142
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5143
|
+
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
5143
5144
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5144
5145
|
"align": "right",
|
|
5145
5146
|
"visibleOn": "${!isLookup}",
|
|
@@ -5179,11 +5180,12 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
5179
5180
|
"rightIconClassName": "m-l-sm"
|
|
5180
5181
|
}
|
|
5181
5182
|
];
|
|
5182
|
-
|
|
5183
|
+
displayAs === 'split'? i18next__default["default"].t('frontend_display_type_is_split') : i18next__default["default"].t('frontend_display_type_is_table');
|
|
5183
5184
|
return {
|
|
5184
5185
|
"type": "dropdown-button",
|
|
5185
5186
|
"icon": "fa fa-table-columns",
|
|
5186
|
-
|
|
5187
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5188
|
+
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
5187
5189
|
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
5188
5190
|
"align": "right",
|
|
5189
5191
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
@@ -5265,7 +5267,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5265
5267
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页
|
|
5266
5268
|
"type": "button",
|
|
5267
5269
|
"align": "right",
|
|
5268
|
-
|
|
5270
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5271
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5269
5272
|
"tooltipPlacement": "top",
|
|
5270
5273
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
5271
5274
|
"label": "",
|
|
@@ -5287,7 +5290,8 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5287
5290
|
"icon": "fa fa-search",
|
|
5288
5291
|
"type": "button",
|
|
5289
5292
|
"tooltipPlacement": "top",
|
|
5290
|
-
|
|
5293
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5294
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5291
5295
|
"badge": {
|
|
5292
5296
|
"offset": [
|
|
5293
5297
|
-5,
|
|
@@ -5332,7 +5336,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5332
5336
|
{
|
|
5333
5337
|
"type": "reload",
|
|
5334
5338
|
"align": "right",
|
|
5335
|
-
|
|
5339
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5340
|
+
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
5341
|
+
"tooltip":"",
|
|
5336
5342
|
"tooltipPlacement": "top",
|
|
5337
5343
|
"className": "bg-white p-2 rounded border-gray-300 text-gray-500"
|
|
5338
5344
|
},
|
|
@@ -5342,8 +5348,9 @@ function getObjectHeaderToolbar(mainObject, formFactor, {showDisplayAs = false,
|
|
|
5342
5348
|
filterVisible ? {
|
|
5343
5349
|
"label": i18next__default["default"].t('frontend_button_search_tooltip'),
|
|
5344
5350
|
"icon": "fa fa-search",
|
|
5345
|
-
|
|
5346
|
-
"
|
|
5351
|
+
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
5352
|
+
// "tooltip": i18next.t('frontend_button_search_tooltip'),
|
|
5353
|
+
// "tooltipPlacement": "top",
|
|
5347
5354
|
"type": "button",
|
|
5348
5355
|
"badge": {
|
|
5349
5356
|
"offset": [
|
|
@@ -5449,9 +5456,16 @@ async function getSource(field, ctx) {
|
|
|
5449
5456
|
valueField = `${ctx.fieldNamePrefix}${valueField}`;
|
|
5450
5457
|
}
|
|
5451
5458
|
data.$value = `$${valueField}`;
|
|
5452
|
-
|
|
5459
|
+
data['$'] = `$$`;
|
|
5453
5460
|
const requestAdaptor = `
|
|
5454
5461
|
var filters = [['parent', '=', null]];
|
|
5462
|
+
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5463
|
+
if(filtersFunction){
|
|
5464
|
+
const _filters = filtersFunction(filters, api.data.$);
|
|
5465
|
+
if(_filters && _filters.length > 0){
|
|
5466
|
+
filters.push(_filters);
|
|
5467
|
+
}
|
|
5468
|
+
}
|
|
5455
5469
|
api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
|
|
5456
5470
|
var defaultValue = api.data.$value;
|
|
5457
5471
|
var optionsFiltersOp = "${field.multiple ? "in" : "="}";
|
|
@@ -6073,6 +6087,8 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
6073
6087
|
modalTitle: i18next__default["default"].t('frontend_form_please_select') + " " + refObjectConfig.label,
|
|
6074
6088
|
labelField: referenceTo.labelField.name,
|
|
6075
6089
|
valueField: referenceTo.valueField.name,
|
|
6090
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6091
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6076
6092
|
modalMode: 'dialog', //TODO 设置 dialog 或者 drawer,用来配置弹出方式
|
|
6077
6093
|
source: source,
|
|
6078
6094
|
size: "lg",
|
|
@@ -6253,6 +6269,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
6253
6269
|
joinValues: false,
|
|
6254
6270
|
extractValue: true,
|
|
6255
6271
|
clearable: true,
|
|
6272
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6273
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6256
6274
|
// labelField: labelField,
|
|
6257
6275
|
// valueField: valueField,
|
|
6258
6276
|
source: apiInfo,
|
|
@@ -6437,6 +6455,8 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6437
6455
|
valueField: referenceTo.valueField.name,
|
|
6438
6456
|
modalMode: 'dialog',
|
|
6439
6457
|
source: source,
|
|
6458
|
+
// disabledOn: this._master目的是相关表新建时禁止编辑关联字段; this.relatedKey目的是相关表编辑时禁止编辑关联字段。
|
|
6459
|
+
disabledOn: `${readonly} || ( (this._master && (this._master.relatedKey ==='${field.name}')) || (this.relatedKey ==='${field.name}') )`,
|
|
6440
6460
|
size: "lg",
|
|
6441
6461
|
pickerSchema: pickerSchema,
|
|
6442
6462
|
joinValues: false,
|
|
@@ -6465,7 +6485,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6465
6485
|
* @Author: baozhoutao@steedos.com
|
|
6466
6486
|
* @Date: 2023-01-13 17:27:54
|
|
6467
6487
|
* @LastEditors: liaodaxue
|
|
6468
|
-
* @LastEditTime: 2023-
|
|
6488
|
+
* @LastEditTime: 2023-07-24 15:23:12
|
|
6469
6489
|
* @Description:
|
|
6470
6490
|
*/
|
|
6471
6491
|
|
|
@@ -6487,21 +6507,39 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
|
6487
6507
|
}
|
|
6488
6508
|
}else {
|
|
6489
6509
|
return {
|
|
6490
|
-
"type": "
|
|
6510
|
+
"type": "control",
|
|
6511
|
+
"label": field.label,
|
|
6491
6512
|
"body": [
|
|
6492
6513
|
{
|
|
6493
|
-
"type": "
|
|
6494
|
-
"
|
|
6495
|
-
"
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6514
|
+
"type": "tabs",
|
|
6515
|
+
"tabsMode": "strong",
|
|
6516
|
+
"className": "steedos-markdown",
|
|
6517
|
+
"tabs": [
|
|
6518
|
+
{
|
|
6519
|
+
"title": "Write",
|
|
6520
|
+
"tab": [
|
|
6521
|
+
{
|
|
6522
|
+
"type": "editor",
|
|
6523
|
+
"name": field.name,
|
|
6524
|
+
"language": "markdown",
|
|
6525
|
+
}
|
|
6526
|
+
]
|
|
6527
|
+
},
|
|
6528
|
+
{
|
|
6529
|
+
"title": "Preview",
|
|
6530
|
+
"tab": [
|
|
6531
|
+
{
|
|
6532
|
+
"type": "markdown",
|
|
6533
|
+
"name": field.name,
|
|
6534
|
+
"options": {
|
|
6535
|
+
"linkify": true,
|
|
6536
|
+
"html": true,
|
|
6537
|
+
"breaks": true
|
|
6538
|
+
}
|
|
6539
|
+
}
|
|
6540
|
+
]
|
|
6541
|
+
}
|
|
6542
|
+
]
|
|
6505
6543
|
}
|
|
6506
6544
|
]
|
|
6507
6545
|
}
|
|
@@ -7576,10 +7614,25 @@ async function getQuickEditSchema(field, options){
|
|
|
7576
7614
|
return quickEditSchema;
|
|
7577
7615
|
}
|
|
7578
7616
|
|
|
7617
|
+
function getFieldWidth(width){
|
|
7618
|
+
const defaultWidth = "unset";//用于使table内的td标签下生成div,实现将快速编辑按钮固定在右侧的效果,并不是为了unset效果
|
|
7619
|
+
if(typeof width == 'string'){
|
|
7620
|
+
if(isNaN(width)){
|
|
7621
|
+
return width;
|
|
7622
|
+
}else {
|
|
7623
|
+
return Number(width);
|
|
7624
|
+
}
|
|
7625
|
+
}else if(typeof width == 'number'){
|
|
7626
|
+
return width;
|
|
7627
|
+
}else {
|
|
7628
|
+
return defaultWidth;
|
|
7629
|
+
}
|
|
7630
|
+
}
|
|
7631
|
+
|
|
7579
7632
|
async function getTableColumns(fields, options){
|
|
7580
7633
|
const columns = [{name: '_index',type: 'text', width: 32, placeholder: ""}];
|
|
7581
7634
|
const allowEdit = options.permissions?.allowEdit && options.permissions?.modifyAllRecords && !options.isLookup && options.enable_inline_edit != false;
|
|
7582
|
-
|
|
7635
|
+
|
|
7583
7636
|
for (const field of fields) {
|
|
7584
7637
|
//增加quickEdit属性,实现快速编辑
|
|
7585
7638
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
@@ -7627,7 +7680,7 @@ async function getTableColumns(fields, options){
|
|
|
7627
7680
|
type: "switch",
|
|
7628
7681
|
name: field.name,
|
|
7629
7682
|
label: field.label,
|
|
7630
|
-
width: field.width
|
|
7683
|
+
width: getFieldWidth(field.width),
|
|
7631
7684
|
toggled: field.toggled,
|
|
7632
7685
|
static: true,
|
|
7633
7686
|
className:"whitespace-nowrap",
|
|
@@ -7638,7 +7691,7 @@ async function getTableColumns(fields, options){
|
|
|
7638
7691
|
type: "switch",
|
|
7639
7692
|
name: field.name,
|
|
7640
7693
|
label: field.label,
|
|
7641
|
-
width: field.width
|
|
7694
|
+
width: getFieldWidth(field.width),
|
|
7642
7695
|
toggled: field.toggled,
|
|
7643
7696
|
quickEdit: quickEditSchema,
|
|
7644
7697
|
static: true,
|
|
@@ -7658,7 +7711,7 @@ async function getTableColumns(fields, options){
|
|
|
7658
7711
|
label: field.label,
|
|
7659
7712
|
map: map,
|
|
7660
7713
|
sortable: field.sortable,
|
|
7661
|
-
width: field.width
|
|
7714
|
+
width: getFieldWidth(field.width),
|
|
7662
7715
|
toggled: field.toggled,
|
|
7663
7716
|
className,
|
|
7664
7717
|
static: true,
|
|
@@ -7692,7 +7745,7 @@ async function getTableColumns(fields, options){
|
|
|
7692
7745
|
label: field.label,
|
|
7693
7746
|
sortable: field.sortable,
|
|
7694
7747
|
// searchable: field.searchable,
|
|
7695
|
-
width: field.width
|
|
7748
|
+
width: getFieldWidth(field.width),
|
|
7696
7749
|
type: type,
|
|
7697
7750
|
tpl: tpl,
|
|
7698
7751
|
toggled: field.toggled,
|
|
@@ -7990,14 +8043,7 @@ async function getTableOperation(ctx){
|
|
|
7990
8043
|
onOpenApi: {
|
|
7991
8044
|
url: `\${context.rootUrl}/service/api/@\${objectName}/recordPermissions/\${_id}`,
|
|
7992
8045
|
method: "get",
|
|
7993
|
-
|
|
7994
|
-
$: "$$",
|
|
7995
|
-
objectName: "${objectName}",
|
|
7996
|
-
listViewId: "${listViewId}",
|
|
7997
|
-
appId: "${appId}",
|
|
7998
|
-
formFactor: "${formFactor}",
|
|
7999
|
-
context: `\${context}`
|
|
8000
|
-
},
|
|
8046
|
+
requestAdaptor: "api.data={}; return api;",
|
|
8001
8047
|
headers: {
|
|
8002
8048
|
Authorization: "Bearer ${context.tenantId},${context.authToken}"
|
|
8003
8049
|
},
|