@steedos-widgets/amis-lib 6.10.12 → 6.10.13

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.cjs.js CHANGED
@@ -15566,6 +15566,13 @@ async function convertSFieldToAmisField(field, readonly, ctx) {
15566
15566
  labelField: 'label',
15567
15567
  valueField: 'value'
15568
15568
  };
15569
+ if(field.isAmis){
15570
+ delete field.mode;
15571
+ convertData = {
15572
+ ...convertData,
15573
+ ...field
15574
+ };
15575
+ }
15569
15576
  const select_menuTpl = `<span class='flex items-center mt-0.5'>
15570
15577
  <span role='img' aria-label='smile' class='anticon anticon-smile'>
15571
15578
  <span class='slds-icon_container slds-icon-standard-\${REPLACE(icon,'_','-')}'>
@@ -16803,7 +16810,7 @@ function getFormFields(props, mode = "edit") {
16803
16810
  fields = getTableFieldsWithoutFieldPrefix(fields, fieldPrefix);
16804
16811
  }
16805
16812
  return (fields || []).map(function (item) {
16806
- let formItem = {
16813
+ let formItem = item.isAmis ? item : {
16807
16814
  "type": "steedos-field",
16808
16815
  "name": item.name,
16809
16816
  "config": item
@@ -16818,6 +16825,9 @@ function getFormFields(props, mode = "edit") {
16818
16825
  function getInputTableCell(field, showAsInlineEditMode) {
16819
16826
  if (showAsInlineEditMode) {
16820
16827
  // 这里不可以用quickEdit,因为amis存在bug:input-table内的字段在行编辑模式时会受到外层相同name的字段的影响 https://github.com/baidu/amis/issues/9653
16828
+ if(field.isAmis){
16829
+ return field;
16830
+ }
16821
16831
  return {
16822
16832
  "type": "steedos-field",
16823
16833
  "config": Object.assign({}, field, {
@@ -16836,6 +16846,16 @@ function getInputTableCell(field, showAsInlineEditMode) {
16836
16846
  }
16837
16847
  }
16838
16848
  else {
16849
+ if(field.isAmis){
16850
+ return {
16851
+ ...field,
16852
+ inInputTable: true,
16853
+ "static": true,
16854
+ "readonly": true,
16855
+ label: field.label,
16856
+ name: field.name
16857
+ };
16858
+ }
16839
16859
  return {
16840
16860
  "type": "steedos-field",
16841
16861
  "config": Object.assign({}, field, {
@@ -17238,6 +17258,7 @@ function getFormPaginationWrapper(props, form, mode) {
17238
17258
  "method": "get",
17239
17259
  "adaptor": `
17240
17260
  const formBody = ${JSON.stringify(formBody)};
17261
+ console.log('formBody===>', formBody);
17241
17262
  return {
17242
17263
  "body": formBody
17243
17264
  }
@@ -18978,7 +18999,6 @@ const showApproveSignImage = (judge) => {
18978
18999
  };
18979
19000
 
