@steedos-widgets/amis-lib 1.2.34 → 1.2.35-beta.2
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 +133 -57
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +133 -57
- package/dist/index.esm.js.map +1 -1
- package/dist/index.umd.js +133 -57
- package/dist/index.umd.js.map +1 -1
- package/dist/types/lib/converter/amis/graphql.d.ts +1 -1
- package/dist/types/lib/converter/amis/tpl.d.ts +1 -0
- package/package.json +2 -2
package/dist/index.umd.js
CHANGED
|
@@ -423,8 +423,8 @@
|
|
|
423
423
|
/*
|
|
424
424
|
* @Author: baozhoutao@steedos.com
|
|
425
425
|
* @Date: 2022-05-23 09:53:08
|
|
426
|
-
* @LastEditors:
|
|
427
|
-
* @LastEditTime: 2023-
|
|
426
|
+
* @LastEditors: liaodaxue
|
|
427
|
+
* @LastEditTime: 2023-07-28 16:26:31
|
|
428
428
|
* @Description:
|
|
429
429
|
*/
|
|
430
430
|
|
|
@@ -608,6 +608,9 @@
|
|
|
608
608
|
<% } %>`
|
|
609
609
|
}
|
|
610
610
|
|
|
611
|
+
function getLocationTpl(field){
|
|
612
|
+
return `\${${field.name} ? ${field.name}.address : ''}`
|
|
613
|
+
}
|
|
611
614
|
|
|
612
615
|
async function getFieldTpl (field, options){
|
|
613
616
|
if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLabel){
|
|
@@ -632,6 +635,8 @@
|
|
|
632
635
|
return await getRelatedFieldTpl(field, options);
|
|
633
636
|
case 'master_detail':
|
|
634
637
|
return await getRelatedFieldTpl(field, options);
|
|
638
|
+
case 'location':
|
|
639
|
+
return await getLocationTpl(field);
|
|
635
640
|
case 'number':
|
|
636
641
|
case 'currency':
|
|
637
642
|
return await getNumberTpl(field);
|
|
@@ -644,9 +649,10 @@
|
|
|
644
649
|
}
|
|
645
650
|
}
|
|
646
651
|
|
|
647
|
-
async function getFieldsTemplate(fields,
|
|
648
|
-
|
|
649
|
-
|
|
652
|
+
async function getFieldsTemplate(fields, display){
|
|
653
|
+
let expandFields = [];
|
|
654
|
+
if(display != false){
|
|
655
|
+
display = true;
|
|
650
656
|
}
|
|
651
657
|
let fieldsName = ['_id'];
|
|
652
658
|
let displayFields = [];
|
|
@@ -658,33 +664,43 @@
|
|
|
658
664
|
}
|
|
659
665
|
for (const field of fieldsArr) {
|
|
660
666
|
//graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
|
|
661
|
-
if(field.
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
667
|
+
if(field.expand){
|
|
668
|
+
expandFields.push(field);
|
|
669
|
+
}else {
|
|
670
|
+
if(field.name.indexOf('.') < 0){
|
|
671
|
+
if(display && (field.type == 'lookup' || field.type == 'master_detail')){
|
|
672
|
+
fieldsName.push(`${field.name}`);
|
|
673
|
+
displayFields.push(`${field.name}`);
|
|
674
|
+
}else {
|
|
675
|
+
fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
|
|
676
|
+
}
|
|
677
|
+
if(_$1.includes(['time','date','datetime','boolean','number','currency'], field.type)){
|
|
678
|
+
fieldsName.push(`${field.name}`);
|
|
679
|
+
}
|
|
680
|
+
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
681
|
+
displayFields.push(`${field.name}`);
|
|
682
|
+
}
|
|
665
683
|
}else {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
fieldsName.push(`${field.name}`);
|
|
684
|
+
objectFieldName = field.name.split('.')[0];
|
|
685
|
+
fieldsName.push(objectFieldName);
|
|
686
|
+
displayFields.push(objectFieldName);
|
|
670
687
|
}
|
|
671
|
-
if(_$1.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
|
|
672
|
-
displayFields.push(`${field.name}`);
|
|
673
|
-
}
|
|
674
|
-
}else {
|
|
675
|
-
objectFieldName = field.name.split('.')[0];
|
|
676
|
-
fieldsName.push(objectFieldName);
|
|
677
|
-
displayFields.push(objectFieldName);
|
|
678
688
|
}
|
|
679
689
|
}
|
|
680
690
|
|
|
681
691
|
displayFields = ___namespace.uniq(displayFields);
|
|
682
692
|
fieldsName = ___namespace.uniq(fieldsName);
|
|
693
|
+
let expandFieldsQuery = "";
|
|
694
|
+
if(expandFields.length > 0){
|
|
695
|
+
___namespace.each(expandFields, function(field){
|
|
696
|
+
expandFieldsQuery = expandFieldsQuery + `${field.expandInfo.fieldName}:${field.expandInfo.fieldName}__expand{${field.expandInfo.displayName}}`;
|
|
697
|
+
});
|
|
698
|
+
}
|
|
683
699
|
|
|
684
700
|
if(displayFields.length > 0){
|
|
685
|
-
return `${fieldsName.join(',')},_display:_ui{${displayFields.join(',')}}`;
|
|
701
|
+
return `${fieldsName.join(',')},${expandFieldsQuery},_display:_ui{${displayFields.join(',')}}`;
|
|
686
702
|
}
|
|
687
|
-
return `${fieldsName.join(' ')}`
|
|
703
|
+
return `${fieldsName.join(' ')},${expandFieldsQuery}`
|
|
688
704
|
}
|
|
689
705
|
|
|
690
706
|
function getRecordPermissionsTemplate(){
|
|
@@ -974,6 +990,7 @@
|
|
|
974
990
|
var frontend_form_cancel$1 = "Cancel";
|
|
975
991
|
var frontend_form_new$1 = "New";
|
|
976
992
|
var frontend_form_edit$1 = "Edit";
|
|
993
|
+
var frontend_form_preview$1 = "Preview";
|
|
977
994
|
var frontend_form_select$1 = "Select";
|
|
978
995
|
var frontend_form_please_select$1 = "Please select";
|
|
979
996
|
var frontend_form_confirm$1 = "Confirm";
|
|
@@ -1056,6 +1073,7 @@
|
|
|
1056
1073
|
frontend_form_cancel: frontend_form_cancel$1,
|
|
1057
1074
|
frontend_form_new: frontend_form_new$1,
|
|
1058
1075
|
frontend_form_edit: frontend_form_edit$1,
|
|
1076
|
+
frontend_form_preview: frontend_form_preview$1,
|
|
1059
1077
|
frontend_form_select: frontend_form_select$1,
|
|
1060
1078
|
frontend_form_please_select: frontend_form_please_select$1,
|
|
1061
1079
|
frontend_form_confirm: frontend_form_confirm$1,
|
|
@@ -1139,6 +1157,7 @@
|
|
|
1139
1157
|
var frontend_form_cancel = "取消";
|
|
1140
1158
|
var frontend_form_new = "新建";
|
|
1141
1159
|
var frontend_form_edit = "编辑";
|
|
1160
|
+
var frontend_form_preview = "预览";
|
|
1142
1161
|
var frontend_form_select = "选择";
|
|
1143
1162
|
var frontend_form_please_select = "请选择";
|
|
1144
1163
|
var frontend_form_confirm = "确认";
|
|
@@ -1222,6 +1241,7 @@
|
|
|
1222
1241
|
frontend_form_cancel: frontend_form_cancel,
|
|
1223
1242
|
frontend_form_new: frontend_form_new,
|
|
1224
1243
|
frontend_form_edit: frontend_form_edit,
|
|
1244
|
+
frontend_form_preview: frontend_form_preview,
|
|
1225
1245
|
frontend_form_select: frontend_form_select,
|
|
1226
1246
|
frontend_form_please_select: frontend_form_please_select,
|
|
1227
1247
|
frontend_form_confirm: frontend_form_confirm,
|
|
@@ -6484,11 +6504,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6484
6504
|
* @Author: baozhoutao@steedos.com
|
|
6485
6505
|
* @Date: 2023-01-13 17:27:54
|
|
6486
6506
|
* @LastEditors: liaodaxue
|
|
6487
|
-
* @LastEditTime: 2023-07-
|
|
6507
|
+
* @LastEditTime: 2023-07-27 17:33:54
|
|
6488
6508
|
* @Description:
|
|
6489
6509
|
*/
|
|
6490
6510
|
|
|
6491
|
-
|
|
6492
6511
|
const getMarkdownFieldSchema = (field, readonly, ctx)=>{
|
|
6493
6512
|
if(readonly){
|
|
6494
6513
|
return {
|
|
@@ -6515,7 +6534,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6515
6534
|
"className": "steedos-markdown",
|
|
6516
6535
|
"tabs": [
|
|
6517
6536
|
{
|
|
6518
|
-
"title": "
|
|
6537
|
+
"title": i18next__default["default"].t('frontend_form_edit'),
|
|
6519
6538
|
"tab": [
|
|
6520
6539
|
{
|
|
6521
6540
|
"type": "editor",
|
|
@@ -6525,7 +6544,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6525
6544
|
]
|
|
6526
6545
|
},
|
|
6527
6546
|
{
|
|
6528
|
-
"title": "
|
|
6547
|
+
"title": i18next__default["default"].t('frontend_form_preview'),
|
|
6529
6548
|
"tab": [
|
|
6530
6549
|
{
|
|
6531
6550
|
"type": "markdown",
|
|
@@ -6582,7 +6601,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6582
6601
|
* @Author: baozhoutao@steedos.com
|
|
6583
6602
|
* @Date: 2022-10-28 14:52:55
|
|
6584
6603
|
* @LastEditors: liaodaxue
|
|
6585
|
-
* @LastEditTime: 2023-07-
|
|
6604
|
+
* @LastEditTime: 2023-07-28 16:16:29
|
|
6586
6605
|
* @Description:
|
|
6587
6606
|
*/
|
|
6588
6607
|
|
|
@@ -6606,6 +6625,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
6606
6625
|
if(!readonly){
|
|
6607
6626
|
if(___namespace.includes(AmisFormInputs, type)){
|
|
6608
6627
|
return `input-${type}`;
|
|
6628
|
+
}else if(type === 'location'){
|
|
6629
|
+
return "location-picker"
|
|
6609
6630
|
}
|
|
6610
6631
|
return type;
|
|
6611
6632
|
}
|
|
@@ -7163,6 +7184,30 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7163
7184
|
type: getAmisStaticFieldType('email', readonly)
|
|
7164
7185
|
};
|
|
7165
7186
|
break;
|
|
7187
|
+
case 'location':
|
|
7188
|
+
// 申请ak后需要设置白名单; https://lbsyun.baidu.com/apiconsole/key/create#/home
|
|
7189
|
+
// console.log('fie==>', field.name, field);
|
|
7190
|
+
let ak = "LiZT5dVbGTsPI91tFGcOlSpe5FDehpf7";
|
|
7191
|
+
let vendor = "baidu"; /* 'baidu' | 'gaode' */
|
|
7192
|
+
if(window.Meteor){
|
|
7193
|
+
const map_ak = Meteor.settings?.public?.amis?.map_ak;
|
|
7194
|
+
if(map_ak){
|
|
7195
|
+
ak = map_ak;
|
|
7196
|
+
}
|
|
7197
|
+
const map_vendor = Meteor.settings?.public?.amis?.map_vendor;
|
|
7198
|
+
if(map_vendor){
|
|
7199
|
+
vendor = map_vendor;
|
|
7200
|
+
}
|
|
7201
|
+
}
|
|
7202
|
+
|
|
7203
|
+
convertData = {
|
|
7204
|
+
type: getAmisStaticFieldType('location', readonly),
|
|
7205
|
+
tpl: readonly ? getLocationTpl(field) : null,
|
|
7206
|
+
ak,
|
|
7207
|
+
vendor,
|
|
7208
|
+
label: field.label
|
|
7209
|
+
};
|
|
7210
|
+
break;
|
|
7166
7211
|
case 'avatar':
|
|
7167
7212
|
convertData = getAmisFileSchema(field, readonly);
|
|
7168
7213
|
break;
|
|
@@ -7654,6 +7699,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7654
7699
|
for (const field of fields) {
|
|
7655
7700
|
//增加quickEdit属性,实现快速编辑
|
|
7656
7701
|
const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
|
|
7702
|
+
let className = "";
|
|
7703
|
+
if(field.wrap != true){
|
|
7704
|
+
className += " whitespace-nowrap";
|
|
7705
|
+
}
|
|
7657
7706
|
if((field.is_name || field.name === options.labelFieldName) && options.objectName === 'cms_files'){
|
|
7658
7707
|
const previewFileScript = `
|
|
7659
7708
|
var data = event.data;
|
|
@@ -7664,7 +7713,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7664
7713
|
columns.push({
|
|
7665
7714
|
"type": "button",
|
|
7666
7715
|
"label": `<%=data.versions ? data.name : "${field.label}"%>`,
|
|
7667
|
-
|
|
7716
|
+
className,
|
|
7668
7717
|
"level": "link",
|
|
7669
7718
|
"quickEdit": quickEditSchema,
|
|
7670
7719
|
"onEvent": {
|
|
@@ -7701,7 +7750,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7701
7750
|
width: getFieldWidth(field.width),
|
|
7702
7751
|
toggled: field.toggled,
|
|
7703
7752
|
static: true,
|
|
7704
|
-
className
|
|
7753
|
+
className,
|
|
7705
7754
|
quickEdit: quickEditSchema
|
|
7706
7755
|
}, field.amis, {name: field.name}));
|
|
7707
7756
|
}else if(field.type === 'avatar' || field.type === 'image' || field.type === 'file'){
|
|
@@ -7713,16 +7762,12 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7713
7762
|
toggled: field.toggled,
|
|
7714
7763
|
quickEdit: quickEditSchema,
|
|
7715
7764
|
static: true,
|
|
7716
|
-
className
|
|
7765
|
+
className,
|
|
7717
7766
|
...getAmisFileReadonlySchema(field)
|
|
7718
7767
|
}, field.amis, {name: field.name}));
|
|
7719
7768
|
}
|
|
7720
7769
|
else if(field.type === 'select'){
|
|
7721
7770
|
const map = getSelectMap(field.options);
|
|
7722
|
-
let className = "";
|
|
7723
|
-
if(field.wrap === false){
|
|
7724
|
-
className += " whitespace-nowrap";
|
|
7725
|
-
}
|
|
7726
7771
|
columns.push(Object.assign({}, {
|
|
7727
7772
|
type: "mapping",
|
|
7728
7773
|
name: field.name,
|
|
@@ -7750,12 +7795,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7750
7795
|
type = 'input-url';
|
|
7751
7796
|
}
|
|
7752
7797
|
}
|
|
7753
|
-
let className = "";
|
|
7754
7798
|
if(field.type === 'textarea'){
|
|
7755
|
-
className
|
|
7756
|
-
}
|
|
7757
|
-
if(field.wrap === false){
|
|
7758
|
-
className += " whitespace-nowrap";
|
|
7799
|
+
className += 'min-w-56';
|
|
7759
7800
|
}
|
|
7760
7801
|
if(!field.hidden && !field.extra){
|
|
7761
7802
|
columns.push(Object.assign({}, {
|
|
@@ -7775,6 +7816,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
7775
7816
|
}, field.amis, {name: field.name}));
|
|
7776
7817
|
}
|
|
7777
7818
|
}
|
|
7819
|
+
|
|
7778
7820
|
}
|
|
7779
7821
|
// columns.push(getOperation(fields));
|
|
7780
7822
|
if(!___namespace.some(columns, { name: options.labelFieldName })){
|
|
@@ -9315,13 +9357,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
9315
9357
|
"selectMirror": permissions.allowCreate,
|
|
9316
9358
|
"initialView": initialView,
|
|
9317
9359
|
"businessHours": businessHours,
|
|
9318
|
-
...config,
|
|
9319
|
-
"onEvent": onEvent,
|
|
9320
9360
|
"views":{
|
|
9321
9361
|
listWeek: {
|
|
9322
9362
|
buttonText: i18next__default["default"].t('frontend_calendar_listWeek')
|
|
9323
9363
|
}
|
|
9324
|
-
}
|
|
9364
|
+
},
|
|
9365
|
+
...config,
|
|
9366
|
+
"onEvent": onEvent
|
|
9325
9367
|
};
|
|
9326
9368
|
return amisSchema;
|
|
9327
9369
|
}
|
|
@@ -10354,8 +10396,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10354
10396
|
/*
|
|
10355
10397
|
* @Author: baozhoutao@steedos.com
|
|
10356
10398
|
* @Date: 2022-07-05 15:55:39
|
|
10357
|
-
* @LastEditors:
|
|
10358
|
-
* @LastEditTime: 2023-
|
|
10399
|
+
* @LastEditors: baozhoutao@steedos.com
|
|
10400
|
+
* @LastEditTime: 2023-07-29 13:58:07
|
|
10359
10401
|
* @Description:
|
|
10360
10402
|
*/
|
|
10361
10403
|
|
|
@@ -10689,6 +10731,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10689
10731
|
"filterVisible": ctx.filterVisible,
|
|
10690
10732
|
"rowClassNameExpr": ctx.rowClassNameExpr
|
|
10691
10733
|
};
|
|
10734
|
+
// console.log(`getListSchema===>`,amisSchema)
|
|
10692
10735
|
return {
|
|
10693
10736
|
uiSchema,
|
|
10694
10737
|
amisSchema,
|
|
@@ -10702,7 +10745,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10702
10745
|
columns,
|
|
10703
10746
|
ctx = {}
|
|
10704
10747
|
) {
|
|
10705
|
-
// console.time('getTableSchema');
|
|
10748
|
+
// console.time('getTableSchema', columns);
|
|
10706
10749
|
const uiSchema = await getUISchema(objectName);
|
|
10707
10750
|
|
|
10708
10751
|
let sort = ctx.sort;
|
|
@@ -10716,19 +10759,52 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
10716
10759
|
}
|
|
10717
10760
|
|
|
10718
10761
|
let fields = [];
|
|
10719
|
-
|
|
10720
|
-
if (_$1.isString(column)
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10762
|
+
for(const column of columns){
|
|
10763
|
+
if (_$1.isString(column)) {
|
|
10764
|
+
if(column.indexOf('.') > 0){
|
|
10765
|
+
const fieldName = column.split('.')[0];
|
|
10766
|
+
const displayName = column.split('.')[1];
|
|
10767
|
+
const filedInfo = uiSchema.fields[fieldName];
|
|
10768
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
10769
|
+
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10770
|
+
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10771
|
+
fields.push(Object.assign({}, rfFieldInfo, {name: column, expand: true, expandInfo: {fieldName, displayName}}));
|
|
10772
|
+
}
|
|
10773
|
+
}else {
|
|
10774
|
+
if(uiSchema.fields[column]){
|
|
10775
|
+
fields.push(uiSchema.fields[column]);
|
|
10776
|
+
}
|
|
10777
|
+
}
|
|
10778
|
+
} else if (_$1.isObject(column)) {
|
|
10779
|
+
if(column.field.indexOf('.') > 0){
|
|
10780
|
+
const fieldName = column.field.split('.')[0];
|
|
10781
|
+
const displayName = column.field.split('.')[1];
|
|
10782
|
+
const filedInfo = uiSchema.fields[fieldName];
|
|
10783
|
+
if(filedInfo && (filedInfo.type === 'lookup' || filedInfo.type === 'master_detail') && _$1.isString(filedInfo.reference_to) ){
|
|
10784
|
+
const rfUiSchema = await getUISchema(filedInfo.reference_to);
|
|
10785
|
+
const rfFieldInfo = rfUiSchema.fields[displayName];
|
|
10786
|
+
fields.push(Object.assign({}, rfFieldInfo,
|
|
10787
|
+
{name: column.field, expand: true, expandInfo: {fieldName, displayName}},
|
|
10788
|
+
{
|
|
10789
|
+
width: column.width,
|
|
10790
|
+
wrap: column.wrap, // wrap = true 是没效果的
|
|
10791
|
+
amis: column.amis
|
|
10792
|
+
}
|
|
10793
|
+
));
|
|
10794
|
+
}
|
|
10795
|
+
}else {
|
|
10796
|
+
if(uiSchema.fields[column.field]){
|
|
10797
|
+
fields.push(
|
|
10798
|
+
Object.assign({}, uiSchema.fields[column.field], {
|
|
10799
|
+
width: column.width,
|
|
10800
|
+
wrap: column.wrap, // wrap = true 是没效果的
|
|
10801
|
+
amis: column.amis
|
|
10802
|
+
})
|
|
10803
|
+
);
|
|
10804
|
+
}
|
|
10805
|
+
}
|
|
10730
10806
|
}
|
|
10731
|
-
}
|
|
10807
|
+
}
|
|
10732
10808
|
|
|
10733
10809
|
const extraColumns = ctx.extraColumns;
|
|
10734
10810
|
|