@steedos-widgets/sortable 3.6.4-beta.2 → 3.6.4-beta.4

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.4-beta.2/dist/sortable.umd.js",
7
- "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.2/dist/sortable.umd.css"
6
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.4/dist/sortable.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.4/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.4-beta.2/dist/meta.js",
18
+ "url": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.4/dist/meta.js",
19
19
  "urls": {
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"
20
+ "default": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.4/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.4/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -54996,7 +54996,8 @@ instance
54996
54996
  }
54997
54997
  });
54998
54998
 
54999
- async function getQuickEditSchema(field, options){
54999
+ async function getQuickEditSchema(object, columnField, options){
55000
+ let field = object.fields[columnField.name];
55000
55001
  //判断在amis3.2以上环境下,放开批量编辑与lookup的单元格编辑
55001
55002
  let isAmisVersionforBatchEdit = false;
55002
55003
  if(window.amisRequire && window.amisRequire('amis')){
@@ -55464,7 +55465,7 @@ function getFieldWidth(width){
55464
55465
  }
55465
55466
  }
55466
55467
 
55467
- async function getTableColumns(fields, options){
55468
+ async function getTableColumns(object, fields, options){
55468
55469
  const columns = [];
55469
55470
  if(!options.isLookup && !options.isInputTable){
55470
55471
  if(!options.enable_tree){
@@ -55478,7 +55479,7 @@ async function getTableColumns(fields, options){
55478
55479
  continue;
55479
55480
  }
55480
55481
  //增加quickEdit属性,实现快速编辑
55481
- const quickEditSchema = allowEdit ? await getQuickEditSchema(field, options) : allowEdit;
55482
+ const quickEditSchema = allowEdit ? await getQuickEditSchema(object, field, options) : allowEdit;
55482
55483
  let className = "";
55483
55484
  const bowserType = getBowserType();
55484
55485
  if(bowserType === "Safari"){
@@ -56050,7 +56051,7 @@ async function getDefaultCrudCard(columns, options) {
56050
56051
  return card;
56051
56052
  }
56052
56053
 
56053
- async function getTableSchema$1(fields, options){
56054
+ async function getTableSchema$1(object, fields, options){
56054
56055
  if(!options){
56055
56056
  options = {};
56056
56057
  }
@@ -56072,7 +56073,7 @@ async function getTableSchema$1(fields, options){
56072
56073
  columns = await getMobileTableColumns(fields, options);
56073
56074
  }
56074
56075
  else {
56075
- columns = await getTableColumns(fields, options);
56076
+ columns = await getTableColumns(object, fields, options);
56076
56077
 
56077
56078
  if(listSchema.mode === "cards"){
56078
56079
  let card = listSchema.card;
@@ -58707,8 +58708,8 @@ async function getObjectFilter(objectSchema, fields, options) {
58707
58708
  /*
58708
58709
  * @Author: baozhoutao@steedos.com
58709
58710
  * @Date: 2022-07-05 15:55:39
58710
- * @LastEditors: baozhoutao@steedos.com
58711
- * @LastEditTime: 2024-02-18 16:05:21
58711
+ * @LastEditors: 殷亮辉 yinlianghui@hotoa.com
58712
+ * @LastEditTime: 2024-02-23 16:37:06
58712
58713
  * @Description:
58713
58714
  */
58714
58715
 
@@ -59030,7 +59031,22 @@ if(typeof window != 'undefined'){
59030
59031
  async function getSource(field, ctx) {
59031
59032
  // data.query 最终格式 "{ \tleftOptions:organizations(filters: {__filters}){value:_id,label:name,children}, children:organizations(filters: {__filters}){ref:_id,children}, defaultValueOptions:space_users(filters: {__options_filters}){user,name} }"
59032
59033
  const refObjectName = ctx.objectName;
59033
- const data = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }], {
59034
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
59035
+ let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
59036
+
59037
+ // 把自动填充规则中依赖的字段也加到api请求中
59038
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59039
+ if (autoFillMapping && autoFillMapping.length) {
59040
+ autoFillMapping.forEach(function (item) {
59041
+ if(item.from !== "children"){
59042
+ optionQueryFields.push({ name: item.from });
59043
+ }
59044
+ defaultOptionQueryFields.push({ name: item.from });
59045
+ });
59046
+ }
59047
+
59048
+ const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
59049
+ expand: false,
59034
59050
  alias: "options",
59035
59051
  filters: "{__filters}"
59036
59052
  });
@@ -59041,7 +59057,8 @@ async function getSource(field, ctx) {
59041
59057
  // });
59042
59058
  // childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
59043
59059
  // data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
59044
- const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }], {
59060
+ const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
59061
+ expand: false,
59045
59062
  alias: "defaultValueOptions",
59046
59063
  filters: "{__options_filters}"
59047
59064
  });
@@ -59108,7 +59125,20 @@ async function getSource(field, ctx) {
59108
59125
  async function getDeferApi(field, ctx) {
59109
59126
  // data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
59110
59127
  const refObjectName = ctx.objectName;
59111
- const data = await getFindQuery({ name: "{__object_name}" }, null, [], {
59128
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
59129
+
59130
+ // 把自动填充规则中依赖的字段也加到api请求中
59131
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59132
+ if (autoFillMapping && autoFillMapping.length) {
59133
+ autoFillMapping.forEach(function (item) {
59134
+ if(item.from !== "children"){
59135
+ optionQueryFields.push({ name: item.from });
59136
+ }
59137
+ });
59138
+ }
59139
+
59140
+ const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
59141
+ expand: false,
59112
59142
  alias: "options",
59113
59143
  // filters: "{__filters}",
59114
59144
  queryOptions: `filters: {__filters}, sort: "{__sort}"`
@@ -59123,8 +59153,6 @@ async function getDeferApi(field, ctx) {
59123
59153
  filters = filters(field);
59124
59154
  }
59125
59155
  data.query = data.query.replace(/,count\:.+/, "}");
59126
- // 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
59127
- data.query = data.query.replace("{_id}", "{{__fields}}");
59128
59156
  const requestAdaptor = `
59129
59157
  var dep = api.query.dep;
59130
59158
  var term = api.query.term;
@@ -59134,11 +59162,10 @@ async function getDeferApi(field, ctx) {
59134
59162
  var sort = "";
59135
59163
  if (dep) {
59136
59164
  objectName = "${refObjectName}";
59137
- fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
59138
59165
  filters = [['parent', '=', dep]];
59139
59166
  sort = "${ctx.sort}";
59140
59167
  }
59141
- api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__fields}/g, fields).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
59168
+ api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
59142
59169
  return api;
59143
59170
  `;
59144
59171
  const adaptor = `
@@ -59492,6 +59519,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
59492
59519
  }
59493
59520
  });
59494
59521
 
59522
+ // 把自动填充规则中依赖的字段也加到api请求中
59523
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59524
+ if (autoFillMapping && autoFillMapping.length) {
59525
+ autoFillMapping.forEach(function (item) {
59526
+ if(!lodash.exports.find(tableFields, function(f){
59527
+ return f.name === item.from
59528
+ })){
59529
+ tableFields.push(refObjectConfig.fields[item.from]);
59530
+ }
59531
+ });
59532
+ }
59533
+
59495
59534
  lodash.exports.each(refObjectConfig.fields, function (field) {
59496
59535
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
59497
59536
  searchableFields.push(field.name);
@@ -59748,7 +59787,7 @@ async function lookupToAmisPicker(field, readonly, ctx){
59748
59787
  if(refObjectConfig.name === 'organizations'){
59749
59788
  labelFieldName = 'name';
59750
59789
  }
59751
- pickerSchema = await getTableSchema$1(tableFields, {
59790
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
59752
59791
  labelFieldName,
59753
59792
  top: top,
59754
59793
  isLookup: true,
@@ -59923,22 +59962,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
59923
59962
 
59924
59963
  let apiInfo;
59925
59964
  let defaultValueOptionsQueryData;
59965
+ const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59926
59966
  if(referenceTo){
59927
- // 字段值单独走一个请求合并到source的同一个GraphQL接口中
59928
- defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
59967
+ let queryFields = [
59929
59968
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
59930
59969
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
59931
- ], {
59970
+ ];
59971
+
59972
+ // 把自动填充规则中依赖的字段也加到api请求中
59973
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59974
+ if (autoFillMapping && autoFillMapping.length) {
59975
+ autoFillMapping.forEach(function (item) {
59976
+ queryFields.push(refObjectConfig.fields[item.from]);
59977
+ });
59978
+ }
59979
+
59980
+ // 字段值单独走一个请求合并到source的同一个GraphQL接口中
59981
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
59982
+ expand: false,
59932
59983
  alias: "defaultValueOptions",
59933
59984
  filters: "{__options_filters}",
59934
59985
  count: false
59935
59986
  });
59936
59987
  apiInfo = await getApi({
59937
59988
  name: referenceTo.objectName
59938
- }, null, [
59939
- Object.assign({}, referenceTo.labelField, {alias: 'label'}),
59940
- Object.assign({}, referenceTo.valueField, {alias: 'value'})
59941
- ], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
59989
+ }, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
59942
59990
 
59943
59991
  apiInfo.adaptor = `
59944
59992
  const data = payload.data;
@@ -59962,7 +60010,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
59962
60010
  };
59963
60011
  }
59964
60012
 
59965
- const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59966
60013
  let listView = getLookupListView(refObjectConfig);
59967
60014
 
59968
60015
  let listviewFilter = getListViewFilter(listView);
@@ -60148,13 +60195,13 @@ async function getApi(object, recordId, fields, options){
60148
60195
  }
60149
60196
 
60150
60197
  async function getAutoFill(field, refObject) {
60151
- let autoFillMapping = field.auto_fill_mapping;
60198
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60152
60199
  if (autoFillMapping && autoFillMapping.length) {
60153
60200
  let fillMapping = {};
60154
- let fieldsForApi = [];
60201
+ // let fieldsForApi = [];
60155
60202
  autoFillMapping.forEach(function (item) {
60156
60203
  fillMapping[item.to] = `\${${item.from}}`;
60157
- fieldsForApi.push(item.from);
60204
+ // fieldsForApi.push(item.from);
60158
60205
  });
60159
60206
  // let api = {
60160
60207
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
@@ -60344,7 +60391,7 @@ async function getIdsPickerSchema(field, readonly, ctx){
60344
60391
  actions: false
60345
60392
  });
60346
60393
  }else {
60347
- pickerSchema = await getTableSchema$1(tableFields, {
60394
+ pickerSchema = await getTableSchema$1(refObjectConfig, tableFields, {
60348
60395
  labelFieldName: refObjectConfig.NAME_FIELD_KEY,
60349
60396
  top: top,
60350
60397
  isLookup: true,