@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.cjs.js
CHANGED
|
@@ -12856,9 +12856,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
12856
12856
|
async function getObjectForm(objectSchema, ctx){
|
|
12857
12857
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
12858
12858
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
12859
|
+
let enableTabs = ctx.enableTabs;
|
|
12859
12860
|
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12860
|
-
if (typeof
|
|
12861
|
-
|
|
12861
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12862
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12862
12863
|
}
|
|
12863
12864
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
12864
12865
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -12902,7 +12903,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
12902
12903
|
body: {
|
|
12903
12904
|
type: 'wrapper',
|
|
12904
12905
|
className: 'p-0 m-0',
|
|
12905
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
12906
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true, enableTabs})),
|
|
12906
12907
|
hiddenOn: "${editFormInited != true}",
|
|
12907
12908
|
},
|
|
12908
12909
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -12957,6 +12958,11 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12957
12958
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
12958
12959
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
12959
12960
|
const serviceId = `service_detail_page`;
|
|
12961
|
+
let enableTabs = ctx.enableTabs;
|
|
12962
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12963
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12964
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12965
|
+
}
|
|
12960
12966
|
const amisSchema = {
|
|
12961
12967
|
type: 'service',
|
|
12962
12968
|
name: `page_readonly_${recordId}`,
|
|
@@ -12983,7 +12989,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12983
12989
|
body: await getFormBody(
|
|
12984
12990
|
_$1.map(fields, (field) => { field.readonly = true; return field; }),
|
|
12985
12991
|
_$1.map(formFields, (field) => { field.readonly = true; return field; }),
|
|
12986
|
-
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups })
|
|
12992
|
+
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups, enableTabs })
|
|
12987
12993
|
),
|
|
12988
12994
|
className: 'steedos-amis-form bg-white',
|
|
12989
12995
|
actions: [], // 不显示表单默认的提交按钮
|
|
@@ -22215,7 +22221,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22215
22221
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
22216
22222
|
initApiAdaptor: initApiAdaptor,
|
|
22217
22223
|
enableTabs: enableTabs,
|
|
22218
|
-
tabsMode: tabsMode,
|
|
22224
|
+
tabsMode: tabsMode || "vertical",
|
|
22219
22225
|
formDataFilter: formDataFilter,
|
|
22220
22226
|
onFormDataFilter: onFormDataFilter,
|
|
22221
22227
|
amisData: allData,
|
|
@@ -24212,6 +24218,9 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
24212
24218
|
else if (type === 'color') {
|
|
24213
24219
|
return 'static-color';
|
|
24214
24220
|
}
|
|
24221
|
+
else if (type === 'file') {
|
|
24222
|
+
return 'control';
|
|
24223
|
+
}
|
|
24215
24224
|
return type;
|
|
24216
24225
|
}
|
|
24217
24226
|
function getLookupLinkOnClick(field, options) {
|
|
@@ -24304,7 +24313,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24304
24313
|
}
|
|
24305
24314
|
_5.label = 1;
|
|
24306
24315
|
case 1:
|
|
24307
|
-
_5.trys.push([1,
|
|
24316
|
+
_5.trys.push([1, 22, , 23]);
|
|
24308
24317
|
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 16];
|
|
24309
24318
|
lookupATagClick = 'onclick="return false;"';
|
|
24310
24319
|
if (window.innerWidth < 768) {
|
|
@@ -24541,7 +24550,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24541
24550
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
24542
24551
|
return [2 /*return*/, schema];
|
|
24543
24552
|
case 16:
|
|
24544
|
-
if (!fStatic) return [3 /*break*/,
|
|
24553
|
+
if (!fStatic) return [3 /*break*/, 19];
|
|
24545
24554
|
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 18];
|
|
24546
24555
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24547
24556
|
case 17:
|
|
@@ -24591,123 +24600,138 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24591
24600
|
static: true,
|
|
24592
24601
|
label: steedosField.label
|
|
24593
24602
|
});
|
|
24594
|
-
if (
|
|
24595
|
-
|
|
24596
|
-
|
|
24597
|
-
|
|
24598
|
-
|
|
24599
|
-
|
|
24600
|
-
|
|
24601
|
-
|
|
24602
|
-
|
|
24603
|
-
|
|
24604
|
-
|
|
24605
|
-
}
|
|
24606
|
-
|
|
24607
|
-
|
|
24608
|
-
|
|
24609
|
-
|
|
24610
|
-
|
|
24611
|
-
|
|
24612
|
-
|
|
24613
|
-
|
|
24614
|
-
|
|
24615
|
-
|
|
24616
|
-
|
|
24617
|
-
|
|
24618
|
-
|
|
24619
|
-
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24625
|
-
|
|
24626
|
-
|
|
24627
|
-
|
|
24628
|
-
|
|
24629
|
-
|
|
24630
|
-
|
|
24631
|
-
|
|
24632
|
-
|
|
24633
|
-
|
|
24634
|
-
|
|
24635
|
-
|
|
24636
|
-
|
|
24637
|
-
|
|
24638
|
-
|
|
24639
|
-
|
|
24640
|
-
|
|
24641
|
-
subField = _o.value;
|
|
24642
|
-
if (!subField.name.endsWith(".$")) {
|
|
24643
|
-
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24644
|
-
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24645
|
-
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24603
|
+
if (steedosField.type === "time" || steedosField.type === "input-time-range") {
|
|
24604
|
+
Object.assign(schema, {
|
|
24605
|
+
inputFormat: 'HH:mm',
|
|
24606
|
+
timeFormat: 'HH:mm',
|
|
24607
|
+
format: '1970-01-01THH:mm:00.000[Z]',
|
|
24608
|
+
});
|
|
24609
|
+
}
|
|
24610
|
+
else if (steedosField.type === "percent") {
|
|
24611
|
+
Object.assign(schema, {
|
|
24612
|
+
"percent": steedosField.scale ? steedosField.scale : true
|
|
24613
|
+
});
|
|
24614
|
+
}
|
|
24615
|
+
else if (steedosField.type === "password") {
|
|
24616
|
+
Object.assign(schema, {
|
|
24617
|
+
"tpl": "******"
|
|
24618
|
+
});
|
|
24619
|
+
}
|
|
24620
|
+
else if (steedosField.type === "select") {
|
|
24621
|
+
map = getSelectMap(steedosField.options);
|
|
24622
|
+
Object.assign(schema, {
|
|
24623
|
+
"placeholder": "",
|
|
24624
|
+
"map": map
|
|
24625
|
+
});
|
|
24626
|
+
}
|
|
24627
|
+
else if (steedosField.type === "color") {
|
|
24628
|
+
Object.assign(schema, {
|
|
24629
|
+
"defaultColor": null
|
|
24630
|
+
});
|
|
24631
|
+
}
|
|
24632
|
+
else if (steedosField.type === "number" || steedosField.type === 'currency') {
|
|
24633
|
+
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
24634
|
+
Object.assign(schema, {
|
|
24635
|
+
"precision": steedosField.scale || 0,
|
|
24636
|
+
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
24637
|
+
});
|
|
24638
|
+
}
|
|
24639
|
+
else if (steedosField.type === "table") {
|
|
24640
|
+
if (steedosField.subFields) {
|
|
24641
|
+
tableFields = [];
|
|
24642
|
+
try {
|
|
24643
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24644
|
+
subField = _o.value;
|
|
24645
|
+
if (!subField.name.endsWith(".$")) {
|
|
24646
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24647
|
+
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24648
|
+
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24649
|
+
}
|
|
24646
24650
|
}
|
|
24647
24651
|
}
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24652
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
24653
|
+
finally {
|
|
24654
|
+
try {
|
|
24655
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
24656
|
+
}
|
|
24657
|
+
finally { if (e_1) throw e_1.error; }
|
|
24653
24658
|
}
|
|
24654
|
-
|
|
24659
|
+
Object.assign(schema, {
|
|
24660
|
+
type: 'steedos-input-table',
|
|
24661
|
+
editable: false,
|
|
24662
|
+
addable: false,
|
|
24663
|
+
removable: false,
|
|
24664
|
+
draggable: false,
|
|
24665
|
+
fields: tableFields,
|
|
24666
|
+
amis: {
|
|
24667
|
+
columnsTogglable: false
|
|
24668
|
+
}
|
|
24669
|
+
});
|
|
24655
24670
|
}
|
|
24656
|
-
Object.assign(schema, {
|
|
24657
|
-
type: 'steedos-input-table',
|
|
24658
|
-
editable: false,
|
|
24659
|
-
addable: false,
|
|
24660
|
-
removable: false,
|
|
24661
|
-
draggable: false,
|
|
24662
|
-
fields: tableFields,
|
|
24663
|
-
amis: {
|
|
24664
|
-
columnsTogglable: false
|
|
24665
|
-
}
|
|
24666
|
-
});
|
|
24667
24671
|
}
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
value =
|
|
24672
|
+
else if (steedosField.type === "image") {
|
|
24673
|
+
Object.assign(schema, {
|
|
24674
|
+
enlargeAble: true,
|
|
24675
|
+
showToolbar: true,
|
|
24676
|
+
pipeIn: function (value, data) {
|
|
24677
|
+
if (steedosField.multiple) {
|
|
24678
|
+
if (!value) {
|
|
24679
|
+
value = [defaultImageValue];
|
|
24680
|
+
}
|
|
24681
|
+
value = value.map(function (item) {
|
|
24682
|
+
if (item && item.split("/").length === 1) {
|
|
24683
|
+
// 不是url格式时转为url格式显示
|
|
24684
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24685
|
+
}
|
|
24686
|
+
else {
|
|
24687
|
+
return item;
|
|
24688
|
+
}
|
|
24689
|
+
});
|
|
24678
24690
|
}
|
|
24679
|
-
|
|
24680
|
-
if (
|
|
24681
|
-
|
|
24682
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24691
|
+
else {
|
|
24692
|
+
if (_$1.isArray(value)) {
|
|
24693
|
+
value = value[0];
|
|
24683
24694
|
}
|
|
24684
|
-
|
|
24685
|
-
|
|
24695
|
+
if (value && value.split("/").length === 1) {
|
|
24696
|
+
// 不是url格式时转为url格式显示
|
|
24697
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24686
24698
|
}
|
|
24687
|
-
});
|
|
24688
|
-
}
|
|
24689
|
-
else {
|
|
24690
|
-
if (_$1.isArray(value)) {
|
|
24691
|
-
value = value[0];
|
|
24692
|
-
}
|
|
24693
|
-
if (value && value.split("/").length === 1) {
|
|
24694
|
-
// 不是url格式时转为url格式显示
|
|
24695
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24696
24699
|
}
|
|
24700
|
+
return value;
|
|
24697
24701
|
}
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24702
|
+
});
|
|
24703
|
+
}
|
|
24704
|
+
else if (steedosField.type === "file") {
|
|
24705
|
+
Object.assign(schema, {
|
|
24706
|
+
"body": [
|
|
24707
|
+
{
|
|
24708
|
+
"type": "service",
|
|
24709
|
+
"api": {
|
|
24710
|
+
"method": "post",
|
|
24711
|
+
"url": "${context.rootUrl}/graphql?file=${".concat(steedosField.name, "}"),
|
|
24712
|
+
"headers": {
|
|
24713
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
24714
|
+
},
|
|
24715
|
+
"data": {
|
|
24716
|
+
"query": "{fileData:cfs_files_filerecord(filters:[\"_id\",\"in\",${".concat(steedosField.name, "|asArray|json}]){_id,original}}")
|
|
24717
|
+
}
|
|
24718
|
+
},
|
|
24719
|
+
"body": [
|
|
24720
|
+
{
|
|
24721
|
+
"type": "each",
|
|
24722
|
+
"source": "${fileData}",
|
|
24723
|
+
"className": "flex flex-col",
|
|
24724
|
+
"items": {
|
|
24725
|
+
"type": "tpl",
|
|
24726
|
+
"tpl": "<a href='${context.rootUrl}/api/files/files/${_id}?download=true' target='_blank'>${original.name}</a>"
|
|
24727
|
+
}
|
|
24728
|
+
}
|
|
24729
|
+
]
|
|
24730
|
+
}
|
|
24731
|
+
]
|
|
24732
|
+
}, { name: "" });
|
|
24733
|
+
}
|
|
24734
|
+
else if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
24711
24735
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
24712
24736
|
Object.assign(schema, {
|
|
24713
24737
|
"precision": steedosField.scale || 0
|
|
@@ -24767,11 +24791,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24767
24791
|
disabled: true
|
|
24768
24792
|
});
|
|
24769
24793
|
}
|
|
24770
|
-
_5.label = 29;
|
|
24771
|
-
case 29:
|
|
24772
24794
|
Object.assign(schema, steedosField.amis || {});
|
|
24773
24795
|
return [2 /*return*/, schema];
|
|
24774
|
-
case
|
|
24796
|
+
case 19:
|
|
24775
24797
|
if (!ctx.className) {
|
|
24776
24798
|
ctx.className = className;
|
|
24777
24799
|
}
|
|
@@ -24832,16 +24854,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24832
24854
|
}
|
|
24833
24855
|
}
|
|
24834
24856
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24835
|
-
case
|
|
24857
|
+
case 20:
|
|
24836
24858
|
schema = _5.sent();
|
|
24837
24859
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24838
24860
|
return [2 /*return*/, schema];
|
|
24839
|
-
case
|
|
24840
|
-
case
|
|
24861
|
+
case 21: return [3 /*break*/, 23];
|
|
24862
|
+
case 22:
|
|
24841
24863
|
error_1 = _5.sent();
|
|
24842
24864
|
console.log("error", error_1);
|
|
24843
|
-
return [3 /*break*/,
|
|
24844
|
-
case
|
|
24865
|
+
return [3 /*break*/, 23];
|
|
24866
|
+
case 23: return [2 /*return*/, null];
|
|
24845
24867
|
}
|
|
24846
24868
|
});
|
|
24847
24869
|
}); };
|