@steedos-widgets/sortable 3.6.3 → 3.6.4-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.
@@ -54141,7 +54141,11 @@ function getNameTpl(field, ctx){
54141
54141
  if(ctx && ctx.isLookup){
54142
54142
  linkTarget = "target='_blank'";
54143
54143
  }
54144
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54144
+ if(ctx.isRelated && window.innerWidth >= 768){
54145
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
54146
+ }else {
54147
+ return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54148
+ }
54145
54149
  }
54146
54150
 
54147
54151
  function getRelatedFieldTpl(field, ctx){
@@ -54170,6 +54174,9 @@ function getRelatedFieldTpl(field, ctx){
54170
54174
  if(_.isString(field.reference_to) || !field.reference_to){
54171
54175
  if(field.multiple){
54172
54176
  let labelTpl = `<%=item.label%>`;
54177
+ if(ctx.isRelated){
54178
+ linkTarget = "target='_blank'";
54179
+ }
54173
54180
  if(!onlyDisplayLookLabel){
54174
54181
  const href = Router.getObjectDetailPath({
54175
54182
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
@@ -54192,7 +54199,12 @@ function getRelatedFieldTpl(field, ctx){
54192
54199
  const href = Router.getObjectDetailPath({
54193
54200
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
54194
54201
  });
54195
- labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
54202
+ if(ctx.isRelated && window.innerWidth >= 768){
54203
+ labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
54204
+ }else {
54205
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
54206
+ }
54207
+
54196
54208
  }
54197
54209
  tpl = labelTpl;
54198
54210
  }
@@ -54307,27 +54319,29 @@ async function getFieldsTemplate(fields, display){
54307
54319
  fieldsArr = lodash.exports.values(fields);
54308
54320
  }
54309
54321
  for (const field of fieldsArr) {
54310
- //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
54311
- if(field.expand){
54312
- expandFields.push(field);
54313
- }else {
54314
- if(field.name.indexOf('.') < 0){
54315
- if(display && (field.type == 'lookup' || field.type == 'master_detail')){
54316
- fieldsName.push(`${field.name}`);
54317
- displayFields.push(`${field.name}`);
54322
+ if(field.name){
54323
+ //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
54324
+ if(field.expand){
54325
+ expandFields.push(field);
54326
+ }else {
54327
+ if(field.name.indexOf('.') < 0){
54328
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
54329
+ fieldsName.push(`${field.name}`);
54330
+ displayFields.push(`${field.name}`);
54331
+ }else {
54332
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
54333
+ }
54334
+ if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
54335
+ fieldsName.push(`${field.name}`);
54336
+ }
54337
+ if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
54338
+ displayFields.push(`${field.name}`);
54339
+ }
54318
54340
  }else {
54319
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
54341
+ objectFieldName = field.name.split('.')[0];
54342
+ fieldsName.push(objectFieldName);
54343
+ displayFields.push(objectFieldName);
54320
54344
  }
54321
- if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
54322
- fieldsName.push(`${field.name}`);
54323
- }
54324
- if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
54325
- displayFields.push(`${field.name}`);
54326
- }
54327
- }else {
54328
- objectFieldName = field.name.split('.')[0];
54329
- fieldsName.push(objectFieldName);
54330
- displayFields.push(objectFieldName);
54331
54345
  }
54332
54346
  }
54333
54347
  }
@@ -55609,6 +55623,55 @@ async function getTableColumns(fields, options){
55609
55623
  columnItem.type = 'color';
55610
55624
  columnItem.defaultColor = null;
55611
55625
  }
55626
+
55627
+ if(window.innerWidth >= 768 && ((field.is_name || field.name === options.labelFieldName) || ((field.type == 'lookup' || field.type == 'master_detail') && lodash.exports.isString(field.reference_to) && field.multiple != true)) && options.isRelated){
55628
+
55629
+ const drawerRecordDetailSchema = {
55630
+ "type": "steedos-record-detail",
55631
+ "objectApiName": "${objectName}",
55632
+ "recordId": `\${${options.idFieldName}}`,
55633
+ "showBackButton": false,
55634
+ "showButtons": true,
55635
+ "data": {
55636
+ "_inDrawer": true, // 用于判断是否在抽屉中
55637
+ "recordLoaded": false, // 重置数据加载状态
55638
+ }
55639
+ };
55640
+
55641
+
55642
+ if(!(field.is_name || field.name === options.labelFieldName)){
55643
+ drawerRecordDetailSchema.objectApiName = field.reference_to;
55644
+ drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
55645
+ }
55646
+
55647
+ columnItem.onEvent = {
55648
+ "click": {
55649
+ "actions": [
55650
+ {
55651
+ "actionType": "drawer",
55652
+ "drawer": {
55653
+ "type": "drawer",
55654
+ "title": "&nbsp;",
55655
+ "headerClassName": "hidden",
55656
+ "size": "lg",
55657
+ "bodyClassName": "p-0 m-0",
55658
+ "closeOnEsc": true,
55659
+ "closeOnOutside": true,
55660
+ "resizable": true,
55661
+ "actions": [],
55662
+ "body": [
55663
+ drawerRecordDetailSchema
55664
+ ],
55665
+ "className": "steedos-record-detail-drawer app-popover",
55666
+ "id": "u:fc5f055afa8c"
55667
+ },
55668
+ "preventDefault": true
55669
+ }
55670
+ ]
55671
+ }
55672
+ };
55673
+ }
55674
+
55612
55675
  }
55613
55676
  }
55614
55677
  if(columnItem){
@@ -55657,7 +55720,7 @@ function getMobileLines(tpls){
55657
55720
  let isNewLine = false;
55658
55721
  let isLeft = true;
55659
55722
  let lineChildrenClassName = "";
55660
- let lineClassName = "flex items-center justify-between";
55723
+ let lineClassName = "flex items-center justify-between mb-1";
55661
55724
  tpls.forEach(function(item){
55662
55725
  if(isNewLine && lines.length < maxLineCount){
55663
55726
  lines.push({
@@ -56258,8 +56321,8 @@ async function getListSchema$1(fields, options){
56258
56321
  /*
56259
56322
  * @Author: baozhoutao@steedos.com
56260
56323
  * @Date: 2022-11-01 15:51:00
56261
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
56262
- * @LastEditTime: 2023-09-25 14:53:05
56324
+ * @LastEditors: baozhoutao@steedos.com
56325
+ * @LastEditTime: 2024-02-18 18:37:35
56263
56326
  * @Description:
56264
56327
  */
56265
56328
 
@@ -56299,13 +56362,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
56299
56362
  const recordId = _master.recordId;
56300
56363
  let relatedKeySaveValue = recordId;
56301
56364
  const relatedField = fields[relatedKey];
56302
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
56365
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
56303
56366
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
56304
56367
  }
56305
56368
  let relatedKeyValue;
56306
- if(!_.isString(relatedField.reference_to)){
56369
+ if(relatedField && !_.isString(relatedField.reference_to)){
56307
56370
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
56308
- }else if (relatedField.multiple) {
56371
+ }else if (relatedField && relatedField.multiple) {
56309
56372
  relatedKeyValue = [relatedKeySaveValue];
56310
56373
  } else {
56311
56374
  relatedKeyValue = relatedKeySaveValue;
@@ -58640,8 +58703,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58640
58703
  /*
58641
58704
  * @Author: baozhoutao@steedos.com
58642
58705
  * @Date: 2022-07-05 15:55:39
58643
- * @LastEditors: liaodaxue
58644
- * @LastEditTime: 2024-02-05 17:56:27
58706
+ * @LastEditors: baozhoutao@steedos.com
58707
+ * @LastEditTime: 2024-02-18 16:05:21
58645
58708
  * @Description:
58646
58709
  */
58647
58710
 
@@ -60080,6 +60143,33 @@ async function getApi(object, recordId, fields, options){
60080
60143
  }
60081
60144
  }
60082
60145
 
60146
+ async function getAutoFill(field, refObject) {
60147
+ let autoFillMapping = field.auto_fill_mapping;
60148
+ if (autoFillMapping && autoFillMapping.length) {
60149
+ let fillMapping = {};
60150
+ let fieldsForApi = [];
60151
+ autoFillMapping.forEach(function (item) {
60152
+ fillMapping[item.to] = `\${${item.from}}`;
60153
+ fieldsForApi.push(item.from);
60154
+ });
60155
+ // let api = {
60156
+ // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60157
+ // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
60158
+ // // "responseData": {
60159
+ // // "name": "${name}"
60160
+ // // },
60161
+ // "silent": false
60162
+ // }
60163
+ // return {
60164
+ // fillMapping,
60165
+ // // api
60166
+ // }
60167
+ // 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
60168
+ // 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
60169
+ return fillMapping;
60170
+ }
60171
+ }
60172
+
60083
60173
  async function lookupToAmis(field, readonly, ctx){
60084
60174
  if(!ctx){
60085
60175
  ctx = {};
@@ -60163,6 +60253,10 @@ async function lookupToAmis(field, readonly, ctx){
60163
60253
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60164
60254
  }
60165
60255
  }
60256
+ const autoFill = await getAutoFill(field);
60257
+ if(autoFill){
60258
+ amisSchema.autoFill = autoFill;
60259
+ }
60166
60260
  return amisSchema;
60167
60261
  }
60168
60262
 
@@ -60334,6 +60428,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
60334
60428
  {
60335
60429
  "type": "editor",
60336
60430
  "name": field.name,
60431
+ "labelClassName": "none",
60337
60432
  "language": "markdown",
60338
60433
  }
60339
60434
  ]