@steedos-widgets/amis-lib 1.1.0-beta.1 → 1.1.0-beta.2

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/index.esm.js CHANGED
@@ -901,7 +901,7 @@ function getRecordPermissionsQuery(object, recordId, options){
901
901
  function getApi$2 (isMobile){
902
902
  if(isMobile);else {
903
903
  // return __meteor_runtime_config__.ROOT_URL_PATH_PREFIX + "/graphql"
904
- return `\${context.rootUrl}/graphql`
904
+ return `\${context.rootUrl}/graphql?reload=\${additionalFilters}`
905
905
  }
906
906
  }
907
907
 
@@ -1048,10 +1048,18 @@ async function getSource$1(field, ctx) {
1048
1048
  }
1049
1049
  data.$value = `$${valueField}`;
1050
1050
  // data["&"] = "$$";
1051
+
1052
+ const fieldValue = ctx.value;
1053
+
1051
1054
  const requestAdaptor = `
1052
1055
  var filters = [['parent', '=', null]];
1053
1056
  api.data.query = api.data.query.replace(/{__filters}/g, JSON.stringify(filters));
1054
1057
  var defaultValue = api.data.$value;
1058
+ var fieldValue = ${JSON.stringify(fieldValue)};
1059
+ if(!defaultValue && fieldValue){
1060
+ // 如果表单中没有字段值,则认字段上配置的value属性
1061
+ defaultValue = fieldValue;
1062
+ }
1055
1063
  var optionsFiltersOp = "${field.multiple ? "in" : "="}";
1056
1064
  var optionsFilters = [["user", optionsFiltersOp, []]];
1057
1065
  if (defaultValue) {
@@ -1160,7 +1168,7 @@ async function getDeferApi$1(field, ctx) {
1160
1168
  `;
1161
1169
  return {
1162
1170
  "method": "post",
1163
- "url": getApi$2() + "?ref=${ref}&dep=${value}",
1171
+ "url": getApi$2() + "&ref=${ref}&dep=${value}",
1164
1172
  "requestAdaptor": requestAdaptor,
1165
1173
  "adaptor": adaptor,
1166
1174
  "data": data,
@@ -1269,6 +1277,11 @@ async function getSelectUserSchema(field, readonly, ctx) {
1269
1277
  if (typeof amisSchema.searchable !== "boolean") {
1270
1278
  amisSchema.searchable = true;
1271
1279
  }
1280
+
1281
+ if(ctx.value){
1282
+ amisSchema.value = ctx.value;
1283
+ }
1284
+
1272
1285
  const onEvent = field.onEvent;
1273
1286
  if (onEvent) {
1274
1287
  amisSchema.onEvent = onEvent;
@@ -3668,7 +3681,7 @@ async function getDeferApi(field, ctx) {
3668
3681
  `;
3669
3682
  return {
3670
3683
  "method": "post",
3671
- "url": getApi$2() + "?dep=${value}",
3684
+ "url": getApi$2() + "&dep=${value}",
3672
3685
  "requestAdaptor": requestAdaptor,
3673
3686
  "adaptor": adaptor,
3674
3687
  "data": data,
@@ -4177,6 +4190,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
4177
4190
  type: getAmisStaticFieldType('select', readonly),
4178
4191
  joinValues: false,
4179
4192
  extractValue: true,
4193
+ clearable: true,
4180
4194
  // labelField: labelField,
4181
4195
  // valueField: valueField,
4182
4196
  source: apiInfo,
@@ -4371,6 +4385,14 @@ async function getIdsPickerSchema(field, readonly, ctx){
4371
4385
  data.extractValue = true;
4372
4386
  }
4373
4387
 
4388
+ if(ctx.value){
4389
+ data.value = ctx.value;
4390
+ }
4391
+
4392
+ if(ctx.selectFirst != undefined){
4393
+ data.selectFirst = ctx.selectFirst;
4394
+ }
4395
+
4374
4396
  if(readonly){
4375
4397
  data.tpl = await getLookupTpl(field, ctx);
4376
4398
  }
@@ -5345,15 +5367,17 @@ async function getEditFormInitApi(object, recordId, fields){
5345
5367
  const dataKeys = _.keys(data);
5346
5368
  const uiSchema = api.body.uiSchema;
5347
5369
  const fieldKeys = uiSchema && _.keys(uiSchema.fields);
5348
- _.each(dataKeys, function(key){
5349
- if(fieldKeys.indexOf(key)<0){
5350
- delete data[key];
5351
- }
5352
- })
5353
5370
 
5354
5371
  if(data){
5355
5372
  ${getScriptForAddUrlPrefixForImgFields(fields)}
5356
5373
  ${getScriptForRewriteValueForFileFields(fields)}
5374
+
5375
+ _.each(dataKeys, function(key){
5376
+ if(fieldKeys.indexOf(key)<0){
5377
+ delete data[key];
5378
+ }
5379
+ })
5380
+
5357
5381
  //初始化接口返回的字段移除字段值为null的字段
5358
5382
  for (key in data){
5359
5383
  if(data[key] === null){
@@ -6434,6 +6458,10 @@ async function getTableApi(mainObject, fields, options){
6434
6458
 
6435
6459
  if(!_.isEmpty(systemFilters)){
6436
6460
  filters = systemFilters;
6461
+ };
6462
+
6463
+ if(api.data.$self.additionalFilters){
6464
+ userFilters.push(api.data.$self.additionalFilters)
6437
6465
  }
6438
6466
 
6439
6467
  if(!_.isEmpty(userFilters)){
@@ -8954,6 +8982,7 @@ const getNextStepInput = async (instance) => {
8954
8982
  id: "u:next_step",
8955
8983
  multiple: false,
8956
8984
  required: true,
8985
+ selectFirst: true,
8957
8986
  "source": {
8958
8987
  "url": "${context.rootUrl}/api/workflow/v2/nextStep?judge=${new_judge}",
8959
8988
  "headers": {
@@ -8981,20 +9010,7 @@ const getNextStepInput = async (instance) => {
8981
9010
  "judge": "${new_judge}",
8982
9011
  }
8983
9012
  },
8984
- // "labelField": "name",
8985
- // "valueField": "_id",
8986
9013
  "onEvent": {
8987
- // "change": {
8988
- // "weight": 0,
8989
- // "actions": [
8990
- // {
8991
- // "componentId": "u:next_users",
8992
- // "args": {
8993
- // },
8994
- // "actionType": "reload"
8995
- // }
8996
- // ]
8997
- // },
8998
9014
  "change": {
8999
9015
  "weight": 0,
9000
9016
  "actions": [
@@ -9008,7 +9024,6 @@ const getNextStepInput = async (instance) => {
9008
9024
  "actionType": "setValue"
9009
9025
  },
9010
9026
  {
9011
- // "componentId": "u:next_step",
9012
9027
  "args": {
9013
9028
  next_step: "${event.data.value}",
9014
9029
  },
@@ -9017,7 +9032,6 @@ const getNextStepInput = async (instance) => {
9017
9032
  },
9018
9033
  ]
9019
9034
  }
9020
-
9021
9035
  }
9022
9036
  },
9023
9037
  ],
@@ -9292,6 +9306,9 @@ const getApprovalDrawerSchema = async (instance) => {
9292
9306
  size: "sm",
9293
9307
  title: `${instance.step.name}`,
9294
9308
  className: "approval-drawer absolute",
9309
+ headerClassName: 'p-2',
9310
+ bodyClassName: 'p-2',
9311
+ footerClassName: 'p-2 pt-0',
9295
9312
  drawerContainer: ()=>{
9296
9313
  return window.$(".antd-Page-content",window.$(".steedos-instance-wrapper"))[0];
9297
9314
  },
@@ -9645,7 +9662,7 @@ const getInstanceApprovalHistory = async ()=>{
9645
9662
  * @Author: baozhoutao@steedos.com
9646
9663
  * @Date: 2022-09-07 16:20:45
9647
9664
  * @LastEditors: baozhoutao@steedos.com
9648
- * @LastEditTime: 2023-03-18 17:29:01
9665
+ * @LastEditTime: 2023-03-22 14:43:18
9649
9666
  * @Description:
9650
9667
  */
9651
9668
 
@@ -10358,6 +10375,7 @@ const getFlowFormSchema = async (instance, box) => {
10358
10375
  type: "page",
10359
10376
  name: "instancePage",
10360
10377
  className: "steedos-amis-instance-view",
10378
+ bodyClassName: "overflow-y-auto h-full",
10361
10379
  "title": {
10362
10380
  "type": "steedos-record-detail-header",
10363
10381
  "label": "标题面板",