@steedos-widgets/amis-object 1.2.30 → 1.2.31
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 +27 -3
- package/dist/amis-object.cjs.js +117 -27
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +27 -3
- package/dist/amis-object.esm.js +117 -27
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +27 -3
- package/dist/amis-object.umd.js +117 -27
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
package/dist/amis-object.cjs.css
CHANGED
|
@@ -238,6 +238,22 @@ body {
|
|
|
238
238
|
}
|
|
239
239
|
}
|
|
240
240
|
|
|
241
|
+
/* TODO: amis3.2.0 .antd-Nav-Menu-item-link类中缺少flex,影响nav样式 */
|
|
242
|
+
.antd-Nav-Menu-item-link{
|
|
243
|
+
display: flex;
|
|
244
|
+
align-items: center;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/* TODO: amis3.2.0 .antd-Nav类中多了background属性,影响nav样式 */
|
|
248
|
+
.antd-Nav{
|
|
249
|
+
background-color: unset;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* TODO: amis3.2.0 fieldset.antd-Collapse > legend类中多了background属性,影响分组样式 */
|
|
253
|
+
fieldset.antd-Collapse > legend{
|
|
254
|
+
height: unset;
|
|
255
|
+
}
|
|
256
|
+
|
|
241
257
|
.ant-dropdown-menu {
|
|
242
258
|
border: 1px solid #e5e5e5;
|
|
243
259
|
border-radius: 0.25rem;
|
|
@@ -750,6 +766,9 @@ body {
|
|
|
750
766
|
.p-3 {
|
|
751
767
|
padding: 0.75rem
|
|
752
768
|
}
|
|
769
|
+
.\!p-2 {
|
|
770
|
+
padding: 0.5rem !important
|
|
771
|
+
}
|
|
753
772
|
.p-1 {
|
|
754
773
|
padding: 0.25rem
|
|
755
774
|
}
|
|
@@ -789,15 +808,15 @@ body {
|
|
|
789
808
|
.pt-0 {
|
|
790
809
|
padding-top: 0px
|
|
791
810
|
}
|
|
792
|
-
.pl-0 {
|
|
793
|
-
padding-left: 0px
|
|
794
|
-
}
|
|
795
811
|
.pl-1\.5 {
|
|
796
812
|
padding-left: 0.375rem
|
|
797
813
|
}
|
|
798
814
|
.pl-1 {
|
|
799
815
|
padding-left: 0.25rem
|
|
800
816
|
}
|
|
817
|
+
.pl-0 {
|
|
818
|
+
padding-left: 0px
|
|
819
|
+
}
|
|
801
820
|
.pr-4 {
|
|
802
821
|
padding-right: 1rem
|
|
803
822
|
}
|
|
@@ -1219,6 +1238,11 @@ body {
|
|
|
1219
1238
|
.lookup-left .antd-Select-popover {
|
|
1220
1239
|
width: auto !important;
|
|
1221
1240
|
}
|
|
1241
|
+
.antd-InputGroup .antd-SelectControl.lookup-left .antd-Select {
|
|
1242
|
+
border-right-width: 1px;
|
|
1243
|
+
border-top-right-radius: 5px;
|
|
1244
|
+
border-bottom-right-radius: 5px;
|
|
1245
|
+
}
|
|
1222
1246
|
|
|
1223
1247
|
@media (min-width: 767px) {
|
|
1224
1248
|
.steedos-amis-form .antd-Collapse .antd-Form--normal,
|
package/dist/amis-object.cjs.js
CHANGED
|
@@ -3656,7 +3656,7 @@ function getNameTpl(field, ctx){
|
|
|
3656
3656
|
|
|
3657
3657
|
function getRelatedFieldTpl(field, ctx){
|
|
3658
3658
|
let tpl = '';
|
|
3659
|
-
if(!field.reference_to && (field.optionsFunction || field._optionsFunction)){
|
|
3659
|
+
if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
|
|
3660
3660
|
if(field.isTableField){
|
|
3661
3661
|
return `\${${field.name}}`
|
|
3662
3662
|
}else {
|
|
@@ -8277,7 +8277,7 @@ const getSettingListviewToolbarButtonSchema = ()=>{
|
|
|
8277
8277
|
"trigger": "click",
|
|
8278
8278
|
"icon": "fa fa-cog",
|
|
8279
8279
|
"tooltip": instance.t('frontend_button_listview_control_tooltip'),
|
|
8280
|
-
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8280
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
8281
8281
|
"align": "right",
|
|
8282
8282
|
"visibleOn": "${!isLookup}",
|
|
8283
8283
|
"buttons": [
|
|
@@ -8321,7 +8321,7 @@ const getDisplayAsButton = function(objectName, showDisplayAs){
|
|
|
8321
8321
|
"type": "dropdown-button",
|
|
8322
8322
|
"icon": "fa fa-table-columns",
|
|
8323
8323
|
"tooltip": `${instance.t('frontend_display_as')} ${displayAsLabel}`,
|
|
8324
|
-
"btnClassName": "antd-Button--iconOnly bg-white p-2 rounded border-gray-300 text-gray-500",
|
|
8324
|
+
"btnClassName": "antd-Button--iconOnly bg-white !p-2 rounded border-gray-300 text-gray-500",
|
|
8325
8325
|
"align": "right",
|
|
8326
8326
|
"visibleOn": "${window:innerWidth > 768 && !!!isLookup}",
|
|
8327
8327
|
"buttons": [
|
|
@@ -8983,6 +8983,14 @@ async function lookupToAmisPicker(field, readonly, ctx){
|
|
|
8983
8983
|
}
|
|
8984
8984
|
}
|
|
8985
8985
|
|
|
8986
|
+
if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
|
|
8987
|
+
if(filters.length > 0){
|
|
8988
|
+
filters = [ ["user_accepted", "=", true], "and", filters ]
|
|
8989
|
+
}else{
|
|
8990
|
+
filters = [["user_accepted", "=", true]];
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
|
|
8986
8994
|
|
|
8987
8995
|
if(allowSearchFields){
|
|
8988
8996
|
allowSearchFields.forEach(function(key){
|
|
@@ -9315,6 +9323,14 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9315
9323
|
filters.push(fieldFilters);
|
|
9316
9324
|
}
|
|
9317
9325
|
|
|
9326
|
+
if(${referenceTo?.objectName === "space_users"} && ${field.reference_to_field === "user"}){
|
|
9327
|
+
if(filters.length > 0){
|
|
9328
|
+
filters = [ ["user_accepted", "=", true], "and", filters ]
|
|
9329
|
+
}else{
|
|
9330
|
+
filters = [["user_accepted", "=", true]];
|
|
9331
|
+
}
|
|
9332
|
+
}
|
|
9333
|
+
|
|
9318
9334
|
const inFilterForm = ${ctx.inFilterForm};
|
|
9319
9335
|
const filtersFunction = ${field.filtersFunction || field._filtersFunction};
|
|
9320
9336
|
|
|
@@ -9354,6 +9370,18 @@ async function lookupToAmisSelect(field, readonly, ctx){
|
|
|
9354
9370
|
payload.data.options = options;
|
|
9355
9371
|
return payload;
|
|
9356
9372
|
`;
|
|
9373
|
+
}else if(field.options){
|
|
9374
|
+
apiInfo.adaptor = `
|
|
9375
|
+
var options = ${JSON.stringify(field.options)}
|
|
9376
|
+
if(api.data.$term){
|
|
9377
|
+
options = _.filter(options, function(o) {
|
|
9378
|
+
var label = o.label;
|
|
9379
|
+
return label.toLowerCase().indexOf(api.data.$term.toLowerCase()) > -1;
|
|
9380
|
+
});
|
|
9381
|
+
}
|
|
9382
|
+
payload.data.options = options;
|
|
9383
|
+
return payload;
|
|
9384
|
+
`;
|
|
9357
9385
|
}
|
|
9358
9386
|
|
|
9359
9387
|
const data = {
|
|
@@ -9433,11 +9461,6 @@ async function lookupToAmis(field, readonly, ctx){
|
|
|
9433
9461
|
// ids人员点选模式
|
|
9434
9462
|
return await lookupToAmisIdsPicker(field, readonly, ctx);
|
|
9435
9463
|
}
|
|
9436
|
-
if(!field.filters || field.filters.length == 0){
|
|
9437
|
-
field.filters = [["user_accepted", "=", true]];
|
|
9438
|
-
}else {
|
|
9439
|
-
field.filters = [ ["user_accepted", "=", true], "and", field.filters ];
|
|
9440
|
-
}
|
|
9441
9464
|
// 左侧树右侧人员列表的下拉框模式,不再支持,而是执行下面的lookupToAmisPicker函数弹出选人窗口
|
|
9442
9465
|
// return await lookupToAmisSelectUser(field, readonly, ctx);
|
|
9443
9466
|
}
|
|
@@ -9925,13 +9948,13 @@ function getSelectFieldOptions(field){
|
|
|
9925
9948
|
___default__namespace.each(field.options, (item)=>{
|
|
9926
9949
|
switch (dataType) {
|
|
9927
9950
|
case 'number':
|
|
9928
|
-
options.push({label: item.label, value: Number(item.value)});
|
|
9951
|
+
options.push({label: item.label, value: Number(item.value), icon: item.icon});
|
|
9929
9952
|
break;
|
|
9930
9953
|
case 'text':
|
|
9931
|
-
options.push({label: item.label, value: String(item.value)});
|
|
9954
|
+
options.push({label: item.label, value: String(item.value), icon: item.icon});
|
|
9932
9955
|
break;
|
|
9933
9956
|
case 'boolean':
|
|
9934
|
-
options.push({label: item.label, value: item.value === 'false' ? false : true});
|
|
9957
|
+
options.push({label: item.label, value: item.value === 'false' ? false : true, icon: item.icon});
|
|
9935
9958
|
break;
|
|
9936
9959
|
}
|
|
9937
9960
|
});
|
|
@@ -9993,6 +10016,17 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
|
9993
10016
|
labelField: 'label',
|
|
9994
10017
|
valueField: 'value'
|
|
9995
10018
|
};
|
|
10019
|
+
const select_menuTpl = `<span class='flex items-center mt-0.5'>
|
|
10020
|
+
<span role='img' aria-label='smile' class='anticon anticon-smile'>
|
|
10021
|
+
<span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
|
|
10022
|
+
<svg class='slds-icon slds-icon_x-small' aria-hidden='true'>
|
|
10023
|
+
<use xlink:href='/assets/icons/standard-sprite/svg/symbols.svg#\${icon}'></use>
|
|
10024
|
+
</svg>
|
|
10025
|
+
</span>
|
|
10026
|
+
</span>
|
|
10027
|
+
<span class='pl-1.5'>\${label}</span>
|
|
10028
|
+
</span>`;
|
|
10029
|
+
convertData.menuTpl = "${icon ? `"+select_menuTpl+"` : label}";
|
|
9996
10030
|
if(field.multiple){
|
|
9997
10031
|
convertData.multiple = true;
|
|
9998
10032
|
convertData.extractValue = true;
|
|
@@ -10724,7 +10758,7 @@ async function getTableColumns$1(fields, options){
|
|
|
10724
10758
|
type: "switch",
|
|
10725
10759
|
name: field.name,
|
|
10726
10760
|
label: field.label,
|
|
10727
|
-
width: field.width,
|
|
10761
|
+
width: field.width || defaultWidth,
|
|
10728
10762
|
toggled: field.toggled,
|
|
10729
10763
|
static: true,
|
|
10730
10764
|
className:"whitespace-nowrap",
|
|
@@ -10745,6 +10779,10 @@ async function getTableColumns$1(fields, options){
|
|
|
10745
10779
|
}
|
|
10746
10780
|
else if(field.type === 'select'){
|
|
10747
10781
|
const map = getSelectMap(field.options);
|
|
10782
|
+
let className = "";
|
|
10783
|
+
if(field.wrap === false){
|
|
10784
|
+
className += " whitespace-nowrap";
|
|
10785
|
+
}
|
|
10748
10786
|
columns.push(Object.assign({}, {
|
|
10749
10787
|
type: "mapping",
|
|
10750
10788
|
name: field.name,
|
|
@@ -10753,7 +10791,7 @@ async function getTableColumns$1(fields, options){
|
|
|
10753
10791
|
sortable: field.sortable,
|
|
10754
10792
|
width: field.width || defaultWidth,
|
|
10755
10793
|
toggled: field.toggled,
|
|
10756
|
-
className
|
|
10794
|
+
className,
|
|
10757
10795
|
static: true,
|
|
10758
10796
|
quickEdit: quickEditSchema
|
|
10759
10797
|
}, field.amis, {name: field.name}));
|
|
@@ -11392,7 +11430,10 @@ async function getTableApi(mainObject, fields, options){
|
|
|
11392
11430
|
if(item[key]){
|
|
11393
11431
|
if(field._optionsFunction){
|
|
11394
11432
|
const optionsFunction = eval("(" + field._optionsFunction+ ")")(item);
|
|
11395
|
-
item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return
|
|
11433
|
+
item[key + '__label'] = _.map(_.filter(optionsFunction, function(option){return item[key] == option.value}), 'label').join(' ');
|
|
11434
|
+
}else if(field.options){
|
|
11435
|
+
const options = field.options;
|
|
11436
|
+
item[key + '__label'] = _.map(_.filter(options, function(option){return item[key] == option.value}), 'label').join(' ');
|
|
11396
11437
|
}
|
|
11397
11438
|
}
|
|
11398
11439
|
})
|
|
@@ -16835,6 +16876,7 @@ var index_esm$1 = /*#__PURE__*/Object.freeze({
|
|
|
16835
16876
|
getRecordPageInitSchema: getRecordPageInitSchema,
|
|
16836
16877
|
getRecordPermissions: getRecordPermissions,
|
|
16837
16878
|
getRecordServiceSchema: getRecordServiceSchema,
|
|
16879
|
+
getReferenceTo: getReferenceTo,
|
|
16838
16880
|
getRelatedFieldValue: getRelatedFieldValue,
|
|
16839
16881
|
getRelatedListSchema: getRelatedListSchema,
|
|
16840
16882
|
getRelatedsCount: getRelatedsCount,
|
|
@@ -18908,12 +18950,13 @@ var AmisGlobalHeader = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18908
18950
|
}); };
|
|
18909
18951
|
|
|
18910
18952
|
var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void 0, function () {
|
|
18911
|
-
var steedosField, field, _a, readonly, _b, ctx, config, $schema, schema, error_1;
|
|
18912
|
-
|
|
18913
|
-
|
|
18953
|
+
var steedosField, field, _a, readonly, _b, ctx, config, $schema, fStatic, objectName, filters, valueFieldKey, labelFieldKey, referenceTo, referenceToField, value, _steedosField, referenceTo, referenceToField, schema, schema, error_1;
|
|
18954
|
+
var _c, _d, _e, _f, _g;
|
|
18955
|
+
return __generator(this, function (_h) {
|
|
18956
|
+
switch (_h.label) {
|
|
18914
18957
|
case 0:
|
|
18915
18958
|
steedosField = null;
|
|
18916
|
-
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, $schema = props.$schema;
|
|
18959
|
+
field = props.field, _a = props.readonly, readonly = _a === void 0 ? false : _a, _b = props.ctx, ctx = _b === void 0 ? {} : _b, config = props.config, $schema = props.$schema, fStatic = props.static;
|
|
18917
18960
|
// console.log(`AmisSteedosField`, props)
|
|
18918
18961
|
if ($schema.config && ___default.isString($schema.config)) {
|
|
18919
18962
|
$schema.config = JSON.parse($schema.config);
|
|
@@ -18934,19 +18977,66 @@ var AmisSteedosField = function (props) { return __awaiter(void 0, void 0, void
|
|
|
18934
18977
|
steedosField = JSON.parse(field);
|
|
18935
18978
|
}
|
|
18936
18979
|
}
|
|
18937
|
-
|
|
18980
|
+
_h.label = 1;
|
|
18938
18981
|
case 1:
|
|
18939
|
-
|
|
18940
|
-
|
|
18982
|
+
_h.trys.push([1, 9, , 10]);
|
|
18983
|
+
if (!(fStatic && (steedosField.type === 'lookup' || steedosField.type === 'master_detail'))) return [3 /*break*/, 6];
|
|
18984
|
+
objectName = void 0, filters = void 0, valueFieldKey = void 0, labelFieldKey = void 0;
|
|
18985
|
+
if (!props.data[steedosField.name]) {
|
|
18986
|
+
return [2 /*return*/, {}];
|
|
18987
|
+
}
|
|
18988
|
+
if (!___default.isString(steedosField.reference_to)) return [3 /*break*/, 3];
|
|
18989
|
+
return [4 /*yield*/, getReferenceTo(steedosField)];
|
|
18941
18990
|
case 2:
|
|
18942
|
-
|
|
18943
|
-
|
|
18944
|
-
|
|
18991
|
+
referenceTo = _h.sent();
|
|
18992
|
+
referenceToField = steedosField.reference_to_field || '_id';
|
|
18993
|
+
objectName = referenceTo.objectName;
|
|
18994
|
+
valueFieldKey = referenceTo && ((_c = referenceTo.valueField) === null || _c === void 0 ? void 0 : _c.name) || '_id';
|
|
18995
|
+
labelFieldKey = referenceTo && ((_d = referenceTo.labelField) === null || _d === void 0 ? void 0 : _d.name) || 'name';
|
|
18996
|
+
value = props.data[steedosField.name];
|
|
18997
|
+
if (___default.isString(value)) {
|
|
18998
|
+
value = [value];
|
|
18999
|
+
}
|
|
19000
|
+
filters = [referenceToField, "in", value];
|
|
19001
|
+
return [3 /*break*/, 5];
|
|
18945
19002
|
case 3:
|
|
18946
|
-
|
|
19003
|
+
_steedosField = __assign$2(__assign$2({}, steedosField), { reference_to: props.data[steedosField.name].o });
|
|
19004
|
+
return [4 /*yield*/, getReferenceTo(_steedosField)];
|
|
19005
|
+
case 4:
|
|
19006
|
+
referenceTo = _h.sent();
|
|
19007
|
+
referenceToField = _steedosField.reference_to_field || '_id';
|
|
19008
|
+
objectName = referenceTo.objectName;
|
|
19009
|
+
valueFieldKey = referenceTo && ((_e = referenceTo.valueField) === null || _e === void 0 ? void 0 : _e.name) || '_id';
|
|
19010
|
+
labelFieldKey = referenceTo && ((_f = referenceTo.labelField) === null || _f === void 0 ? void 0 : _f.name) || 'name';
|
|
19011
|
+
filters = [referenceToField, "in", props.data[_steedosField.name].ids];
|
|
19012
|
+
_h.label = 5;
|
|
19013
|
+
case 5:
|
|
19014
|
+
schema = Object.assign({}, {
|
|
19015
|
+
type: 'select',
|
|
19016
|
+
multiple: steedosField.multiple,
|
|
19017
|
+
name: steedosField.name,
|
|
19018
|
+
label: steedosField.label,
|
|
19019
|
+
static: true,
|
|
19020
|
+
className: (_g = steedosField.amis) === null || _g === void 0 ? void 0 : _g.className,
|
|
19021
|
+
source: {
|
|
19022
|
+
"method": "post",
|
|
19023
|
+
"url": "${context.rootUrl}/graphql",
|
|
19024
|
+
"requestAdaptor": "\n api.data = {\n query: '{options:".concat(objectName, "(filters: ").concat(JSON.stringify(filters), "){label: ").concat(labelFieldKey, ",value: ").concat(valueFieldKey, "}}'\n }\n return api;\n ")
|
|
19025
|
+
}
|
|
19026
|
+
}, ___default.pick(steedosField.amis || {}, ['className', 'inline', 'label', 'labelAlign', 'name', 'labelRemark', 'description', 'placeholder', 'staticClassName', 'staticLabelClassName', 'staticInputClassName', 'staticSchema']));
|
|
19027
|
+
// console.log(`AmisSteedosField return schema`, schema)
|
|
19028
|
+
return [2 /*return*/, schema];
|
|
19029
|
+
case 6: return [4 /*yield*/, index.convertSFieldToAmisField(steedosField, readonly, ctx)];
|
|
19030
|
+
case 7:
|
|
19031
|
+
schema = _h.sent();
|
|
19032
|
+
// console.log(`AmisSteedosField return schema`, schema)
|
|
19033
|
+
return [2 /*return*/, schema];
|
|
19034
|
+
case 8: return [3 /*break*/, 10];
|
|
19035
|
+
case 9:
|
|
19036
|
+
error_1 = _h.sent();
|
|
18947
19037
|
console.log("error", error_1);
|
|
18948
|
-
return [3 /*break*/,
|
|
18949
|
-
case
|
|
19038
|
+
return [3 /*break*/, 10];
|
|
19039
|
+
case 10: return [2 /*return*/, null];
|
|
18950
19040
|
}
|
|
18951
19041
|
});
|
|
18952
19042
|
}); };
|