@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.cjs.css
CHANGED
package/dist/amis-object.cjs.js
CHANGED
|
@@ -10958,7 +10958,7 @@ async function getObjectRecordDetailHeader(objectSchema, recordId, options) {
|
|
|
10958
10958
|
|
|
10959
10959
|
// console.log('=======================max=========================', max)
|
|
10960
10960
|
|
|
10961
|
-
if(objectSchema.compactLayouts){
|
|
10961
|
+
if(objectSchema.compactLayouts && objectSchema.compactLayouts.length > 0){
|
|
10962
10962
|
const details = [];
|
|
10963
10963
|
_.each(_.slice(_.difference(objectSchema.compactLayouts, [objectSchema.NAME_FIELD_KEY]), 0, max), (fieldName)=>{
|
|
10964
10964
|
const field = objectSchema.fields[fieldName];
|
|
@@ -12154,18 +12154,19 @@ function getObjectHeaderToolbar(mainObject, fields, formFactor, {
|
|
|
12154
12154
|
}
|
|
12155
12155
|
let toolbarReloadButton;
|
|
12156
12156
|
const onReloadScript = `
|
|
12157
|
-
// const scope = event.context.scoped;
|
|
12158
|
-
// var listView = scope.parent.getComponents().find(function(n){
|
|
12159
|
-
// return n.props.type === "crud";
|
|
12160
|
-
// });
|
|
12161
|
-
// listView.handleChangePage(1);
|
|
12162
|
-
|
|
12163
|
-
|
|
12164
12157
|
// 触发搜索,而不是reload,因为使用search-box可以在amissdk是3.6.3-patch.8+实现在非第一页的情况下,快速搜索输入框中过滤条件变更时再点刷新可以自动跳转翻页到第一页
|
|
12165
12158
|
const scope = event.context.scoped;
|
|
12166
12159
|
const sb = SteedosUI.getClosestAmisComponentByType(scope, "search-box");
|
|
12167
|
-
|
|
12168
|
-
|
|
12160
|
+
if (sb) {
|
|
12161
|
+
const sbValue = sb.state.value;
|
|
12162
|
+
sb.handleSearch(sbValue);
|
|
12163
|
+
}else{
|
|
12164
|
+
var listView = scope.parent.getComponents().find(function(n){
|
|
12165
|
+
return n.props.type === "crud";
|
|
12166
|
+
});
|
|
12167
|
+
listView.handleChangePage(1);
|
|
12168
|
+
}
|
|
12169
|
+
|
|
12169
12170
|
`;
|
|
12170
12171
|
toolbarReloadButton = {
|
|
12171
12172
|
// "type": "reload",//不可以直接使用reload,因为它不会设置页码到第一页,这在加载更多按钮的翻页模式下会有问题
|
|
@@ -12856,9 +12857,10 @@ async function getFormSchemaWithDataFilter(form, options = {}){
|
|
|
12856
12857
|
async function getObjectForm(objectSchema, ctx){
|
|
12857
12858
|
const { recordId, formFactor, layout = formFactor === 'SMALL' ? 'normal' : "horizontal", labelAlign, tabId, appId, defaults, submitSuccActions = [],
|
|
12858
12859
|
formDataFilter, onFormDataFilter, amisData, env } = ctx;
|
|
12860
|
+
let enableTabs = ctx.enableTabs;
|
|
12859
12861
|
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12860
|
-
if (typeof
|
|
12861
|
-
|
|
12862
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12863
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12862
12864
|
}
|
|
12863
12865
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
12864
12866
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
@@ -12902,7 +12904,7 @@ async function getObjectForm(objectSchema, ctx){
|
|
|
12902
12904
|
body: {
|
|
12903
12905
|
type: 'wrapper',
|
|
12904
12906
|
className: 'p-0 m-0',
|
|
12905
|
-
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true})),
|
|
12907
|
+
body: await getFormBody(fields, formFields, Object.assign({}, ctx, {fieldGroups: objectSchema.field_groups, omitReadonlyFields: true, enableTabs})),
|
|
12906
12908
|
hiddenOn: "${editFormInited != true}",
|
|
12907
12909
|
},
|
|
12908
12910
|
panelClassName:'m-0 sm:rounded-lg shadow-none border-none',
|
|
@@ -12957,6 +12959,11 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12957
12959
|
const fields = _$1__default["default"].values(objectSchema.fields);
|
|
12958
12960
|
const formFields = getFormFields$1(objectSchema, ctx);
|
|
12959
12961
|
const serviceId = `service_detail_page`;
|
|
12962
|
+
let enableTabs = ctx.enableTabs;
|
|
12963
|
+
//优先识别组件上的enableTabs属性,若不存在,则识别对象上定义的
|
|
12964
|
+
if (typeof enableTabs !== 'boolean') {
|
|
12965
|
+
enableTabs = objectSchema.enable_form_tabs;
|
|
12966
|
+
}
|
|
12960
12967
|
const amisSchema = {
|
|
12961
12968
|
type: 'service',
|
|
12962
12969
|
name: `page_readonly_${recordId}`,
|
|
@@ -12983,7 +12990,7 @@ async function getObjectDetail(objectSchema, recordId, ctx){
|
|
|
12983
12990
|
body: await getFormBody(
|
|
12984
12991
|
_$1.map(fields, (field) => { field.readonly = true; return field; }),
|
|
12985
12992
|
_$1.map(formFields, (field) => { field.readonly = true; return field; }),
|
|
12986
|
-
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups })
|
|
12993
|
+
Object.assign({}, ctx, { showSystemFields: true, fieldGroups: objectSchema.field_groups, enableTabs })
|
|
12987
12994
|
),
|
|
12988
12995
|
className: 'steedos-amis-form bg-white',
|
|
12989
12996
|
actions: [], // 不显示表单默认的提交按钮
|
|
@@ -22150,6 +22157,7 @@ var SteedosSkeleton = function (props) {
|
|
|
22150
22157
|
}))) : null));
|
|
22151
22158
|
};
|
|
22152
22159
|
|
|
22160
|
+
// md:border-b
|
|
22153
22161
|
var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
22154
22162
|
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;
|
|
22155
22163
|
return __generator(this, function (_f) {
|
|
@@ -22215,7 +22223,7 @@ var AmisObjectForm = function (props) { return __awaiter(void 0, void 0, void 0,
|
|
|
22215
22223
|
initApiRequestAdaptor: initApiRequestAdaptor,
|
|
22216
22224
|
initApiAdaptor: initApiAdaptor,
|
|
22217
22225
|
enableTabs: enableTabs,
|
|
22218
|
-
tabsMode: tabsMode,
|
|
22226
|
+
tabsMode: tabsMode || "vertical",
|
|
22219
22227
|
formDataFilter: formDataFilter,
|
|
22220
22228
|
onFormDataFilter: onFormDataFilter,
|
|
22221
22229
|
amisData: allData,
|
|
@@ -24212,6 +24220,9 @@ function getAmisStaticFieldType(type, data_type, options) {
|
|
|
24212
24220
|
else if (type === 'color') {
|
|
24213
24221
|
return 'static-color';
|
|
24214
24222
|
}
|
|
24223
|
+
else if (type === 'file') {
|
|
24224
|
+
return 'control';
|
|
24225
|
+
}
|
|
24215
24226
|
return type;
|
|
24216
24227
|
}
|
|
24217
24228
|
function getLookupLinkOnClick(field, options) {
|
|
@@ -24304,7 +24315,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24304
24315
|
}
|
|
24305
24316
|
_5.label = 1;
|
|
24306
24317
|
case 1:
|
|
24307
|
-
_5.trys.push([1,
|
|
24318
|
+
_5.trys.push([1, 22, , 23]);
|
|
24308
24319
|
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 16];
|
|
24309
24320
|
lookupATagClick = 'onclick="return false;"';
|
|
24310
24321
|
if (window.innerWidth < 768) {
|
|
@@ -24541,7 +24552,7 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24541
24552
|
// console.log(`steedos field [lookup] schema:`, schema)
|
|
24542
24553
|
return [2 /*return*/, schema];
|
|
24543
24554
|
case 16:
|
|
24544
|
-
if (!fStatic) return [3 /*break*/,
|
|
24555
|
+
if (!fStatic) return [3 /*break*/, 19];
|
|
24545
24556
|
if (!props.data.hasOwnProperty("_display")) return [3 /*break*/, 18];
|
|
24546
24557
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, true, ctx)];
|
|
24547
24558
|
case 17:
|
|
@@ -24591,123 +24602,138 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24591
24602
|
static: true,
|
|
24592
24603
|
label: steedosField.label
|
|
24593
24604
|
});
|
|
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 }));
|
|
24605
|
+
if (steedosField.type === "time" || steedosField.type === "input-time-range") {
|
|
24606
|
+
Object.assign(schema, {
|
|
24607
|
+
inputFormat: 'HH:mm',
|
|
24608
|
+
timeFormat: 'HH:mm',
|
|
24609
|
+
format: '1970-01-01THH:mm:00.000[Z]',
|
|
24610
|
+
});
|
|
24611
|
+
}
|
|
24612
|
+
else if (steedosField.type === "percent") {
|
|
24613
|
+
Object.assign(schema, {
|
|
24614
|
+
"percent": steedosField.scale ? steedosField.scale : true
|
|
24615
|
+
});
|
|
24616
|
+
}
|
|
24617
|
+
else if (steedosField.type === "password") {
|
|
24618
|
+
Object.assign(schema, {
|
|
24619
|
+
"tpl": "******"
|
|
24620
|
+
});
|
|
24621
|
+
}
|
|
24622
|
+
else if (steedosField.type === "select") {
|
|
24623
|
+
map = getSelectMap(steedosField.options);
|
|
24624
|
+
Object.assign(schema, {
|
|
24625
|
+
"placeholder": "",
|
|
24626
|
+
"map": map
|
|
24627
|
+
});
|
|
24628
|
+
}
|
|
24629
|
+
else if (steedosField.type === "color") {
|
|
24630
|
+
Object.assign(schema, {
|
|
24631
|
+
"defaultColor": null
|
|
24632
|
+
});
|
|
24633
|
+
}
|
|
24634
|
+
else if (steedosField.type === "number" || steedosField.type === 'currency') {
|
|
24635
|
+
// amis input-number和number组件中的precision表示小数位数,并不是魔方平台的精度概念,要转换下,否则小数点后会显示很多的0
|
|
24636
|
+
Object.assign(schema, {
|
|
24637
|
+
"precision": steedosField.scale || 0,
|
|
24638
|
+
"kilobitSeparator": steedosField.enable_thousands //识别enable_thousands,控制千分位分隔符
|
|
24639
|
+
});
|
|
24640
|
+
}
|
|
24641
|
+
else if (steedosField.type === "table") {
|
|
24642
|
+
if (steedosField.subFields) {
|
|
24643
|
+
tableFields = [];
|
|
24644
|
+
try {
|
|
24645
|
+
for (_m = __values(steedosField.subFields), _o = _m.next(); !_o.done; _o = _m.next()) {
|
|
24646
|
+
subField = _o.value;
|
|
24647
|
+
if (!subField.name.endsWith(".$")) {
|
|
24648
|
+
subFieldName = subField.name.replace("".concat(steedosField._prefix || '').concat(steedosField.name, ".$."), '').replace("".concat(steedosField.name, "."), '');
|
|
24649
|
+
// const gridSub = await convertSFieldToAmisField(Object.assign({}, subField, {name: subFieldName, isTableField: true}), readonly, ctx);
|
|
24650
|
+
tableFields.push(Object.assign({}, subField, { name: subFieldName }));
|
|
24651
|
+
}
|
|
24646
24652
|
}
|
|
24647
24653
|
}
|
|
24648
|
-
|
|
24649
|
-
|
|
24650
|
-
|
|
24651
|
-
|
|
24652
|
-
|
|
24654
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
24655
|
+
finally {
|
|
24656
|
+
try {
|
|
24657
|
+
if (_o && !_o.done && (_y = _m.return)) _y.call(_m);
|
|
24658
|
+
}
|
|
24659
|
+
finally { if (e_1) throw e_1.error; }
|
|
24653
24660
|
}
|
|
24654
|
-
|
|
24661
|
+
Object.assign(schema, {
|
|
24662
|
+
type: 'steedos-input-table',
|
|
24663
|
+
editable: false,
|
|
24664
|
+
addable: false,
|
|
24665
|
+
removable: false,
|
|
24666
|
+
draggable: false,
|
|
24667
|
+
fields: tableFields,
|
|
24668
|
+
amis: {
|
|
24669
|
+
columnsTogglable: false
|
|
24670
|
+
}
|
|
24671
|
+
});
|
|
24655
24672
|
}
|
|
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
24673
|
}
|
|
24668
|
-
|
|
24669
|
-
|
|
24670
|
-
|
|
24671
|
-
|
|
24672
|
-
|
|
24673
|
-
|
|
24674
|
-
|
|
24675
|
-
|
|
24676
|
-
|
|
24677
|
-
value =
|
|
24674
|
+
else if (steedosField.type === "image") {
|
|
24675
|
+
Object.assign(schema, {
|
|
24676
|
+
enlargeAble: true,
|
|
24677
|
+
showToolbar: true,
|
|
24678
|
+
pipeIn: function (value, data) {
|
|
24679
|
+
if (steedosField.multiple) {
|
|
24680
|
+
if (!value) {
|
|
24681
|
+
value = [defaultImageValue];
|
|
24682
|
+
}
|
|
24683
|
+
value = value.map(function (item) {
|
|
24684
|
+
if (item && item.split("/").length === 1) {
|
|
24685
|
+
// 不是url格式时转为url格式显示
|
|
24686
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24687
|
+
}
|
|
24688
|
+
else {
|
|
24689
|
+
return item;
|
|
24690
|
+
}
|
|
24691
|
+
});
|
|
24678
24692
|
}
|
|
24679
|
-
|
|
24680
|
-
if (
|
|
24681
|
-
|
|
24682
|
-
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(item)));
|
|
24693
|
+
else {
|
|
24694
|
+
if (_$1.isArray(value)) {
|
|
24695
|
+
value = value[0];
|
|
24683
24696
|
}
|
|
24684
|
-
|
|
24685
|
-
|
|
24697
|
+
if (value && value.split("/").length === 1) {
|
|
24698
|
+
// 不是url格式时转为url格式显示
|
|
24699
|
+
return window.getImageFieldUrl(window.Meteor.absoluteUrl("/api/files/images/".concat(value)));
|
|
24686
24700
|
}
|
|
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
24701
|
}
|
|
24702
|
+
return value;
|
|
24697
24703
|
}
|
|
24698
|
-
|
|
24699
|
-
|
|
24700
|
-
|
|
24701
|
-
|
|
24702
|
-
|
|
24703
|
-
|
|
24704
|
-
|
|
24705
|
-
|
|
24706
|
-
|
|
24707
|
-
|
|
24708
|
-
|
|
24709
|
-
|
|
24710
|
-
|
|
24704
|
+
});
|
|
24705
|
+
}
|
|
24706
|
+
else if (steedosField.type === "file") {
|
|
24707
|
+
Object.assign(schema, {
|
|
24708
|
+
"body": [
|
|
24709
|
+
{
|
|
24710
|
+
"type": "service",
|
|
24711
|
+
"api": {
|
|
24712
|
+
"method": "post",
|
|
24713
|
+
"url": "${context.rootUrl}/graphql?file=${".concat(steedosField.name, "}"),
|
|
24714
|
+
"headers": {
|
|
24715
|
+
"Authorization": "Bearer ${context.tenantId},${context.authToken}"
|
|
24716
|
+
},
|
|
24717
|
+
"data": {
|
|
24718
|
+
"query": "{fileData:cfs_files_filerecord(filters:[\"_id\",\"in\",${".concat(steedosField.name, "|asArray|json}]){_id,original}}")
|
|
24719
|
+
}
|
|
24720
|
+
},
|
|
24721
|
+
"body": [
|
|
24722
|
+
{
|
|
24723
|
+
"type": "each",
|
|
24724
|
+
"source": "${fileData}",
|
|
24725
|
+
"className": "flex flex-col",
|
|
24726
|
+
"items": {
|
|
24727
|
+
"type": "tpl",
|
|
24728
|
+
"tpl": "<a href='${context.rootUrl}/api/files/files/${_id}?download=true' target='_blank'>${original.name}</a>"
|
|
24729
|
+
}
|
|
24730
|
+
}
|
|
24731
|
+
]
|
|
24732
|
+
}
|
|
24733
|
+
]
|
|
24734
|
+
}, { name: "" });
|
|
24735
|
+
}
|
|
24736
|
+
else if (steedosField.type === 'formula' || steedosField.type === 'summary') {
|
|
24711
24737
|
if (steedosField.data_type === 'number' || steedosField.data_type === 'currency') {
|
|
24712
24738
|
Object.assign(schema, {
|
|
24713
24739
|
"precision": steedosField.scale || 0
|
|
@@ -24767,11 +24793,9 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24767
24793
|
disabled: true
|
|
24768
24794
|
});
|
|
24769
24795
|
}
|
|
24770
|
-
_5.label = 29;
|
|
24771
|
-
case 29:
|
|
24772
24796
|
Object.assign(schema, steedosField.amis || {});
|
|
24773
24797
|
return [2 /*return*/, schema];
|
|
24774
|
-
case
|
|
24798
|
+
case 19:
|
|
24775
24799
|
if (!ctx.className) {
|
|
24776
24800
|
ctx.className = className;
|
|
24777
24801
|
}
|
|
@@ -24832,16 +24856,16 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
24832
24856
|
}
|
|
24833
24857
|
}
|
|
24834
24858
|
return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
24835
|
-
case
|
|
24859
|
+
case 20:
|
|
24836
24860
|
schema = _5.sent();
|
|
24837
24861
|
// console.log(`AmisSteedosField return schema`, schema)
|
|
24838
24862
|
return [2 /*return*/, schema];
|
|
24839
|
-
case
|
|
24840
|
-
case
|
|
24863
|
+
case 21: return [3 /*break*/, 23];
|
|
24864
|
+
case 22:
|
|
24841
24865
|
error_1 = _5.sent();
|
|
24842
24866
|
console.log("error", error_1);
|
|
24843
|
-
return [3 /*break*/,
|
|
24844
|
-
case
|
|
24867
|
+
return [3 /*break*/, 23];
|
|
24868
|
+
case 23: return [2 /*return*/, null];
|
|
24845
24869
|
}
|
|
24846
24870
|
});
|
|
24847
24871
|
}); };
|