@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.
package/dist/assets.json CHANGED
@@ -3,8 +3,8 @@
3
3
  {
4
4
  "package": "@steedos-widgets/sortable",
5
5
  "urls": [
6
- "https://unpkg.com/@steedos-widgets/sortable@3.6.3/dist/sortable.umd.js",
7
- "https://unpkg.com/@steedos-widgets/sortable@3.6.3/dist/sortable.umd.css"
6
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/sortable.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/sortable.umd.css"
8
8
  ],
9
9
  "library": "BuilderSortable"
10
10
  }
@@ -15,10 +15,10 @@
15
15
  "npm": {
16
16
  "package": "@steedos-widgets/sortable"
17
17
  },
18
- "url": "https://unpkg.com/@steedos-widgets/sortable@3.6.3/dist/meta.js",
18
+ "url": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/meta.js",
19
19
  "urls": {
20
- "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.3/dist/meta.js",
21
- "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.3/dist/meta.js"
20
+ "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -54145,7 +54145,11 @@ function getNameTpl(field, ctx){
54145
54145
  if(ctx && ctx.isLookup){
54146
54146
  linkTarget = "target='_blank'";
54147
54147
  }
54148
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54148
+ if(ctx.isRelated && window.innerWidth >= 768){
54149
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
54150
+ }else {
54151
+ return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54152
+ }
54149
54153
  }
54150
54154
 
