@steedos-widgets/amis-object 6.3.2 → 6.3.4
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.css +3 -0
- package/dist/amis-object.cjs.js +156 -132
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +3 -0
- package/dist/amis-object.esm.js +156 -132
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +3 -0
- package/dist/amis-object.umd.js +19 -19
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +21 -21
- package/dist/meta.js +75 -75
- package/package.json +3 -3
package/dist/amis-object.esm.css
CHANGED
package/dist/amis-object.esm.js
CHANGED
|
@@ -10930,7 +10930,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
10930
10930
|
|
|
10931
10931
|
// console.log('=======================max=========================', max)
|
|
10932
10932
|
|
|
10933
|
-
if(objectSchema.compactLayouts){
|
|
10933
|
+
if(objectSchema.compactLayouts && objectSchema.compactLayouts.length > 0){
|
|
10934
10934
|
const details = [];
|
|
10935
10935
|
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
10936
10936
|
const field = objectSchema.fields[fieldName];
|
|
@@ -12126,18 +12126,19 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
12126
12126
|
}
|
|
12127
12127
|
let toolbarReloadButton;
|
|
12128
12128
|
const onReloadScript = `
|
|
12129
|
-
// const scope = event.context.scoped;
|
|
12130
|
-
// var listView = scope.parent.getComponents().find(function(n){
|
|
12131
|
-
// return n.props.type === "crud";
|
|
12132
|
-
// });
|
|
12133
|
-
// listView.handleChangePage(1);
|
|
12134
|
-
|
|
12135
|
-
|
|
12136
12129
|
// 触发搜索,而不是reload,因为使用search-box可以在amissdk是3.6.3-patch.8+实现在非第一页的情况下,快速搜索输入框中过滤条件变更时再点刷新可以自动跳转翻页到第一页
|
|
12137
12130
|
const scope = event.context.scoped;
|
|
12138
12131
|
const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
|
|
12139
|
-
|
|
12140
|
-
|
|
12132
|
+
if (sb) {
|
|
12133
|
+
const sbValue = sb.state.value;
|
|
12134
|
+
sb.handleSearch(sbValue);
|
|
12135
|
+
}else{
|
|
12136
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
12137
|
+
return n.props.type === "crud";
|
|
12138
|
+
});
|
|
12139
|
+
listView.handleChangePage(1);
|
|
12140
|
+
}
|
|
12141
|
+
|
|
12141
12142
|
`;
|
|
12142
12143
|
toolbarReloadButton = {
|
|
12143
12144
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
@@ -12828,9 +12829,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
12828
12829
|
async function getObjectForm(objectSchema, ctx){
|
|
12829
12830
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
12830
12831
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
12832
|
+
let enableTabs = ctx.enableTabs;
|
|
12831
12833
|
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12832
|
-
if (typeof
|
|
12833
|
-
|
|
12834
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12835
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12834
12836
|
}
|
|
12835
12837
|
const fields = _$1__default.values(objectSchema.fields);
|
|
12836
12838
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -12874,7 +12876,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
12874
12876
|
body: {
|
|
12875
12877
|
type: 'wrapper',
|
|
12876
12878
|
className: 'p-0 m-0',
|
|
12877
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
12879
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true, enableTabs})),
|
|
12878
12880
|
hiddenOn: "${editFormInited != true}",
|
|
12879
12881
|
},
|
|
12880
12882
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -12929,6 +12931,11 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12929
12931
|
const fields = _$1__default.values(objectSchema.fields);
|
|
12930
12932
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
12931
12933
|
const serviceId = `service_detail_page`;
|
|
12934
|
+
let enableTabs = ctx.enableTabs;
|
|
12935
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12936
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12937
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12938
|
+
}
|
|
12932
12939
|
const amisSchema = {
|
|
12933
12940
|
type: 'service',
|
|
12934
12941
|
name: `page_readonly_${recordId}`,
|
|
@@ -12955,7 +12962,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12955
12962
|
body: await getFormBody(
|
|
12956
12963
|
map(fields, (field) => { field.readonly = true; return field; }),
|
|
12957
12964
|
map(formFields, (field) => { field.readonly = true; return field; }),
|
|
12958
|
-
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups })
|
|
12965
|
+
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups, enableTabs })
|
|
12959
12966
|
),
|
|
12960
12967
|
className: 'steedos-amis-form bg-white',
|
|
12961
12968
|
actions: [], // 不显示表单默认的提交按钮
|
|
@@ -22122,6 +22129,7 @@ var SteedosSkeleton = function (props) {
|
|
|
22122
22129
|
}))) : null));
|
|
22123
22130
|
};
|
|
22124
22131
|
|
|
22132
|
+
// md:border-b
|
|
22125
22133
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22126
22134
|
var $schema, recordId, defaultData, mode, _a, layout, labelAlign, appId, fieldsExtend, _b, excludedFields, _c, fields, _d, form, _e, className, enableInitApi, initApiRequestAdaptor, initApiAdaptor, apiRequestAdaptor, apiAdaptor, enableTabs, tabsMode, submitSuccActions, data, formDataFilter, onFormDataFilter, env, objectApiName, schemaKeys, formSchema, defaults, options, globalData, amisSchema, uiSchema, allData, schema, schema, formData;
|
|
22127
22135
|
return __generator(this, function (_f) {
|
|
@@ -22187,7 +22195,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22187
22195
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
22188
22196
|
initApiAdaptor: initApiAdaptor,
|
|
22189
22197
|
enableTabs: enableTabs,
|
|
22190
|
-
tabsMode: tabsMode,
|
|
22198
|
+
tabsMode: tabsMode || "vertical",
|
|
22191
22199
|
formDataFilter: formDataFilter,
|
|
22192
22200
|
onFormDataFilter: onFormDataFilter,
|
|
22193
22201
|
amisData: allData,
|
|
@@ -24184,6 +24192,9 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
24184
24192
|
else if (type === 'color') {
|
|
24185
24193
|
return 'static-color';
|
|
24186
24194
|
}
|
|
24195
|
+
else if (type === 'file') {
|
|
24196
|
+
return 'control';
|
|
24197
|
+
}
|
|
24187
24198
|
return type;
|
|
24188
24199
|
}
|
|
24189
24200
|
function getLookupLinkOnClick(field, options) {
|
|
@@ -24276,7 +24287,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24276
24287
|
}
|
|
24277
24288
|
_5.label = 1;
|
|
24278
24289
|
case 1:
|
|
24279
|
-
_5.trys.push([1,
|
|
24290
|
+
_5.trys.push([1, 22, , 23]);
|
|
24280
24291
|
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 16];
|
|
24281
24292
|
lookupATagClick = 'onclick="return false;"';
|
|
24282
24293
|
if (window.innerWidth < 768) {
|
|
@@ -24513,7 +24524,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24513
24524
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
24514
24525
|
return [2 /*return*/, schema];
|
|
24515
24526
|
case 16:
|
|
24516
|
-
if (!fStatic) return [3 /*break*/,
|
|
24527
|
+
if (!fStatic) return [3 /*break*/, 19];
|
|
24517
24528
|
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 18];
|
|
24518
24529
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24519
24530
|
case 17:
|
|
@@ -24563,123 +24574,138 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24563
24574
|
static: true,
|
|
24564
24575
|
label: steedosField.label
|
|
24565
24576
|
});
|
|
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 }));
|
|
24577
|
+
if (steedosField.type === "time" || steedosField.type === "input-time-range") {
|
|
24578
|
+
Object.assign(schema, {
|
|
24579
|
+
inputFormat: 'HH:mm',
|
|
24580
|
+
timeFormat: 'HH:mm',
|
|
24581
|
+
format: '1970-01-01THH:mm:00.000[Z]',
|
|
24582
|
+
});
|
|
24583
|
+
}
|
|
24584
|
+
else if (steedosField.type === "percent") {
|
|
24585
|
+
Object.assign(schema, {
|
|
24586
|
+
"percent": steedosField.scale ? steedosField.scale : true
|
|
24587
|
+
});
|
|
24588
|
+
}
|
|
24589
|
+
else if (steedosField.type === "password") {
|
|
24590
|
+
Object.assign(schema, {
|
|
24591
|
+
"tpl": "******"
|
|
24592
|
+
});
|
|
24593
|
+
}
|
|
24594
|
+
else if (steedosField.type === "select") {
|
|
24595
|
+
map = getSelectMap(steedosField.options);
|
|
24596
|
+
Object.assign(schema, {
|
|
24597
|
+
"placeholder": "",
|
|
24598
|
+
"map": map
|
|
24599
|
+
});
|
|
24600
|
+
}
|
|
24601
|
+
else if (steedosField.type === "color") {
|
|
24602
|
+
Object.assign(schema, {
|
|
24603
|
+
"defaultColor": null
|
|
24604
|
+
});
|
|
24605
|
+
}
|
|
24606
|
+
else if (steedosField.type === "number" || steedosField.type === 'currency') {
|
|
24607
|
+
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
24608
|
+
Object.assign(schema, {
|
|
24609
|
+
"precision": steedosField.scale || 0,
|
|
24610
|
+
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
24611
|
+
});
|
|
24612
|
+
}
|
|
24613
|
+
else if (steedosField.type === "table") {
|
|
24614
|
+
if (steedosField.subFields) {
|
|
24615
|
+
tableFields = [];
|
|
24616
|
+
try {
|
|
24617
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24618
|
+
subField = _o.value;
|
|
24619
|
+
if (!subField.name.endsWith(".$")) {
|
|
24620
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24621
|
+
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24622
|
+
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24623
|
+
}
|
|
24618
24624
|
}
|
|
24619
24625
|
}
|
|
24620
|
-
|
|
24621
|
-
|
|
24622
|
-
|
|
24623
|
-
|
|
24624
|
-
|
|
24626
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
24627
|
+
finally {
|
|
24628
|
+
try {
|
|
24629
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
24630
|
+
}
|
|
24631
|
+
finally { if (e_1) throw e_1.error; }
|
|
24625
24632
|
}
|
|
24626
|
-
|
|
24633
|
+
Object.assign(schema, {
|
|
24634
|
+
type: 'steedos-input-table',
|
|
24635
|
+
editable: false,
|
|
24636
|
+
addable: false,
|
|
24637
|
+
removable: false,
|
|
24638
|
+
draggable: false,
|
|
24639
|
+
fields: tableFields,
|
|
24640
|
+
amis: {
|
|
24641
|
+
columnsTogglable: false
|
|
24642
|
+
}
|
|
24643
|
+
});
|
|
24627
24644
|
}
|
|
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
24645
|
}
|
|
24640
|
-
|
|
24641
|
-
|
|
24642
|
-
|
|
24643
|
-
|
|
24644
|
-
|
|
24645
|
-
|
|
24646
|
-
|
|
24647
|
-
|
|
24648
|
-
|
|
24649
|
-
value =
|
|
24646
|
+
else if (steedosField.type === "image") {
|
|
24647
|
+
Object.assign(schema, {
|
|
24648
|
+
enlargeAble: true,
|
|
24649
|
+
showToolbar: true,
|
|
24650
|
+
pipeIn: function (value, data) {
|
|
24651
|
+
if (steedosField.multiple) {
|
|
24652
|
+
if (!value) {
|
|
24653
|
+
value = [defaultImageValue];
|
|
24654
|
+
}
|
|
24655
|
+
value = value.map(function (item) {
|
|
24656
|
+
if (item && item.split("/").length === 1) {
|
|
24657
|
+
// 不是url格式时转为url格式显示
|
|
24658
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24659
|
+
}
|
|
24660
|
+
else {
|
|
24661
|
+
return item;
|
|
24662
|
+
}
|
|
24663
|
+
});
|
|
24650
24664
|
}
|
|
24651
|
-
|
|
24652
|
-
if (
|
|
24653
|
-
|
|
24654
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24665
|
+
else {
|
|
24666
|
+
if (isArray(value)) {
|
|
24667
|
+
value = value[0];
|
|
24655
24668
|
}
|
|
24656
|
-
|
|
24657
|
-
|
|
24669
|
+
if (value && value.split("/").length === 1) {
|
|
24670
|
+
// 不是url格式时转为url格式显示
|
|
24671
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24658
24672
|
}
|
|
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
24673
|
}
|
|
24674
|
+
return value;
|
|
24669
24675
|
}
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
|
|
24678
|
-
|
|
24679
|
-
|
|
24680
|
-
|
|
24681
|
-
|
|
24682
|
-
|
|
24676
|
+
});
|
|
24677
|
+
}
|
|
24678
|
+
else if (steedosField.type === "file") {
|
|
24679
|
+
Object.assign(schema, {
|
|
24680
|
+
"body": [
|
|
24681
|
+
{
|
|
24682
|
+
"type": "service",
|
|
24683
|
+
"api": {
|
|
24684
|
+
"method": "post",
|
|
24685
|
+
"url": "${context.rootUrl}/graphql?file=${".concat(steedosField.name, "}"),
|
|
24686
|
+
"headers": {
|
|
24687
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
24688
|
+
},
|
|
24689
|
+
"data": {
|
|
24690
|
+
"query": "{fileData:cfs_files_filerecord(filters:[\"_id\",\"in\",${".concat(steedosField.name, "|asArray|json}]){_id,original}}")
|
|
24691
|
+
}
|
|
24692
|
+
},
|
|
24693
|
+
"body": [
|
|
24694
|
+
{
|
|
24695
|
+
"type": "each",
|
|
24696
|
+
"source": "${fileData}",
|
|
24697
|
+
"className": "flex flex-col",
|
|
24698
|
+
"items": {
|
|
24699
|
+
"type": "tpl",
|
|
24700
|
+
"tpl": "<a href='${context.rootUrl}/api/files/files/${_id}?download=true' target='_blank'>${original.name}</a>"
|
|
24701
|
+
}
|
|
24702
|
+
}
|
|
24703
|
+
]
|
|
24704
|
+
}
|
|
24705
|
+
]
|
|
24706
|
+
}, { name: "" });
|
|
24707
|
+
}
|
|
24708
|
+
else if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
24683
24709
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
24684
24710
|
Object.assign(schema, {
|
|
24685
24711
|
"precision": steedosField.scale || 0
|
|
@@ -24739,11 +24765,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24739
24765
|
disabled: true
|
|
24740
24766
|
});
|
|
24741
24767
|
}
|
|
24742
|
-
_5.label = 29;
|
|
24743
|
-
case 29:
|
|
24744
24768
|
Object.assign(schema, steedosField.amis || {});
|
|
24745
24769
|
return [2 /*return*/, schema];
|
|
24746
|
-
case
|
|
24770
|
+
case 19:
|
|
24747
24771
|
if (!ctx.className) {
|
|
24748
24772
|
ctx.className = className;
|
|
24749
24773
|
}
|
|
@@ -24804,16 +24828,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24804
24828
|
}
|
|
24805
24829
|
}
|
|
24806
24830
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24807
|
-
case
|
|
24831
|
+
case 20:
|
|
24808
24832
|
schema = _5.sent();
|
|
24809
24833
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24810
24834
|
return [2 /*return*/, schema];
|
|
24811
|
-
case
|
|
24812
|
-
case
|
|
24835
|
+
case 21: return [3 /*break*/, 23];
|
|
24836
|
+
case 22:
|
|
24813
24837
|
error_1 = _5.sent();
|
|
24814
24838
|
console.log("error", error_1);
|
|
24815
|
-
return [3 /*break*/,
|
|
24816
|
-
case
|
|
24839
|
+
return [3 /*break*/, 23];
|
|
24840
|
+
case 23: return [2 /*return*/, null];
|
|
24817
24841
|
}
|
|
24818
24842
|
});
|
|
24819
24843
|
}); };
|