@steedos-widgets/amis-lib 1.2.9 → 1.2.10
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 +44 -53
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +45 -54
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +44 -53
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/tpl.d.ts +1 -0
- package/dist/types/lib/converter/amis/util.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -408,11 +408,28 @@
|
|
|
408
408
|
|
|
409
409
|
};
|
|
410
410
|
|
|
411
|
+
/*
|
|
412
|
+
* @Author: baozhoutao@steedos.com
|
|
413
|
+
* @Date: 2022-07-20 16:29:22
|
|
414
|
+
* @LastEditors: Please set LastEditors
|
|
415
|
+
* @LastEditTime: 2023-05-18 15:22:51
|
|
416
|
+
* @Description:
|
|
417
|
+
*/
|
|
418
|
+
|
|
419
|
+
function getContrastColor(bgColor) {
|
|
420
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
421
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
422
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
423
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
424
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
425
|
+
return brightness < 128 ? "#ffffff" : "#000000";
|
|
426
|
+
}
|
|
427
|
+
|
|
411
428
|
/*
|
|
412
429
|
* @Author: baozhoutao@steedos.com
|
|
413
430
|
* @Date: 2022-05-23 09:53:08
|
|
414
|
-
* @LastEditors:
|
|
415
|
-
* @LastEditTime: 2023-
|
|
431
|
+
* @LastEditors: Please set LastEditors
|
|
432
|
+
* @LastEditTime: 2023-05-18 16:34:39
|
|
416
433
|
* @Description:
|
|
417
434
|
*/
|
|
418
435
|
|
|
@@ -465,6 +482,21 @@
|
|
|
465
482
|
function getSelectTpl(field){
|
|
466
483
|
return `<div>\${_display.${field.name}}</div>`
|
|
467
484
|
}
|
|
485
|
+
function getSelectMap(selectOptions){
|
|
486
|
+
let map = {};
|
|
487
|
+
_$1.forEach(selectOptions,(option)=>{
|
|
488
|
+
const optionValue = option.value + '';
|
|
489
|
+
if(option.color){
|
|
490
|
+
const background = option.color.charAt(0) === '#' ? option.color : '#'+option.color;
|
|
491
|
+
const color = getContrastColor(background);
|
|
492
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
493
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
494
|
+
}else {
|
|
495
|
+
map[optionValue] = option.label;
|
|
496
|
+
}
|
|
497
|
+
});
|
|
498
|
+
return map;
|
|
499
|
+
}
|
|
468
500
|
|
|
469
501
|
function getNameTplUrl(field, ctx){
|
|
470
502
|
if(ctx.objectName === 'cms_files'){
|
|
@@ -3424,8 +3456,8 @@
|
|
|
3424
3456
|
},
|
|
3425
3457
|
"body":[{
|
|
3426
3458
|
"type": "button",
|
|
3427
|
-
"visibleOn": "${window:innerWidth > 768 && window:historyPaths.length > 1}",
|
|
3428
|
-
"className":"flex mr-
|
|
3459
|
+
"visibleOn": "${window:innerWidth > 768 && (window:historyPaths.length > 1 || window:historyPaths[0].params.record_id) && display !== 'split'}",
|
|
3460
|
+
"className":"flex mr-4",
|
|
3429
3461
|
"onEvent": {
|
|
3430
3462
|
"click": {
|
|
3431
3463
|
"actions": [
|
|
@@ -3442,7 +3474,7 @@
|
|
|
3442
3474
|
"category": "utility",
|
|
3443
3475
|
"name": "back",
|
|
3444
3476
|
"colorVariant": "default",
|
|
3445
|
-
"className": "slds-button_icon slds-global-header__icon"
|
|
3477
|
+
"className": "slds-button_icon slds-global-header__icon w-4"
|
|
3446
3478
|
}
|
|
3447
3479
|
]
|
|
3448
3480
|
}]
|
|
@@ -4410,7 +4442,7 @@
|
|
|
4410
4442
|
{
|
|
4411
4443
|
"dialog": {
|
|
4412
4444
|
"type": "dialog",
|
|
4413
|
-
"title": "
|
|
4445
|
+
"title": "默认排序规则",
|
|
4414
4446
|
"data": {
|
|
4415
4447
|
"&": "$$",
|
|
4416
4448
|
"targetObjectName": "${objectName}",
|
|
@@ -6010,23 +6042,6 @@ else{
|
|
|
6010
6042
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
6011
6043
|
};
|
|
6012
6044
|
|
|
6013
|
-
/*
|
|
6014
|
-
* @Author: baozhoutao@steedos.com
|
|
6015
|
-
* @Date: 2022-07-20 16:29:22
|
|
6016
|
-
* @LastEditors: Please set LastEditors
|
|
6017
|
-
* @LastEditTime: 2023-05-11 11:19:54
|
|
6018
|
-
* @Description:
|
|
6019
|
-
*/
|
|
6020
|
-
|
|
6021
|
-
function getContrastColor(bgColor) {
|
|
6022
|
-
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
6023
|
-
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
6024
|
-
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
6025
|
-
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
6026
|
-
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
6027
|
-
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
6028
|
-
}
|
|
6029
|
-
|
|
6030
6045
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
6031
6046
|
// const Lookup = require('./lookup');
|
|
6032
6047
|
|
|
@@ -6217,19 +6232,7 @@ else{
|
|
|
6217
6232
|
// break;
|
|
6218
6233
|
case 'select':
|
|
6219
6234
|
if(readonly){
|
|
6220
|
-
const
|
|
6221
|
-
let map = {};
|
|
6222
|
-
___namespace.forEach(selectOptions,(option)=>{
|
|
6223
|
-
const optionValue = option.value + '';
|
|
6224
|
-
if(option.color){
|
|
6225
|
-
const background = '#'+option.color;
|
|
6226
|
-
const color = getContrastColor(background);
|
|
6227
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
6228
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
6229
|
-
}else {
|
|
6230
|
-
map[optionValue] = option.label;
|
|
6231
|
-
}
|
|
6232
|
-
});
|
|
6235
|
+
const map = getSelectMap(field.options);
|
|
6233
6236
|
convertData = {
|
|
6234
6237
|
type: "static-mapping",
|
|
6235
6238
|
name: field.name,
|
|
@@ -6928,7 +6931,8 @@ else{
|
|
|
6928
6931
|
data.global = "${global}";
|
|
6929
6932
|
data.context = "${context}";
|
|
6930
6933
|
data.defaultData = "${defaultData}";
|
|
6931
|
-
|
|
6934
|
+
data._master = "${_master}";
|
|
6935
|
+
|
|
6932
6936
|
return {
|
|
6933
6937
|
method: "post",
|
|
6934
6938
|
url: getApi$2() + '&objectName=${objectName}' ,
|
|
@@ -6994,7 +6998,7 @@ else{
|
|
|
6994
6998
|
formInitialValuesFun = new Function("return " + formInitialValuesFun)();
|
|
6995
6999
|
}
|
|
6996
7000
|
if(typeof formInitialValuesFun === "function"){
|
|
6997
|
-
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global})
|
|
7001
|
+
initialValues = formInitialValuesFun.apply({doc: defaultValues || {} , global: api.body.global, master: api.body._master })
|
|
6998
7002
|
}
|
|
6999
7003
|
}
|
|
7000
7004
|
catch(ex){
|
|
@@ -7650,19 +7654,7 @@ else{
|
|
|
7650
7654
|
}, field.amis, {name: field.name}));
|
|
7651
7655
|
}
|
|
7652
7656
|
else if(field.type === 'select'){
|
|
7653
|
-
const
|
|
7654
|
-
let map = {};
|
|
7655
|
-
_$1.forEach(selectOptions,(option)=>{
|
|
7656
|
-
const optionValue = option.value + '';
|
|
7657
|
-
if(option.color){
|
|
7658
|
-
const background = '#'+option.color;
|
|
7659
|
-
const color = getContrastColor(background);
|
|
7660
|
-
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7661
|
-
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7662
|
-
}else {
|
|
7663
|
-
map[optionValue] = option.label;
|
|
7664
|
-
}
|
|
7665
|
-
});
|
|
7657
|
+
const map = getSelectMap(field.options);
|
|
7666
7658
|
columns.push(Object.assign({}, {
|
|
7667
7659
|
type: "mapping",
|
|
7668
7660
|
name: field.name,
|
|
@@ -8215,11 +8207,10 @@ else{
|
|
|
8215
8207
|
if(api.data.$self._isRelated){
|
|
8216
8208
|
const self = api.data.$self;
|
|
8217
8209
|
const relatedKey = self.relatedKey;
|
|
8218
|
-
const recordId = self.recordId;
|
|
8219
8210
|
const refField = self.uiSchema.fields[relatedKey];
|
|
8220
8211
|
const masterRecord = self._master.record;
|
|
8221
8212
|
const masterObjectName = self._master.objectName;
|
|
8222
|
-
let relatedValue = recordId;
|
|
8213
|
+
let relatedValue = self._master.recordId;
|
|
8223
8214
|
if(refField.reference_to_field && refField.reference_to_field != '_id'){
|
|
8224
8215
|
relatedValue = masterRecord[refField.reference_to_field]
|
|
8225
8216
|
}
|