54151
54155
  function getRelatedFieldTpl(field, ctx){
@@ -54174,6 +54178,9 @@ function getRelatedFieldTpl(field, ctx){
54174
54178
  if(_.isString(field.reference_to) || !field.reference_to){
54175
54179
  if(field.multiple){
54176
54180
  let labelTpl = `<%=item.label%>`;
54181
+ if(ctx.isRelated){
54182
+ linkTarget = "target='_blank'";
54183
+ }
54177
54184
  if(!onlyDisplayLookLabel){
54178
54185
  const href = Router.getObjectDetailPath({
54179
54186
  formFactor: ctx.formFactor, appId: "<%=data.appId%>", objectName: `<%=item.objectName%>`, recordId: `<%=item.value%>`, _templateType: "JavaScript"
@@ -54196,7 +54203,12 @@ function getRelatedFieldTpl(field, ctx){
54196
54203
  const href = Router.getObjectDetailPath({
54197
54204
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
54198
54205
  });
54199
- labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
54206
+ if(ctx.isRelated && window.innerWidth >= 768){
54207
+ labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
54208
+ }else {
54209
+ labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
54210
+ }
54211
+
54200
54212
  }
54201
54213
  tpl = labelTpl;
54202
54214
  }
@@ -54311,27 +54323,29 @@ async function getFieldsTemplate(fields, display){
54311
54323
  fieldsArr = lodash.exports.values(fields);
54312
54324
  }
54313
54325
  for (const field of fieldsArr) {
54314
- //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
54315
- if(field.expand){
54316
- expandFields.push(field);
54317
- }else {
54318
- if(field.name.indexOf('.') < 0){
54319
- if(display && (field.type == 'lookup' || field.type == 'master_detail')){
54320
- fieldsName.push(`${field.name}`);
54321
- displayFields.push(`${field.name}`);
54326
+ if(field.name){
54327
+ //graphql 的 ui\display 中使用的字段需要先在query中查询. 否则会返回null
54328
+ if(field.expand){
54329
+ expandFields.push(field);
54330
+ }else {
54331
+ if(field.name.indexOf('.') < 0){
54332
+ if(display && (field.type == 'lookup' || field.type == 'master_detail')){
54333
+ fieldsName.push(`${field.name}`);
54334
+ displayFields.push(`${field.name}`);
54335
+ }else {
54336
+ fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
54337
+ }
54338
+ if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
54339
+ fieldsName.push(`${field.name}`);
54340
+ }
54341
+ if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
54342
+ displayFields.push(`${field.name}`);
54343
+ }
54322
54344
  }else {
54323
- fieldsName.push( field.alias ? `${field.alias}:${field.name}` : field.name);
54345
+ objectFieldName = field.name.split('.')[0];
54346
+ fieldsName.push(objectFieldName);
54347
+ displayFields.push(objectFieldName);
54324
54348
  }
54325
- if(lodash.exports.includes(['time','date','datetime','boolean','number','currency'], field.type)){
54326
- fieldsName.push(`${field.name}`);
54327
- }
54328
- if(lodash.exports.includes(['percent','time','filesize','date','datetime','boolean','number','currency', 'select', 'file', 'image', 'avatar', 'formula', 'summary', 'object', 'grid'], field.type)){
54329
- displayFields.push(`${field.name}`);
54330
- }
54331
- }else {
54332
- objectFieldName = field.name.split('.')[0];
54333
- fieldsName.push(objectFieldName);
54334
- displayFields.push(objectFieldName);
54335
54349
  }
54336
54350
  }
54337
54351
  }
@@ -55613,6 +55627,55 @@ async function getTableColumns(fields, options){
55613
55627
  columnItem.type = 'color';
55614
55628
  columnItem.defaultColor = null;
55615
55629
  }
55630
+
55631
+ 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){
55632
+
55633
+ const drawerRecordDetailSchema = {
55634
+ "type": "steedos-record-detail",
55635
+ "objectApiName": "${objectName}",
55636
+ "recordId": `\${${options.idFieldName}}`,
55637
+ "showBackButton": false,
55638
+ "showButtons": true,
55639
+ "data": {
55640
+ "_inDrawer": true, // 用于判断是否在抽屉中
55641
+ "recordLoaded": false, // 重置数据加载状态
55642
+ }
55643
+ };
55644
+
55645
+
55646
+ if(!(field.is_name || field.name === options.labelFieldName)){
55647
+ drawerRecordDetailSchema.objectApiName = field.reference_to;
55648
+ drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
55649
+ }
55650
+
55651
+ columnItem.onEvent = {
55652
+ "click": {
55653
+ "actions": [
55654
+ {
55655
+ "actionType": "drawer",
55656
+ "drawer": {
55657
+ "type": "drawer",
55658
+ "title": "&nbsp;",
55659
+ "headerClassName": "hidden",
55660
+ "size": "lg",
55661
+ "bodyClassName": "p-0 m-0",
55662
+ "closeOnEsc": true,
55663
+ "closeOnOutside": true,
55664
+ "resizable": true,
55665
+ "actions": [],
55666
+ "body": [
55667
+ drawerRecordDetailSchema
55668
+ ],
55669
+ "className": "steedos-record-detail-drawer app-popover",
55670
+ "id": "u:fc5f055afa8c"
55671
+ },
55672
+ "preventDefault": true
55673
+ }
55674
+ ]
55675
+ }
55676
+ };
55677
+ }
55678
+
55616
55679
  }
55617
55680
  }
55618
55681
  if(columnItem){
@@ -55661,7 +55724,7 @@ function getMobileLines(tpls){
55661
55724
  let isNewLine = false;
55662
55725
  let isLeft = true;
55663
55726
  let lineChildrenClassName = "";
55664
- let lineClassName = "flex items-center justify-between";
55727
+ let lineClassName = "flex items-center justify-between mb-1";
55665
55728
  tpls.forEach(function(item){
55666
55729
  if(isNewLine && lines.length < maxLineCount){
55667
55730
  lines.push({
@@ -56262,8 +56325,8 @@ async function getListSchema$1(fields, options){
56262
56325
  /*
56263
56326
  * @Author: baozhoutao@steedos.com
56264
56327
  * @Date: 2022-11-01 15:51:00
56265
- * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
56266
- * @LastEditTime: 2023-09-25 14:53:05
56328
+ * @LastEditors: baozhoutao@steedos.com
56329
+ * @LastEditTime: 2024-02-18 18:37:35
56267
56330
  * @Description:
56268
56331
  */
56269
56332
 
@@ -56303,13 +56366,13 @@ const getSchema$5 = async (uiSchema, ctx) => {
56303
56366
  const recordId = _master.recordId;
56304
56367
  let relatedKeySaveValue = recordId;
56305
56368
  const relatedField = fields[relatedKey];
56306
- if(relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
56369
+ if(relatedField && relatedField.reference_to_field && relatedField.reference_to_field !== '_id'){
56307
56370
  relatedKeySaveValue = _master.record[relatedField.reference_to_field];
56308
56371
  }
56309
56372
  let relatedKeyValue;
56310
- if(!_.isString(relatedField.reference_to)){
56373
+ if(relatedField && !_.isString(relatedField.reference_to)){
56311
56374
  relatedKeyValue = { o: masterObjectName, ids: [relatedKeySaveValue] };
56312
- }else if (relatedField.multiple) {
56375
+ }else if (relatedField && relatedField.multiple) {
56313
56376
  relatedKeyValue = [relatedKeySaveValue];
56314
56377
  } else {
56315
56378
  relatedKeyValue = relatedKeySaveValue;
@@ -58644,8 +58707,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58644
58707
  /*
58645
58708
  * @Author: baozhoutao@steedos.com
58646
58709
  * @Date: 2022-07-05 15:55:39
58647
- * @LastEditors: liaodaxue
58648
- * @LastEditTime: 2024-02-05 17:56:27
58710
+ * @LastEditors: baozhoutao@steedos.com
58711
+ * @LastEditTime: 2024-02-18 16:05:21
58649
58712
  * @Description:
58650
58713
  */
58651
58714
 
@@ -60084,6 +60147,33 @@ async function getApi(object, recordId, fields, options){
60084
60147
  }
60085
60148
  }
60086
60149
 
60150
+ async function getAutoFill(field, refObject) {
60151
+ let autoFillMapping = field.auto_fill_mapping;
60152
+ if (autoFillMapping && autoFillMapping.length) {
60153
+ let fillMapping = {};
60154
+ let fieldsForApi = [];
60155
+ autoFillMapping.forEach(function (item) {
60156
+ fillMapping[item.to] = `\${${item.from}}`;
60157
+ fieldsForApi.push(item.from);
60158
+ });
60159
+ // let api = {
60160
+ // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60161
+ // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
60162
+ // // "responseData": {
60163
+ // // "name": "${name}"
60164
+ // // },
60165
+ // "silent": false
60166
+ // }
60167
+ // return {
60168
+ // fillMapping,
60169
+ // // api
60170
+ // }
60171
+ // 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
60172
+ // 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
60173
+ return fillMapping;
60174
+ }
60175
+ }
60176
+
60087
60177
  async function lookupToAmis(field, readonly, ctx){
60088
60178
  if(!ctx){
60089
60179
  ctx = {};
@@ -60167,6 +60257,10 @@ async function lookupToAmis(field, readonly, ctx){
60167
60257
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60168
60258
  }
60169
60259
  }
60260
+ const autoFill = await getAutoFill(field);
60261
+ if(autoFill){
60262
+ amisSchema.autoFill = autoFill;
60263
+ }
60170
60264
  return amisSchema;
60171
60265
  }
60172
60266
 
@@ -60338,6 +60432,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
60338
60432
  {
60339
60433
  "type": "editor",
60340
60434
  "name": field.name,
60435
+ "labelClassName": "none",
60341
60436
  "language": "markdown",
60342
60437
  }
60343
60438
  ]