@steedos-widgets/amis-object 6.3.2 → 6.3.3
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-object.cjs.js +144 -122
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.js +144 -122
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.js +15 -16
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +70 -75
- package/package.json +3 -3
package/dist/amis-object.esm.js
CHANGED
|
@@ -12828,9 +12828,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
12828
12828
|
async function getObjectForm(objectSchema, ctx){
|
|
12829
12829
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
12830
12830
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
12831
|
+
let enableTabs = ctx.enableTabs;
|
|
12831
12832
|
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12832
|
-
if (typeof
|
|
12833
|
-
|
|
12833
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12834
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12834
12835
|
}
|
|
12835
12836
|
const fields = _$1__default.values(objectSchema.fields);
|
|
12836
12837
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -12874,7 +12875,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
12874
12875
|
body: {
|
|
12875
12876
|
type: 'wrapper',
|
|
12876
12877
|
className: 'p-0 m-0',
|
|
12877
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
12878
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true, enableTabs})),
|
|
12878
12879
|
hiddenOn: "${editFormInited != true}",
|
|
12879
12880
|
},
|
|
12880
12881
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -12929,6 +12930,11 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12929
12930
|
const fields = _$1__default.values(objectSchema.fields);
|
|
12930
12931
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
12931
12932
|
const serviceId = `service_detail_page`;
|
|
12933
|
+
let enableTabs = ctx.enableTabs;
|
|
12934
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12935
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12936
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12937
|
+
}
|
|
12932
12938
|
const amisSchema = {
|
|
12933
12939
|
type: 'service',
|
|
12934
12940
|
name: `page_readonly_${recordId}`,
|
|
@@ -12955,7 +12961,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12955
12961
|
body: await getFormBody(
|
|
12956
12962
|
map(fields, (field) => { field.readonly = true; return field; }),
|
|
12957
12963
|
map(formFields, (field) => { field.readonly = true; return field; }),
|
|
12958
|
-
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups })
|
|
12964
|
+
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups, enableTabs })
|
|
12959
12965
|
),
|
|
12960
12966
|
className: 'steedos-amis-form bg-white',
|
|
12961
12967
|
actions: [], // 不显示表单默认的提交按钮
|
|
@@ -22187,7 +22193,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22187
22193
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
22188
22194
|
initApiAdaptor: initApiAdaptor,
|
|
22189
22195
|
enableTabs: enableTabs,
|
|
22190
|
-
tabsMode: tabsMode,
|
|
22196
|
+
tabsMode: tabsMode || "vertical",
|
|
22191
22197
|
formDataFilter: formDataFilter,
|
|
22192
22198
|
onFormDataFilter: onFormDataFilter,
|
|
22193
22199
|
amisData: allData,
|
|
@@ -24184,6 +24190,9 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
24184
24190
|
else if (type === 'color') {
|
|
24185
24191
|
return 'static-color';
|
|
24186
24192
|
}
|
|
24193
|
+
else if (type === 'file') {
|
|
24194
|
+
return 'control';
|
|
24195
|
+
}
|
|
24187
24196
|
return type;
|
|
24188
24197
|
}
|
|
24189
24198
|
function getLookupLinkOnClick(field, options) {
|
|
@@ -24276,7 +24285,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24276
24285
|
}
|
|
24277
24286
|
_5.label = 1;
|
|
24278
24287
|
case 1:
|
|
24279
|
-
_5.trys.push([1,
|
|
24288
|
+
_5.trys.push([1, 22, , 23]);
|
|
24280
24289
|
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 16];
|
|
24281
24290
|
lookupATagClick = 'onclick="return false;"';
|
|
24282
24291
|
if (window.innerWidth < 768) {
|
|
@@ -24513,7 +24522,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24513
24522
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
24514
24523
|
return [2 /*return*/, schema];
|
|
24515
24524
|
case 16:
|
|
24516
|
-
if (!fStatic) return [3 /*break*/,
|
|
24525
|
+
if (!fStatic) return [3 /*break*/, 19];
|
|
24517
24526
|
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 18];
|
|
24518
24527
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24519
24528
|
case 17:
|
|
@@ -24563,123 +24572,138 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24563
24572
|
static: true,
|
|
24564
24573
|
label: steedosField.label
|
|
24565
24574
|
});
|
|
24566
|
-
if (
|
|
24567
|
-
|
|
24568
|
-
|
|
24569
|
-
|
|
24570
|
-
|
|
24571
|
-
|
|
24572
|
-
|
|
24573
|
-
|
|
24574
|
-
|
|
24575
|
-
|
|
24576
|
-
|
|
24577
|
-
}
|
|
24578
|
-
|
|
24579
|
-
|
|
24580
|
-
|
|
24581
|
-
|
|
24582
|
-
|
|
24583
|
-
|
|
24584
|
-
|
|
24585
|
-
|
|
24586
|
-
|
|
24587
|
-
|
|
24588
|
-
|
|
24589
|
-
|
|
24590
|
-
|
|
24591
|
-
|
|
24592
|
-
|
|
24593
|
-
|
|
24594
|
-
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
subField = _o.value;
|
|
24614
|
-
if (!subField.name.endsWith(".$")) {
|
|
24615
|
-
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24616
|
-
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24617
|
-
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24575
|
+
if (steedosField.type === "time" || steedosField.type === "input-time-range") {
|
|
24576
|
+
Object.assign(schema, {
|
|
24577
|
+
inputFormat: 'HH:mm',
|
|
24578
|
+
timeFormat: 'HH:mm',
|
|
24579
|
+
format: '1970-01-01THH:mm:00.000[Z]',
|
|
24580
|
+
});
|
|
24581
|
+
}
|
|
24582
|
+
else if (steedosField.type === "percent") {
|
|
24583
|
+
Object.assign(schema, {
|
|
24584
|
+
"percent": steedosField.scale ? steedosField.scale : true
|
|
24585
|
+
});
|
|
24586
|
+
}
|
|
24587
|
+
else if (steedosField.type === "password") {
|
|
24588
|
+
Object.assign(schema, {
|
|
24589
|
+
"tpl": "******"
|
|
24590
|
+
});
|
|
24591
|
+
}
|
|
24592
|
+
else if (steedosField.type === "select") {
|
|
24593
|
+
map = getSelectMap(steedosField.options);
|
|
24594
|
+
Object.assign(schema, {
|
|
24595
|
+
"placeholder": "",
|
|
24596
|
+
"map": map
|
|
24597
|
+
});
|
|
24598
|
+
}
|
|
24599
|
+
else if (steedosField.type === "color") {
|
|
24600
|
+
Object.assign(schema, {
|
|
24601
|
+
"defaultColor": null
|
|
24602
|
+
});
|
|
24603
|
+
}
|
|
24604
|
+
else if (steedosField.type === "number" || steedosField.type === 'currency') {
|
|
24605
|
+
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
24606
|
+
Object.assign(schema, {
|
|
24607
|
+
"precision": steedosField.scale || 0,
|
|
24608
|
+
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
24609
|
+
});
|
|
24610
|
+
}
|
|
24611
|
+
else if (steedosField.type === "table") {
|
|
24612
|
+
if (steedosField.subFields) {
|
|
24613
|
+
tableFields = [];
|
|
24614
|
+
try {
|
|
24615
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24616
|
+
subField = _o.value;
|
|
24617
|
+
if (!subField.name.endsWith(".$")) {
|
|
24618
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24619
|
+
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24620
|
+
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24621
|
+
}
|
|
24618
24622
|
}
|
|
24619
24623
|
}
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24624
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
24625
|
+
finally {
|
|
24626
|
+
try {
|
|
24627
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
24628
|
+
}
|
|
24629
|
+
finally { if (e_1) throw e_1.error; }
|
|
24625
24630
|
}
|
|
24626
|
-
|
|
24631
|
+
Object.assign(schema, {
|
|
24632
|
+
type: 'steedos-input-table',
|
|
24633
|
+
editable: false,
|
|
24634
|
+
addable: false,
|
|
24635
|
+
removable: false,
|
|
24636
|
+
draggable: false,
|
|
24637
|
+
fields: tableFields,
|
|
24638
|
+
amis: {
|
|
24639
|
+
columnsTogglable: false
|
|
24640
|
+
}
|
|
24641
|
+
});
|
|
24627
24642
|
}
|
|
24628
|
-
Object.assign(schema, {
|
|
24629
|
-
type: 'steedos-input-table',
|
|
24630
|
-
editable: false,
|
|
24631
|
-
addable: false,
|
|
24632
|
-
removable: false,
|
|
24633
|
-
draggable: false,
|
|
24634
|
-
fields: tableFields,
|
|
24635
|
-
amis: {
|
|
24636
|
-
columnsTogglable: false
|
|
24637
|
-
}
|
|
24638
|
-
});
|
|
24639
24643
|
}
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
value =
|
|
24644
|
+
else if (steedosField.type === "image") {
|
|
24645
|
+
Object.assign(schema, {
|
|
24646
|
+
enlargeAble: true,
|
|
24647
|
+
showToolbar: true,
|
|
24648
|
+
pipeIn: function (value, data) {
|
|
24649
|
+
if (steedosField.multiple) {
|
|
24650
|
+
if (!value) {
|
|
24651
|
+
value = [defaultImageValue];
|
|
24652
|
+
}
|
|
24653
|
+
value = value.map(function (item) {
|
|
24654
|
+
if (item && item.split("/").length === 1) {
|
|
24655
|
+
// 不是url格式时转为url格式显示
|
|
24656
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24657
|
+
}
|
|
24658
|
+
else {
|
|
24659
|
+
return item;
|
|
24660
|
+
}
|
|
24661
|
+
});
|
|
24650
24662
|
}
|
|
24651
|
-
|
|
24652
|
-
if (
|
|
24653
|
-
|
|
24654
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24663
|
+
else {
|
|
24664
|
+
if (isArray(value)) {
|
|
24665
|
+
value = value[0];
|
|
24655
24666
|
}
|
|
24656
|
-
|
|
24657
|
-
|
|
24667
|
+
if (value && value.split("/").length === 1) {
|
|
24668
|
+
// 不是url格式时转为url格式显示
|
|
24669
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24658
24670
|
}
|
|
24659
|
-
});
|
|
24660
|
-
}
|
|
24661
|
-
else {
|
|
24662
|
-
if (isArray(value)) {
|
|
24663
|
-
value = value[0];
|
|
24664
|
-
}
|
|
24665
|
-
if (value && value.split("/").length === 1) {
|
|
24666
|
-
// 不是url格式时转为url格式显示
|
|
24667
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24668
24671
|
}
|
|
24672
|
+
return value;
|
|
24669
24673
|
}
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24674
|
+
});
|
|
24675
|
+
}
|
|
24676
|
+
else if (steedosField.type === "file") {
|
|
24677
|
+
Object.assign(schema, {
|
|
24678
|
+
"body": [
|
|
24679
|
+
{
|
|
24680
|
+
"type": "service",
|
|
24681
|
+
"api": {
|
|
24682
|
+
"method": "post",
|
|
24683
|
+
"url": "${context.rootUrl}/graphql?file=${".concat(steedosField.name, "}"),
|
|
24684
|
+
"headers": {
|
|
24685
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
24686
|
+
},
|
|
24687
|
+
"data": {
|
|
24688
|
+
"query": "{fileData:cfs_files_filerecord(filters:[\"_id\",\"in\",${".concat(steedosField.name, "|asArray|json}]){_id,original}}")
|
|
24689
|
+
}
|
|
24690
|
+
},
|
|
24691
|
+
"body": [
|
|
24692
|
+
{
|
|
24693
|
+
"type": "each",
|
|
24694
|
+
"source": "${fileData}",
|
|
24695
|
+
"className": "flex flex-col",
|
|
24696
|
+
"items": {
|
|
24697
|
+
"type": "tpl",
|
|
24698
|
+
"tpl": "<a href='${context.rootUrl}/api/files/files/${_id}?download=true' target='_blank'>${original.name}</a>"
|
|
24699
|
+
}
|
|
24700
|
+
}
|
|
24701
|
+
]
|
|
24702
|
+
}
|
|
24703
|
+
]
|
|
24704
|
+
}, { name: "" });
|
|
24705
|
+
}
|
|
24706
|
+
else if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
24683
24707
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
24684
24708
|
Object.assign(schema, {
|
|
24685
24709
|
"precision": steedosField.scale || 0
|
|
@@ -24739,11 +24763,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24739
24763
|
disabled: true
|
|
24740
24764
|
});
|
|
24741
24765
|
}
|
|
24742
|
-
_5.label = 29;
|
|
24743
|
-
case 29:
|
|
24744
24766
|
Object.assign(schema, steedosField.amis || {});
|
|
24745
24767
|
return [2 /*return*/, schema];
|
|
24746
|
-
case
|
|
24768
|
+
case 19:
|
|
24747
24769
|
if (!ctx.className) {
|
|
24748
24770
|
ctx.className = className;
|
|
24749
24771
|
}
|
|
@@ -24804,16 +24826,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24804
24826
|
}
|
|
24805
24827
|
}
|
|
24806
24828
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24807
|
-
case
|
|
24829
|
+
case 20:
|
|
24808
24830
|
schema = _5.sent();
|
|
24809
24831
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24810
24832
|
return [2 /*return*/, schema];
|
|
24811
|
-
case
|
|
24812
|
-
case
|
|
24833
|
+
case 21: return [3 /*break*/, 23];
|
|
24834
|
+
case 22:
|
|
24813
24835
|
error_1 = _5.sent();
|
|
24814
24836
|
console.log("error", error_1);
|
|
24815
|
-
return [3 /*break*/,
|
|
24816
|
-
case
|
|
24837
|
+
return [3 /*break*/, 23];
|
|
24838
|
+
case 23: return [2 /*return*/, null];
|
|
24817
24839
|
}
|
|
24818
24840
|
});
|
|
24819
24841
|
}); };
|