@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.cjs.js
CHANGED
|
@@ -5811,7 +5811,7 @@ async function getObjectFieldsFilterFormSchema(ctx) {
|
|
|
5811
5811
|
const formSchema = {
|
|
5812
5812
|
"type": "service",
|
|
5813
5813
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
5814
|
-
"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-
|
|
5814
|
+
"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",
|
|
5815
5815
|
"style":{
|
|
5816
5816
|
"max-height":ctx.formFactor === 'SMALL'?"30vh":"unset"
|
|
5817
5817
|
},
|
|
@@ -6398,7 +6398,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
6398
6398
|
"className": "slds-filters"
|
|
6399
6399
|
},
|
|
6400
6400
|
"size": "xs",
|
|
6401
|
-
"className": `border-
|
|
6401
|
+
"className": `border-y slds-grid slds-grid_vertical slds-nowrap ${!ctx.isLookup && "mt-2"}`,
|
|
6402
6402
|
"visibleOn": "this.showFieldsFilter",
|
|
6403
6403
|
},
|
|
6404
6404
|
"className": "bg-white"
|
|
@@ -6586,7 +6586,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6586
6586
|
"icon": "fa fa-refresh",
|
|
6587
6587
|
"actionType": "reload",
|
|
6588
6588
|
"target": amisListViewId,
|
|
6589
|
-
"className": "bg-white p-2 rounded
|
|
6589
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
6590
6590
|
},
|
|
6591
6591
|
fieldsFilterButtonSchema,
|
|
6592
6592
|
// {
|
|
@@ -6594,7 +6594,7 @@ async function getObjectListHeaderSecordLine(objectSchema, listViewName, ctx) {
|
|
|
6594
6594
|
// "label": "",
|
|
6595
6595
|
// "icon": "fa fa-filter",
|
|
6596
6596
|
// "actionType": "custom",
|
|
6597
|
-
// "className": "bg-transparent p-2 rounded
|
|
6597
|
+
// "className": "bg-transparent p-2 rounded text-gray-500",
|
|
6598
6598
|
// "id": "u:c20cb87d96c9",
|
|
6599
6599
|
// "onEvent": {
|
|
6600
6600
|
// "click": {
|
|
@@ -6642,7 +6642,7 @@ function getObjectListHeader$1(objectSchema, listViewName, ctx) {
|
|
|
6642
6642
|
let headerSchema = [{
|
|
6643
6643
|
"type": "wrapper",
|
|
6644
6644
|
"body": body,
|
|
6645
|
-
"className": `
|
|
6645
|
+
"className": `sm:rounded-tl sm:rounded-tr p-4 -mb-4`
|
|
6646
6646
|
}];
|
|
6647
6647
|
return headerSchema;
|
|
6648
6648
|
}
|
|
@@ -6777,7 +6777,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
6777
6777
|
let body = [
|
|
6778
6778
|
{
|
|
6779
6779
|
"type": "wrapper",
|
|
6780
|
-
"className": "p-4
|
|
6780
|
+
"className": "p-4 border-b",
|
|
6781
6781
|
"body": [
|
|
6782
6782
|
{
|
|
6783
6783
|
"type": "grid",
|
|
@@ -7903,7 +7903,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
7903
7903
|
"icon": "fa fa-cog",
|
|
7904
7904
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7905
7905
|
// "tooltip": i18next.t('frontend_button_listview_control_tooltip'),
|
|
7906
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7906
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7907
7907
|
"align": "right",
|
|
7908
7908
|
"visibleOn": "${!isLookup}",
|
|
7909
7909
|
"buttons": [
|
|
@@ -7948,7 +7948,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
7948
7948
|
"icon": "fa fa-table-columns",
|
|
7949
7949
|
//TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
7950
7950
|
// "tooltip": `${i18next.t('frontend_display_as')} ${displayAsLabel}`,
|
|
7951
|
-
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded
|
|
7951
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded text-gray-500",
|
|
7952
7952
|
"align": "right",
|
|
7953
7953
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
7954
7954
|
"buttons": [
|
|
@@ -8141,7 +8141,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8141
8141
|
// //TODO: dropdown-button只支持在按钮上方配置提示,对于上方按钮的点击会有影响,为保持统一,暂时去除,等待amis优化,https://github.com/baidu/amis/issues/7330
|
|
8142
8142
|
// // "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8143
8143
|
// "tooltipPlacement": "top",
|
|
8144
|
-
// "className": "bg-white p-2 rounded
|
|
8144
|
+
// "className": "bg-white p-2 rounded text-gray-500",
|
|
8145
8145
|
// "label": "",
|
|
8146
8146
|
// "icon": "fa fa-sync",
|
|
8147
8147
|
// "visibleOn": "${!showFieldsFilter}",
|
|
@@ -8165,7 +8165,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8165
8165
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8166
8166
|
"tooltip":"",
|
|
8167
8167
|
"tooltipPlacement": "top",
|
|
8168
|
-
"className": "bg-white p-2 rounded
|
|
8168
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8169
8169
|
};
|
|
8170
8170
|
}
|
|
8171
8171
|
else {
|
|
@@ -8176,7 +8176,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8176
8176
|
// "tooltip": i18next.t('frontend_button_reload_tooltip'),
|
|
8177
8177
|
"tooltip":"",
|
|
8178
8178
|
"tooltipPlacement": "top",
|
|
8179
|
-
"className": "bg-white p-2 rounded
|
|
8179
|
+
"className": "bg-white p-2 rounded text-gray-500"
|
|
8180
8180
|
};
|
|
8181
8181
|
}
|
|
8182
8182
|
let toolbarFilter;
|
|
@@ -8198,7 +8198,7 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
8198
8198
|
"visibleOn": "${isFieldsFilterEmpty == false && isLookup != true}"
|
|
8199
8199
|
},
|
|
8200
8200
|
"align": "right",
|
|
8201
|
-
"className": "bg-white p-2 rounded
|
|
8201
|
+
"className": "bg-white p-2 rounded text-gray-500",
|
|
8202
8202
|
"onEvent": {
|
|
8203
8203
|
"click": {
|
|
8204
8204
|
"actions": [
|
|
@@ -8525,7 +8525,7 @@ async function getObjectCRUD(objectSchema, fields, options){
|
|
|
8525
8525
|
const bodyProps = {
|
|
8526
8526
|
// toolbar: getToolbar(),
|
|
8527
8527
|
// headerToolbar: getObjectHeaderToolbar(objectSchema, options.formFactor, {showDisplayAs}),
|
|
8528
|
-
headerToolbarClassName: "px-4 py-2 border-
|
|
8528
|
+
headerToolbarClassName: "px-4 py-2 border-b",
|
|
8529
8529
|
footerToolbar: getObjectFooterToolbar(objectSchema, options.formFactor, {
|
|
8530
8530
|
...options,
|
|
8531
8531
|
disableStatistics: options.queryCount === false
|
|
@@ -9259,7 +9259,7 @@ async function getRecordDetailRelatedListSchema(objectName, recordId, relatedObj
|
|
|
9259
9259
|
amisSchema: {
|
|
9260
9260
|
type: "service",
|
|
9261
9261
|
id: componentId,
|
|
9262
|
-
className: `steedos-record-related-list py-2 first:pt-0 border-b last:border-b-0 ${componentId} ${className}`,
|
|
9262
|
+
className: `steedos-record-related-list py-2 first:pt-0 border-b-0 last:border-b-0 ${componentId} ${className}`,
|
|
9263
9263
|
data: {
|
|
9264
9264
|
relatedKey: relatedKey,
|
|
9265
9265
|
listViewId: `amis-\${appId}-${relatedObjectName}-listview`,
|
|
@@ -10005,7 +10005,7 @@ async function getRecordDetailSchema(objectName, appId, props = {}){
|
|
|
10005
10005
|
};
|
|
10006
10006
|
const content = {
|
|
10007
10007
|
"type": "tabs",
|
|
10008
|
-
"className": "steedos-record-tabs bg-white p-4 m-0
|
|
10008
|
+
"className": "steedos-record-tabs bg-white p-4 m-0 border-b",
|
|
10009
10009
|
"contentClassName": "bg-none",
|
|
10010
10010
|
"tabs": [
|
|
10011
10011
|
detailed
|
|
@@ -10940,6 +10940,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10940
10940
|
}
|
|
10941
10941
|
});
|
|
10942
10942
|
|
|
10943
|
+
let listviewFilter = getListViewFilter(listView);
|
|
10944
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
10945
|
+
|
|
10943
10946
|
let sort = "";
|
|
10944
10947
|
if(listView){
|
|
10945
10948
|
sort = getListViewSort(listView);
|
|
@@ -10986,7 +10989,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
10986
10989
|
Object.assign(api.data.$self, __changedSearchBoxValues, __changedFilterFormValues);
|
|
10987
10990
|
}
|
|
10988
10991
|
const selfData = JSON.parse(JSON.stringify(api.data.$self));
|
|
10989
|
-
var filters = [];
|
|
10992
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
10990
10993
|
var pageSize = api.data.pageSize || 10;
|
|
10991
10994
|
var pageNo = api.data.pageNo || 1;
|
|
10992
10995
|
var skip = (pageNo - 1) * pageSize;
|
|
@@ -11048,6 +11051,16 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
11048
11051
|
}
|
|
11049
11052
|
|
|
11050
11053
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11054
|
+
|
|
11055
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11056
|
+
|
|
11057
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11058
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$self.__super);
|
|
11059
|
+
if(_filters0 && _filters0.length){
|
|
11060
|
+
filters.push(_filters0);
|
|
11061
|
+
}
|
|
11062
|
+
}
|
|
11063
|
+
|
|
11051
11064
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11052
11065
|
|
|
11053
11066
|
if(filtersFunction && !inFilterForm){
|
|
@@ -11360,6 +11373,9 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11360
11373
|
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
11361
11374
|
let listView = getLookupListView(refObjectConfig);
|
|
11362
11375
|
|
|
11376
|
+
let listviewFilter = getListViewFilter(listView);
|
|
11377
|
+
let listviewFiltersFunction = listView && listView._filters;
|
|
11378
|
+
|
|
11363
11379
|
let sort = "";
|
|
11364
11380
|
if(listView){
|
|
11365
11381
|
sort = getListViewSort(listView);
|
|
@@ -11389,7 +11405,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11389
11405
|
apiInfo.data['rfield'] = `\${object_name}`;
|
|
11390
11406
|
// [["_id", "=", "$${field.name}._id"],"or",["name", "contains", "$term"]]
|
|
11391
11407
|
apiInfo.requestAdaptor = `
|
|
11392
|
-
var filters = [];
|
|
11408
|
+
${listviewFilter && !ctx.inFilterForm ? `var filters = ${JSON.stringify(listviewFilter)};` : 'var filters = [];'}
|
|
11393
11409
|
var top = 200;
|
|
11394
11410
|
if(api.data.$term){
|
|
11395
11411
|
filters = [["${referenceTo?.NAME_FIELD_KEY || 'name'}", "contains", api.data.$term]];
|
|
@@ -11412,6 +11428,16 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
11412
11428
|
}
|
|
11413
11429
|
|
|
11414
11430
|
const inFilterForm = ${ctx.inFilterForm};
|
|
11431
|
+
|
|
11432
|
+
const listviewFiltersFunction = ${listviewFiltersFunction};
|
|
11433
|
+
|
|
11434
|
+
if(listviewFiltersFunction && !inFilterForm){
|
|
11435
|
+
const _filters0 = listviewFiltersFunction(filters, api.data.$);
|
|
11436
|
+
if(_filters0 && _filters0.length){
|
|
11437
|
+
filters.push(_filters0);
|
|
11438
|
+
}
|
|
11439
|
+
}
|
|
11440
|
+
|
|
11415
11441
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
11416
11442
|
|
|
11417
11443
|
if(filtersFunction && !inFilterForm){
|
|
@@ -12253,7 +12279,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
12253
12279
|
convertData = {
|
|
12254
12280
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
12255
12281
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
12256
|
-
format: 'YYYY-MM-DDTHH:mm:
|
|
12282
|
+
format: 'YYYY-MM-DDTHH:mm:00.000Z',
|
|
12257
12283
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
12258
12284
|
utc: true,
|
|
12259
12285
|
};
|
|
@@ -13025,8 +13051,56 @@ function uuidv4() {
|
|
|
13025
13051
|
* @Author: 殷亮辉 yinlianghui@hotoa.com
|
|
13026
13052
|
* @Date: 2023-11-15 09:50:22
|
|
13027
13053
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
13028
|
-
* @LastEditTime: 2024-01-
|
|
13054
|
+
* @LastEditTime: 2024-01-26 17:47:16
|
|
13055
|
+
*/
|
|
13056
|
+
|
|
13057
|
+
/**
|
|
13058
|
+
* 子表组件字段值中每行数据补上字段值为空的的字段值,把值统一设置为空字符串,是为了解决amis amis 3.6/6.0 input-table组件bug:行中字段值为空时会显示为父作用域中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13059
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13060
|
+
* @param {*} value 子表组件字段值,数组
|
|
13061
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13062
|
+
* @returns 转换后的子表组件字段值
|
|
13063
|
+
*/
|
|
13064
|
+
function getTableValueWithEmptyValue(value, fields) {
|
|
13065
|
+
return (value || []).map((itemValue) => {
|
|
13066
|
+
//这里不clone的话,会造成在pipeIn函数执行该函数后像pipeOut一样最终输出到表单项中,即库里字段值会被改了
|
|
13067
|
+
const newItemValue = _$1.clone(itemValue);
|
|
13068
|
+
(fields || []).forEach((itemField) => {
|
|
13069
|
+
if(itemField.name && (newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13070
|
+
// 这里newItemValue中不存在 itemField.name 属性,或者值为null时都会有“显示为父作用域中的同名变量值”的问题,所以null和undefined都要重置为空字符串
|
|
13071
|
+
// 实测数字、下拉框、多选lookup等字段类型重置为空字符串都不会有问题,而且实测amis from组件的清空表单字段值功能就是把表单中的各种字段类型设置为空字符串,所以看起来也符合amis规范
|
|
13072
|
+
newItemValue[itemField.name] = "";
|
|
13073
|
+
}
|
|
13074
|
+
if (newItemValue.children) {
|
|
13075
|
+
newItemValue.children = getTableValueWithEmptyValue(newItemValue.children, fields);
|
|
13076
|
+
}
|
|
13077
|
+
});
|
|
13078
|
+
return newItemValue;
|
|
13079
|
+
});
|
|
13080
|
+
}
|
|
13081
|
+
|
|
13082
|
+
/**
|
|
13083
|
+
* 把子表组件字段值中每行数据中经过上面getTableValueWithEmptyValue函数空字段值移除
|
|
13084
|
+
* amis #9520修正后此函数及相关代码可以移除
|
|
13085
|
+
* @param {*} value 子表组件字段值,数组
|
|
13086
|
+
* @param {*} fields 子表组件fields属性,数组
|
|
13087
|
+
* @returns 转换后的子表组件字段值
|
|
13029
13088
|
*/
|
|
13089
|
+
function getTableValueWithoutEmptyValue(value, fields) {
|
|
13090
|
+
return (value || []).map((itemValue) => {
|
|
13091
|
+
const newItemValue = _$1.clone(itemValue);
|
|
13092
|
+
(fields || []).forEach((itemField) => {
|
|
13093
|
+
if(itemField.name && (newItemValue[itemField.name] === "" || newItemValue[itemField.name] === undefined || newItemValue[itemField.name] === null)){
|
|
13094
|
+
// 这里额外把null和undefined值也删除掉纯粹是没必要输出保存它们
|
|
13095
|
+
delete newItemValue[itemField.name];
|
|
13096
|
+
}
|
|
13097
|
+
if (newItemValue.children) {
|
|
13098
|
+
newItemValue.children = getTableValueWithoutEmptyValue(newItemValue.children, fields);
|
|
13099
|
+
}
|
|
13100
|
+
});
|
|
13101
|
+
return newItemValue;
|
|
13102
|
+
});
|
|
13103
|
+
}
|
|
13030
13104
|
|
|
13031
13105
|
function getTablePrimaryKey(props) {
|
|
13032
13106
|
return props.primaryKey || "_id";
|
|
@@ -13106,6 +13180,7 @@ function getTableValueWithoutFieldPrefix(value, fieldPrefix) {
|
|
|
13106
13180
|
* 子表组件字段值中每行数据的键值key补上指定前缀
|
|
13107
13181
|
* @param {*} value 子表组件字段值,数组
|
|
13108
13182
|
* @param {*} fieldPrefix 字段前缀
|
|
13183
|
+
* @param {*} primaryKey 主键字段名,主键不参与被键值key规则,需要排除,审批王amis表单也是这个规则
|
|
13109
13184
|
* @returns 转换后的子表组件字段值
|
|
13110
13185
|
*/
|
|
13111
13186
|
function getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey) {
|
|
@@ -13177,20 +13252,16 @@ function getInputTableCell(field, showAsInlineEditMode) {
|
|
|
13177
13252
|
}
|
|
13178
13253
|
}
|
|
13179
13254
|
else {
|
|
13180
|
-
// 这里加一层service是因为amis 3.6/6.0中有bug,不加的话,这里会显示为父作用域中中的同名变量值,见:https://github.com/baidu/amis/issues/9520
|
|
13181
13255
|
return {
|
|
13182
|
-
"type": "
|
|
13256
|
+
"type": "steedos-field",
|
|
13257
|
+
"config": Object.assign({}, field, {
|
|
13258
|
+
label: false
|
|
13259
|
+
}),
|
|
13260
|
+
inInputTable: true,
|
|
13261
|
+
"static": true,
|
|
13262
|
+
"readonly": true,
|
|
13183
13263
|
label: field.label,
|
|
13184
|
-
name: field.name
|
|
13185
|
-
"body":[{
|
|
13186
|
-
"type": "steedos-field",
|
|
13187
|
-
"config": Object.assign({}, field, {
|
|
13188
|
-
label: false
|
|
13189
|
-
}),
|
|
13190
|
-
inInputTable: true,
|
|
13191
|
-
"static": true,
|
|
13192
|
-
"readonly": true
|
|
13193
|
-
}]
|
|
13264
|
+
name: field.name
|
|
13194
13265
|
}
|
|
13195
13266
|
}
|
|
13196
13267
|
}
|
|
@@ -13377,9 +13448,14 @@ function getFormPagination(props, mode) {
|
|
|
13377
13448
|
"onEvent": {
|
|
13378
13449
|
"click": {
|
|
13379
13450
|
"actions": [
|
|
13451
|
+
{
|
|
13452
|
+
"actionType": "validate",
|
|
13453
|
+
"componentId": formId
|
|
13454
|
+
},
|
|
13380
13455
|
{
|
|
13381
13456
|
"actionType": "custom",
|
|
13382
|
-
"script": onPageChangeScript
|
|
13457
|
+
"script": onPageChangeScript,
|
|
13458
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13383
13459
|
}
|
|
13384
13460
|
]
|
|
13385
13461
|
}
|
|
@@ -13404,9 +13480,14 @@ function getFormPagination(props, mode) {
|
|
|
13404
13480
|
"onEvent": {
|
|
13405
13481
|
"click": {
|
|
13406
13482
|
"actions": [
|
|
13483
|
+
{
|
|
13484
|
+
"actionType": "validate",
|
|
13485
|
+
"componentId": formId
|
|
13486
|
+
},
|
|
13407
13487
|
{
|
|
13408
13488
|
"actionType": "custom",
|
|
13409
|
-
"script": onPageChangeScript
|
|
13489
|
+
"script": onPageChangeScript,
|
|
13490
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13410
13491
|
}
|
|
13411
13492
|
]
|
|
13412
13493
|
}
|
|
@@ -13898,9 +13979,14 @@ async function getButtonActions(props, mode) {
|
|
|
13898
13979
|
"onEvent": {
|
|
13899
13980
|
"click": {
|
|
13900
13981
|
"actions": [
|
|
13982
|
+
{
|
|
13983
|
+
"actionType": "validate",
|
|
13984
|
+
"componentId": formId
|
|
13985
|
+
},
|
|
13901
13986
|
{
|
|
13902
13987
|
"actionType": "custom",
|
|
13903
|
-
"script": onSaveAndNewItemScript
|
|
13988
|
+
"script": onSaveAndNewItemScript,
|
|
13989
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13904
13990
|
}
|
|
13905
13991
|
]
|
|
13906
13992
|
}
|
|
@@ -13913,9 +13999,14 @@ async function getButtonActions(props, mode) {
|
|
|
13913
13999
|
"onEvent": {
|
|
13914
14000
|
"click": {
|
|
13915
14001
|
"actions": [
|
|
14002
|
+
{
|
|
14003
|
+
"actionType": "validate",
|
|
14004
|
+
"componentId": formId
|
|
14005
|
+
},
|
|
13916
14006
|
{
|
|
13917
14007
|
"actionType": "custom",
|
|
13918
|
-
"script": onSaveAndCopyItemScript
|
|
14008
|
+
"script": onSaveAndCopyItemScript,
|
|
14009
|
+
"expression": "${!!!event.data.validateResult.error}" //触发表单校验结果会存入validateResult,amis 3.2不支持,高版本比如 3.5.3支持
|
|
13919
14010
|
}
|
|
13920
14011
|
]
|
|
13921
14012
|
}
|
|
@@ -14181,18 +14272,51 @@ async function getButtonView(props) {
|
|
|
14181
14272
|
|
|
14182
14273
|
async function getButtonDelete(props) {
|
|
14183
14274
|
return {
|
|
14184
|
-
"type": "button",
|
|
14185
|
-
"label": "",
|
|
14186
|
-
"icon": "fa fa-trash-alt",//不可以用fa-trash-o,因为设计字段布局界面中弹出的设置分组列表中显示不了这个图标
|
|
14275
|
+
"type": "dropdown-button",
|
|
14187
14276
|
"level": "link",
|
|
14188
|
-
"
|
|
14189
|
-
|
|
14190
|
-
|
|
14277
|
+
"icon": "fa fa-trash-alt",
|
|
14278
|
+
"size": "xs",
|
|
14279
|
+
"hideCaret": true,
|
|
14280
|
+
"closeOnClick": true,
|
|
14281
|
+
"body": [
|
|
14282
|
+
{
|
|
14283
|
+
"type": "wrapper",
|
|
14284
|
+
"size": "md",
|
|
14285
|
+
"className": "w-80",
|
|
14286
|
+
"body": [
|
|
14287
|
+
{
|
|
14288
|
+
"tpl": "确定要删除吗?",
|
|
14289
|
+
"type": "tpl"
|
|
14290
|
+
},
|
|
14291
|
+
{
|
|
14292
|
+
"type": "flex",
|
|
14293
|
+
"justify": "flex-end",
|
|
14294
|
+
"className": "mt-3",
|
|
14295
|
+
"items": [
|
|
14296
|
+
{
|
|
14297
|
+
"type": "button",
|
|
14298
|
+
"label": "取消",
|
|
14299
|
+
"className": "mr-2"
|
|
14300
|
+
},
|
|
14301
|
+
{
|
|
14302
|
+
"type": "button",
|
|
14303
|
+
"label": "删除",
|
|
14304
|
+
"level": "danger",
|
|
14305
|
+
"onEvent": {
|
|
14306
|
+
"click": {
|
|
14307
|
+
"actions": await getButtonActions(props, "delete")
|
|
14308
|
+
}
|
|
14309
|
+
}
|
|
14310
|
+
}
|
|
14311
|
+
]
|
|
14312
|
+
}
|
|
14313
|
+
]
|
|
14191
14314
|
}
|
|
14192
|
-
|
|
14193
|
-
}
|
|
14315
|
+
]
|
|
14316
|
+
}
|
|
14194
14317
|
}
|
|
14195
14318
|
|
|
14319
|
+
|
|
14196
14320
|
const getAmisInputTableSchema = async (props) => {
|
|
14197
14321
|
if (!props.id) {
|
|
14198
14322
|
props.id = "steedos_input_table_" + props.name + "_" + Math.random().toString(36).substr(2, 9);
|
|
@@ -14265,6 +14389,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14265
14389
|
if (fieldPrefix) {
|
|
14266
14390
|
value = getTableValueWithoutFieldPrefix(value, fieldPrefix);
|
|
14267
14391
|
}
|
|
14392
|
+
value = getTableValueWithEmptyValue(value, fields);
|
|
14268
14393
|
if (primaryKey) {
|
|
14269
14394
|
// 这里临时给每行数据补上primaryKey字段值,如果库里不需要保存这里补上的字段值,pipeOut中会识别autoGeneratePrimaryKeyValue属性选择最终移除这里补上的字段值
|
|
14270
14395
|
// 这里始终自动生成primaryKey字段值,而不是只在pipeOut输出整个子表字段值时才生成,是因为要支持当数据库里保存的子表字段行数据没有primaryKey字段值时的行嵌套模式(即节点的children属性)功能
|
|
@@ -14286,6 +14411,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14286
14411
|
if (fieldPrefix) {
|
|
14287
14412
|
value = getTableValuePrependFieldPrefix(value, fieldPrefix, primaryKey);
|
|
14288
14413
|
}
|
|
14414
|
+
value = getTableValueWithoutEmptyValue(value, fields);
|
|
14289
14415
|
if (props.autoGeneratePrimaryKeyValue === true) {
|
|
14290
14416
|
// 如果需要把自动生成的primaryKey值输出保存的库中,则补全所有行中的primaryKey值
|
|
14291
14417
|
// 这里如果不全部补全的话,初始从库里返回的字段值中拿到的行没primaryKey值的话就不会自动补上
|
|
@@ -14358,6 +14484,17 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14358
14484
|
"body": headerToolbar
|
|
14359
14485
|
});
|
|
14360
14486
|
}
|
|
14487
|
+
let className = "steedos-input-table";
|
|
14488
|
+
|
|
14489
|
+
if (typeof props.className == "object") {
|
|
14490
|
+
className = {
|
|
14491
|
+
[className]: "true",
|
|
14492
|
+
...props.className
|
|
14493
|
+
};
|
|
14494
|
+
} else if (typeof props.className == "string") {
|
|
14495
|
+
className = `${className} ${props.className} `;
|
|
14496
|
+
}
|
|
14497
|
+
|
|
14361
14498
|
let schema = {
|
|
14362
14499
|
"type": "control",
|
|
14363
14500
|
"body": {
|
|
@@ -14371,7 +14508,7 @@ const getAmisInputTableSchema = async (props) => {
|
|
|
14371
14508
|
"labelAlign": props.labelAlign,
|
|
14372
14509
|
//控制control的mode属性,https://aisuda.bce.baidu.com/amis/zh-CN/components/form/formitem#表单项展示
|
|
14373
14510
|
"mode": props.mode || null,
|
|
14374
|
-
|
|
14511
|
+
className
|
|
14375
14512
|
};
|
|
14376
14513
|
// console.log("===schema===", schema);
|
|
14377
14514
|
return schema;
|