@steedos-widgets/amis-lib 3.6.2-beta.11 → 3.6.2-beta.13
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 +131 -106
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +131 -106
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +30 -25
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/fields/lookup.d.ts +2 -0
- package/dist/types/lib/input_table.d.ts +23 -15
- package/dist/types/schema/standard_import_data.amis.d.ts +7 -0
- package/dist/types/standard/button.d.ts +7 -0
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -381,6 +381,9 @@ const Router = {
|
|
|
381
381
|
if(uiSchema.enable_split){
|
|
382
382
|
defaultDisplay = "split";
|
|
383
383
|
}
|
|
384
|
+
if(window.innerWidth <= 768){
|
|
385
|
+
return "grid";
|
|
386
|
+
}
|
|
384
387
|
return value ? value : defaultDisplay;
|
|
385
388
|
},
|
|
386
389
|
|
|
@@ -2064,7 +2067,7 @@ async function getQuickEditSchema(field, options){
|
|
|
2064
2067
|
}
|
|
2065
2068
|
|
|
2066
2069
|
function getFieldWidth(width){
|
|
2067
|
-
const defaultWidth =
|
|
2070
|
+
const defaultWidth = null;
|
|
2068
2071
|
if(typeof width == 'string'){
|
|
2069
2072
|
if(isNaN(width)){
|
|
2070
2073
|
return width || defaultWidth;
|
|
@@ -2094,14 +2097,14 @@ async function getTableColumns(fields, options){
|
|
|
2094
2097
|
//增加quickEdit属性,实现快速编辑
|
|
2095
2098
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2096
2099
|
let className = "";
|
|
2097
|
-
if(
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2100
|
+
if(/Safari/.test(navigator.userAgent)){
|
|
2101
|
+
className += " whitespace-nowrap ";
|
|
2102
|
+
}else {
|
|
2103
|
+
if(field.wrap != true){
|
|
2101
2104
|
className += " whitespace-nowrap ";
|
|
2105
|
+
}else {
|
|
2106
|
+
className += " break-words ";
|
|
2102
2107
|
}
|
|
2103
|
-
}else {
|
|
2104
|
-
className += " break-words ";
|
|
2105
2108
|
}
|
|
2106
2109
|
let columnItem;
|
|
2107
2110
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
@@ -2996,15 +2999,8 @@ async function getTableApi(mainObject, fields, options){
|
|
|
2996
2999
|
}
|
|
2997
3000
|
});
|
|
2998
3001
|
};
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
isTreeOptionsComputed = true;
|
|
3002
|
-
}
|
|
3003
|
-
if(!isTreeOptionsComputed){
|
|
3004
|
-
// 如果api接口设置在缓存,缓存期间并不会重新请求接口,payload.data.rows是上次计算后的结果
|
|
3005
|
-
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
3006
|
-
assignIndexToTreeRecords(payload.data.rows, '');
|
|
3007
|
-
}
|
|
3002
|
+
payload.data.rows = getTreeOptions(records,{"valueField":"_id"});
|
|
3003
|
+
assignIndexToTreeRecords(payload.data.rows, '');
|
|
3008
3004
|
}
|
|
3009
3005
|
|
|
3010
3006
|
|
|
@@ -4900,9 +4896,16 @@ const getSchema$2 = (uiSchema) => {
|
|
|
4900
4896
|
"form": {
|
|
4901
4897
|
debug: false,
|
|
4902
4898
|
resetAfterSubmit: false,
|
|
4899
|
+
data: {
|
|
4900
|
+
editFormInited: true,
|
|
4901
|
+
},
|
|
4903
4902
|
initApi: {
|
|
4903
|
+
method: 'GET',
|
|
4904
4904
|
url: '/api/v1/queue_import_history/${recordId}?fields=["state"]',
|
|
4905
4905
|
sendOn: 'this.recordId',
|
|
4906
|
+
data: null,
|
|
4907
|
+
requestAdaptor: "return api;",
|
|
4908
|
+
adaptor: "return payload;",
|
|
4906
4909
|
responseData: {
|
|
4907
4910
|
importState: "${state}"
|
|
4908
4911
|
}
|
|
@@ -9024,7 +9027,7 @@ const getRecordPermissions = async (objectName, recordId)=>{
|
|
|
9024
9027
|
* @Author: baozhoutao@steedos.com
|
|
9025
9028
|
* @Date: 2022-07-05 15:55:39
|
|
9026
9029
|
* @LastEditors: baozhoutao@steedos.com
|
|
9027
|
-
* @LastEditTime: 2024-01-
|
|
9030
|
+
* @LastEditTime: 2024-01-24 10:18:17
|
|
9028
9031
|
* @Description:
|
|
9029
9032
|
*/
|
|
9030
9033
|
|
|
@@ -9123,7 +9126,9 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9123
9126
|
const foreign_key_value = arr[2] ? arr[1]+'.'+arr[2] : arr[1];
|
|
9124
9127
|
mainRelated[arr[0]] = foreign_key_value;
|
|
9125
9128
|
}
|
|
9126
|
-
}
|
|
9129
|
+
}
|
|
9130
|
+
// 防止related_lists中没有相关子表,但是details中有相关子表的情况
|
|
9131
|
+
if(!mainRelated[relatedObjectName]){
|
|
9127
9132
|
const details = _$1.union(mainObjectUiSchema.details,mainObjectUiSchema.lookup_details) || [];
|
|
9128
9133
|
for (const detail of details) {
|
|
9129
9134
|
const arr = detail.split(".");
|
|
@@ -10659,17 +10664,13 @@ function getReferenceToSync(field) {
|
|
|
10659
10664
|
|
|
10660
10665
|
function getLookupSapceUserTreeSchema(isMobile){
|
|
10661
10666
|
let apiAdaptor = `
|
|
10662
|
-
// console.log("===getLookupSapceUserTreeSchema===", JSON.stringify(payload));
|
|
10663
10667
|
const records = payload.data.options;
|
|
10664
|
-
let isTreeOptionsComputed = false;
|
|
10665
|
-
if(records.length === 1 && records[0].children){
|
|
10666
|
-
isTreeOptionsComputed = true;
|
|
10667
|
-
}
|
|
10668
|
-
if(isTreeOptionsComputed){
|
|
10669
|
-
return payload;
|
|
10670
|
-
}
|
|
10671
10668
|
const treeRecords = [];
|
|
10672
|
-
const getChildren = (records, childrenIds) => {
|
|
10669
|
+
const getChildren = (currentRecord, records, childrenIds) => {
|
|
10670
|
+
if (currentRecord.children && typeof currentRecord.children[0] === "object") {
|
|
10671
|
+
// 考虑api配置了cache缓存的话,不会请求接口但是会重新进这个接收适配器脚本且payload.data.options返回的会是上一次计算结果,这里直接返回计算过的children
|
|
10672
|
+
return currentRecord.children;
|
|
10673
|
+
}
|
|
10673
10674
|
if (!childrenIds) {
|
|
10674
10675
|
return;
|
|
10675
10676
|
}
|
|
@@ -10678,7 +10679,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10678
10679
|
});
|
|
10679
10680
|
_.each(children, (item) => {
|
|
10680
10681
|
if (item.children) {
|
|
10681
|
-
item.children = getChildren(records, item.children)
|
|
10682
|
+
item.children = getChildren(item, records, item.children)
|
|
10682
10683
|
}else{
|
|
10683
10684
|
item.children = [];
|
|
10684
10685
|
}
|
|
@@ -10704,7 +10705,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10704
10705
|
|
|
10705
10706
|
_.each(records, (record) => {
|
|
10706
10707
|
if (record.noParent == 1) {
|
|
10707
|
-
treeRecords.push(Object.assign({}, record, { children: getChildren(records, record.children) }));
|
|
10708
|
+
treeRecords.push(Object.assign({}, record, { children: getChildren(record, records, record.children) }));
|
|
10708
10709
|
}
|
|
10709
10710
|
});
|
|
10710
10711
|
console.log(treeRecords)
|
|
@@ -10754,6 +10755,7 @@ function getLookupSapceUserTreeSchema(isMobile){
|
|
|
10754
10755
|
}
|
|
10755
10756
|
},
|
|
10756
10757
|
"label": "",
|
|
10758
|
+
"mode": "normal",
|
|
10757
10759
|
"name": "organizations",
|
|
10758
10760
|
"multiple": false,
|
|
10759
10761
|
"joinValues": false,
|
|
@@ -12550,7 +12552,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12550
12552
|
}else {
|
|
12551
12553
|
convertData.className = 'm-0';
|
|
12552
12554
|
}
|
|
12553
|
-
if(readonly){
|
|
12555
|
+
if(readonly && ctx.mode !== 'edit'){
|
|
12554
12556
|
convertData.className = `${convertData.className} border-b`;
|
|
12555
12557
|
}
|
|
12556
12558
|
if(readonly){
|
|
@@ -12832,6 +12834,13 @@ const getSection = async (formFields, permissionFields, fieldSchemaArray, sectio
|
|
|
12832
12834
|
}
|
|
12833
12835
|
}
|
|
12834
12836
|
|
|
12837
|
+
fieldSetBody.forEach((field)=>{
|
|
12838
|
+
//判断label是否存在,不存在时将label的空占位元素隐藏
|
|
12839
|
+
if(!field.label){
|
|
12840
|
+
field.labelClassName = "none";
|
|
12841
|
+
}
|
|
12842
|
+
});
|
|
12843
|
+
|
|
12835
12844
|
// fieldSet 已支持显隐控制
|
|
12836
12845
|
const sectionFieldsVisibleOn = ___namespace.map(___namespace.compact(___namespace.map(fieldSetBody, 'visibleOn')), (visibleOn) => {
|
|
12837
12846
|
let visible = visibleOn;
|
|
@@ -12974,10 +12983,10 @@ function uuidv4() {
|
|
|
12974
12983
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12975
12984
|
* @Date: 2023-11-15 09:50:22
|
|
12976
12985
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12977
|
-
* @LastEditTime: 2024-01-
|
|
12986
|
+
* @LastEditTime: 2024-01-24 14:56:03
|
|
12978
12987
|
*/
|
|
12979
12988
|
|
|
12980
|
-
function getTablePrimaryKey(props){
|
|
12989
|
+
function getTablePrimaryKey(props) {
|
|
12981
12990
|
return props.primaryKey || "_id";
|
|
12982
12991
|
}
|
|
12983
12992
|
|
|
@@ -12987,22 +12996,22 @@ function getTablePrimaryKey(props){
|
|
|
12987
12996
|
* @param {*} primaryKey 主键字段名,一般为_id
|
|
12988
12997
|
* @returns 转换后的子表组件字段值
|
|
12989
12998
|
*/
|
|
12990
|
-
function getTableValueWithPrimaryKeyValue(value, primaryKey){
|
|
12991
|
-
if(!primaryKey){
|
|
12999
|
+
function getTableValueWithPrimaryKeyValue(value, primaryKey) {
|
|
13000
|
+
if (!primaryKey) {
|
|
12992
13001
|
return value;
|
|
12993
13002
|
}
|
|
12994
|
-
return (value || []).map((itemValue)=>{
|
|
13003
|
+
return (value || []).map((itemValue) => {
|
|
12995
13004
|
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里把primaryKey字段值保存了
|
|
12996
13005
|
const newItemValue = _$1.clone(itemValue);
|
|
12997
|
-
if(newItemValue[primaryKey]){
|
|
12998
|
-
if(newItemValue.children){
|
|
13006
|
+
if (newItemValue[primaryKey]) {
|
|
13007
|
+
if (newItemValue.children) {
|
|
12999
13008
|
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13000
13009
|
}
|
|
13001
13010
|
return newItemValue;
|
|
13002
13011
|
}
|
|
13003
13012
|
else {
|
|
13004
13013
|
newItemValue[primaryKey] = uuidv4();
|
|
13005
|
-
if(newItemValue.children){
|
|
13014
|
+
if (newItemValue.children) {
|
|
13006
13015
|
newItemValue.children = getTableValueWithPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13007
13016
|
}
|
|
13008
13017
|
return newItemValue;
|
|
@@ -13016,14 +13025,14 @@ function getTableValueWithPrimaryKeyValue(value, primaryKey){
|
|
|
13016
13025
|
* @param {*} primaryKey 主键字段名,一般为_id
|
|
13017
13026
|
* @returns 转换后的子表组件字段值
|
|
13018
13027
|
*/
|
|
13019
|
-
function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
|
|
13020
|
-
if(!primaryKey){
|
|
13028
|
+
function getTableValueWithoutPrimaryKeyValue(value, primaryKey) {
|
|
13029
|
+
if (!primaryKey) {
|
|
13021
13030
|
return value;
|
|
13022
13031
|
}
|
|
13023
|
-
return (value || []).map((itemValue)=>{
|
|
13032
|
+
return (value || []).map((itemValue) => {
|
|
13024
13033
|
//这里clone只是为了保险,不是必须的,每次修改子表数据是否都会生成新的primaryKey字段值是由pipeOut中识别autoGeneratePrimaryKeyValue决定的,跟这里没关系
|
|
13025
13034
|
const newItemValue = _$1.clone(itemValue);
|
|
13026
|
-
if(newItemValue.children){
|
|
13035
|
+
if (newItemValue.children) {
|
|
13027
13036
|
newItemValue.children = getTableValueWithoutPrimaryKeyValue(newItemValue.children, primaryKey);
|
|
13028
13037
|
}
|
|
13029
13038
|
delete newItemValue[primaryKey];
|
|
@@ -13037,12 +13046,12 @@ function getTableValueWithoutPrimaryKeyValue(value, primaryKey){
|
|
|
13037
13046
|
* @param {*} fieldPrefix 字段前缀
|
|
13038
13047
|
* @returns 转换后的子表组件字段值
|
|
13039
13048
|
*/
|
|
13040
|
-
function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
13049
|
+
function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
13041
13050
|
let convertedValue = [];
|
|
13042
|
-
(value || []).forEach((itemValue)=>{
|
|
13051
|
+
(value || []).forEach((itemValue) => {
|
|
13043
13052
|
var newItemValue = {};
|
|
13044
|
-
for(let n in itemValue){
|
|
13045
|
-
if(itemValue.hasOwnProperty(n)){
|
|
13053
|
+
for (let n in itemValue) {
|
|
13054
|
+
if (itemValue.hasOwnProperty(n)) {
|
|
13046
13055
|
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
13047
13056
|
}
|
|
13048
13057
|
}
|
|
@@ -13057,16 +13066,16 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
|
13057
13066
|
* @param {*} fieldPrefix 字段前缀
|
|
13058
13067
|
* @returns 转换后的子表组件字段值
|
|
13059
13068
|
*/
|
|
13060
|
-
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
|
|
13069
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
13061
13070
|
let convertedValue = [];
|
|
13062
|
-
(value || []).forEach((itemValue)=>{
|
|
13071
|
+
(value || []).forEach((itemValue) => {
|
|
13063
13072
|
var newItemValue = {};
|
|
13064
|
-
for(let n in itemValue){
|
|
13065
|
-
if(itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey){
|
|
13073
|
+
for (let n in itemValue) {
|
|
13074
|
+
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
13066
13075
|
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
13067
13076
|
}
|
|
13068
13077
|
}
|
|
13069
|
-
if(primaryKey && itemValue[primaryKey]){
|
|
13078
|
+
if (primaryKey && itemValue[primaryKey]) {
|
|
13070
13079
|
newItemValue[primaryKey] = itemValue[primaryKey];
|
|
13071
13080
|
}
|
|
13072
13081
|
convertedValue.push(newItemValue);
|
|
@@ -13080,7 +13089,7 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey){
|
|
|
13080
13089
|
* @param {*} fieldPrefix 字段前缀
|
|
13081
13090
|
* @returns 转换后的子表组件字段值
|
|
13082
13091
|
*/
|
|
13083
|
-
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix){
|
|
13092
|
+
function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
13084
13093
|
return (fields || []).map((item) => {
|
|
13085
13094
|
const newItem = _$1.clone(item);//这里不clone的话,会造成子表组件重新render,从而审批王那边点开子表行编辑窗口时报错
|
|
13086
13095
|
newItem.name = newItem.name.replace(new RegExp(`^${fieldPrefix}`), "");
|
|
@@ -13118,6 +13127,7 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13118
13127
|
name: field.name,
|
|
13119
13128
|
quickEdit: {
|
|
13120
13129
|
"type": "steedos-field",
|
|
13130
|
+
"mode": "inline",
|
|
13121
13131
|
"config": Object.assign({}, field, {
|
|
13122
13132
|
label: false
|
|
13123
13133
|
})
|
|
@@ -13197,7 +13207,9 @@ async function getInputTableColumns(props) {
|
|
|
13197
13207
|
}
|
|
13198
13208
|
}
|
|
13199
13209
|
if (field) {
|
|
13200
|
-
let
|
|
13210
|
+
let mode = typeof extendColumnProps.inlineEditMode === "boolean" ?
|
|
13211
|
+
extendColumnProps.inlineEditMode : showAsInlineEditMode;
|
|
13212
|
+
let tableCell = getInputTableCell(field, mode);
|
|
13201
13213
|
return Object.assign({}, tableCell, extendColumnProps);
|
|
13202
13214
|
}
|
|
13203
13215
|
else {
|
|
@@ -13220,7 +13232,7 @@ async function getInputTableColumns(props) {
|
|
|
13220
13232
|
*/
|
|
13221
13233
|
function getFormPagination(props, mode) {
|
|
13222
13234
|
let showPagination = true;
|
|
13223
|
-
if(mode === "new" && !!!props.editable){
|
|
13235
|
+
if (mode === "new" && !!!props.editable) {
|
|
13224
13236
|
//不允许编辑只允许新建时不应该让用户操作翻页
|
|
13225
13237
|
showPagination = false;
|
|
13226
13238
|
}
|
|
@@ -13236,37 +13248,41 @@ function getFormPagination(props, mode) {
|
|
|
13236
13248
|
let __formId = "${formId}";
|
|
13237
13249
|
let fieldValue = event.data.__tableItems;//这里不可以_.cloneDeep,因为翻页form中用的是event.data.__tableItems,直接变更其值即可改变表单中的值
|
|
13238
13250
|
let pageChangeDirection = context.props.pageChangeDirection;
|
|
13251
|
+
let mode = "${mode}";
|
|
13239
13252
|
// event.data中的index和__page分别表示当前要把表单数据提交到的行索引和用于标定下一页页码的当前页页码
|
|
13240
13253
|
// 一般来说__page = index + 1,但是可以让event.data中传入__page和index值不是这种联系。
|
|
13241
13254
|
// 比如__page设置为3,index设置为0表示把当前表单数据提交到第一页,但是跳转到第4页,弹出的表单中底下的新增和复制按钮依赖了此功能
|
|
13242
13255
|
// let currentPage = currentIndex + 1;
|
|
13243
13256
|
let currentPage = event.data.__page;
|
|
13244
13257
|
let currentIndex = event.data.index;
|
|
13245
|
-
|
|
13246
|
-
|
|
13247
|
-
|
|
13248
|
-
|
|
13249
|
-
|
|
13250
|
-
|
|
13251
|
-
|
|
13252
|
-
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13256
|
-
|
|
13258
|
+
if(mode !== "readonly"){
|
|
13259
|
+
// 新建编辑时,翻页才需要把当前页表单保存,只读时直接翻页即可
|
|
13260
|
+
// 翻页到下一页之前需要先把当前页改动的内容保存到中间变量__tableItems中
|
|
13261
|
+
let currentFormValues = scope.getComponentById(__formId).getValues();
|
|
13262
|
+
// 这里不clone的话,其值会带上__super属性
|
|
13263
|
+
currentFormValues = _.clone(currentFormValues);
|
|
13264
|
+
var parent = event.data.parent;
|
|
13265
|
+
var __parentIndex = event.data.__parentIndex;
|
|
13266
|
+
if(parent){
|
|
13267
|
+
fieldValue[__parentIndex].children[currentIndex] = currentFormValues;
|
|
13268
|
+
// 重写父节点,并且改变其某个属性以让子节点修改的内容回显到界面上
|
|
13269
|
+
fieldValue[__parentIndex] = Object.assign({}, fieldValue[__parentIndex], {
|
|
13270
|
+
children: fieldValue[__parentIndex].children,
|
|
13271
|
+
__fix_rerender_after_children_modified_tag: new Date().getTime()
|
|
13272
|
+
});
|
|
13273
|
+
}
|
|
13274
|
+
else{
|
|
13275
|
+
fieldValue[currentIndex] = currentFormValues;
|
|
13276
|
+
}
|
|
13277
|
+
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
13278
|
+
doAction({
|
|
13279
|
+
"componentId": "${props.id}",
|
|
13280
|
+
"actionType": "setValue",
|
|
13281
|
+
"args": {
|
|
13282
|
+
"value": fieldValue
|
|
13283
|
+
}
|
|
13257
13284
|
});
|
|
13258
13285
|
}
|
|
13259
|
-
else{
|
|
13260
|
-
fieldValue[currentIndex] = currentFormValues;
|
|
13261
|
-
}
|
|
13262
|
-
// 翻页到下一页前需要同时把改动的内容保存到最终正式的表单字段中,所以额外给正式表单字段执行一次setValue
|
|
13263
|
-
doAction({
|
|
13264
|
-
"componentId": "${props.id}",
|
|
13265
|
-
"actionType": "setValue",
|
|
13266
|
-
"args": {
|
|
13267
|
-
"value": fieldValue
|
|
13268
|
-
}
|
|
13269
|
-
});
|
|
13270
13286
|
|
|
13271
13287
|
// 以下是翻页逻辑,翻到下一页并把下一页内容显示到表单上
|
|
13272
13288
|
let targetPage;
|
|
@@ -13326,7 +13342,7 @@ function getFormPagination(props, mode) {
|
|
|
13326
13342
|
{
|
|
13327
13343
|
"type": "tpl",
|
|
13328
13344
|
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
13329
|
-
"tpl": "${__page}/${__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length}"
|
|
13345
|
+
"tpl": "${__page}/${__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length}"
|
|
13330
13346
|
},
|
|
13331
13347
|
{
|
|
13332
13348
|
"type": "button",
|
|
@@ -13336,7 +13352,7 @@ function getFormPagination(props, mode) {
|
|
|
13336
13352
|
"pageChangeDirection": "next",
|
|
13337
13353
|
// "disabledOn": showPagination ? "${__page >= __tableItems.length}" : "true",
|
|
13338
13354
|
// 这里用__super.parent,加__super是为了防止当前记录有字段名为parent的重名变量
|
|
13339
|
-
"disabledOn": showPagination ? "${__page >= (__super.parent ? __tableItems[__parentIndex]['children'].length : __tableItems.length)}" : "true",
|
|
13355
|
+
"disabledOn": showPagination ? "${__page >= (__super.parent ? COMPACT(__tableItems[__parentIndex]['children']).length : COMPACT(__tableItems).length)}" : "true",
|
|
13340
13356
|
"size": "sm",
|
|
13341
13357
|
"id": buttonNextId,
|
|
13342
13358
|
"onEvent": {
|
|
@@ -13656,7 +13672,7 @@ async function getButtonActions(props, mode) {
|
|
|
13656
13672
|
let formPaginationId = getComponentId("form_pagination", props.id);
|
|
13657
13673
|
let parentFormData = "${__super.__super.__super.__super || {}}";
|
|
13658
13674
|
let amisVersion = getComparableAmisVersion();
|
|
13659
|
-
if(amisVersion < 3.6){
|
|
13675
|
+
if (amisVersion < 3.6) {
|
|
13660
13676
|
parentFormData = "${__super.__super || {}}";
|
|
13661
13677
|
}
|
|
13662
13678
|
if (mode == "new" || mode == "edit") {
|
|
@@ -13820,13 +13836,13 @@ async function getButtonActions(props, mode) {
|
|
|
13820
13836
|
`;
|
|
13821
13837
|
let dialogButtons = [
|
|
13822
13838
|
{
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
|
|
13826
|
-
|
|
13839
|
+
"type": "button",
|
|
13840
|
+
"label": "完成",
|
|
13841
|
+
"actionType": "confirm",
|
|
13842
|
+
"level": "primary"
|
|
13827
13843
|
}
|
|
13828
13844
|
];
|
|
13829
|
-
if(props.addable){
|
|
13845
|
+
if (props.addable) {
|
|
13830
13846
|
// 有新增行权限时额外添加新增和复制按钮
|
|
13831
13847
|
dialogButtons = [
|
|
13832
13848
|
{
|
|
@@ -13899,7 +13915,7 @@ async function getButtonActions(props, mode) {
|
|
|
13899
13915
|
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
13900
13916
|
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
13901
13917
|
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
13902
|
-
|
|
13918
|
+
},
|
|
13903
13919
|
"actions": dialogButtons,
|
|
13904
13920
|
"onEvent": {
|
|
13905
13921
|
"confirm": {
|
|
@@ -13997,7 +14013,10 @@ async function getButtonActions(props, mode) {
|
|
|
13997
14013
|
// 为了解决"弹出的dialog窗口中子表组件会影响页面布局界面中父作用域字段值",比如设计字段布局微页面中的设置分组功能,弹出的就是子表dialog
|
|
13998
14014
|
// 所以这里使用json|toJson转一次,断掉event.data.__tableItems与上层任用域中props.name的联系
|
|
13999
14015
|
// "__tableItems": `\${${props.name}|json|toJson}`
|
|
14000
|
-
"__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
14016
|
+
// "__tableItems": `\${((__super.parent ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
14017
|
+
// 在节点嵌套情况下,当前节点正好是带children属性的节点的话,这里弹出的dialog映射到的会是children数组,这是amis目前的规则,
|
|
14018
|
+
// 所以这里加判断有children时,用__super.__super让映射到正确的作用域层,如果不加,则__tableItems取到的会是children数组,而不是整个子表组件的值
|
|
14019
|
+
"__tableItems": `\${((children ? __super.__super.${props.name} : __super.${props.name}) || [])|json|toJson}`
|
|
14001
14020
|
},
|
|
14002
14021
|
}
|
|
14003
14022
|
}
|
|
@@ -14134,7 +14153,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14134
14153
|
}
|
|
14135
14154
|
let primaryKey = getTablePrimaryKey(props);
|
|
14136
14155
|
let showOperation = props.showOperation;
|
|
14137
|
-
if(showOperation !== false){
|
|
14156
|
+
if (showOperation !== false) {
|
|
14138
14157
|
showOperation = true;
|
|
14139
14158
|
}
|
|
14140
14159
|
let fieldPrefix = props.fieldPrefix;
|
|
@@ -14146,7 +14165,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14146
14165
|
let buttonsForColumnOperations = [];
|
|
14147
14166
|
let inlineEditMode = props.inlineEditMode;
|
|
14148
14167
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
14149
|
-
if(showOperation){
|
|
14168
|
+
if (showOperation) {
|
|
14150
14169
|
if (props.editable) {
|
|
14151
14170
|
let showEditButton = true;
|
|
14152
14171
|
if (showAsInlineEditMode) {
|
|
@@ -14180,7 +14199,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14180
14199
|
let amis = props["input-table"] || props.amis || {};//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
14181
14200
|
let inputTableSchema = {
|
|
14182
14201
|
"type": "input-table",
|
|
14183
|
-
"
|
|
14202
|
+
"mode": "normal",
|
|
14184
14203
|
"name": props.name,
|
|
14185
14204
|
//不可以addable/editable/removable设置为true,因为会在原生的操作列显示操作按钮图标,此开关实测只控制这个按钮显示不会影响功能
|
|
14186
14205
|
// "addable": props.addable,
|
|
@@ -14197,31 +14216,31 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14197
14216
|
"showFooterAddBtn": false,
|
|
14198
14217
|
"className": props.tableClassName,
|
|
14199
14218
|
"pipeIn": (value, data) => {
|
|
14200
|
-
if(fieldPrefix){
|
|
14219
|
+
if (fieldPrefix) {
|
|
14201
14220
|
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
14202
14221
|
}
|
|
14203
|
-
if(primaryKey){
|
|
14222
|
+
if (primaryKey) {
|
|
14204
14223
|
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
14205
14224
|
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
14206
14225
|
// 这里要注意,流程详细设置界面的字段设置功能中的子表组件中,数据库里保存的子表字段行数据是有primaryKey字段值的,它不依赖这里自动生成行primaryKey值功能
|
|
14207
14226
|
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
14208
14227
|
}
|
|
14209
|
-
if(amis.pipeIn){
|
|
14210
|
-
if(typeof amis.pipeIn === 'function'){
|
|
14228
|
+
if (amis.pipeIn) {
|
|
14229
|
+
if (typeof amis.pipeIn === 'function') {
|
|
14211
14230
|
return amis.pipeIn(value, data);
|
|
14212
14231
|
}
|
|
14213
14232
|
}
|
|
14214
14233
|
return value;
|
|
14215
14234
|
},
|
|
14216
14235
|
"pipeOut": (value, data) => {
|
|
14217
|
-
value = (value || []).map(function(item){
|
|
14236
|
+
value = (value || []).map(function (item) {
|
|
14218
14237
|
delete item.__fix_rerender_after_children_modified_tag;
|
|
14219
14238
|
return item;
|
|
14220
14239
|
});
|
|
14221
|
-
if(fieldPrefix){
|
|
14240
|
+
if (fieldPrefix) {
|
|
14222
14241
|
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
14223
14242
|
}
|
|
14224
|
-
if(props.autoGeneratePrimaryKeyValue === true){
|
|
14243
|
+
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
14225
14244
|
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
14226
14245
|
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
14227
14246
|
value = getTableValueWithPrimaryKeyValue(value, primaryKey);
|
|
@@ -14233,8 +14252,8 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14233
14252
|
// 只有autoGeneratePrimaryKey配置为true时,每行的primaryKey字段值才会始终保持不变
|
|
14234
14253
|
value = getTableValueWithoutPrimaryKeyValue(value, primaryKey);
|
|
14235
14254
|
}
|
|
14236
|
-
if(amis.pipeOut){
|
|
14237
|
-
if(typeof amis.pipeOut === 'function'){
|
|
14255
|
+
if (amis.pipeOut) {
|
|
14256
|
+
if (typeof amis.pipeOut === 'function') {
|
|
14238
14257
|
return amis.pipeOut(value, data);
|
|
14239
14258
|
}
|
|
14240
14259
|
}
|
|
@@ -14249,9 +14268,6 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14249
14268
|
"width": buttonsForColumnOperations.length > 1 ? "60px" : "20px"
|
|
14250
14269
|
});
|
|
14251
14270
|
}
|
|
14252
|
-
if (showAsInlineEditMode) {
|
|
14253
|
-
inputTableSchema.needConfirm = false;
|
|
14254
|
-
}
|
|
14255
14271
|
if (amis) {
|
|
14256
14272
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
14257
14273
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
@@ -14293,10 +14309,19 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14293
14309
|
});
|
|
14294
14310
|
}
|
|
14295
14311
|
let schema = {
|
|
14296
|
-
"type": "
|
|
14297
|
-
"body":
|
|
14298
|
-
|
|
14299
|
-
|
|
14312
|
+
"type": "control",
|
|
14313
|
+
"body": {
|
|
14314
|
+
"type": "service",
|
|
14315
|
+
"body": schemaBody,
|
|
14316
|
+
"id": serviceId
|
|
14317
|
+
},
|
|
14318
|
+
"label": props.label,
|
|
14319
|
+
"labelClassName": props.label ? props.labelClassName : "none",
|
|
14320
|
+
"labelRemark": props.labelRemark,
|
|
14321
|
+
"labelAlign": props.labelAlign,
|
|
14322
|
+
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14323
|
+
"mode": props.mode || null,
|
|
14324
|
+
"className": props.className
|
|
14300
14325
|
};
|
|
14301
14326
|
// console.log("===schema===", schema);
|
|
14302
14327
|
return schema;
|