18980
19001
  const getUserApprove = ({ instance, userId }) => {
18981
- console.log(`getUserApprove===>`, instance, userId);
18982
19002
  const currentTrace = _$1.find(instance.traces, (trace) => {
18983
19003
  return trace.is_finished != true;
18984
19004
  });
@@ -19995,6 +20015,7 @@ const getArgumentsList = (func)=>{
19995
20015
  };
19996
20016
 
19997
20017
  const getFieldEditTpl = async (field, label)=>{
20018
+ console.log('field',field);
19998
20019
  const tpl = {
19999
20020
  label: label === true ? field.name : false,
20000
20021
  name: field.code,
@@ -20202,6 +20223,7 @@ const getFieldEditTpl = async (field, label)=>{
20202
20223
  break;
20203
20224
  case "number":
20204
20225
  tpl.type = "input-number";
20226
+ tpl.precision=2;
20205
20227
  break;
20206
20228
  case "date":
20207
20229
  tpl.type = "input-date";
@@ -20272,7 +20294,6 @@ const getFieldEditTpl = async (field, label)=>{
20272
20294
  tpl.options = getSelectOptions(field);
20273
20295
  break;
20274
20296
  case "odata":
20275
- console.log('odata field', field);
20276
20297
  const argsName = getArgumentsList(field.filters);
20277
20298
  var labelField = field.formula.substr(1, field.formula.length - 2);
20278
20299
  labelField = labelField.substr(labelField.indexOf(".") + 1);
@@ -20281,9 +20302,7 @@ const getFieldEditTpl = async (field, label)=>{
20281
20302
  // tpl.labelField = labelField;
20282
20303
  // tpl.valueField = "_value";
20283
20304
  tpl.source = {
20284
- url: _$1.startsWith(field.url, "http")
20285
- ? field.url
20286
- : `\${context.rootUrl}${field.url}`,
20305
+ url: field.url,
20287
20306
  method: "get",
20288
20307
  dataType: "json",
20289
20308
  adaptor:`
@@ -20303,28 +20322,32 @@ const getFieldEditTpl = async (field, label)=>{
20303
20322
  return payload;
20304
20323
  `,
20305
20324
  requestAdaptor: `
20306
- const field = ${JSON.stringify(field)};
20307
- if(field.filters){
20325
+ const filters = ${_.replace(field.filters, /_.pluck/g, '_.map')};
20326
+ const url = ${field.url}
20327
+ if(filters){
20328
+ console.log('filters', filters);
20308
20329
  const joinKey = field.url.indexOf('?') > 0 ? '&' : '?';
20309
- if(field.filters.startsWith('function(') || field.filters.startsWith('function (')){
20330
+ if(filters.startsWith('function(') || filters.startsWith('function (')){
20310
20331
  const argsName = ${JSON.stringify(argsName)};
20311
- const fun = eval('_fun='+field.filters);
20332
+ const fun = eval('_fun='+filters);
20312
20333
  const funArgs = [];
20313
20334
  for(const item of argsName){
20314
20335
  funArgs.push(context[item])
20315
20336
  }
20316
- api.url = field.url + joinKey + "$filter=" + fun.apply({}, funArgs)
20337
+ api.url = url + joinKey + "$filter=" + fun.apply({}, funArgs)
20317
20338
  }else{
20318
- api.url = field.url + joinKey + "$filter=" + field.filters
20339
+ api.url = url + joinKey + "$filter=" + filters
20319
20340
  }
20341
+ }else{
20342
+ api.url = url
20320
20343
  }
20321
20344
  api.query = {};
20322
- console.log('api', api);
20323
20345
  return api;
20324
- `
20346
+ `,
20347
+ trackExpression: _.join(_.map(argsName, (item)=>{return `\${${item}|json}`}), '-')
20325
20348
  };
20326
- // delete tpl.source;
20327
- console.log('odata tpl', tpl);
20349
+ tpl.isAmis=true;
20350
+ console.log(`odata`, tpl);
20328
20351
  break;
20329
20352
  case "html":
20330
20353
  if (tpl.disabled) {
@@ -20401,7 +20424,7 @@ const getFieldReadonlyTpl = async (field, label)=>{
20401
20424
  map[item.value] = item.label;
20402
20425
  });
20403
20426
  tpl.type = 'static';
20404
- tpl.tpl = `<% var options = ${JSON.stringify(map)}; return (options && options[data.${field.code}]) || ''%>`;
20427
+ tpl.tpl = `<% var options = ${JSON.stringify(map)}; return (options && options[data["${field.code}"]]) || ''%>`;
20405
20428
  }else if(field.type === 'odata'){
20406
20429
  tpl.type = 'static';
20407
20430
  tpl.tpl = `<div>\${${field.code}['@label']}</div>`;
@@ -20552,7 +20575,6 @@ const getFormTrs = async (instance) => {
20552
20575
  const trs = [];
20553
20576
  let tdFields = [];
20554
20577
  let fields = [];
20555
- console.log('getFormTrs===>', instance.fields);
20556
20578
  _$1.each(instance.fields, (field) => {
20557
20579
  fields.push(field);
20558
20580
  if (field.type === "section" && field.fields) {
@@ -20885,7 +20907,6 @@ const getFlowFormSchema = async (instance, box) => {
20885
20907
  else {
20886
20908
  formContentSchema = await getFormTableView(instance);
20887
20909
  }
20888
- console.log(`formContentSchema`, formContentSchema);
20889
20910
  const amisSchemaStr = instance.formVersion?.amis_schema;
20890
20911
 
20891
20912
  let initedEvents = [];
@@ -20909,7 +20930,6 @@ const getFlowFormSchema = async (instance, box) => {
20909
20930
  });
20910
20931
  }
20911
20932
 
20912
- console.log('getFlowFormSchema formContentSchema', formContentSchema);
20913
20933
  return {
20914
20934
  type: "page",
20915
20935
  name: "instancePage",
@@ -21147,7 +21167,6 @@ const getFlowVersion = async (instance) => {
21147
21167
  const result = await amisLib.fetchAPI(`/api/workflow/flow/${instance.flow._id}/version/${instance.flow_version}`, {
21148
21168
  method: "get"
21149
21169
  });
21150
- console.log(`getFlowVersion: `, result);
21151
21170
  return result;
21152
21171
  };
21153
21172
 
@@ -21155,7 +21174,6 @@ const getFormVersion = async (instance) => {
21155
21174
  const result = await amisLib.fetchAPI(`/api/workflow/form/${instance.form._id}/version/${instance.form_version}`, {
21156
21175
  method: "get"
21157
21176
  });
21158
- console.log(`getFormVersion: `, result);
21159
21177
  return result;
21160
21178
  };
21161
21179
 
@@ -21276,7 +21294,6 @@ const getInstanceInfo = async (props) => {
21276
21294
  if (!instance) {
21277
21295
  return undefined;
21278
21296
  }
21279
- console.log(`box====>`, box);
21280
21297
  if (box === "inbox" || box === "draft") {
21281
21298
  userApprove = getUserApprove({ instance, userId });
21282
21299
  }
@@ -21291,9 +21308,6 @@ const getInstanceInfo = async (props) => {
21291
21308
  step = getStep({ flowVersion, stepId: trace.step });
21292
21309
  }
21293
21310
 
21294
- console.log(`userApprove===>`, userApprove);
21295
- console.log(`step===>`, step);
21296
-
21297
21311
  let currentStep = getStep({ flowVersion, stepId: ___default["default"].last(instance.traces).step });
21298
21312
 
21299
21313
  const lastCCStep = getLastCCStep(instance, userId);