@steedos-widgets/sortable 3.6.15 → 6.3.0-beta.11

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.15/dist/sortable.umd.js",
7
- "https://unpkg.com/@steedos-widgets/sortable@3.6.15/dist/sortable.umd.css"
6
+ "https://unpkg.com/@steedos-widgets/sortable@6.3.0-beta.11/dist/sortable.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/sortable@6.3.0-beta.11/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.15/dist/meta.js",
18
+ "url": "https://unpkg.com/@steedos-widgets/sortable@6.3.0-beta.11/dist/meta.js",
19
19
  "urls": {
20
- "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.15/dist/meta.js",
21
- "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.15/dist/meta.js"
20
+ "default": "https://unpkg.com/@steedos-widgets/sortable@6.3.0-beta.11/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/sortable@6.3.0-beta.11/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -54145,10 +54145,23 @@ function getNameTpl(field, ctx){
54145
54145
  if(ctx && ctx.isLookup){
54146
54146
  linkTarget = "target='_blank'";
54147
54147
  }
54148
+ let nameLabel = field.name;
54149
+ //若字段类型是lookup,则按照相关表tpl的label规则显示;若是其它类型,则显示_display或字段本身的值
54150
+ if (field.type == "lookup") {
54151
+ if(!field.reference_to && (field.optionsFunction || field._optionsFunction || field.options)){
54152
+ if(!field.isTableField){
54153
+ nameLabel = `\${${field.name}__label}`;
54154
+ }
54155
+ } else {
54156
+ nameLabel = `\${_display.${field.name}.label}`;
54157
+ }
54158
+ } else {
54159
+ nameLabel = `\${_display.${field.name} || ${field.name}}`;
54160
+ }
54148
54161
  if(ctx.isRelated && window.innerWidth >= 768){
54149
- return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
54162
+ return `<a href="${href}" ${linkTarget} onclick="return false;">\${${nameLabel} | raw}</a>`
54150
54163
  }else {
54151
- return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
54164
+ return `<a href="${href}" ${linkTarget}>\${${nameLabel} | raw}</a>`
54152
54165
  }
54153
54166
  }
54154
54167
 
@@ -54273,7 +54286,7 @@ function getLocationTpl(field){
54273
54286
  }
54274
54287
 
