@steedos-widgets/amis-lib 3.6.4-beta.3 → 3.6.4-beta.5
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 +85 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +85 -42
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +119 -116
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/table.d.ts +2 -2
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -1653,7 +1653,8 @@ i18next
|
|
|
1653
1653
|
}
|
|
1654
1654
|
});
|
|
1655
1655
|
|
|
1656
|
-
async function getQuickEditSchema(
|
|
1656
|
+
async function getQuickEditSchema(object, columnField, options){
|
|
1657
|
+
let field = object.fields[columnField.name];
|
|
1657
1658
|
//判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
|
|
1658
1659
|
let isAmisVersionforBatchEdit = false;
|
|
1659
1660
|
if(window.amisRequire && window.amisRequire('amis')){
|
|
@@ -2121,7 +2122,7 @@ function getFieldWidth(width){
|
|
|
2121
2122
|
}
|
|
2122
2123
|
}
|
|
2123
2124
|
|
|
2124
|
-
async function getTableColumns(fields, options){
|
|
2125
|
+
async function getTableColumns(object, fields, options){
|
|
2125
2126
|
const columns = [];
|
|
2126
2127
|
if(!options.isLookup && !options.isInputTable){
|
|
2127
2128
|
if(!options.enable_tree){
|
|
@@ -2135,7 +2136,7 @@ async function getTableColumns(fields, options){
|
|
|
2135
2136
|
continue;
|
|
2136
2137
|
}
|
|
2137
2138
|
//增加quickEdit属性,实现快速编辑
|
|
2138
|
-
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2139
|
+
const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
|
|
2139
2140
|
let className = "";
|
|
2140
2141
|
const bowserType = getBowserType();
|
|
2141
2142
|
if(bowserType === "Safari"){
|
|
@@ -2649,7 +2650,7 @@ async function getTableOperation(ctx){
|
|
|
2649
2650
|
"label": "xxx",
|
|
2650
2651
|
"buttons": operationButtons,
|
|
2651
2652
|
"placement": "bottomRight",
|
|
2652
|
-
"overlayClassName": "
|
|
2653
|
+
"overlayClassName": "border rounded !min-w-[160px]",
|
|
2653
2654
|
"trigger": ["click"],
|
|
2654
2655
|
"id": "u:c2140a365019",
|
|
2655
2656
|
onOpenApi: {
|
|
@@ -2707,7 +2708,7 @@ async function getDefaultCrudCard(columns, options) {
|
|
|
2707
2708
|
return card;
|
|
2708
2709
|
}
|
|
2709
2710
|
|
|
2710
|
-
async function getTableSchema$1(fields, options){
|
|
2711
|
+
async function getTableSchema$1(object, fields, options){
|
|
2711
2712
|
if(!options){
|
|
2712
2713
|
options = {};
|
|
2713
2714
|
}
|
|
@@ -2729,7 +2730,7 @@ async function getTableSchema$1(fields, options){
|
|
|
2729
2730
|
columns = await getMobileTableColumns(fields, options);
|
|
2730
2731
|
}
|
|
2731
2732
|
else {
|
|
2732
|
-
columns = await getTableColumns(fields, options);
|
|
2733
|
+
columns = await getTableColumns(object, fields, options);
|
|
2733
2734
|
|
|
2734
2735
|
if(listSchema.mode === "cards"){
|
|
2735
2736
|
let card = listSchema.card;
|
|
@@ -5727,6 +5728,7 @@ const getObjectDetailButtonsSchemas = (objectSchema, recordId, ctx)=>{
|
|
|
5727
5728
|
type: "steedos-dropdown-button",
|
|
5728
5729
|
label: "",
|
|
5729
5730
|
buttons: moreButtons,
|
|
5731
|
+
"overlayClassName": "border rounded !min-w-[160px]",
|
|
5730
5732
|
className: 'slds-icon ml-1',
|
|
5731
5733
|
visibleOn: moreButtonsVisibleOn
|
|
5732
5734
|
};
|
|
@@ -8817,7 +8819,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8817
8819
|
crudId: listSchema.id || id, enable_tree: objectSchema.enable_tree
|
|
8818
8820
|
}, options);
|
|
8819
8821
|
tableOptions.amisData = createObject(options.amisData || {}, {});
|
|
8820
|
-
const table = await getTableSchema$1(fields, tableOptions);
|
|
8822
|
+
const table = await getTableSchema$1(objectSchema, fields, tableOptions);
|
|
8821
8823
|
// delete table.mode;
|
|
8822
8824
|
//image与avatar需要在提交修改时特别处理
|
|
8823
8825
|
const imageNames = ___default.compact(___default.map(___default.filter(fields, (field) => ["image","avatar"].includes(field.type)), 'name'));
|
|
@@ -9084,7 +9086,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
9084
9086
|
body: {
|
|
9085
9087
|
type: 'wrapper',
|
|
9086
9088
|
className: 'p-0 m-0',
|
|
9087
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups})),
|
|
9089
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
9088
9090
|
hiddenOn: "${editFormInited != true}",
|
|
9089
9091
|
},
|
|
9090
9092
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -9692,8 +9694,8 @@ async function getObjectRelatedListsMiniSchema(objectApiName){
|
|
|
9692
9694
|
/*
|
|
9693
9695
|
* @Author: baozhoutao@steedos.com
|
|
9694
9696
|
* @Date: 2022-07-05 15:55:39
|
|
9695
|
-
* @LastEditors:
|
|
9696
|
-
* @LastEditTime: 2024-02-
|
|
9697
|
+
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
9698
|
+
* @LastEditTime: 2024-02-23 16:37:06
|
|
9697
9699
|
* @Description:
|
|
9698
9700
|
*/
|
|
9699
9701
|
|
|
@@ -10041,6 +10043,7 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10041
10043
|
let fields = [];
|
|
10042
10044
|
for (const column of columns) {
|
|
10043
10045
|
if (isString(column)) {
|
|
10046
|
+
let columnField;
|
|
10044
10047
|
if (column.indexOf('.') > 0) {
|
|
10045
10048
|
const fieldName = column.split('.')[0];
|
|
10046
10049
|
const displayName = column.split('.')[1];
|
|
@@ -10048,23 +10051,30 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10048
10051
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10049
10052
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10050
10053
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10051
|
-
|
|
10054
|
+
columnField = Object.assign({}, rfFieldInfo, { name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } }, ctx);
|
|
10052
10055
|
}else if(filedInfo && filedInfo.type === 'object'){
|
|
10053
|
-
|
|
10056
|
+
columnField = uiSchema.fields[column];
|
|
10054
10057
|
}
|
|
10055
10058
|
} else {
|
|
10056
10059
|
if (uiSchema.fields[column]) {
|
|
10057
|
-
|
|
10060
|
+
columnField = Object.assign({}, uiSchema.fields[column], ctx);
|
|
10058
10061
|
}
|
|
10059
10062
|
else if(ctx.extra){
|
|
10060
10063
|
// 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
|
|
10061
|
-
|
|
10064
|
+
columnField = {
|
|
10062
10065
|
extra: true,
|
|
10063
10066
|
name: column
|
|
10064
|
-
}
|
|
10067
|
+
};
|
|
10065
10068
|
}
|
|
10066
10069
|
}
|
|
10070
|
+
if(columnField){
|
|
10071
|
+
// 列上的字段不认uiSchema.fields中定义的amis属性
|
|
10072
|
+
columnField = Object.assign({}, columnField, {amis: undefined});
|
|
10073
|
+
fields.push(columnField);
|
|
10074
|
+
}
|
|
10075
|
+
|
|
10067
10076
|
} else if (isObject$1(column)) {
|
|
10077
|
+
let columnField;
|
|
10068
10078
|
if (column.field.indexOf('.') > 0) {
|
|
10069
10079
|
const fieldName = column.field.split('.')[0];
|
|
10070
10080
|
const displayName = column.field.split('.')[1];
|
|
@@ -10072,33 +10082,34 @@ async function convertColumnsToTableFields(columns, uiSchema, ctx = {}) {
|
|
|
10072
10082
|
if (filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && isString(filedInfo.reference_to)) {
|
|
10073
10083
|
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10074
10084
|
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10075
|
-
|
|
10085
|
+
columnField = Object.assign({}, rfFieldInfo, ctx,
|
|
10076
10086
|
{ name: `${fieldName}__expand.${displayName}`, expand: true, expandInfo: { fieldName, displayName } },
|
|
10077
10087
|
{
|
|
10078
10088
|
width: column.width,
|
|
10079
|
-
wrap: column.wrap
|
|
10080
|
-
amis: column.amis
|
|
10089
|
+
wrap: column.wrap // wrap = true 是没效果的
|
|
10081
10090
|
}
|
|
10082
|
-
)
|
|
10091
|
+
);
|
|
10083
10092
|
}
|
|
10084
10093
|
} else {
|
|
10085
10094
|
if (uiSchema.fields[column.field]) {
|
|
10086
|
-
fields.
|
|
10087
|
-
|
|
10088
|
-
|
|
10089
|
-
|
|
10090
|
-
amis: column.amis
|
|
10091
|
-
})
|
|
10092
|
-
);
|
|
10095
|
+
columnField = Object.assign({}, uiSchema.fields[column.field], ctx, {
|
|
10096
|
+
width: column.width,
|
|
10097
|
+
wrap: column.wrap // wrap = true 是没效果的
|
|
10098
|
+
});
|
|
10093
10099
|
}
|
|
10094
10100
|
else if(ctx.extra){
|
|
10095
10101
|
// 配置列表视图extra_columns时允许字段是hidden的,hidden的字段在uiSchema.fields中不存在
|
|
10096
|
-
|
|
10102
|
+
columnField = {
|
|
10097
10103
|
extra: true,
|
|
10098
10104
|
name: column.field
|
|
10099
|
-
}
|
|
10105
|
+
};
|
|
10100
10106
|
}
|
|
10101
10107
|
}
|
|
10108
|
+
if(columnField){
|
|
10109
|
+
// 列上的字段不认uiSchema.fields中定义的amis属性,用列上配置的amis覆盖
|
|
10110
|
+
columnField = Object.assign({}, columnField, {amis: column.amis});
|
|
10111
|
+
fields.push(columnField);
|
|
10112
|
+
}
|
|
10102
10113
|
}
|
|
10103
10114
|
}
|
|
10104
10115
|
return fields;
|
|
@@ -10212,7 +10223,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10212
10223
|
};
|
|
10213
10224
|
const content = {
|
|
10214
10225
|
"type": "tabs",
|
|
10215
|
-
"className": "steedos-record-tabs bg-white p-4 mt-
|
|
10226
|
+
"className": "steedos-record-tabs bg-white p-4 mt-2",
|
|
10216
10227
|
"contentClassName": "bg-none",
|
|
10217
10228
|
"tabs": [
|
|
10218
10229
|
detailed
|
|
@@ -11428,7 +11439,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11428
11439
|
if(refObjectConfig.name === 'organizations'){
|
|
11429
11440
|
labelFieldName = 'name';
|
|
11430
11441
|
}
|
|
11431
|
-
pickerSchema = await getTableSchema$1(tableFields, {
|
|
11442
|
+
pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
|
|
11432
11443
|
labelFieldName,
|
|
11433
11444
|
top: top,
|
|
11434
11445
|
isLookup: true,
|
|
@@ -12036,7 +12047,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
12036
12047
|
actions: false
|
|
12037
12048
|
});
|
|
12038
12049
|
}else {
|
|
12039
|
-
pickerSchema = await getTableSchema$1(tableFields, {
|
|
12050
|
+
pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
|
|
12040
12051
|
labelFieldName: refObjectConfig.NAME_FIELD_KEY,
|
|
12041
12052
|
top: top,
|
|
12042
12053
|
isLookup: true,
|
|
@@ -13183,15 +13194,15 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
13183
13194
|
/*
|
|
13184
13195
|
* @Author: baozhoutao@steedos.com
|
|
13185
13196
|
* @Date: 2022-05-26 16:02:08
|
|
13186
|
-
* @LastEditors:
|
|
13187
|
-
* @LastEditTime:
|
|
13197
|
+
* @LastEditors: yinlianghui@hotoa.com yinlianghui@hotoa.com
|
|
13198
|
+
* @LastEditTime: 2024-02-25 14:13:10
|
|
13188
13199
|
* @Description:
|
|
13189
13200
|
*/
|
|
13190
13201
|
|
|
13191
13202
|
const getFieldSchemaArray = (formFields, ctx) => {
|
|
13192
13203
|
let fieldSchemaArray = [];
|
|
13193
13204
|
fieldSchemaArray.length = 0;
|
|
13194
|
-
|
|
13205
|
+
ctx && ctx.recordId;
|
|
13195
13206
|
|
|
13196
13207
|
_$1.forEach(formFields, (field) => {
|
|
13197
13208
|
if (!field.group || field.group == 'null' || field.group == '-')
|
|
@@ -13204,9 +13215,7 @@ const getFieldSchemaArray = (formFields, ctx) => {
|
|
|
13204
13215
|
}
|
|
13205
13216
|
|
|
13206
13217
|
let forceHidden = false;
|
|
13207
|
-
if(
|
|
13208
|
-
// 新建记录时,只读字段先隐藏,后续支持显示后,即任务:https://github.com/steedos/steedos-platform/issues/3164 完成后再放开
|
|
13209
|
-
// 表单只读时所有字段都是readonly,设计器中如果forceHidden会造成整个表单在只读的时候显示为空白了,所以要排除掉
|
|
13218
|
+
if(ctx.omitReadonlyFields && field.readonly){
|
|
13210
13219
|
forceHidden = true;
|
|
13211
13220
|
}
|
|
13212
13221
|
|
|
@@ -13666,10 +13675,32 @@ async function getInputTableColumns(props) {
|
|
|
13666
13675
|
// 实测过,直接不生成对应的隐藏column并不会对input-table值造成丢失问题,隐藏的列字段值能正常维护
|
|
13667
13676
|
|
|
13668
13677
|
let fieldPrefix = props.fieldPrefix;
|
|
13669
|
-
let fields = props.fields || [];
|
|
13678
|
+
let fields = cloneDeep(props.fields || []);
|
|
13670
13679
|
if (fieldPrefix) {
|
|
13671
13680
|
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13672
13681
|
}
|
|
13682
|
+
if (inlineEditMode == true) {
|
|
13683
|
+
let popOverContainerSelector = "";
|
|
13684
|
+
let popOverContainer = props.popOverContainer && props.popOverContainer();
|
|
13685
|
+
//获取到当前input-table所处的popOverContainer(可能是modal-dialog中),
|
|
13686
|
+
//给所有的下拉框字段配置popOverContainerSelector,使下拉框组件的弹出框挂载到当前dialog上,防止被dialog遮挡
|
|
13687
|
+
if (popOverContainer) {
|
|
13688
|
+
let classList = Array.prototype.slice.call(popOverContainer.parentElement.classList);
|
|
13689
|
+
if (classList.includes('amis-dialog-widget')) {
|
|
13690
|
+
popOverContainerSelector = '.' + classList.join('.') + ' .antd-Modal-content';
|
|
13691
|
+
}
|
|
13692
|
+
}
|
|
13693
|
+
fields.forEach(function (field) {
|
|
13694
|
+
//lookup存在下拉框模式;弹出模式用的是picker组件,不认popOverContainerSelector属性,所以统一加上
|
|
13695
|
+
if (field.type == "select" || field.type == "lookup") {
|
|
13696
|
+
field.amis = {
|
|
13697
|
+
...field.amis,
|
|
13698
|
+
popOverContainerSelector
|
|
13699
|
+
};
|
|
13700
|
+
}
|
|
13701
|
+
});
|
|
13702
|
+
}
|
|
13703
|
+
|
|
13673
13704
|
if (columns && columns.length) {
|
|
13674
13705
|
return columns.map(function (column) {
|
|
13675
13706
|
let field, extendColumnProps = {};
|
|
@@ -13719,7 +13750,7 @@ async function getInputTableColumns(props) {
|
|
|
13719
13750
|
}
|
|
13720
13751
|
else {
|
|
13721
13752
|
return fields.map(function (field) {
|
|
13722
|
-
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
13753
|
+
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
13723
13754
|
tableCell.className = " whitespace-nowrap ";
|
|
13724
13755
|
return tableCell;
|
|
13725
13756
|
}) || [];
|
|
@@ -14686,7 +14717,7 @@ async function getButtonDelete(props) {
|
|
|
14686
14717
|
return {
|
|
14687
14718
|
"type": "dropdown-button",
|
|
14688
14719
|
"level": "link",
|
|
14689
|
-
"btnClassName": "text-gray-400",
|
|
14720
|
+
"btnClassName": "text-gray-400 steedos-delete-button",
|
|
14690
14721
|
"icon": "fa fa-trash-alt",
|
|
14691
14722
|
"size": "xs",
|
|
14692
14723
|
"hideCaret": true,
|
|
@@ -14849,11 +14880,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14849
14880
|
}
|
|
14850
14881
|
};
|
|
14851
14882
|
if (buttonsForColumnOperations.length) {
|
|
14852
|
-
inputTableSchema.columns.
|
|
14883
|
+
inputTableSchema.columns.unshift({
|
|
14853
14884
|
"name": "__op__",
|
|
14854
14885
|
"type": "operation",
|
|
14855
14886
|
"buttons": buttonsForColumnOperations,
|
|
14856
|
-
"width":
|
|
14887
|
+
"width": 1
|
|
14857
14888
|
});
|
|
14858
14889
|
}
|
|
14859
14890
|
// if (showAsInlineEditMode) {
|
|
@@ -14902,6 +14933,18 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14902
14933
|
}
|
|
14903
14934
|
let className = "steedos-input-table";
|
|
14904
14935
|
|
|
14936
|
+
if (props.showIndex) {
|
|
14937
|
+
className += " steedos-show-index";
|
|
14938
|
+
}
|
|
14939
|
+
|
|
14940
|
+
if (buttonsForColumnOperations.length) {
|
|
14941
|
+
className += " steedos-has-operations";
|
|
14942
|
+
}
|
|
14943
|
+
|
|
14944
|
+
if (props.enableTree) {
|
|
14945
|
+
className += " steedos-tree-mode";
|
|
14946
|
+
}
|
|
14947
|
+
|
|
14905
14948
|
if (typeof props.className == "object") {
|
|
14906
14949
|
className = {
|
|
14907
14950
|
[className]: "true",
|