@steedos-widgets/amis-lib 3.6.2-beta.8 → 3.6.2-beta.9
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 +100 -19
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +100 -19
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +43 -15
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -340,22 +340,26 @@ const getSteedosAuth = () => {
|
|
|
340
340
|
* @Description:
|
|
341
341
|
*/
|
|
342
342
|
|
|
343
|
-
|
|
344
343
|
const Router = {
|
|
345
344
|
getTabDisplayAs(tab_id){
|
|
345
|
+
const uiSchema = getUISchemaSync$1(tab_id, false);
|
|
346
346
|
var urlSearch = new URLSearchParams(document.location.search);
|
|
347
347
|
if(urlSearch.has('display')){
|
|
348
348
|
return urlSearch.get('display')
|
|
349
349
|
}
|
|
350
350
|
const key = `tab_${tab_id}_display`;
|
|
351
351
|
// const key = `page_display`;
|
|
352
|
-
const value =
|
|
353
|
-
|
|
352
|
+
const value = sessionStorage.getItem(key);
|
|
353
|
+
let defaultDisplay = "grid";
|
|
354
|
+
if(uiSchema.enable_split){
|
|
355
|
+
defaultDisplay = "split";
|
|
356
|
+
}
|
|
357
|
+
return value ? value : defaultDisplay;
|
|
354
358
|
},
|
|
355
359
|
|
|
356
360
|
setTabDisplayAs(tab_id, displayAs){
|
|
357
361
|
const key = `tab_${tab_id}_display`;
|
|
358
|
-
|
|
362
|
+
sessionStorage.setItem(key, displayAs);
|
|
359
363
|
},
|
|
360
364
|
getAppPath({formFactor, appId}){
|
|
361
365
|
return `/app/${appId}`;
|
|
@@ -2060,7 +2064,11 @@ async function getTableColumns(fields, options){
|
|
|
2060
2064
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
2061
2065
|
let className = "";
|
|
2062
2066
|
if(field.wrap != true){
|
|
2063
|
-
|
|
2067
|
+
if(field.wrap != false && field.is_wide){
|
|
2068
|
+
className += " break-words ";
|
|
2069
|
+
}else {
|
|
2070
|
+
className += " whitespace-nowrap ";
|
|
2071
|
+
}
|
|
2064
2072
|
}else {
|
|
2065
2073
|
className += " break-words ";
|
|
2066
2074
|
}
|
|
@@ -2159,12 +2167,12 @@ async function getTableColumns(fields, options){
|
|
|
2159
2167
|
if(field.type === 'textarea'){
|
|
2160
2168
|
className += 'min-w-56';
|
|
2161
2169
|
}
|
|
2162
|
-
if(field.type === 'date'){
|
|
2163
|
-
|
|
2164
|
-
}
|
|
2165
|
-
if(field.type === 'datetime'){
|
|
2166
|
-
|
|
2167
|
-
}
|
|
2170
|
+
// if(field.type === 'date'){
|
|
2171
|
+
// className += 'date-min-w';
|
|
2172
|
+
// }
|
|
2173
|
+
// if(field.type === 'datetime'){
|
|
2174
|
+
// className += 'datetime-min-w';
|
|
2175
|
+
// }
|
|
2168
2176
|
|
|
2169
2177
|
//field上的amis属性里的clssname需要单独判断类型合并
|
|
2170
2178
|
if (typeof field.amis?.className == "object") {
|
|
@@ -6731,8 +6739,27 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6731
6739
|
let max = 10;
|
|
6732
6740
|
if(options.formFactor === 'SMALL'){
|
|
6733
6741
|
max = 4;
|
|
6742
|
+
}else {
|
|
6743
|
+
|
|
6744
|
+
let divWidth = window.innerWidth;
|
|
6745
|
+
|
|
6746
|
+
if(options.display === 'split'){
|
|
6747
|
+
divWidth = divWidth - 388;
|
|
6748
|
+
}
|
|
6749
|
+
|
|
6750
|
+
if(document.body.classList.contains('sidebar')){
|
|
6751
|
+
divWidth = divWidth - 210;
|
|
6752
|
+
}
|
|
6753
|
+
|
|
6754
|
+
// 根据屏幕宽度计算显示数量, 使高亮字段只占1行
|
|
6755
|
+
max = Math.trunc(divWidth / 200 );
|
|
6756
|
+
if(max > 10){
|
|
6757
|
+
max = 10;
|
|
6758
|
+
}
|
|
6734
6759
|
}
|
|
6735
6760
|
|
|
6761
|
+
// console.log('=======================max=========================', max)
|
|
6762
|
+
|
|
6736
6763
|
if(objectSchema.compactLayouts){
|
|
6737
6764
|
const details = [];
|
|
6738
6765
|
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
@@ -6746,11 +6773,26 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6746
6773
|
}
|
|
6747
6774
|
});
|
|
6748
6775
|
|
|
6776
|
+
// 注意: 以下注释不能删除. tailwind css 动态编译时会识别以下注释, 生成对应的样式
|
|
6777
|
+
// xl:grid-cols-1
|
|
6778
|
+
// xl:grid-cols-2
|
|
6779
|
+
// xl:grid-cols-3
|
|
6780
|
+
// xl:grid-cols-4
|
|
6781
|
+
// xl:grid-cols-5
|
|
6782
|
+
// xl:grid-cols-6
|
|
6783
|
+
// xl:grid-cols-7
|
|
6784
|
+
// xl:grid-cols-8
|
|
6785
|
+
// xl:grid-cols-9
|
|
6786
|
+
// xl:grid-cols-10
|
|
6787
|
+
// xl:grid-cols-11
|
|
6788
|
+
// xl:grid-cols-12
|
|
6789
|
+
|
|
6749
6790
|
body.push({
|
|
6750
6791
|
"type": "wrapper",
|
|
6751
6792
|
"body": {
|
|
6752
6793
|
"type": "form",
|
|
6753
|
-
"className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
|
|
6794
|
+
// "className": "gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 2xl:grid-cols-5 3xl:grid-cols-8 4xl:grid-cols-8 5xl:grid-cols-10", //max-h-12 overflow-hidden
|
|
6795
|
+
"className": `gap-2 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-5 xl:grid-cols-${max}`,
|
|
6754
6796
|
"wrapWithPanel": false,
|
|
6755
6797
|
"actions": [],
|
|
6756
6798
|
"body": details,
|
|
@@ -7820,14 +7862,14 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7820
7862
|
{
|
|
7821
7863
|
"type": "button",
|
|
7822
7864
|
"label": i18next.t('frontend_display_type_is_table'),
|
|
7823
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
7865
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'grid');let url = document.location.pathname; var urlSearch = new URLSearchParams(document.location.search); if(urlSearch.get(\"side_object\") && urlSearch.get(\"side_listview_id\")){url=`/app/${props.data.appId}/${urlSearch.get(\"side_object\")}/grid/${urlSearch.get(\"side_listview_id\")}`;}; props.env.jumpTo(url + '?display=grid');",
|
|
7824
7866
|
"rightIcon": displayAs != 'split' ? "fa fa-check" : null,
|
|
7825
7867
|
"rightIconClassName": "m-l-sm"
|
|
7826
7868
|
},
|
|
7827
7869
|
{
|
|
7828
7870
|
"type": "button",
|
|
7829
7871
|
"label": i18next.t('frontend_display_type_is_split'),
|
|
7830
|
-
"onClick": "const key = 'tab_"+objectName+"_display';
|
|
7872
|
+
"onClick": "const key = 'tab_"+objectName+"_display';sessionStorage.setItem(key, 'split');const url = document.location.pathname + '?display=split'; props.env.jumpTo(url);",
|
|
7831
7873
|
"rightIcon": displayAs === 'split' ? "fa fa-check" : null,
|
|
7832
7874
|
"rightIconClassName": "m-l-sm"
|
|
7833
7875
|
}
|
|
@@ -12885,7 +12927,7 @@ async function getFormBody(permissionFields, formFields, ctx){
|
|
|
12885
12927
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12886
12928
|
* @Date: 2023-11-15 09:50:22
|
|
12887
12929
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
12888
|
-
* @LastEditTime: 2024-01-
|
|
12930
|
+
* @LastEditTime: 2024-01-18 10:29:57
|
|
12889
12931
|
*/
|
|
12890
12932
|
|
|
12891
12933
|
/**
|
|
@@ -12906,6 +12948,26 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix){
|
|
|
12906
12948
|
return convertedValue;
|
|
12907
12949
|
}
|
|
12908
12950
|
|
|
12951
|
+
/**
|
|
12952
|
+
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
12953
|
+
* @param {*} value 子表组件字段值,数组
|
|
12954
|
+
* @param {*} fieldPrefix 字段前缀
|
|
12955
|
+
* @returns 转换后的子表组件字段值
|
|
12956
|
+
*/
|
|
12957
|
+
function getTableValuePrependFieldPrefix(value, fieldPrefix){
|
|
12958
|
+
let convertedValue = [];
|
|
12959
|
+
(value || []).forEach((itemValue)=>{
|
|
12960
|
+
var newItemValue = {};
|
|
12961
|
+
for(let n in itemValue){
|
|
12962
|
+
if(typeof itemValue[n] !== undefined){
|
|
12963
|
+
newItemValue[`${fieldPrefix}${n}`] = itemValue[n];
|
|
12964
|
+
}
|
|
12965
|
+
}
|
|
12966
|
+
convertedValue.push(newItemValue);
|
|
12967
|
+
});
|
|
12968
|
+
return convertedValue;
|
|
12969
|
+
}
|
|
12970
|
+
|
|
12909
12971
|
/**
|
|
12910
12972
|
* 子表组件字段集合属性中每个字段name移除指定前缀
|
|
12911
12973
|
* @param {*} fields 子表组件字段集合,数组
|
|
@@ -13869,7 +13931,6 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13869
13931
|
if (props.fieldPrefix) {
|
|
13870
13932
|
props.fields = getTableFieldsWithoutFieldPrefix(props.fields, props.fieldPrefix);
|
|
13871
13933
|
}
|
|
13872
|
-
console.log("=getAmisInputTableSchema==props.fields, props.fieldPrefix===", props.fields, props.fieldPrefix);
|
|
13873
13934
|
let serviceId = getComponentId("table_service", props.id);
|
|
13874
13935
|
let buttonsForColumnOperations = [];
|
|
13875
13936
|
let inlineEditMode = props.inlineEditMode;
|
|
@@ -13905,6 +13966,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13905
13966
|
buttonsForColumnOperations.push(buttonDeleteSchema);
|
|
13906
13967
|
}
|
|
13907
13968
|
}
|
|
13969
|
+
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
13908
13970
|
let inputTableSchema = {
|
|
13909
13971
|
"type": "input-table",
|
|
13910
13972
|
"label": props.label,
|
|
@@ -13924,15 +13986,33 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13924
13986
|
"showFooterAddBtn": false,
|
|
13925
13987
|
"className": props.tableClassName,
|
|
13926
13988
|
"pipeOut": (value, data) => {
|
|
13927
|
-
|
|
13989
|
+
value = (value || []).map(function(item){
|
|
13928
13990
|
delete item.__fix_rerender_after_children_modified_tag;
|
|
13929
13991
|
return item;
|
|
13930
13992
|
});
|
|
13993
|
+
if(props.fieldPrefix){
|
|
13994
|
+
value = getTableValuePrependFieldPrefix(value, props.fieldPrefix);
|
|
13995
|
+
}
|
|
13996
|
+
if(amis.pipeOut){
|
|
13997
|
+
if(typeof amis.pipeOut === 'function'){
|
|
13998
|
+
return amis.pipeOut(value, data);
|
|
13999
|
+
}
|
|
14000
|
+
}
|
|
14001
|
+
return value;
|
|
13931
14002
|
}
|
|
13932
14003
|
};
|
|
14004
|
+
if(amis.pipeIn){
|
|
14005
|
+
inputTableSchema.pipeIn = amis.pipeIn;
|
|
14006
|
+
}
|
|
13933
14007
|
if(props.fieldPrefix){
|
|
13934
14008
|
inputTableSchema.pipeIn = (value, data) => {
|
|
13935
|
-
|
|
14009
|
+
value = getTableValueWithoutFieldPrefix(value, props.fieldPrefix);
|
|
14010
|
+
if(amis.pipeIn){
|
|
14011
|
+
if(typeof amis.pipeIn === 'function'){
|
|
14012
|
+
return amis.pipeIn(value, data);
|
|
14013
|
+
}
|
|
14014
|
+
}
|
|
14015
|
+
return value;
|
|
13936
14016
|
};
|
|
13937
14017
|
}
|
|
13938
14018
|
if (buttonsForColumnOperations.length) {
|
|
@@ -13946,10 +14026,11 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
13946
14026
|
if (showAsInlineEditMode) {
|
|
13947
14027
|
inputTableSchema.needConfirm = false;
|
|
13948
14028
|
}
|
|
13949
|
-
let amis = props["input-table"] || props.amis;//额外支持"input-table"代替amis属性,是因为在字段yml文件中用amis作为key不好理解
|
|
13950
14029
|
if (amis) {
|
|
13951
14030
|
// 支持配置amis属性重写或添加最终生成的input-table中任何属性。
|
|
13952
14031
|
delete amis.id;//如果steedos-input-table组件配置了amis.id属性,会造成新建编辑行功能不生效
|
|
14032
|
+
delete amis.pipeIn;//该属性在上面合并过了
|
|
14033
|
+
delete amis.pipeOut;//该属性在上面合并过了
|
|
13953
14034
|
Object.assign(inputTableSchema, amis);
|
|
13954
14035
|
}
|
|
13955
14036
|
const isAnyFieldHasDependOn = (props.fields || []).find(function (item) {
|