54275
54288
  async function getFieldTpl (field, options){
54276
- if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel){
54289
+ if((field.is_name || field.name === options.labelFieldName) && !options.onlyDisplayLookLabel && field.multiple !== true){
54277
54290
  return getNameTpl(field, options)
54278
54291
  }
54279
54292
  switch (field.type) {
@@ -54314,7 +54327,7 @@ async function getFieldsTemplate(fields, display){
54314
54327
  if(display != false){
54315
54328
  display = true;
54316
54329
  }
54317
- let fieldsName = ['_id'];
54330
+ let fieldsName = ['_id', 'space'];
54318
54331
  let displayFields = [];
54319
54332
  let fieldsArr = [];
54320
54333
  if(lodash.exports.isArray(fields)){
@@ -55003,6 +55016,29 @@ instance
55003
55016
  }
55004
55017
  });
55005
55018
 
55019
+ /*
55020
+ * @Author: baozhoutao@steedos.com
55021
+ * @Date: 2022-07-13 15:18:03
55022
+ * @LastEditors: baozhoutao@steedos.com
55023
+ * @LastEditTime: 2023-04-11 10:34:26
55024
+ * @Description:
55025
+ */
55026
+
55027
+ async function getPage({type, pageId = '', appId, objectName = '', recordId = '', formFactor = 'LARGE'}){
55028
+ const api = `/api/pageSchema/${type}?app=${appId}&objectApiName=${objectName}&recordId=${recordId}&pageId=${pageId}&formFactor=${formFactor}`;
55029
+ const page = await fetchAPI(api);
55030
+ if (page && page.schema) {
55031
+ page.schema = JSON.parse(page.schema);
55032
+ if(page.schema.data){
55033
+ delete page.schema.data.recordId;
55034
+ delete page.schema.data.objectName;
55035
+ delete page.schema.data.context;
55036
+ delete page.schema.data.global;
55037
+ }
55038
+ return page;
55039
+ }
55040
+ }
55041
+
55006
55042
  async function getQuickEditSchema(object, columnField, options){
55007
55043
  let field = object.fields[columnField.name];
55008
55044
  //判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
@@ -55637,20 +55673,26 @@ async function getTableColumns(object, fields, options){
55637
55673
  }
55638
55674
 
55639
55675
  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){
55640
-
55641
- const drawerRecordDetailSchema = {
55676
+ const recordPage = await getPage({ type: 'record', appId: options.appId, objectName: options.objectName, formFactor: options.formFactor });
55677
+ const drawerRecordDetailSchema = recordPage ? Object.assign({}, recordPage.schema, {
55678
+ "recordId": `\${${options.idFieldName}}`,
55679
+ "data": {
55680
+ ...recordPage.schema.data,
55681
+ "_inDrawer": true, // 用于判断是否在抽屉中
55682
+ "recordLoaded": false, // 重置数据加载状态
55683
+ }
55684
+ }) : {
55642
55685
  "type": "steedos-record-detail",
55643
55686
  "objectApiName": "${objectName}",
55644
55687
  "recordId": `\${${options.idFieldName}}`,
55645
55688
  "showBackButton": false,
55646
55689
  "showButtons": true,
55647
55690
  "data": {
55648
- "_inDrawer": true, // 用于判断是否在抽屉中
55649
- "recordLoaded": false, // 重置数据加载状态
55691
+ "_inDrawer": true, // 用于判断是否在抽屉中
55692
+ "recordLoaded": false, // 重置数据加载状态
55650
55693
  }
55651
55694
  };
55652
55695
 
55653
-
55654
55696
  if(!(field.is_name || field.name === options.labelFieldName)){
55655
55697
  drawerRecordDetailSchema.objectApiName = field.reference_to;
55656
55698
  drawerRecordDetailSchema.recordId = `\${_display.${field.name}.value}`;
@@ -55666,7 +55708,7 @@ async function getTableColumns(object, fields, options){
55666
55708
  "title": "&nbsp;",
55667
55709
  "headerClassName": "hidden",
55668
55710
  "size": "lg",
55669
- "bodyClassName": "p-0 m-0",
55711
+ "bodyClassName": "p-0 m-0 bg-gray-100",
55670
55712
  "closeOnEsc": true,
55671
55713
  "closeOnOutside": true,
55672
55714
  "resizable": true,
@@ -56528,7 +56570,8 @@ const getSchema$5 = async (uiSchema, ctx) => {
56528
56570
  type: 'button',
56529
56571
  actionType: 'confirm',
56530
56572
  label: instance.t('frontend_form_save'),
56531
- primary: true
56573
+ primary: true,
56574
+ close: `object_actions_drawer_${uiSchema.name}`
56532
56575
  },
56533
56576
  ]
56534
56577
  }
@@ -58746,7 +58789,7 @@ async function getObjectFilter(objectSchema, fields, options) {
58746
58789
  * @Author: baozhoutao@steedos.com
58747
58790
  * @Date: 2022-07-05 15:55:39
58748
58791
  * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
58749
- * @LastEditTime: 2024-02-23 16:37:06
58792
+ * @LastEditTime: 2024-04-26 16:46:44
58750
58793
  * @Description:
58751
58794
  */
58752
58795
 
@@ -58979,37 +59022,44 @@ async function getListSchema(
58979
59022
  * 本次存储代码段
58980
59023
  */
58981
59024
  try {
58982
- const listViewPropsStoreKey = location.pathname + "/crud";
58983
- let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
58984
- /**
58985
- * localListViewProps规范来自crud请求api中api.data.$self参数值的。
58986
- * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
58987
- * __searchable__...:顶部放大镜搜索条件
58988
- * filter:右侧过滤器
58989
- * perPage:每页条数
58990
- * page:当前页码
58991
- * orderBy:排序字段
58992
- * orderDir:排序方向
58993
- */
58994
- if (localListViewProps) {
58995
- localListViewProps = JSON.parse(localListViewProps);
58996
- // localListViewProps.perPage = 3;
58997
- let listSchema = {};
58998
- if(localListViewProps.orderBy){
58999
- listSchema.orderBy = localListViewProps.orderBy;
59000
- }
59001
- if(localListViewProps.orderDir){
59002
- listSchema.orderDir = localListViewProps.orderDir;
59003
- }
59025
+ const listViewPropsStoreKey = location.pathname + "/crud";
59026
+ let localListViewProps = sessionStorage.getItem(listViewPropsStoreKey);
59027
+ /**
59028
+ * localListViewProps规范来自crud请求api中api.data.$self参数值的。
59029
+ * 比如:{"perPage":20,"page":1,"__searchable__name":"7","__searchable__between__n1__c":[null,null],"filter":[["name","contains","a"]]}
59030
+ * __searchable__...:顶部放大镜搜索条件
59031
+ * filter:右侧过滤器
59032
+ * perPage:每页条数
59033
+ * page:当前页码
59034
+ * orderBy:排序字段
59035
+ * orderDir:排序方向
59036
+ */
59037
+ if (localListViewProps) {
59038
+ localListViewProps = JSON.parse(localListViewProps);
59039
+ // localListViewProps.perPage = 3;
59040
+ let listSchema = {};
59041
+ if (localListViewProps.orderBy) {
59042
+ listSchema.orderBy = localListViewProps.orderBy;
59043
+ }
59044
+ if (localListViewProps.orderDir) {
59045
+ listSchema.orderDir = localListViewProps.orderDir;
59046
+ }
59004
59047
 
59005
- if(localListViewProps.perPage){
59006
- listSchema.perPage = localListViewProps.perPage;
59048
+ if (localListViewProps.perPage) {
59049
+ listSchema.perPage = localListViewProps.perPage;
59050
+ }
59051
+ defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
59007
59052
  }
59008
- defaults.listSchema = lodash.exports.defaultsDeep({}, listSchema, defaults.listSchema || {});
59009
- }
59010
59053
  }
59011
59054
  catch (ex) {
59012
- console.error("本地存储中crud参数解析异常:", ex);
59055
+ console.error("本地存储中crud参数解析异常:", ex);
59056
+ }
59057
+
59058
+ if (window.innerWidth > 768) {
59059
+ // 列表视图组件PC端高度自动计算实现满屏效果,手机端不需要满屏效果,所以不用autofillheight,且允许重写微页面中重新组件autoFillHeight属性
59060
+ defaults.listSchema = lodash.exports.defaultsDeep({}, defaults.listSchema || {}, {
59061
+ autoFillHeight: true
59062
+ });
59013
59063
  }
59014
59064
 
59015
59065
  ctx.defaults = defaults;
@@ -59570,7 +59620,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59570
59620
  });
59571
59621
 
59572
59622
  // 把自动填充规则中依赖的字段也加到api请求中
59573
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59623
+ let autoFillMapping = field.auto_fill_mapping;
59574
59624
  if (autoFillMapping && autoFillMapping.length) {
59575
59625
  autoFillMapping.forEach(function (item) {
59576
59626
  if(!lodash.exports.find(tableFields, function(f){
@@ -59720,7 +59770,11 @@ async function lookupToAmisPicker(field, readonly, ctx){
59720
59770
  // 如果当前元素不是数组,则处理该元素
59721
59771
  // 下面正则用于匹配amis公式\${}
59722
59772
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
59723
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
59773
+ try{
59774
+ arr[i] = currentAmis.evaluate(arr[i], api.context);
59775
+ }catch(ex){
59776
+ console.error("运行lookup过滤公式时出现错误:",ex);
59777
+ }
59724
59778
  }
59725
59779
  }
59726
59780
  }
@@ -60042,7 +60096,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60042
60096
  ];
60043
60097
 
60044
60098
  // 把自动填充规则中依赖的字段也加到api请求中
60045
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60099
+ let autoFillMapping = field.auto_fill_mapping;
60046
60100
  if (autoFillMapping && autoFillMapping.length) {
60047
60101
  autoFillMapping.forEach(function (item) {
60048
60102
  queryFields.push(refObjectConfig.fields[item.from]);
@@ -60128,6 +60182,7 @@ async function lookupToAmisSelect(field, readonly, ctx){
60128
60182
  var fieldFilters = ${JSON.stringify(field.filters)};
60129
60183
  var currentAmis = amisRequire('amis');
60130
60184
  //递归fieldFilters数组,检查每一个元素,判断若是公式,就仅把它解析
60185
+ debugger;
60131
60186
  function traverseNestedArray(arr) {
60132
60187
  for (let i = 0; i < arr.length; i++) {
60133
60188
  if (Array.isArray(arr[i])) {
@@ -60137,7 +60192,11 @@ async function lookupToAmisSelect(field, readonly, ctx){
60137
60192
  // 如果当前元素不是数组,则处理该元素
60138
60193
  // 下面正则用于匹配amis公式\${}
60139
60194
  if(/\\\$\\\{([^}]*)\\\}/.test(arr[i])) {
60140
- arr[i] = currentAmis.evaluate(arr[i], api.data.$);
60195
+ try{
60196
+ arr[i] = currentAmis.evaluate(arr[i], api.context);
60197
+ }catch(ex){
60198
+ console.error("运行lookup过滤公式时出现错误:",ex);
60199
+ }
60141
60200
  }
60142
60201
  }
60143
60202
  }
@@ -60284,14 +60343,25 @@ async function getApi(object, recordId, fields, options){
60284
60343
  }
60285
60344
 
60286
60345
  async function getAutoFill(field, refObject) {
60287
- let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60346
+ let autoFillMapping = field.auto_fill_mapping;
60288
60347
  if (autoFillMapping && autoFillMapping.length) {
60289
60348
  let fillMapping = {};
60349
+ if (field.multiple) {
60350
+ autoFillMapping.forEach(function (item) {
60351
+ //from的字段类型为lookup、master_detail、select时,需要保留数组格式;其他类型需要转变为字符串格式
60352
+ if (lodash.exports.includes(["lookup","master_detail","select"], refObject.fields[item.from].type)) {
60353
+ fillMapping[item.to] = `\${items | pick:${item.from}}`;
60354
+ } else {
60355
+ fillMapping[item.to] = `\${items | pick:${item.from} | join}`;
60356
+ }
60357
+ });
60358
+ }else {
60359
+ autoFillMapping.forEach(function (item) {
60360
+ fillMapping[item.to] = `\${${item.from}}`;
60361
+ });
60362
+ }
60290
60363
  // let fieldsForApi = [];
60291
- autoFillMapping.forEach(function (item) {
60292
- fillMapping[item.to] = `\${${item.from}}`;
60293
- // fieldsForApi.push(item.from);
60294
- });
60364
+ // fieldsForApi.push(item.from);
60295
60365
  // let api = {
60296
60366
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60297
60367
  // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
@@ -60393,7 +60463,7 @@ async function lookupToAmis(field, readonly, ctx){
60393
60463
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60394
60464
  }
60395
60465
  }
60396
- const autoFill = await getAutoFill(field);
60466
+ const autoFill = await getAutoFill(field, refObject);
60397
60467
  if(autoFill){
60398
60468
  amisSchema.autoFill = autoFill;
60399
60469
  // 这里不配置initAutoFill值,按amis规则initAutoFill默认值为fillIfNotSet处理--需要amis sdk 版本 > 3.6.3-patch.6(不包括)版本