@steedos-widgets/amis-object 1.2.9 → 1.2.11
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/amis/AmisObjectForm.d.ts +1 -0
- package/dist/amis/AmisRecordDetailHeader.d.ts +3 -0
- package/dist/amis/index.d.ts +0 -1
- package/dist/amis-object.cjs.css +19 -9
- package/dist/amis-object.cjs.js +113 -110
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +19 -9
- package/dist/amis-object.esm.js +114 -111
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +19 -9
- package/dist/amis-object.umd.js +113 -110
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
package/dist/amis-object.esm.css
CHANGED
|
@@ -393,6 +393,9 @@ body {
|
|
|
393
393
|
.-mb-4 {
|
|
394
394
|
margin-bottom: -1rem
|
|
395
395
|
}
|
|
396
|
+
.mr-4 {
|
|
397
|
+
margin-right: 1rem
|
|
398
|
+
}
|
|
396
399
|
.mr-2 {
|
|
397
400
|
margin-right: 0.5rem
|
|
398
401
|
}
|
|
@@ -408,9 +411,6 @@ body {
|
|
|
408
411
|
.ml-4 {
|
|
409
412
|
margin-left: 1rem
|
|
410
413
|
}
|
|
411
|
-
.mr-4 {
|
|
412
|
-
margin-right: 1rem
|
|
413
|
-
}
|
|
414
414
|
.-ml-px {
|
|
415
415
|
margin-left: -1px
|
|
416
416
|
}
|
|
@@ -510,12 +510,12 @@ body {
|
|
|
510
510
|
.w-14 {
|
|
511
511
|
width: 3.5rem
|
|
512
512
|
}
|
|
513
|
-
.w-6 {
|
|
514
|
-
width: 1.5rem
|
|
515
|
-
}
|
|
516
513
|
.w-4 {
|
|
517
514
|
width: 1rem
|
|
518
515
|
}
|
|
516
|
+
.w-6 {
|
|
517
|
+
width: 1.5rem
|
|
518
|
+
}
|
|
519
519
|
.w-20 {
|
|
520
520
|
width: 5rem
|
|
521
521
|
}
|
|
@@ -561,6 +561,9 @@ body {
|
|
|
561
561
|
.max-w-md {
|
|
562
562
|
max-width: 28rem
|
|
563
563
|
}
|
|
564
|
+
.flex-initial {
|
|
565
|
+
flex: 0 1 auto
|
|
566
|
+
}
|
|
564
567
|
.flex-auto {
|
|
565
568
|
flex: 1 1 auto
|
|
566
569
|
}
|
|
@@ -1133,9 +1136,6 @@ body {
|
|
|
1133
1136
|
right: 30px;
|
|
1134
1137
|
background: transparent;
|
|
1135
1138
|
}
|
|
1136
|
-
.antd-Table-toolbar .antd-Crud-loadMore .antd-Button.is-disabled {
|
|
1137
|
-
display: none;
|
|
1138
|
-
}
|
|
1139
1139
|
@media (max-width: 576px) {
|
|
1140
1140
|
.steedos-record-detail-related-lists .steedos-record-related-list .steedos-object-table .antd-Table-footToolbar {
|
|
1141
1141
|
display: none;
|
|
@@ -1238,6 +1238,16 @@ body {
|
|
|
1238
1238
|
column-gap: 1rem;
|
|
1239
1239
|
}
|
|
1240
1240
|
|
|
1241
|
+
@media (max-width: 768px) {
|
|
1242
|
+
.record-detail-header-name {
|
|
1243
|
+
display: -webkit-box;
|
|
1244
|
+
overflow: hidden;
|
|
1245
|
+
text-overflow: ellipsis;
|
|
1246
|
+
-webkit-line-clamp: 2;
|
|
1247
|
+
-webkit-box-orient: vertical;
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
|
|
1241
1251
|
.steedos-context-bar .antd-Nav-list {
|
|
1242
1252
|
border-bottom: 0px;
|
|
1243
1253
|
height: 40px;
|
package/dist/amis-object.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState, useEffect, createElement } from 'react';
|
|
2
2
|
import * as ___default from 'lodash';
|
|
3
|
-
import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get,
|
|
3
|
+
import ___default__default, { isEmpty, isArray, each, find, endsWith, cloneDeep, includes, toArray, mergeWith, isString, union, has, slice, defaultsDeep as defaultsDeep$1, isObject as isObject$1, map, filter, get, isBoolean, omitBy, isNil, forEach, startsWith, isFunction, compact, difference, keys, pick, first, values, pickBy, random, assign, isNumber } from 'lodash';
|
|
4
4
|
import { Dropdown, Tabs, Spin, Badge, Skeleton, Modal as Modal$1, message, notification, Button, Space, Drawer as Drawer$1 } from 'antd';
|
|
5
5
|
import ReactDOM, { createRoot } from 'react-dom';
|
|
6
6
|
|
|
@@ -741,11 +741,28 @@ const Router$1 = {
|
|
|
741
741
|
|
|
742
742
|
};
|
|
743
743
|
|
|
744
|
+
/*
|
|
745
|
+
* @Author: baozhoutao@steedos.com
|
|
746
|
+
* @Date: 2022-07-20 16:29:22
|
|
747
|
+
* @LastEditors: Please set LastEditors
|
|
748
|
+
* @LastEditTime: 2023-05-18 15:22:51
|
|
749
|
+
* @Description:
|
|
750
|
+
*/
|
|
751
|
+
|
|
752
|
+
function getContrastColor(bgColor) {
|
|
753
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
754
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
755
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
756
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
757
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
758
|
+
return brightness < 128 ? "#ffffff" : "#000000";
|
|
759
|
+
}
|
|
760
|
+
|
|
744
761
|
/*
|
|
745
762
|
* @Author: baozhoutao@steedos.com
|
|
746
763
|
* @Date: 2022-05-23 09:53:08
|
|
747
|
-
* @LastEditors:
|
|
748
|
-
* @LastEditTime: 2023-
|
|
764
|
+
* @LastEditors: Please set LastEditors
|
|
765
|
+
* @LastEditTime: 2023-05-22 15:13:18
|
|
749
766
|
* @Description:
|
|
750
767
|
*/
|
|
751
768
|
|
|
@@ -798,6 +815,22 @@ async function getRefObjectNameFieldName(field){
|
|
|
798
815
|
function getSelectTpl(field){
|
|
799
816
|
return `<div>\${_display.${field.name}}</div>`
|
|
800
817
|
}
|
|
818
|
+
function getSelectMap(selectOptions){
|
|
819
|
+
let map = {};
|
|
820
|
+
forEach(selectOptions,(option)=>{
|
|
821
|
+
const optionValue = option.value + '';
|
|
822
|
+
const optionColor = option.color + '';
|
|
823
|
+
if(optionColor){
|
|
824
|
+
const background = optionColor.charAt(0) === '#' ? optionColor : '#'+optionColor;
|
|
825
|
+
const color = getContrastColor(background);
|
|
826
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
827
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
828
|
+
}else {
|
|
829
|
+
map[optionValue] = option.label;
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
return map;
|
|
833
|
+
}
|
|
801
834
|
|
|
802
835
|
function getNameTplUrl(field, ctx){
|
|
803
836
|
if(ctx.objectName === 'cms_files'){
|
|
@@ -2194,9 +2227,10 @@ const getSchema$1 = (uiSchema) => {
|
|
|
2194
2227
|
{
|
|
2195
2228
|
name: "template_url",
|
|
2196
2229
|
label: "导入模板",
|
|
2197
|
-
type: "
|
|
2198
|
-
|
|
2199
|
-
|
|
2230
|
+
type: "markdown",
|
|
2231
|
+
options: {
|
|
2232
|
+
html: true
|
|
2233
|
+
},
|
|
2200
2234
|
className: "whitespace-nowrap",
|
|
2201
2235
|
},
|
|
2202
2236
|
null,
|
|
@@ -3043,6 +3077,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3043
3077
|
if (!ctx) {
|
|
3044
3078
|
ctx = {};
|
|
3045
3079
|
}
|
|
3080
|
+
const btnSearchId = "btn_filter_form_search_" + new Date().getTime();
|
|
3046
3081
|
const filterFormSchema = await getObjectFieldsFilterFormSchema(ctx);
|
|
3047
3082
|
const onSearchScript = `
|
|
3048
3083
|
const scope = event.context.scoped;
|
|
@@ -3059,7 +3094,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3059
3094
|
// // 这会造成handleFilterSubmit时把移除掉的搜索项字段之前的值加到过滤条件中
|
|
3060
3095
|
// for(var k in filterFormValues){
|
|
3061
3096
|
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
3062
|
-
// removedValues[k] =
|
|
3097
|
+
// removedValues[k] = null;
|
|
3063
3098
|
// }
|
|
3064
3099
|
// }
|
|
3065
3100
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
@@ -3098,7 +3133,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3098
3133
|
const removedValues = {};
|
|
3099
3134
|
for(var k in filterFormValues){
|
|
3100
3135
|
if(/^__searchable__/.test(k)){
|
|
3101
|
-
removedValues[k] =
|
|
3136
|
+
removedValues[k] = null;
|
|
3102
3137
|
}
|
|
3103
3138
|
}
|
|
3104
3139
|
if(!event.data.isLookup){
|
|
@@ -3109,7 +3144,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3109
3144
|
if(localListViewProps){
|
|
3110
3145
|
localListViewProps = JSON.parse(localListViewProps);
|
|
3111
3146
|
for(var k in localListViewProps){
|
|
3112
|
-
removedValues[k] =
|
|
3147
|
+
removedValues[k] = null;
|
|
3113
3148
|
}
|
|
3114
3149
|
}
|
|
3115
3150
|
}
|
|
@@ -3267,7 +3302,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3267
3302
|
});
|
|
3268
3303
|
const removedValues = {};
|
|
3269
3304
|
removedKeys.forEach(function(key){
|
|
3270
|
-
removedValues[key] =
|
|
3305
|
+
removedValues[key] = null;
|
|
3271
3306
|
});
|
|
3272
3307
|
filterForm.setValues(removedValues);//这里使用filterInnerForm也可以
|
|
3273
3308
|
|
|
@@ -3280,10 +3315,14 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3280
3315
|
let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
|
|
3281
3316
|
if(localListViewProps){
|
|
3282
3317
|
localListViewProps = JSON.parse(localListViewProps);
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3318
|
+
_.each(localListViewProps, function(n,k){
|
|
3319
|
+
// __searchable__开头的不在searchableFields范围则清除其值
|
|
3320
|
+
let isRemoved = !!removedFields.find(function(fieldName){
|
|
3321
|
+
return new RegExp("__searchable__\.*" + fieldName + "$").test(k);
|
|
3322
|
+
});
|
|
3323
|
+
if(isRemoved){
|
|
3324
|
+
delete localListViewProps[k];
|
|
3325
|
+
}
|
|
3287
3326
|
});
|
|
3288
3327
|
sessionStorage.setItem(listViewPropsStoreKey, JSON.stringify(localListViewProps));
|
|
3289
3328
|
}
|
|
@@ -3317,9 +3356,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3317
3356
|
"body": [
|
|
3318
3357
|
{
|
|
3319
3358
|
"type": "button",
|
|
3359
|
+
"id": btnSearchId,
|
|
3320
3360
|
"label": "搜索",
|
|
3321
3361
|
"icon": "fa fa-search",
|
|
3322
|
-
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3362
|
+
// "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3323
3363
|
"onEvent": {
|
|
3324
3364
|
"click": {
|
|
3325
3365
|
"actions": [
|
|
@@ -3335,7 +3375,7 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3335
3375
|
"type": "button",
|
|
3336
3376
|
"label": "取消",
|
|
3337
3377
|
"name": "btn_filter_form_cancel",
|
|
3338
|
-
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3378
|
+
// "visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3339
3379
|
"onEvent": {
|
|
3340
3380
|
"click": {
|
|
3341
3381
|
"actions": [
|
|
@@ -3450,6 +3490,10 @@ async function getObjectFieldsFilterBarSchema(objectSchema, ctx) {
|
|
|
3450
3490
|
"actionType": "custom",
|
|
3451
3491
|
"script": onSearchableFieldsChangeScript
|
|
3452
3492
|
},
|
|
3493
|
+
{
|
|
3494
|
+
"actionType": "click",
|
|
3495
|
+
"componentId": btnSearchId
|
|
3496
|
+
},
|
|
3453
3497
|
{
|
|
3454
3498
|
"componentId": "",
|
|
3455
3499
|
"args": {},
|
|
@@ -3757,8 +3801,8 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3757
3801
|
},
|
|
3758
3802
|
"body":[{
|
|
3759
3803
|
"type": "button",
|
|
3760
|
-
"visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
|
|
3761
|
-
"className":"flex mr-
|
|
3804
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
3805
|
+
"className":"flex mr-4",
|
|
3762
3806
|
"onEvent": {
|
|
3763
3807
|
"click": {
|
|
3764
3808
|
"actions": [
|
|
@@ -3775,7 +3819,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3775
3819
|
"category": "utility",
|
|
3776
3820
|
"name": "back",
|
|
3777
3821
|
"colorVariant": "default",
|
|
3778
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
3822
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
3779
3823
|
}
|
|
3780
3824
|
]
|
|
3781
3825
|
}]
|
|
@@ -3804,7 +3848,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3804
3848
|
// "tpl": "${(record && uiSchema && record[uiSchema.NAME_FIELD_KEY]) || name}",
|
|
3805
3849
|
"inline": false,
|
|
3806
3850
|
"wrapperComponent": "",
|
|
3807
|
-
"className": "leading-5 text-xl font-bold"
|
|
3851
|
+
"className": "record-detail-header-name leading-5 text-xl font-bold"
|
|
3808
3852
|
}
|
|
3809
3853
|
],
|
|
3810
3854
|
"columnClassName": "p-l-xs"
|
|
@@ -3813,6 +3857,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3813
3857
|
"className": "flex justify-between"
|
|
3814
3858
|
}
|
|
3815
3859
|
],
|
|
3860
|
+
"columnClassName": "flex-initial",
|
|
3816
3861
|
"md": "auto",
|
|
3817
3862
|
});
|
|
3818
3863
|
}
|
|
@@ -3833,7 +3878,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
3833
3878
|
{
|
|
3834
3879
|
"type": "grid",
|
|
3835
3880
|
"columns": gridBody,
|
|
3836
|
-
"className": "flex justify-between"
|
|
3881
|
+
"className": "flex justify-between flex-nowrap"
|
|
3837
3882
|
}
|
|
3838
3883
|
],
|
|
3839
3884
|
"hiddenOn": "${recordLoaded != true}"
|
|
@@ -4050,12 +4095,13 @@ const getNewListviewButtonSchema = ()=>{
|
|
|
4050
4095
|
"type": "dialog",
|
|
4051
4096
|
"title": "新建 列表视图",
|
|
4052
4097
|
"data": {
|
|
4053
|
-
"&":
|
|
4098
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4054
4099
|
"all": "${uiSchema.list_views.all}",
|
|
4055
4100
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
4056
4101
|
"appId": "${appId}",
|
|
4057
4102
|
"global": "${global}",
|
|
4058
4103
|
"targetObjectName": "${objectName}",
|
|
4104
|
+
"context": "${context}"
|
|
4059
4105
|
},
|
|
4060
4106
|
"body": [
|
|
4061
4107
|
{
|
|
@@ -4199,12 +4245,13 @@ const getCopyListviewButtonSchema = ()=>{
|
|
|
4199
4245
|
"type": "dialog",
|
|
4200
4246
|
"title": "复制 列表视图",
|
|
4201
4247
|
"data": {
|
|
4202
|
-
"&":
|
|
4248
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4203
4249
|
"listName": "${listName}",
|
|
4204
4250
|
"targetObjectName": "${objectName}",
|
|
4205
4251
|
"list_view": "${uiSchema.list_views[listName]}",
|
|
4206
4252
|
"appId": "${appId}",
|
|
4207
|
-
"global": "${global}"
|
|
4253
|
+
"global": "${global}",
|
|
4254
|
+
"context": "${context}"
|
|
4208
4255
|
},
|
|
4209
4256
|
"body": [
|
|
4210
4257
|
{
|
|
@@ -4346,7 +4393,8 @@ const getRenameListviewButtonSchema = ()=>{
|
|
|
4346
4393
|
"data": {
|
|
4347
4394
|
"targetObjectName": "${objectName}",
|
|
4348
4395
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4349
|
-
"appId": "${appId}"
|
|
4396
|
+
"appId": "${appId}",
|
|
4397
|
+
"context": "${context}"
|
|
4350
4398
|
},
|
|
4351
4399
|
"body": [
|
|
4352
4400
|
{
|
|
@@ -4403,6 +4451,7 @@ const getSetListviewShareButtonSchema = ()=>{
|
|
|
4403
4451
|
"title": "共享设置",
|
|
4404
4452
|
"data": {
|
|
4405
4453
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4454
|
+
"context": "${context}"
|
|
4406
4455
|
},
|
|
4407
4456
|
"body": [
|
|
4408
4457
|
{
|
|
@@ -4448,7 +4497,8 @@ const getSetListviewFiltersButtonSchema = ()=>{
|
|
|
4448
4497
|
"targetObjectName": "${objectName}",
|
|
4449
4498
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4450
4499
|
"listName": "${listName}",
|
|
4451
|
-
"appId": "${appId}"
|
|
4500
|
+
"appId": "${appId}",
|
|
4501
|
+
"context": "${context}"
|
|
4452
4502
|
},
|
|
4453
4503
|
"body": [
|
|
4454
4504
|
{
|
|
@@ -4592,11 +4642,12 @@ const getSetListviewColumnsButtonSchema = ()=>{
|
|
|
4592
4642
|
"type": "dialog",
|
|
4593
4643
|
"title": "显示的列",
|
|
4594
4644
|
"data": {
|
|
4595
|
-
"&":
|
|
4645
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4596
4646
|
"targetObjectName": "${objectName}",
|
|
4597
4647
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4598
4648
|
"listName": "${listName}",
|
|
4599
|
-
"appId": "${appId}"
|
|
4649
|
+
"appId": "${appId}",
|
|
4650
|
+
"context": "${context}"
|
|
4600
4651
|
},
|
|
4601
4652
|
"body": [
|
|
4602
4653
|
{
|
|
@@ -4743,13 +4794,14 @@ const getSetListviewSortButtonSchema = ()=>{
|
|
|
4743
4794
|
{
|
|
4744
4795
|
"dialog": {
|
|
4745
4796
|
"type": "dialog",
|
|
4746
|
-
"title": "
|
|
4797
|
+
"title": "默认排序规则",
|
|
4747
4798
|
"data": {
|
|
4748
|
-
"&":
|
|
4799
|
+
//"&":"$$",2.7、2.9、3.0在此处失效
|
|
4749
4800
|
"targetObjectName": "${objectName}",
|
|
4750
4801
|
"recordId": "${uiSchema.list_views[listName]._id}",
|
|
4751
4802
|
"listName": "${listName}",
|
|
4752
|
-
"appId": "${appId}"
|
|
4803
|
+
"appId": "${appId}",
|
|
4804
|
+
"context": "${context}"
|
|
4753
4805
|
},
|
|
4754
4806
|
"body": [
|
|
4755
4807
|
{
|
|
@@ -5439,24 +5491,13 @@ function getLookupSapceUserTreeSchema(){
|
|
|
5439
5491
|
"actionType": "custom",
|
|
5440
5492
|
"script": `
|
|
5441
5493
|
const scope = event.context.scoped;
|
|
5442
|
-
|
|
5443
|
-
// var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
5444
|
-
// return n.props.type === "form";
|
|
5445
|
-
// });
|
|
5446
|
-
// var filterFormValues = filterForm.getValues();
|
|
5447
|
-
filterFormValues={
|
|
5494
|
+
var filterFormValues={
|
|
5448
5495
|
"__searchable__organizations_parents":event.data.value.value
|
|
5449
5496
|
}
|
|
5450
5497
|
var listView = scope.parent.getComponents().find(function(n){
|
|
5451
5498
|
return n.props.type === "crud";
|
|
5452
5499
|
});
|
|
5453
|
-
|
|
5454
|
-
// for(var k in filterFormValues){
|
|
5455
|
-
// if(filterFormValues[k] === "" && !filterFormValues.hasOwnProperty(k)){
|
|
5456
|
-
// removedValues[k] = "";
|
|
5457
|
-
// }
|
|
5458
|
-
// }
|
|
5459
|
-
listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
5500
|
+
listView.handleFilterSubmit(Object.assign({}, filterFormValues));
|
|
5460
5501
|
`
|
|
5461
5502
|
}
|
|
5462
5503
|
]
|
|
@@ -5570,7 +5611,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5570
5611
|
|
|
5571
5612
|
const source = await getApi$1(refObjectConfig, null, fields, {expand: true, alias: 'rows', queryOptions: `filters: {__filters}, top: {__top}, skip: {__skip}, sort: "{__sort}"`});
|
|
5572
5613
|
|
|
5573
|
-
if(source.url){
|
|
5614
|
+
if(source.url && !ctx.inFilterForm){
|
|
5574
5615
|
const depend_on = [];
|
|
5575
5616
|
const sendOn = [];
|
|
5576
5617
|
___default.each(field.depend_on, (fName)=>{
|
|
@@ -5634,9 +5675,10 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
5634
5675
|
filters.push(fieldFilters);
|
|
5635
5676
|
}
|
|
5636
5677
|
|
|
5678
|
+
const inFilterForm = ${ctx.inFilterForm};
|
|
5637
5679
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5638
5680
|
|
|
5639
|
-
if(filtersFunction){
|
|
5681
|
+
if(filtersFunction && !inFilterForm){
|
|
5640
5682
|
const _filters = filtersFunction(filters, api.data.$self.__super.__super);
|
|
5641
5683
|
if(_filters && _filters.length > 0){
|
|
5642
5684
|
filters.push(_filters);
|
|
@@ -5856,7 +5898,8 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
5856
5898
|
sort = getListViewSort(listView);
|
|
5857
5899
|
}
|
|
5858
5900
|
|
|
5859
|
-
|
|
5901
|
+
// 列表视图搜索栏中,即inFilterForm=true时,不需要执行depend_on
|
|
5902
|
+
if(apiInfo.url && !ctx.inFilterForm){
|
|
5860
5903
|
const depend_on = [];
|
|
5861
5904
|
const sendOn = [];
|
|
5862
5905
|
___default.each(field.depend_on, (fName)=>{
|
|
@@ -5893,9 +5936,10 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
5893
5936
|
filters.push(fieldFilters);
|
|
5894
5937
|
}
|
|
5895
5938
|
|
|
5939
|
+
const inFilterForm = ${ctx.inFilterForm};
|
|
5896
5940
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
5897
5941
|
|
|
5898
|
-
if(filtersFunction){
|
|
5942
|
+
if(filtersFunction && !inFilterForm){
|
|
5899
5943
|
const _filters = filtersFunction(filters, api.data.$);
|
|
5900
5944
|
if(_filters && _filters.length > 0){
|
|
5901
5945
|
filters.push(_filters);
|
|
@@ -5921,7 +5965,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
5921
5965
|
referenceTo ? referenceTo.valueField.name : '';
|
|
5922
5966
|
if(field.optionsFunction || field._optionsFunction){
|
|
5923
5967
|
apiInfo.adaptor = `
|
|
5924
|
-
|
|
5968
|
+
var options = eval(${field.optionsFunction || field._optionsFunction})(api.data.$);
|
|
5969
|
+
if(api.data.$term){
|
|
5970
|
+
options = _.filter(options, function(o) {
|
|
5971
|
+
var label = o.label;
|
|
5972
|
+
return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
|
|
5973
|
+
});
|
|
5974
|
+
}
|
|
5975
|
+
payload.data.options = options;
|
|
5925
5976
|
return payload;
|
|
5926
5977
|
`;
|
|
5927
5978
|
}
|
|
@@ -6057,7 +6108,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
|
|
|
6057
6108
|
source.data.$term = "$term";
|
|
6058
6109
|
source.data.$self = "$$";
|
|
6059
6110
|
|
|
6060
|
-
if(idsDependOn && source.url){
|
|
6111
|
+
if(idsDependOn && source.url && !ctx.inFilterForm){
|
|
6061
6112
|
source.sendOn = `\${${idsDependOn} && ${idsDependOn}.length}`;
|
|
6062
6113
|
source.url = `${source.url}&depend_on_${idsDependOn}=\${${idsDependOn}|join}`;
|
|
6063
6114
|
}
|
|
@@ -6343,23 +6394,6 @@ const getAmisFileSchema = (steedosField, readonly)=>{
|
|
|
6343
6394
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
6344
6395
|
};
|
|
6345
6396
|
|
|
6346
|
-
/*
|
|
6347
|
-
* @Author: baozhoutao@steedos.com
|
|
6348
|
-
* @Date: 2022-07-20 16:29:22
|
|
6349
|
-
* @LastEditors: Please set LastEditors
|
|
6350
|
-
* @LastEditTime: 2023-05-11 11:19:54
|
|
6351
|
-
* @Description:
|
|
6352
|
-
*/
|
|
6353
|
-
|
|
6354
|
-
function getContrastColor(bgColor) {
|
|
6355
|
-
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
6356
|
-
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
6357
|
-
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
6358
|
-
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
6359
|
-
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
6360
|
-
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
6361
|
-
}
|
|
6362
|
-
|
|
6363
6397
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
6364
6398
|
// const Lookup = require('./lookup');
|
|
6365
6399
|
|
|
@@ -6550,19 +6584,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6550
6584
|
// break;
|
|
6551
6585
|
case 'select':
|
|
6552
6586
|
if(readonly){
|
|
6553
|
-
const
|
|
6554
|
-
let map = {};
|
|
6555
|
-
___default.forEach(selectOptions,(option)=>{
|
|
6556
|
-
const optionValue = option.value + '';
|
|
6557
|
-
if(option.color){
|
|
6558
|
-
const background = '#'+option.color;
|
|
6559
|
-
const color = getContrastColor(background);
|
|
6560
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
6561
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
6562
|
-
}else {
|
|
6563
|
-
map[optionValue] = option.label;
|
|
6564
|
-
}
|
|
6565
|
-
});
|
|
6587
|
+
const map = getSelectMap(field.options);
|
|
6566
6588
|
convertData = {
|
|
6567
6589
|
type: "static-mapping",
|
|
6568
6590
|
name: field.name,
|
|
@@ -6928,7 +6950,7 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
6928
6950
|
convertData.className = fieldTypeClassName;
|
|
6929
6951
|
}
|
|
6930
6952
|
|
|
6931
|
-
if(field.visible_on){
|
|
6953
|
+
if(field.visible_on && !ctx.inFilterForm){
|
|
6932
6954
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
6933
6955
|
if(field.visible_on.startsWith("{{")){
|
|
6934
6956
|
convertData.visibleOn = `${field.visible_on.substring(2, field.visible_on.length -2).replace(/formData./g, 'data.')}`;
|
|
@@ -7021,7 +7043,7 @@ async function getFieldSearchable(perField, permissionFields, ctx){
|
|
|
7021
7043
|
_field.multiple = true;
|
|
7022
7044
|
_field.is_wide = false;
|
|
7023
7045
|
_field.defaultValue = undefined;
|
|
7024
|
-
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true}));
|
|
7046
|
+
const amisField = await convertSFieldToAmisField(_field, false, Object.assign({}, ctx, {fieldNamePrefix: fieldNamePrefix, required: false, showSystemFields: true, inFilterForm: true}));
|
|
7025
7047
|
if(amisField){
|
|
7026
7048
|
return amisField;
|
|
7027
7049
|
}
|
|
@@ -7261,7 +7283,8 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
7261
7283
|
data.global = "${global}";
|
|
7262
7284
|
data.context = "${context}";
|
|
7263
7285
|
data.defaultData = "${defaultData}";
|
|
7264
|
-
|
|
7286
|
+
data._master = "${_master}";
|
|
7287
|
+
|
|
7265
7288
|
return {
|
|
7266
7289
|
method: "post",
|
|
7267
7290
|
url: getApi$2() + '&objectName=${objectName}' ,
|
|
@@ -7327,7 +7350,7 @@ async function getEditFormInitApi(object, recordId, fields, options){
|
|
|
7327
7350
|
formInitialValuesFun = new Function("return " + formInitialValuesFun)();
|
|
7328
7351
|
}
|
|
7329
7352
|
if(typeof formInitialValuesFun === "function"){
|
|
7330
|
-
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
|
|
7353
|
+
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global, master: api.body._master })
|
|
7331
7354
|
}
|
|
7332
7355
|
}
|
|
7333
7356
|
catch(ex){
|
|
@@ -7983,19 +8006,7 @@ async function getTableColumns$1(fields, options){
|
|
|
7983
8006
|
}, field.amis, {name: field.name}));
|
|
7984
8007
|
}
|
|
7985
8008
|
else if(field.type === 'select'){
|
|
7986
|
-
const
|
|
7987
|
-
let map = {};
|
|
7988
|
-
forEach(selectOptions,(option)=>{
|
|
7989
|
-
const optionValue = option.value + '';
|
|
7990
|
-
if(option.color){
|
|
7991
|
-
const background = '#'+option.color;
|
|
7992
|
-
const color = getContrastColor(background);
|
|
7993
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7994
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7995
|
-
}else {
|
|
7996
|
-
map[optionValue] = option.label;
|
|
7997
|
-
}
|
|
7998
|
-
});
|
|
8009
|
+
const map = getSelectMap(field.options);
|
|
7999
8010
|
columns.push(Object.assign({}, {
|
|
8000
8011
|
type: "mapping",
|
|
8001
8012
|
name: field.name,
|
|
@@ -8034,7 +8045,7 @@ async function getTableColumns$1(fields, options){
|
|
|
8034
8045
|
tpl: tpl,
|
|
8035
8046
|
toggled: field.toggled,
|
|
8036
8047
|
className,
|
|
8037
|
-
|
|
8048
|
+
options: field.type === 'html' ? {html: true} : null
|
|
8038
8049
|
// toggled: true
|
|
8039
8050
|
}, field.amis, {name: field.name}));
|
|
8040
8051
|
}
|
|
@@ -8548,11 +8559,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
8548
8559
|
if(api.data.$self._isRelated){
|
|
8549
8560
|
const self = api.data.$self;
|
|
8550
8561
|
const relatedKey = self.relatedKey;
|
|
8551
|
-
const recordId = self.recordId;
|
|
8552
8562
|
const refField = self.uiSchema.fields[relatedKey];
|
|
8553
8563
|
const masterRecord = self._master.record;
|
|
8554
8564
|
const masterObjectName = self._master.objectName;
|
|
8555
|
-
let relatedValue = recordId;
|
|
8565
|
+
let relatedValue = self._master.recordId;
|
|
8556
8566
|
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
8557
8567
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
8558
8568
|
}
|
|
@@ -13915,13 +13925,6 @@ var AmisRecordDetailHeader = function (props) { return __awaiter(void 0, void 0,
|
|
|
13915
13925
|
});
|
|
13916
13926
|
}); };
|
|
13917
13927
|
|
|
13918
|
-
/*
|
|
13919
|
-
* @Author: baozhoutao@steedos.com
|
|
13920
|
-
* @Date: 2022-12-08 10:32:17
|
|
13921
|
-
* @LastEditors: baozhoutao@steedos.com
|
|
13922
|
-
* @LastEditTime: 2023-04-13 18:40:42
|
|
13923
|
-
* @Description:
|
|
13924
|
-
*/
|
|
13925
13928
|
var AmisRecordDetail = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
13926
13929
|
var className, $schema, appId, _a, objectApiName, body, schema;
|
|
13927
13930
|
return __generator(this, function (_b) {
|
|
@@ -14505,7 +14508,7 @@ var AmisAppMenu = function (props) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
14505
14508
|
schemaApi: {
|
|
14506
14509
|
"method": "get",
|
|
14507
14510
|
"url": "${context.rootUrl}/service/api/apps/".concat(appId, "/menus"),
|
|
14508
|
-
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\":
|
|
14511
|
+
"adaptor": "\n try {\n console.log('payload====>', payload)\n if(payload.nav_schema){\n payload.data = payload.nav_schema;\n return payload\n }\n\n const data = { nav: [] };\n const stacked = ".concat(stacked, ";\n const showIcon = ").concat(showIcon, ";\n const selectedId = '").concat(selectedId, "';\n const tab_groups = payload.tab_groups;\n if(stacked){\n _.each(_.groupBy(payload.children, 'group'), (tabs, groupName) => {\n if (groupName === 'undefined' || groupName === '') {\n _.each(tabs, (tab) => {\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n })\n })\n } else {\n data.nav.push({\n \"label\": groupName,\n \"unfolded\": _.find(tab_groups, {\"group_name\": groupName})?.default_open != false,\n \"children\": _.map(tabs, (tab) => {\n return {\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n }\n })\n }) \n }\n });\n }else{\n _.each(payload.children, (tab)=>{\n data.nav.push({\n \"label\": showIcon ? {\n type: 'tpl',\n tpl: `<span class='fill-slate-500 text-slate-700 block -ml-px no-underline group flex items-center text-[15px] font-medium rounded-md'><svg class=\"mr-1 flex-shrink-0 h-6 w-6\"><use xlink:href=\"/assets/icons/standard-sprite/svg/symbols.svg#${tab.icon || 'account'}\"></use></svg>${tab.name}</span>`\n } : tab.name,\n \"to\": tab.path,\n \"target\":tab.target\n // active: selectedId === tab.id,\n });\n })\n }\n payload.data = {\n \"type\": \"nav\",\n className: \"").concat(className, "\",\n \"stacked\": ").concat(stacked, ",\n \"overflow\": ").concat(JSON.stringify(overflow), ",\n \"indentSize\": ").concat(indentSize, ",\n \"links\": data.nav,\n };\n } catch (error) {\n console.log(`error`, error)\n }\n console.log('payload===2==>', payload)\n return payload;\n "),
|
|
14509
14512
|
"headers": {
|
|
14510
14513
|
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
14511
14514
|
}
|
|
@@ -14954,7 +14957,7 @@ var AmisGlobalHeaderToolbar = function (props) { return __awaiter(void 0, void 0
|
|
|
14954
14957
|
* @Author: baozhoutao@steedos.com
|
|
14955
14958
|
* @Date: 2022-09-01 14:44:57
|
|
14956
14959
|
* @LastEditors: 殷亮辉 yinlianghui@hotoa.com
|
|
14957
|
-
* @LastEditTime: 2023-05-
|
|
14960
|
+
* @LastEditTime: 2023-05-18 22:39:31
|
|
14958
14961
|
* @Description:
|
|
14959
14962
|
*/
|
|
14960
14963
|
var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -15014,7 +15017,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
15014
15017
|
},
|
|
15015
15018
|
{
|
|
15016
15019
|
"type": "button",
|
|
15017
|
-
"visibleOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}",
|
|
15020
|
+
"visibleOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}",
|
|
15018
15021
|
"className": "flex",
|
|
15019
15022
|
"onEvent": {
|
|
15020
15023
|
"click": {
|
|
@@ -15040,7 +15043,7 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
15040
15043
|
"className": 'block h-10 w-auto mr-4',
|
|
15041
15044
|
"type": "tpl",
|
|
15042
15045
|
"tpl": "<a href='/app' class='flex items-center '><img class='block h-10 w-auto' src='".concat(logoSrc, "'></a>"),
|
|
15043
|
-
"hiddenOn": "${window:innerWidth < 768 && window:historyPaths.length > 1}"
|
|
15046
|
+
"hiddenOn": "${window:innerWidth < 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id)}"
|
|
15044
15047
|
},
|
|
15045
15048
|
],
|
|
15046
15049
|
},
|