@steedos-widgets/amis-lib 3.6.2-beta.14 → 3.6.2-beta.16
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 +181 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +181 -44
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +59 -39
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/input_table.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -5784,7 +5784,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
5784
5784
|
const formSchema = {
|
|
5785
5785
|
"type": "service",
|
|
5786
5786
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
5787
|
-
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-
|
|
5787
|
+
"className": ctx.formFactor === 'SMALL' ? "slds-filters__body p-0 mb-2 overflow-y-auto overflow-x-hidden" : "slds-filters__body p-0 sm:grid sm:gap-4 sm:grid-cols-4 p-2",
|
|
5788
5788
|
"style":{
|
|
5789
5789
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
5790
5790
|
},
|
|
@@ -6371,7 +6371,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6371
6371
|
"className": "slds-filters"
|
|
6372
6372
|
},
|
|
6373
6373
|
"size": "xs",
|
|
6374
|
-
"className": `border-
|
|
6374
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
6375
6375
|
"visibleOn": "this.showFieldsFilter",
|
|
6376
6376
|
},
|
|
6377
6377
|
"className": "bg-white"
|
|
@@ -6559,7 +6559,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6559
6559
|
"icon": "fa fa-refresh",
|
|
6560
6560
|
"actionType": "reload",
|
|
6561
6561
|
"target": amisListViewId,
|
|
6562
|
-
"className": "bg-white p-2 rounded
|
|
6562
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
6563
6563
|
},
|
|
6564
6564
|
fieldsFilterButtonSchema,
|
|
6565
6565
|
// {
|
|
@@ -6567,7 +6567,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6567
6567
|
// "label": "",
|
|
6568
6568
|
// "icon": "fa fa-filter",
|
|
6569
6569
|
// "actionType": "custom",
|
|
6570
|
-
// "className": "bg-transparent p-2 rounded
|
|
6570
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
6571
6571
|
// "id": "u:c20cb87d96c9",
|
|
6572
6572
|
// "onEvent": {
|
|
6573
6573
|
// "click": {
|
|
@@ -6615,7 +6615,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6615
6615
|
let headerSchema = [{
|
|
6616
6616
|
"type": "wrapper",
|
|
6617
6617
|
"body": body,
|
|
6618
|
-
"className": `
|
|
6618
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
6619
6619
|
}];
|
|
6620
6620
|
return headerSchema;
|
|
6621
6621
|
}
|
|
@@ -6750,7 +6750,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6750
6750
|
let body = [
|
|
6751
6751
|
{
|
|
6752
6752
|
"type": "wrapper",
|
|
6753
|
-
"className": "p-4
|
|
6753
|
+
"className": "p-4 border-b",
|
|
6754
6754
|
"body": [
|
|
6755
6755
|
{
|
|
6756
6756
|
"type": "grid",
|
|
@@ -7876,7 +7876,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7876
7876
|
"icon": "fa fa-cog",
|
|
7877
7877
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7878
7878
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
7879
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7879
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7880
7880
|
"align": "right",
|
|
7881
7881
|
"visibleOn": "${!isLookup}",
|
|
7882
7882
|
"buttons": [
|
|
@@ -7921,7 +7921,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7921
7921
|
"icon": "fa fa-table-columns",
|
|
7922
7922
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7923
7923
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
7924
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7924
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7925
7925
|
"align": "right",
|
|
7926
7926
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
7927
7927
|
"buttons": [
|
|
@@ -8114,7 +8114,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8114
8114
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8115
8115
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8116
8116
|
// "tooltipPlacement": "top",
|
|
8117
|
-
// "className": "bg-white p-2 rounded
|
|
8117
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
8118
8118
|
// "label": "",
|
|
8119
8119
|
// "icon": "fa fa-sync",
|
|
8120
8120
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -8138,7 +8138,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8138
8138
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8139
8139
|
"tooltip":"",
|
|
8140
8140
|
"tooltipPlacement": "top",
|
|
8141
|
-
"className": "bg-white p-2 rounded
|
|
8141
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8142
8142
|
};
|
|
8143
8143
|
}
|
|
8144
8144
|
else {
|
|
@@ -8149,7 +8149,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8149
8149
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8150
8150
|
"tooltip":"",
|
|
8151
8151
|
"tooltipPlacement": "top",
|
|
8152
|
-
"className": "bg-white p-2 rounded
|
|
8152
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8153
8153
|
};
|
|
8154
8154
|
}
|
|
8155
8155
|
let toolbarFilter;
|
|
@@ -8171,7 +8171,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8171
8171
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8172
8172
|
},
|
|
8173
8173
|
"align": "right",
|
|
8174
|
-
"className": "bg-white p-2 rounded
|
|
8174
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
8175
8175
|
"onEvent": {
|
|
8176
8176
|
"click": {
|
|
8177
8177
|
"actions": [
|
|
@@ -8498,7 +8498,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8498
8498
|
const bodyProps = {
|
|
8499
8499
|
// toolbar: getToolbar(),
|
|
8500
8500
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
8501
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
8501
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
8502
8502
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
8503
8503
|
...options,
|
|
8504
8504
|
disableStatistics: options.queryCount === false
|
|
@@ -9232,7 +9232,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9232
9232
|
amisSchema: {
|
|
9233
9233
|
type: "service",
|
|
9234
9234
|
id: componentId,
|
|
9235
|
-
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9235
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b-0 last:border-b-0 ${componentId} ${className}`,
|
|
9236
9236
|
data: {
|
|
9237
9237
|
relatedKey: relatedKey,
|
|
9238
9238
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -9978,7 +9978,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
9978
9978
|
};
|
|
9979
9979
|
const content = {
|
|
9980
9980
|
"type": "tabs",
|
|
9981
|
-
"className": "steedos-record-tabs bg-white p-4 m-0
|
|
9981
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 border-b",
|
|
9982
9982
|
"contentClassName": "bg-none",
|
|
9983
9983
|
"tabs": [
|
|
9984
9984
|
detailed
|
|
@@ -10913,6 +10913,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10913
10913
|
}
|
|
10914
10914
|
});
|
|
10915
10915
|
|
|
10916
|
+
let listviewFilter = getListViewFilter(listView);
|
|
10917
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
10918
|
+
|
|
10916
10919
|
let sort = "";
|
|
10917
10920
|
if(listView){
|
|
10918
10921
|
sort = getListViewSort(listView);
|
|
@@ -10959,7 +10962,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10959
10962
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10960
10963
|
}
|
|
10961
10964
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10962
|
-
var filters = [];
|
|
10965
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
10963
10966
|
var pageSize = api.data.pageSize || 10;
|
|
10964
10967
|
var pageNo = api.data.pageNo || 1;
|
|
10965
10968
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -11021,6 +11024,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11021
11024
|
}
|
|
11022
11025
|
|
|
11023
11026
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11027
|
+
|
|
11028
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11029
|
+
|
|
11030
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11031
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
11032
|
+
if(_filters0 && _filters0.length){
|
|
11033
|
+
filters.push(_filters0);
|
|
11034
|
+
}
|
|
11035
|
+
}
|
|
11036
|
+
|
|
11024
11037
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11025
11038
|
|
|
11026
11039
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11333,6 +11346,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11333
11346
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11334
11347
|
let listView = getLookupListView(refObjectConfig);
|
|
11335
11348
|
|
|
11349
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11350
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11351
|
+
|
|
11336
11352
|
let sort = "";
|
|
11337
11353
|
if(listView){
|
|
11338
11354
|
sort = getListViewSort(listView);
|
|
@@ -11362,7 +11378,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11362
11378
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
11363
11379
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
11364
11380
|
apiInfo.requestAdaptor = `
|
|
11365
|
-
var filters = [];
|
|
11381
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
11366
11382
|
var top = 200;
|
|
11367
11383
|
if(api.data.$term){
|
|
11368
11384
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -11385,6 +11401,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11385
11401
|
}
|
|
11386
11402
|
|
|
11387
11403
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11404
|
+
|
|
11405
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11406
|
+
|
|
11407
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11408
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
11409
|
+
if(_filters0 && _filters0.length){
|
|
11410
|
+
filters.push(_filters0);
|
|
11411
|
+
}
|
|
11412
|
+
}
|
|
11413
|
+
|
|
11388
11414
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11389
11415
|
|
|
11390
11416
|
if(filtersFunction && !inFilterForm){
|
|
@@ -12226,7 +12252,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12226
12252
|
convertData = {
|
|
12227
12253
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
12228
12254
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
12229
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
12255
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
12230
12256
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
12231
12257
|
utc: true,
|
|
12232
12258
|
};
|
|
@@ -12998,8 +13024,56 @@ function uuidv4() {
|
|
|
12998
13024
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
12999
13025
|
* @Date: 2023-11-15 09:50:22
|
|
13000
13026
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
13001
|
-
* @LastEditTime: 2024-01-
|
|
13027
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
13028
|
+
*/
|
|
13029
|
+
|
|
13030
|
+
/**
|
|
13031
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13032
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13033
|
+
* @param {*} value 子表组件字段值,数组
|
|
13034
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13035
|
+
* @returns 转换后的子表组件字段值
|
|
13036
|
+
*/
|
|
13037
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
13038
|
+
return (value || []).map((itemValue) => {
|
|
13039
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
13040
|
+
const newItemValue = clone(itemValue);
|
|
13041
|
+
(fields || []).forEach((itemField) => {
|
|
13042
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13043
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
13044
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
13045
|
+
newItemValue[itemField.name] = "";
|
|
13046
|
+
}
|
|
13047
|
+
if (newItemValue.children) {
|
|
13048
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
13049
|
+
}
|
|
13050
|
+
});
|
|
13051
|
+
return newItemValue;
|
|
13052
|
+
});
|
|
13053
|
+
}
|
|
13054
|
+
|
|
13055
|
+
/**
|
|
13056
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
13057
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13058
|
+
* @param {*} value 子表组件字段值,数组
|
|
13059
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13060
|
+
* @returns 转换后的子表组件字段值
|
|
13002
13061
|
*/
|
|
13062
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
13063
|
+
return (value || []).map((itemValue) => {
|
|
13064
|
+
const newItemValue = clone(itemValue);
|
|
13065
|
+
(fields || []).forEach((itemField) => {
|
|
13066
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13067
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
13068
|
+
delete newItemValue[itemField.name];
|
|
13069
|
+
}
|
|
13070
|
+
if (newItemValue.children) {
|
|
13071
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
13072
|
+
}
|
|
13073
|
+
});
|
|
13074
|
+
return newItemValue;
|
|
13075
|
+
});
|
|
13076
|
+
}
|
|
13003
13077
|
|
|
13004
13078
|
function getTablePrimaryKey(props) {
|
|
13005
13079
|
return props.primaryKey || "_id";
|
|
@@ -13079,6 +13153,7 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
|
13079
13153
|
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
13080
13154
|
* @param {*} value 子表组件字段值,数组
|
|
13081
13155
|
* @param {*} fieldPrefix 字段前缀
|
|
13156
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
13082
13157
|
* @returns 转换后的子表组件字段值
|
|
13083
13158
|
*/
|
|
13084
13159
|
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
@@ -13150,20 +13225,16 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13150
13225
|
}
|
|
13151
13226
|
}
|
|
13152
13227
|
else {
|
|
13153
|
-
// 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13154
13228
|
return {
|
|
13155
|
-
"type": "
|
|
13229
|
+
"type": "steedos-field",
|
|
13230
|
+
"config": Object.assign({}, field, {
|
|
13231
|
+
label: false
|
|
13232
|
+
}),
|
|
13233
|
+
inInputTable: true,
|
|
13234
|
+
"static": true,
|
|
13235
|
+
"readonly": true,
|
|
13156
13236
|
label: field.label,
|
|
13157
|
-
name: field.name
|
|
13158
|
-
"body":[{
|
|
13159
|
-
"type": "steedos-field",
|
|
13160
|
-
"config": Object.assign({}, field, {
|
|
13161
|
-
label: false
|
|
13162
|
-
}),
|
|
13163
|
-
inInputTable: true,
|
|
13164
|
-
"static": true,
|
|
13165
|
-
"readonly": true
|
|
13166
|
-
}]
|
|
13237
|
+
name: field.name
|
|
13167
13238
|
}
|
|
13168
13239
|
}
|
|
13169
13240
|
}
|
|
@@ -13350,9 +13421,14 @@ function getFormPagination(props, mode) {
|
|
|
13350
13421
|
"onEvent": {
|
|
13351
13422
|
"click": {
|
|
13352
13423
|
"actions": [
|
|
13424
|
+
{
|
|
13425
|
+
"actionType": "validate",
|
|
13426
|
+
"componentId": formId
|
|
13427
|
+
},
|
|
13353
13428
|
{
|
|
13354
13429
|
"actionType": "custom",
|
|
13355
|
-
"script": onPageChangeScript
|
|
13430
|
+
"script": onPageChangeScript,
|
|
13431
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13356
13432
|
}
|
|
13357
13433
|
]
|
|
13358
13434
|
}
|
|
@@ -13377,9 +13453,14 @@ function getFormPagination(props, mode) {
|
|
|
13377
13453
|
"onEvent": {
|
|
13378
13454
|
"click": {
|
|
13379
13455
|
"actions": [
|
|
13456
|
+
{
|
|
13457
|
+
"actionType": "validate",
|
|
13458
|
+
"componentId": formId
|
|
13459
|
+
},
|
|
13380
13460
|
{
|
|
13381
13461
|
"actionType": "custom",
|
|
13382
|
-
"script": onPageChangeScript
|
|
13462
|
+
"script": onPageChangeScript,
|
|
13463
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13383
13464
|
}
|
|
13384
13465
|
]
|
|
13385
13466
|
}
|
|
@@ -13871,9 +13952,14 @@ async function getButtonActions(props, mode) {
|
|
|
13871
13952
|
"onEvent": {
|
|
13872
13953
|
"click": {
|
|
13873
13954
|
"actions": [
|
|
13955
|
+
{
|
|
13956
|
+
"actionType": "validate",
|
|
13957
|
+
"componentId": formId
|
|
13958
|
+
},
|
|
13874
13959
|
{
|
|
13875
13960
|
"actionType": "custom",
|
|
13876
|
-
"script": onSaveAndNewItemScript
|
|
13961
|
+
"script": onSaveAndNewItemScript,
|
|
13962
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13877
13963
|
}
|
|
13878
13964
|
]
|
|
13879
13965
|
}
|
|
@@ -13886,9 +13972,14 @@ async function getButtonActions(props, mode) {
|
|
|
13886
13972
|
"onEvent": {
|
|
13887
13973
|
"click": {
|
|
13888
13974
|
"actions": [
|
|
13975
|
+
{
|
|
13976
|
+
"actionType": "validate",
|
|
13977
|
+
"componentId": formId
|
|
13978
|
+
},
|
|
13889
13979
|
{
|
|
13890
13980
|
"actionType": "custom",
|
|
13891
|
-
"script": onSaveAndCopyItemScript
|
|
13981
|
+
"script": onSaveAndCopyItemScript,
|
|
13982
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13892
13983
|
}
|
|
13893
13984
|
]
|
|
13894
13985
|
}
|
|
@@ -14154,18 +14245,51 @@ async function getButtonView(props) {
|
|
|
14154
14245
|
|
|
14155
14246
|
async function getButtonDelete(props) {
|
|
14156
14247
|
return {
|
|
14157
|
-
"type": "button",
|
|
14158
|
-
"label": "",
|
|
14159
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
14248
|
+
"type": "dropdown-button",
|
|
14160
14249
|
"level": "link",
|
|
14161
|
-
"
|
|
14162
|
-
|
|
14163
|
-
|
|
14250
|
+
"icon": "fa fa-trash-alt",
|
|
14251
|
+
"size": "xs",
|
|
14252
|
+
"hideCaret": true,
|
|
14253
|
+
"closeOnClick": true,
|
|
14254
|
+
"body": [
|
|
14255
|
+
{
|
|
14256
|
+
"type": "wrapper",
|
|
14257
|
+
"size": "md",
|
|
14258
|
+
"className": "w-80",
|
|
14259
|
+
"body": [
|
|
14260
|
+
{
|
|
14261
|
+
"tpl": "确定要删除吗?",
|
|
14262
|
+
"type": "tpl"
|
|
14263
|
+
},
|
|
14264
|
+
{
|
|
14265
|
+
"type": "flex",
|
|
14266
|
+
"justify": "flex-end",
|
|
14267
|
+
"className": "mt-3",
|
|
14268
|
+
"items": [
|
|
14269
|
+
{
|
|
14270
|
+
"type": "button",
|
|
14271
|
+
"label": "取消",
|
|
14272
|
+
"className": "mr-2"
|
|
14273
|
+
},
|
|
14274
|
+
{
|
|
14275
|
+
"type": "button",
|
|
14276
|
+
"label": "删除",
|
|
14277
|
+
"level": "danger",
|
|
14278
|
+
"onEvent": {
|
|
14279
|
+
"click": {
|
|
14280
|
+
"actions": await getButtonActions(props, "delete")
|
|
14281
|
+
}
|
|
14282
|
+
}
|
|
14283
|
+
}
|
|
14284
|
+
]
|
|
14285
|
+
}
|
|
14286
|
+
]
|
|
14164
14287
|
}
|
|
14165
|
-
|
|
14166
|
-
}
|
|
14288
|
+
]
|
|
14289
|
+
}
|
|
14167
14290
|
}
|
|
14168
14291
|
|
|
14292
|
+
|
|
14169
14293
|
const getAmisInputTableSchema = async (props) => {
|
|
14170
14294
|
if (!props.id) {
|
|
14171
14295
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
@@ -14238,6 +14362,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14238
14362
|
if (fieldPrefix) {
|
|
14239
14363
|
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
14240
14364
|
}
|
|
14365
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
14241
14366
|
if (primaryKey) {
|
|
14242
14367
|
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
14243
14368
|
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
@@ -14259,6 +14384,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14259
14384
|
if (fieldPrefix) {
|
|
14260
14385
|
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
14261
14386
|
}
|
|
14387
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
14262
14388
|
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
14263
14389
|
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
14264
14390
|
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
@@ -14331,6 +14457,17 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14331
14457
|
"body": headerToolbar
|
|
14332
14458
|
});
|
|
14333
14459
|
}
|
|
14460
|
+
let className = "steedos-input-table";
|
|
14461
|
+
|
|
14462
|
+
if (typeof props.className == "object") {
|
|
14463
|
+
className = {
|
|
14464
|
+
[className]: "true",
|
|
14465
|
+
...props.className
|
|
14466
|
+
};
|
|
14467
|
+
} else if (typeof props.className == "string") {
|
|
14468
|
+
className = `${className} ${props.className} `;
|
|
14469
|
+
}
|
|
14470
|
+
|
|
14334
14471
|
let schema = {
|
|
14335
14472
|
"type": "control",
|
|
14336
14473
|
"body": {
|
|
@@ -14344,7 +14481,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14344
14481
|
"labelAlign": props.labelAlign,
|
|
14345
14482
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14346
14483
|
"mode": props.mode || null,
|
|
14347
|
-
|
|
14484
|
+
className
|
|
14348
14485
|
};
|
|
14349
14486
|
// console.log("===schema===", schema);
|
|
14350
14487
|
return schema;
|