@steedos-widgets/amis-lib 3.6.4-beta.5 → 3.6.4-beta.7
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 +78 -11
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +78 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +50 -43
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -2395,7 +2395,7 @@ function getMobileLines(tpls){
|
|
|
2395
2395
|
}
|
|
2396
2396
|
if(isLeft){
|
|
2397
2397
|
// 左侧半行
|
|
2398
|
-
lineChildrenClassName = "steedos-listview-item-left truncate
|
|
2398
|
+
lineChildrenClassName = "steedos-listview-item-left truncate";
|
|
2399
2399
|
if(item.field.is_wide){
|
|
2400
2400
|
// 左侧全行样式可以单独写,如果需要配置两行省略号效果,可以加样式类 two-lines-truncate
|
|
2401
2401
|
lineChildrenClassName = "steedos-listview-item-wide";
|
|
@@ -2407,7 +2407,7 @@ function getMobileLines(tpls){
|
|
|
2407
2407
|
}
|
|
2408
2408
|
else {
|
|
2409
2409
|
// 右侧半行,这里加样式类 flex flex-shrink-0,是为了省略号只显示在左半行,右半行文字一般比较短,如果也加省略号效果的话,左侧文字多的话,右侧没几个字就显示省略号了
|
|
2410
|
-
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0
|
|
2410
|
+
lineChildrenClassName = "steedos-listview-item-right truncate ml-2 flex flex-shrink-0";
|
|
2411
2411
|
}
|
|
2412
2412
|
//支持字段amis属性配置classname,识别classname的类型,与原样式合并
|
|
2413
2413
|
var className;
|
|
@@ -6955,6 +6955,15 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6955
6955
|
divWidth = divWidth - 210;
|
|
6956
6956
|
}
|
|
6957
6957
|
|
|
6958
|
+
if(options._inDrawer){
|
|
6959
|
+
try {
|
|
6960
|
+
divWidth = new Number($("html").css("font-size").replace('px', '')) * 60;
|
|
6961
|
+
} catch (error) {
|
|
6962
|
+
console.error(error);
|
|
6963
|
+
divWidth = 16 * 60;
|
|
6964
|
+
}
|
|
6965
|
+
}
|
|
6966
|
+
|
|
6958
6967
|
// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
6959
6968
|
max = Math.trunc(divWidth / 200 );
|
|
6960
6969
|
if(max > 10){
|
|
@@ -13427,9 +13436,11 @@ function uuidv4() {
|
|
|
13427
13436
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
13428
13437
|
* @Date: 2023-11-15 09:50:22
|
|
13429
13438
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
13430
|
-
* @LastEditTime: 2024-
|
|
13439
|
+
* @LastEditTime: 2024-02-29 18:36:58
|
|
13431
13440
|
*/
|
|
13432
13441
|
|
|
13442
|
+
const fieldPrefixSplit = "__";
|
|
13443
|
+
|
|
13433
13444
|
/**
|
|
13434
13445
|
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13435
13446
|
* amis #9520修正后此函数及相关代码可以移除
|
|
@@ -13544,7 +13555,12 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
|
13544
13555
|
var newItemValue = {};
|
|
13545
13556
|
for (let n in itemValue) {
|
|
13546
13557
|
if (itemValue.hasOwnProperty(n)) {
|
|
13547
|
-
|
|
13558
|
+
if(n === "children"){
|
|
13559
|
+
newItemValue.children = getTableValueWithoutFieldPrefix(itemValue.children, fieldPrefix);
|
|
13560
|
+
}
|
|
13561
|
+
else {
|
|
13562
|
+
newItemValue[n.replace(new RegExp(`^${fieldPrefix}`), "")] = itemValue[n];
|
|
13563
|
+
}
|
|
13548
13564
|
}
|
|
13549
13565
|
}
|
|
13550
13566
|
convertedValue.push(newItemValue);
|
|
@@ -13565,7 +13581,12 @@ function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
|
13565
13581
|
var newItemValue = {};
|
|
13566
13582
|
for (let n in itemValue) {
|
|
13567
13583
|
if (itemValue.hasOwnProperty(n) && typeof itemValue[n] !== undefined && n !== primaryKey) {
|
|
13568
|
-
|
|
13584
|
+
if(n === "children"){
|
|
13585
|
+
newItemValue.children = getTableValuePrependFieldPrefix(itemValue.children, fieldPrefix, primaryKey);
|
|
13586
|
+
}
|
|
13587
|
+
else {
|
|
13588
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
13589
|
+
}
|
|
13569
13590
|
}
|
|
13570
13591
|
}
|
|
13571
13592
|
if (primaryKey && itemValue[primaryKey]) {
|
|
@@ -13590,6 +13611,23 @@ function getTableFieldsWithoutFieldPrefix(fields, fieldPrefix) {
|
|
|
13590
13611
|
});
|
|
13591
13612
|
}
|
|
13592
13613
|
|
|
13614
|
+
/**
|
|
13615
|
+
* 子表组件字段集合属性中每个字段name补上指定前缀
|
|
13616
|
+
* 因amis存在bug:input-table内的字段在行编辑模式时会受到外层相同name的字段的影响 https://github.com/baidu/amis/issues/9653
|
|
13617
|
+
* 在渲染input table组件时统一调用此函数加上前缀来避开同名字段问题
|
|
13618
|
+
* @param {*} fields 子表组件字段集合,数组
|
|
13619
|
+
* @param {*} fieldPrefix 字段前缀
|
|
13620
|
+
* @returns 转换后的子表组件字段值
|
|
13621
|
+
*/
|
|
13622
|
+
function getTableFieldsPrependFieldPrefix(fields, fieldPrefix) {
|
|
13623
|
+
return (fields || []).map((item) => {
|
|
13624
|
+
const newItem = clone(item);
|
|
13625
|
+
newItem.name = `${fieldPrefix}${item.name}`;
|
|
13626
|
+
newItem.__originalName = item.name;
|
|
13627
|
+
return newItem;
|
|
13628
|
+
});
|
|
13629
|
+
}
|
|
13630
|
+
|
|
13593
13631
|
/**
|
|
13594
13632
|
* @param {*} props
|
|
13595
13633
|
* @param {*} mode edit/new/readonly
|
|
@@ -13600,6 +13638,9 @@ function getFormFields(props, mode = "edit") {
|
|
|
13600
13638
|
if (fieldPrefix) {
|
|
13601
13639
|
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13602
13640
|
}
|
|
13641
|
+
else {
|
|
13642
|
+
fields = getTableFieldsPrependFieldPrefix(fields, props.name + fieldPrefixSplit);
|
|
13643
|
+
}
|
|
13603
13644
|
return (fields || []).map(function (item) {
|
|
13604
13645
|
let formItem = {
|
|
13605
13646
|
"type": "steedos-field",
|
|
@@ -13668,7 +13709,7 @@ function getComponentId(name, tag) {
|
|
|
13668
13709
|
* @param {*} props
|
|
13669
13710
|
* @param {*} mode edit/new/readonly
|
|
13670
13711
|
*/
|
|
13671
|
-
async function getInputTableColumns(props) {
|
|
13712
|
+
async function getInputTableColumns(props, buttonsForColumnOperations) {
|
|
13672
13713
|
let columns = props.columns || [];
|
|
13673
13714
|
let inlineEditMode = props.inlineEditMode;
|
|
13674
13715
|
let showAsInlineEditMode = inlineEditMode && props.editable;
|
|
@@ -13679,6 +13720,12 @@ async function getInputTableColumns(props) {
|
|
|
13679
13720
|
if (fieldPrefix) {
|
|
13680
13721
|
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
13681
13722
|
}
|
|
13723
|
+
else {
|
|
13724
|
+
fields = getTableFieldsPrependFieldPrefix(fields, props.name + fieldPrefixSplit);
|
|
13725
|
+
columns = getTableFieldsPrependFieldPrefix(columns.map(function (item) {
|
|
13726
|
+
return typeof item == "string" ? { name: item } : item;
|
|
13727
|
+
}), props.name + fieldPrefixSplit);
|
|
13728
|
+
}
|
|
13682
13729
|
if (inlineEditMode == true) {
|
|
13683
13730
|
let popOverContainerSelector = "";
|
|
13684
13731
|
let popOverContainer = props.popOverContainer && props.popOverContainer();
|
|
@@ -13702,7 +13749,7 @@ async function getInputTableColumns(props) {
|
|
|
13702
13749
|
}
|
|
13703
13750
|
|
|
13704
13751
|
if (columns && columns.length) {
|
|
13705
|
-
return columns.map(function (column) {
|
|
13752
|
+
return columns.map(function (column, index) {
|
|
13706
13753
|
let field, extendColumnProps = {};
|
|
13707
13754
|
if (typeof column === "string") {
|
|
13708
13755
|
// 如果字符串,则取出要显示的列配置
|
|
@@ -13728,9 +13775,13 @@ async function getInputTableColumns(props) {
|
|
|
13728
13775
|
let className = "";
|
|
13729
13776
|
//判断是否换行,目前规则默认换行
|
|
13730
13777
|
if(extendColumnProps.wrap != true){
|
|
13731
|
-
className += " whitespace-nowrap
|
|
13778
|
+
className += " whitespace-nowrap";
|
|
13732
13779
|
}else {
|
|
13733
|
-
className += " break-words
|
|
13780
|
+
className += " break-words";
|
|
13781
|
+
}
|
|
13782
|
+
|
|
13783
|
+
if(buttonsForColumnOperations.length == 0 && !props.showIndex && index == 0) {
|
|
13784
|
+
className += " antd-Table-primayCell";
|
|
13734
13785
|
}
|
|
13735
13786
|
//合并classname
|
|
13736
13787
|
if (typeof extendColumnProps.className == "object") {
|
|
@@ -13749,9 +13800,12 @@ async function getInputTableColumns(props) {
|
|
|
13749
13800
|
});
|
|
13750
13801
|
}
|
|
13751
13802
|
else {
|
|
13752
|
-
return fields.map(function (field) {
|
|
13803
|
+
return fields.map(function (field, index) {
|
|
13753
13804
|
let tableCell = getInputTableCell(field, showAsInlineEditMode);
|
|
13754
13805
|
tableCell.className = " whitespace-nowrap ";
|
|
13806
|
+
if(buttonsForColumnOperations.length == 0 && !props.showIndex && index == 0) {
|
|
13807
|
+
tableCell.className += " antd-Table-primayCell";
|
|
13808
|
+
}
|
|
13755
13809
|
return tableCell;
|
|
13756
13810
|
}) || [];
|
|
13757
13811
|
}
|
|
@@ -13969,6 +14023,10 @@ function getFormPaginationWrapper(props, form, mode) {
|
|
|
13969
14023
|
let getTableValueWithoutFieldPrefix = new Function('v', 'f', "return (" + ${getTableValueWithoutFieldPrefix.toString()} + ")(v, f)");
|
|
13970
14024
|
lastestFieldValue = getTableValueWithoutFieldPrefix(lastestFieldValue, fieldPrefix);
|
|
13971
14025
|
}
|
|
14026
|
+
else{
|
|
14027
|
+
let getTableValuePrependFieldPrefix = new Function('v', 'f', "return (" + ${getTableValuePrependFieldPrefix.toString()} + ")(v, f)");
|
|
14028
|
+
lastestFieldValue = getTableValuePrependFieldPrefix(lastestFieldValue, "${props.name + fieldPrefixSplit}", "${primaryKey}");
|
|
14029
|
+
}
|
|
13972
14030
|
//不可以直接像event.data.__tableItems = lastestFieldValue; 这样整个赋值,否则作用域会断
|
|
13973
14031
|
let mode = "${mode || ''}";
|
|
13974
14032
|
if(mode === "new"){
|
|
@@ -14775,6 +14833,9 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14775
14833
|
if (fieldPrefix) {
|
|
14776
14834
|
fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
|
|
14777
14835
|
}
|
|
14836
|
+
else {
|
|
14837
|
+
fields = getTableFieldsPrependFieldPrefix(fields, props.name + fieldPrefixSplit);
|
|
14838
|
+
}
|
|
14778
14839
|
let serviceId = getComponentId("table_service", props.id);
|
|
14779
14840
|
let buttonsForColumnOperations = [];
|
|
14780
14841
|
let inlineEditMode = props.inlineEditMode;
|
|
@@ -14826,7 +14887,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14826
14887
|
"showIndex": props.showIndex,
|
|
14827
14888
|
"perPage": props.perPage,
|
|
14828
14889
|
"id": props.id,
|
|
14829
|
-
"columns": await getInputTableColumns(props),
|
|
14890
|
+
"columns": await getInputTableColumns(props, buttonsForColumnOperations),
|
|
14830
14891
|
// "needConfirm": false, //不可以配置为false,否则,单元格都是可编辑状态,且很多static类型无法正常显示,比如static-mapping
|
|
14831
14892
|
"strictMode": props.strictMode,
|
|
14832
14893
|
"showTableAddBtn": false,
|
|
@@ -14836,6 +14897,9 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14836
14897
|
if (fieldPrefix) {
|
|
14837
14898
|
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
14838
14899
|
}
|
|
14900
|
+
else {
|
|
14901
|
+
value = getTableValuePrependFieldPrefix(value, props.name + fieldPrefixSplit, primaryKey);
|
|
14902
|
+
}
|
|
14839
14903
|
value = getTableValueWithEmptyValue(value, fields);
|
|
14840
14904
|
if (primaryKey) {
|
|
14841
14905
|
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
@@ -14858,6 +14922,9 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14858
14922
|
if (fieldPrefix) {
|
|
14859
14923
|
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
14860
14924
|
}
|
|
14925
|
+
else {
|
|
14926
|
+
value = getTableValueWithoutFieldPrefix(value, props.name + fieldPrefixSplit);
|
|
14927
|
+
}
|
|
14861
14928
|
value = getTableValueWithoutEmptyValue(value, fields);
|
|
14862
14929
|
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
14863
14930
|
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|