@steedos-widgets/amis-object 1.2.6 → 1.2.7
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 +43 -0
- package/dist/amis-object.cjs.js +201 -31
- package/dist/amis-object.cjs.js.map +1 -1
- package/dist/amis-object.esm.css +43 -0
- package/dist/amis-object.esm.js +202 -32
- package/dist/amis-object.esm.js.map +1 -1
- package/dist/amis-object.umd.css +43 -0
- package/dist/amis-object.umd.js +201 -31
- package/dist/amis-object.umd.js.map +1 -1
- package/dist/assets.json +11 -11
- package/package.json +3 -3
package/dist/amis-object.umd.css
CHANGED
|
@@ -205,6 +205,39 @@ body {
|
|
|
205
205
|
overflow: unset;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
/* 手机端native时间控件样式 */
|
|
209
|
+
@media (max-width: 768px){
|
|
210
|
+
.steedos-combo-edit .antd-Form-row{
|
|
211
|
+
display: flex !important;
|
|
212
|
+
-moz-column-gap: unset !important;
|
|
213
|
+
column-gap: unset !important;
|
|
214
|
+
}
|
|
215
|
+
.steedos-combo-edit .antd-Form::before{
|
|
216
|
+
content: unset;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.steedos-combo-edit .antd-Form .antd-Form-item::after{
|
|
220
|
+
content: unset;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.steedos-combo-edit .antd-Form .antd-Form-item{
|
|
224
|
+
padding: 0;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.steedos-combo-edit{
|
|
228
|
+
flex-wrap:nowrap !important;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.steedos-combo-edit .steedos-native-date .antd-TextControl-input input{
|
|
232
|
+
min-width: 120px;
|
|
233
|
+
align-items: start !important;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.steedos-combo-edit .steedos-native-time .antd-TextControl-input input{
|
|
237
|
+
min-width: 70px;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
208
241
|
.ant-dropdown-menu {
|
|
209
242
|
border: 1px solid #e5e5e5;
|
|
210
243
|
border-radius: 0.25rem;
|
|
@@ -608,6 +641,9 @@ body {
|
|
|
608
641
|
.rounded-full {
|
|
609
642
|
border-radius: 9999px
|
|
610
643
|
}
|
|
644
|
+
.rounded-xl {
|
|
645
|
+
border-radius: 0.75rem
|
|
646
|
+
}
|
|
611
647
|
.rounded-md {
|
|
612
648
|
border-radius: 0.375rem
|
|
613
649
|
}
|
|
@@ -724,6 +760,10 @@ body {
|
|
|
724
760
|
padding-left: 0.5rem;
|
|
725
761
|
padding-right: 0.5rem
|
|
726
762
|
}
|
|
763
|
+
.py-1 {
|
|
764
|
+
padding-top: 0.25rem;
|
|
765
|
+
padding-bottom: 0.25rem
|
|
766
|
+
}
|
|
727
767
|
.pt-4 {
|
|
728
768
|
padding-top: 1rem
|
|
729
769
|
}
|
|
@@ -903,6 +943,9 @@ body {
|
|
|
903
943
|
outline-offset: 2px
|
|
904
944
|
}
|
|
905
945
|
@media (min-width: 640px) {
|
|
946
|
+
.sm\:sticky {
|
|
947
|
+
position: sticky
|
|
948
|
+
}
|
|
906
949
|
.sm\:m-3 {
|
|
907
950
|
margin: 0.75rem
|
|
908
951
|
}
|
package/dist/amis-object.umd.js
CHANGED
|
@@ -3043,7 +3043,7 @@
|
|
|
3043
3043
|
// }
|
|
3044
3044
|
// listView.handleFilterSubmit(Object.assign({}, removedValues, filterFormValues));
|
|
3045
3045
|
`;
|
|
3046
|
-
const
|
|
3046
|
+
const onCancelScript = `
|
|
3047
3047
|
const scope = event.context.scoped;
|
|
3048
3048
|
var filterForm = scope.parent.parent.getComponents().find(function(n){
|
|
3049
3049
|
return n.props.type === "form";
|
|
@@ -3071,6 +3071,14 @@
|
|
|
3071
3071
|
}
|
|
3072
3072
|
}
|
|
3073
3073
|
listView.handleFilterSubmit(removedValues);
|
|
3074
|
+
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3075
|
+
return n.props.type === "service";
|
|
3076
|
+
});
|
|
3077
|
+
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3078
|
+
//触发amis crud 高度重算
|
|
3079
|
+
setTimeout(()=>{
|
|
3080
|
+
window.dispatchEvent(new Event("resize"))
|
|
3081
|
+
}, 100);
|
|
3074
3082
|
`;
|
|
3075
3083
|
const dataProviderInited = `
|
|
3076
3084
|
const objectName = data.objectName;
|
|
@@ -3267,14 +3275,15 @@
|
|
|
3267
3275
|
},
|
|
3268
3276
|
{
|
|
3269
3277
|
"type": "button",
|
|
3270
|
-
"label": "
|
|
3278
|
+
"label": "取消",
|
|
3279
|
+
"name": "btn_filter_form_cancel",
|
|
3271
3280
|
"visibleOn": "this.filterFormSearchableFields && this.filterFormSearchableFields.length",
|
|
3272
3281
|
"onEvent": {
|
|
3273
3282
|
"click": {
|
|
3274
3283
|
"actions": [
|
|
3275
3284
|
{
|
|
3276
3285
|
"actionType": "custom",
|
|
3277
|
-
"script":
|
|
3286
|
+
"script": onCancelScript
|
|
3278
3287
|
}
|
|
3279
3288
|
]
|
|
3280
3289
|
}
|
|
@@ -3878,11 +3887,26 @@ const filterForm = scope.getComponents().find(function(n){
|
|
|
3878
3887
|
const filterService = filterForm.context.getComponents().find(function(n){
|
|
3879
3888
|
return n.props.type === "service";
|
|
3880
3889
|
});
|
|
3881
|
-
filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3882
|
-
|
|
3883
|
-
|
|
3884
|
-
|
|
3885
|
-
|
|
3890
|
+
// filterService.setData({showFieldsFilter: !!!filterService.props.data.showFieldsFilter});
|
|
3891
|
+
let resizeWindow = function(){
|
|
3892
|
+
//触发amis crud 高度重算
|
|
3893
|
+
setTimeout(()=>{
|
|
3894
|
+
window.dispatchEvent(new Event("resize"))
|
|
3895
|
+
}, 500);
|
|
3896
|
+
}
|
|
3897
|
+
if(filterService.props.data.showFieldsFilter){
|
|
3898
|
+
let buttonCancel = SteedosUI.getClosestAmisComponentByType(filterForm.context, "button", {
|
|
3899
|
+
direction: "down",
|
|
3900
|
+
name: "btn_filter_form_cancel"
|
|
3901
|
+
});
|
|
3902
|
+
buttonCancel.props.dispatchEvent('click', {}).then(function(){
|
|
3903
|
+
resizeWindow();
|
|
3904
|
+
});
|
|
3905
|
+
}
|
|
3906
|
+
else{
|
|
3907
|
+
filterService.setData({showFieldsFilter: true});
|
|
3908
|
+
resizeWindow();
|
|
3909
|
+
}
|
|
3886
3910
|
`;
|
|
3887
3911
|
|
|
3888
3912
|
function getExportApiRequestAdaptorScript(){
|
|
@@ -4621,8 +4645,8 @@ setTimeout(()=>{
|
|
|
4621
4645
|
}
|
|
4622
4646
|
else {
|
|
4623
4647
|
return [
|
|
4648
|
+
"switch-per-page",
|
|
4624
4649
|
"statistics",
|
|
4625
|
-
// "switch-per-page",
|
|
4626
4650
|
"pagination"
|
|
4627
4651
|
]
|
|
4628
4652
|
}
|
|
@@ -5814,6 +5838,23 @@ setTimeout(()=>{
|
|
|
5814
5838
|
return readonly ? getAmisFileReadonlySchema(steedosField) : getAmisFileEditSchema(steedosField);
|
|
5815
5839
|
};
|
|
5816
5840
|
|
|
5841
|
+
/*
|
|
5842
|
+
* @Author: baozhoutao@steedos.com
|
|
5843
|
+
* @Date: 2022-07-20 16:29:22
|
|
5844
|
+
* @LastEditors: Please set LastEditors
|
|
5845
|
+
* @LastEditTime: 2023-05-11 11:19:54
|
|
5846
|
+
* @Description:
|
|
5847
|
+
*/
|
|
5848
|
+
|
|
5849
|
+
function getContrastColor(bgColor) {
|
|
5850
|
+
var backgroundColor = (bgColor.charAt(0) === '#') ? bgColor.substring(1, 7) : bgColor;
|
|
5851
|
+
var r = parseInt(backgroundColor.substr(0, 2), 16);
|
|
5852
|
+
var g = parseInt(backgroundColor.substr(2, 2), 16);
|
|
5853
|
+
var b = parseInt(backgroundColor.substr(4, 2), 16);
|
|
5854
|
+
var brightness = (r * 299 + g * 587 + b * 114) / 1000;
|
|
5855
|
+
return brightness >= 128 ? "#000000" : "#ffffff";
|
|
5856
|
+
}
|
|
5857
|
+
|
|
5817
5858
|
const OMIT_FIELDS = ['created', 'created_by', 'modified', 'modified_by'];
|
|
5818
5859
|
// const Lookup = require('./lookup');
|
|
5819
5860
|
|
|
@@ -5967,6 +6008,8 @@ setTimeout(()=>{
|
|
|
5967
6008
|
}
|
|
5968
6009
|
|
|
5969
6010
|
async function convertSFieldToAmisField(field, readonly, ctx) {
|
|
6011
|
+
// console.log('convertSFieldToAmisField====>', field, readonly, ctx)
|
|
6012
|
+
const isMobile = window.innerWidth <= 768;
|
|
5970
6013
|
// 创建人和修改人、创建时间和修改时间不显示
|
|
5971
6014
|
if(___default__namespace.includes(OMIT_FIELDS, field.name) && ctx.showSystemFields != true){
|
|
5972
6015
|
return;
|
|
@@ -6001,20 +6044,42 @@ setTimeout(()=>{
|
|
|
6001
6044
|
// }
|
|
6002
6045
|
// break;
|
|
6003
6046
|
case 'select':
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6047
|
+
if(readonly){
|
|
6048
|
+
const selectOptions = field.options;
|
|
6049
|
+
let map = {};
|
|
6050
|
+
___default__namespace.forEach(selectOptions,(option)=>{
|
|
6051
|
+
const optionValue = option.value + '';
|
|
6052
|
+
if(option.color){
|
|
6053
|
+
const background = '#'+option.color;
|
|
6054
|
+
const color = getContrastColor(background);
|
|
6055
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
6056
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
6057
|
+
}else {
|
|
6058
|
+
map[optionValue] = option.label;
|
|
6059
|
+
}
|
|
6060
|
+
});
|
|
6061
|
+
convertData = {
|
|
6062
|
+
type: "static-mapping",
|
|
6063
|
+
name: field.name,
|
|
6064
|
+
label: field.label,
|
|
6065
|
+
map: map
|
|
6066
|
+
};
|
|
6067
|
+
}else {
|
|
6068
|
+
convertData = {
|
|
6069
|
+
type: getAmisStaticFieldType('select', readonly),
|
|
6070
|
+
joinValues: false,
|
|
6071
|
+
options: getSelectFieldOptions(field),
|
|
6072
|
+
extractValue: true,
|
|
6073
|
+
clearable: true,
|
|
6074
|
+
labelField: 'label',
|
|
6075
|
+
valueField: 'value'
|
|
6076
|
+
};
|
|
6077
|
+
if(field.multiple){
|
|
6078
|
+
convertData.multiple = true;
|
|
6079
|
+
convertData.extractValue = true;
|
|
6080
|
+
}
|
|
6017
6081
|
}
|
|
6082
|
+
|
|
6018
6083
|
break;
|
|
6019
6084
|
case 'boolean':
|
|
6020
6085
|
convertData = {
|
|
@@ -6034,7 +6099,26 @@ setTimeout(()=>{
|
|
|
6034
6099
|
};
|
|
6035
6100
|
break;
|
|
6036
6101
|
case 'date':
|
|
6037
|
-
convertData = {
|
|
6102
|
+
convertData = isMobile && !readonly ? {
|
|
6103
|
+
type: "native-date",
|
|
6104
|
+
pipeIn: (value, data) => {
|
|
6105
|
+
if (value) {
|
|
6106
|
+
value = moment(value).utc().format('YYYY-MM-DD');
|
|
6107
|
+
return value;
|
|
6108
|
+
} else {
|
|
6109
|
+
return "";
|
|
6110
|
+
}
|
|
6111
|
+
|
|
6112
|
+
},
|
|
6113
|
+
pipeOut: (value, oldValue, data) => {
|
|
6114
|
+
if (value) {
|
|
6115
|
+
value = moment(value).format('YYYY-MM-DDT00:00:00.000[Z]');
|
|
6116
|
+
return value;
|
|
6117
|
+
} else {
|
|
6118
|
+
return "";
|
|
6119
|
+
}
|
|
6120
|
+
}
|
|
6121
|
+
} : {
|
|
6038
6122
|
type: getAmisStaticFieldType('date', readonly),
|
|
6039
6123
|
inputFormat: "YYYY-MM-DD",
|
|
6040
6124
|
format:'YYYY-MM-DDT00:00:00.000[Z]',
|
|
@@ -6053,12 +6137,48 @@ setTimeout(()=>{
|
|
|
6053
6137
|
};
|
|
6054
6138
|
break;
|
|
6055
6139
|
case 'datetime':
|
|
6056
|
-
convertData = {
|
|
6140
|
+
convertData = isMobile && !readonly ? {
|
|
6141
|
+
type: "combo",
|
|
6142
|
+
pipeIn: (value, data) => {
|
|
6143
|
+
let revalue = {};
|
|
6144
|
+
if (value && value != "Invalid date") {
|
|
6145
|
+
value = moment(value).format('YYYY-MM-DD HH:mm:ss');
|
|
6146
|
+
revalue[field.name + "-native-date"] = value.split(' ')[0];
|
|
6147
|
+
revalue[field.name + "-native-time"] = value.split(' ')[1];
|
|
6148
|
+
} else {
|
|
6149
|
+
revalue[field.name + "-native-date"] = "";
|
|
6150
|
+
revalue[field.name + "-native-time"] = "";
|
|
6151
|
+
}
|
|
6152
|
+
return revalue;
|
|
6153
|
+
},
|
|
6154
|
+
pipeOut: (value, oldValue, data) => {
|
|
6155
|
+
let revalue = "";
|
|
6156
|
+
if (value[field.name + "-native-date"] && value[field.name + "-native-time"]) {
|
|
6157
|
+
revalue = value[field.name + "-native-date"] + " " + value[field.name + "-native-time"];
|
|
6158
|
+
revalue = moment(revalue).utc().format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
|
|
6159
|
+
}
|
|
6160
|
+
return revalue;
|
|
6161
|
+
},
|
|
6162
|
+
items: [
|
|
6163
|
+
{
|
|
6164
|
+
type: "native-date",
|
|
6165
|
+
name: field.name + "-native-date",
|
|
6166
|
+
className: "steedos-native-date",
|
|
6167
|
+
value: ""
|
|
6168
|
+
},
|
|
6169
|
+
{
|
|
6170
|
+
type: "native-time",
|
|
6171
|
+
name: field.name + "-native-time",
|
|
6172
|
+
className: "steedos-native-time",
|
|
6173
|
+
value: ""
|
|
6174
|
+
}
|
|
6175
|
+
]
|
|
6176
|
+
} : {
|
|
6057
6177
|
type: getAmisStaticFieldType('datetime', readonly),
|
|
6058
6178
|
inputFormat: 'YYYY-MM-DD HH:mm',
|
|
6059
|
-
format:'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
6179
|
+
format: 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
|
6060
6180
|
tpl: readonly ? getDateTimeTpl(field) : null,
|
|
6061
|
-
utc: true
|
|
6181
|
+
utc: true,
|
|
6062
6182
|
};
|
|
6063
6183
|
break;
|
|
6064
6184
|
case 'input-time-range':
|
|
@@ -6073,7 +6193,26 @@ setTimeout(()=>{
|
|
|
6073
6193
|
};
|
|
6074
6194
|
break;
|
|
6075
6195
|
case 'time':
|
|
6076
|
-
convertData = {
|
|
6196
|
+
convertData = isMobile && !readonly ? {
|
|
6197
|
+
type: "native-time",
|
|
6198
|
+
pipeIn: (value, data) => {
|
|
6199
|
+
if (value) {
|
|
6200
|
+
value = moment(value).utc().format('HH:mm');
|
|
6201
|
+
return value;
|
|
6202
|
+
} else {
|
|
6203
|
+
return "";
|
|
6204
|
+
}
|
|
6205
|
+
|
|
6206
|
+
},
|
|
6207
|
+
pipeOut: (value, oldValue, data) => {
|
|
6208
|
+
if (value) {
|
|
6209
|
+
value = moment('1970-01-01 ' + value).format('1970-01-01THH:mm:00.000[Z]');
|
|
6210
|
+
return value;
|
|
6211
|
+
} else {
|
|
6212
|
+
return "";
|
|
6213
|
+
}
|
|
6214
|
+
}
|
|
6215
|
+
} : {
|
|
6077
6216
|
type: getAmisStaticFieldType('time', readonly),
|
|
6078
6217
|
inputFormat: 'HH:mm',
|
|
6079
6218
|
timeFormat:'HH:mm',
|
|
@@ -6277,6 +6416,13 @@ setTimeout(()=>{
|
|
|
6277
6416
|
convertData.quickEdit = false;
|
|
6278
6417
|
}
|
|
6279
6418
|
|
|
6419
|
+
let fieldTypeClassName = ' steedos-' + convertData.type + (readonly ? '-readonly' : '-edit');
|
|
6420
|
+
if (convertData.className) {
|
|
6421
|
+
convertData.className = convertData.className + fieldTypeClassName;
|
|
6422
|
+
} else {
|
|
6423
|
+
convertData.className = fieldTypeClassName;
|
|
6424
|
+
}
|
|
6425
|
+
|
|
6280
6426
|
if(field.visible_on){
|
|
6281
6427
|
// convertData.visibleOn = `\$${field.visible_on.substring(1, field.visible_on.length -1).replace(/formData./g, '')}`;
|
|
6282
6428
|
if(field.visible_on.startsWith("{{")){
|
|
@@ -6960,7 +7106,7 @@ setTimeout(()=>{
|
|
|
6960
7106
|
api: await getTableApi(objectSchema, fields, options),
|
|
6961
7107
|
hiddenOn: options.tableHiddenOn,
|
|
6962
7108
|
autoFillHeight: options.isRelated ? false : true,
|
|
6963
|
-
className: `flex-auto ${crudClassName || ""}`,
|
|
7109
|
+
className: `flex-auto bg-white ${crudClassName || ""}`,
|
|
6964
7110
|
crudClassName: crudClassName,
|
|
6965
7111
|
},
|
|
6966
7112
|
bodyProps,
|
|
@@ -7306,7 +7452,31 @@ setTimeout(()=>{
|
|
|
7306
7452
|
...getAmisFileReadonlySchema(field)
|
|
7307
7453
|
}, field.amis, {name: field.name}));
|
|
7308
7454
|
}
|
|
7309
|
-
|
|
7455
|
+
else if(field.type === 'select'){
|
|
7456
|
+
const selectOptions = field.options;
|
|
7457
|
+
let map = {};
|
|
7458
|
+
___default.forEach(selectOptions,(option)=>{
|
|
7459
|
+
const optionValue = option.value + '';
|
|
7460
|
+
if(option.color){
|
|
7461
|
+
const background = '#'+option.color;
|
|
7462
|
+
const color = getContrastColor(background);
|
|
7463
|
+
const optionColorStyle = 'background:'+background+';color:'+color;
|
|
7464
|
+
map[optionValue] = `<span class="rounded-xl px-2 py-1" style='${optionColorStyle}'>${option.label}</span>`;
|
|
7465
|
+
}else {
|
|
7466
|
+
map[optionValue] = option.label;
|
|
7467
|
+
}
|
|
7468
|
+
});
|
|
7469
|
+
columns.push(Object.assign({}, {
|
|
7470
|
+
type: "mapping",
|
|
7471
|
+
name: field.name,
|
|
7472
|
+
label: field.label,
|
|
7473
|
+
map: map,
|
|
7474
|
+
sortable: field.sortable,
|
|
7475
|
+
width: field.width,
|
|
7476
|
+
toggled: field.toggled,
|
|
7477
|
+
className:"whitespace-nowrap",
|
|
7478
|
+
}, field.amis, {name: field.name}));
|
|
7479
|
+
}
|
|
7310
7480
|
else {
|
|
7311
7481
|
const tpl = await getFieldTpl(field, options);
|
|
7312
7482
|
|
|
@@ -13206,7 +13376,7 @@ setTimeout(()=>{
|
|
|
13206
13376
|
return __generator(this, function (_d) {
|
|
13207
13377
|
switch (_d.label) {
|
|
13208
13378
|
case 0:
|
|
13209
|
-
_a = props.className, className = _a === void 0 ? 'sticky top-0 z-10 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
|
|
13379
|
+
_a = props.className, className = _a === void 0 ? 'sm:sticky top-0 z-10 bg-gray-100 border-b sm:shadow sm:rounded sm:border border-slate-300 p-4' : _a;
|
|
13210
13380
|
return [4 /*yield*/, getUISchema(props.objectApiName || "space_users", false)];
|
|
13211
13381
|
case 1:
|
|
13212
13382
|
objectUiSchema = _d.sent();
|
|
@@ -14764,7 +14934,7 @@ setTimeout(()=>{
|
|
|
14764
14934
|
});
|
|
14765
14935
|
}); };
|
|
14766
14936
|
|
|
14767
|
-
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,
|
|
14937
|
+
var __assign=function(){return (__assign=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},StandardObjects={Base:{Actions:{standard_query:{visible:function(e,t,n){return !1}},standard_new:{visible:function(e,t,n){return "cms_files"!==e&&"instances"!==e&&(n?n.allowCreate:void 0)}},standard_edit:{visible:function(e,t,n){if(n)return n.allowEdit}},standard_delete:{visible:function(e,t,n){if(n)return n.allowDelete}},standard_import_data:{visible:function(e,t,n){var r=this.object;if(n)return n.allowCreate&&r.hasImportTemplates}},standard_approve:{visible:function(e,t,n){return !1}},standard_view_instance:{visible:function(e,t,n){return !1}},standard_submit_for_approval:{visible:function(e,t,n){return window.Steedos.ProcessManager.allowSubmit.apply(this,[e,t])},todo:function(e,t){return window.Steedos.ProcessManager.submit.apply(this,[e,t])}},standard_follow:{visible:function(e,t,n){return !1}},standard_delete_many:{visible:function(e,t,n){return !RegExp("\\w+/view/\\w+").test(location.pathname)&&(n?n.allowDelete:void 0)}}}}},authRequest=function(e,t){var i=null;e=Steedos.absoluteUrl(e);try{var n=[{name:"Content-Type",value:"application/json"},{name:"Authorization",value:Steedos.getAuthorization()}],r={type:"get",url:e,dataType:"json",contentType:"application/json",beforeSend:function(t){if(n&&n.length)return n.forEach(function(e){return t.setRequestHeader(e.name,e.value)})},success:function(e){i=e;},error:function(e,t,n){var r,o;e.responseJSON&&e.responseJSON.error?(r=e.responseJSON.error,o=void(i={error:r}),o=r.reason||r.message||r,console.error(o)):console.error(e.responseJSON);}};return $.ajax(Object.assign({},r,t)),i}catch(e){console.error(e);}};function _extends(){return (_extends=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,r=arguments[t];for(n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);}return e}).apply(this,arguments)}const newFunctionComponent=o=>e=>{const[t,n]=React.useState(!0);var r=()=>{n(!1);};return ___default.has(e,"ref")||(window.SteedosUI.refs[e.name]={show:()=>{n(!0);},close:r}),React__default["default"].createElement(o,_extends({visible:t,onCancel:r,onClose:r},{width:"70%",style:{width:"70%",maxWidth:"950px",minWidth:"480px"}},e))},newComponentRender=(n,r)=>(e,t)=>{e.name||(e.name=n+"-"+(e.name||"default")),(t=t||document.getElementById(`steedos-${n}-root-`+e.name))||((t=document.createElement("div")).setAttribute("id",`steedos-${n}-root-`+e.name),document.body.appendChild(t));e=React__default["default"].createElement(newFunctionComponent(r),e);ReactDOM.createRoot(t).render(e);},Modal=___default.assign(newComponentRender("modal",antd.Modal),{info:antd.Modal.info,success:antd.Modal.success,error:antd.Modal.error,warning:antd.Modal.warning,confirm:antd.Modal.confirm}),Drawer=newComponentRender("drawer",antd.Drawer),getGraphqlFieldsQuery=e=>{const t=["_id"];return e.push("record_permissions"),___default.each(e,e=>{-1<e.indexOf(".")&&(e=e.split(".")[0]),t.push(""+e);}),""+t.join(" ")},getFindOneQuery=(e,t,n)=>{e=e.replace(/\./g,"_");n=getGraphqlFieldsQuery(n);let r="";t=[`id: "${t}"`];return `{record:${e}__findOne${r=0<t.length?`(${t.join(",")})`:r}{${n}}}`},SObject={getRecord:async(e,t,n)=>{return (await fetchAPI("/graphql",{method:"post",body:JSON.stringify({query:getFindOneQuery(e,t,n)})})).data.record},getUISchema:async(e,t)=>getUISchema(e,t)},canSaveFilter=e=>!(!e._id||e.owner!==getSteedosAuth()?.userId),ListView={showFilter:(e,{listView:t,data:n})=>{canSaveFilter(t);n.filters&&(n.filters=filtersToConditions(n.filters));},getVisibleFilter:(e,t)=>{return t||(canSaveFilter(e)?e.filters:void 0)},getQueryFilter:(e,t)=>{return canSaveFilter(e)?ListView.getVisibleFilter(e,t):___default.isEmpty(t)?e.filters:[e.filters,"and",t]},getFirstListView:async e=>{e=await window.getUISchema(e);return _.first(_.sortBy(_.values(e.list_views),"sort_no"))}},Router={getAppPath({appId:e}){return "/app/"+e},getPagePath(){},getObjectListViewPath({appId:e,objectName:t,listViewName:n}){return `/app/${e}/${t}/grid/`+n},getObjectDetailPath({appId:e,objectName:t,recordId:n}){return `/app/${e}/${t}/view/`+n},getObjectRelatedViewPath({appId:e,masterObjectName:t,masterRecordId:n,objectName:r,foreignKey:o}){return `/app/${e}/${t}/${n}/${r}/grid?related_field_name=`+o}};var withModalWrap=function(t,e){return function(e){return React.createElement(t,e)}},render=function(e,t,n,r){e=withModalWrap(e),e=React.createElement(e,__assign({},t));return ReactDOM__default["default"].render(e,n)};const safeRunFunction=(t,n,r,o)=>{try{var i=window.Creator;if(!!(!i||!i.getObjectUrl)&&/\bSteedos\b|\bCreator\b|\bMeteor\b|\bSession\b/.test(t))return console.info("调用了Creator|Steedos|Meteor|Session变量的脚本不执行,直接按空值处理。"),"";let e=[];return ___default.isNil(n)||(e=___default.isArray(n)?n:[n]),t.bind(o||{})(...e)}catch(e){return console.log(e),r}};function safeEval(js){try{return eval(js)}catch(e){console.error(e,js);}}const isExpression=function(e){var t,n;return "string"==typeof e&&(t=/^{{(function.+)}}$/,n=/^{{(.+=>.+)}}$/,!("string"!=typeof e||!e.match(/^{{(.+)}}$/)||e.match(t)||e.match(n)))},parseSingleExpression=function(t,e,n,r){var o,i=function(e,t){return "#"!==t&&t?"string"==typeof t?_.get(e,t):void console.error("path has to be a string"):e||{}}(e=void 0===e?{}:e,function(e){return "string"!=typeof e||1===(e=e.split(".")).length?"#":(e.pop(),e.join("."))}(n))||{};if("string"!=typeof t)return t;o="__G_L_O_B_A_L__",e="\n return "+t.substring(2,t.length-2).replace(/\bformData\b/g,JSON.stringify(e).replace(/\bglobal\b/g,o)).replace(/\bglobal\b/g,JSON.stringify(r)).replace(new RegExp("\\b"+o+"\\b","g"),"global").replace(/rootValue/g,JSON.stringify(i));try{return Function(e)()}catch(e){return console.log(e,t,n),t}};var Expression=Object.freeze({__proto__:null,isExpression:isExpression,parseSingleExpression:parseSingleExpression});const getCompatibleDefaultValueExpression=(e,t)=>{let n=e;return /^\{\w+(\.*\w+)*\}$/.test(e)&&(n=-1<e.indexOf("userId")||-1<e.indexOf("spaceId")||-1<e.indexOf("user.")||-1<e.indexOf("now")?`{${e}}`.replace("{{","{{global."):`{${e}}`.replace("{{","{{formData."),t&&(n=n.replace(/\{\{(.+)\}\}/,"{{[$1]}}"))),n},getFieldDefaultValue=(e,t)=>{if(!e)return null;let n=e.defaultValue;e._defaultValue&&(n=safeEval(`(${e._defaultValue})`)),___default.isFunction(n)&&(n=safeRunFunction(n,[],null,{name:e.name})),___default.isString(n)&&(n=getCompatibleDefaultValueExpression(n,e.multiple));var r=isExpression(n);return r&&(n=parseSingleExpression(n,{},"#",t)),"select"===e.type&&(t=e.data_type||"text",!n||r||e.multiple||("text"!==t||___default.isString(n)?"number"!==t||___default.isNumber(n)?"boolean"!==t||___default.isBoolean(n)||(n="true"===n):n=Number(n):n=String(n))),n};function getTreeOptions(t,e){const o=e?.valueField||"value";e?.labelField;const n=e?.unfoldedNum||1,r=[],i=(t,n,r)=>{var e;if(n)return e=_.filter(t,e=>_.includes(n,e[o])),_.each(e,e=>{1<=r?(e.unfolded=!0,e.children&&(e.children=i(t,e.children,r-1))):e.children&&(e.children=i(t,e.children,r));}),e};for(var a=t,s=0;s<a.length;s++)if(a[s].noParent=0,a[s].unfolded=!1,a[s].parent){let e=1;for(var l=0;l<a.length;l++)a[s].parent==a[l][o]&&(e=0);1==e&&(a[s].noParent=1);}else a[s].noParent=1;return _.each(t,e=>{1==e.noParent&&(1<=n?(e.unfolded=!0,r.push(Object.assign({},e,{children:i(t,e.children,n-1)}))):r.push(Object.assign({},e,{children:i(t,e.children,n)})));}),r}function getClosestAmisComponentByType(t,n,r){let o=(r=r||{}).name;var e=r.direction||"up";let i=t.getComponents().find(function(e){return e.props.type===n&&(!o||e.props.name===o)});if(i)return i;if("down"===e){if(t.children&&t.children.length){for(let e=0;e<t.children.length&&!(i=getClosestAmisComponentByType(t.children[e],n,r));e++);return i}}else if("up"===e&&t.parent)return getClosestAmisComponentByType(t.parent,n,r)}const SteedosUI$1=Object.assign({},{render:render,Router:Router,ListView:ListView,Object:SObject,Modal:Modal,Drawer:Drawer,refs:{},getRef(e){return SteedosUI$1.refs[e]},router:{go:(e,t)=>{var n=window.FlowRouter;if(t)return n?n.go(t):window.open(t);n?n.reload():console.warn("暂不支持自动跳转",e);},reload:()=>{console.log("reload");}},message:antd.message,notification:antd.notification,components:{Button:antd.Button,Space:antd.Space},getRefId:({type:e,appId:t,name:n})=>{switch(e){case"listview":return `amis-${t}-${n}-listview`;case"form":return `amis-${t}-${n}-form`;case"detail":return `amis-${t}-${n}-detail`;default:return `amis-${t}-${n}-`+e}},reloadRecord:()=>{if(window.FlowRouter)return window.FlowRouter.reload()},getFieldDefaultValue:getFieldDefaultValue,getTreeOptions:getTreeOptions,getClosestAmisComponentByType:getClosestAmisComponentByType});var getBuilderContext=function(){return "undefined"==typeof window?{}:Builder.settings.context||Builder.settings},Steedos$1=__assign({getRootUrl:function(e){var t=getBuilderContext();return t.rootUrl||("undefined"!=typeof window?window.localStorage.getItem("steedos:rootUrl"):"")||e},absoluteUrl:function(e){return void 0===e&&(e=""),"".concat(Steedos$1.getRootUrl()).concat(e)},getTenantId:function(){try{var e=getBuilderContext().tenantId;return (e=window.location.search&&!e?new URLSearchParams(window.location.search).get("X-Space-Id"):e)?e:null}catch(e){console.error(e);}},getAuthorization:function(){try{var e=getBuilderContext(),t=e.tenantId,n=e.authToken;return t&&n?"Bearer ".concat(t,",").concat(n):null}catch(e){console.error(e);}},authRequest:authRequest,StandardObjects:StandardObjects},Expression);"undefined"==typeof window||window.Steedos||(window.Steedos=Steedos$1),"undefined"==typeof window||window.SteedosUI||(window.SteedosUI=SteedosUI$1);
|
|
14768
14938
|
|
|
14769
14939
|
var index_esm = /*#__PURE__*/Object.freeze({
|
|
14770
14940
|
__proto__: null,
|