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

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.3/dist/sortable.umd.js",
7
+ "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.3/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.3/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.3/dist/meta.js",
21
+ "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.3/dist/meta.js"
22
22
  }
23
23
  }
24
24
  ]
@@ -59030,7 +59030,22 @@ if(typeof window != 'undefined'){
59030
59030
  async function getSource(field, ctx) {
59031
59031
  // 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
59032
  const refObjectName = ctx.objectName;
59033
- const data = await getFindQuery({ name: refObjectName }, null, [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }], {
59033
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
59034
+ let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
59035
+
59036
+ // 把自动填充规则中依赖的字段也加到api请求中
59037
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59038
+ if (autoFillMapping && autoFillMapping.length) {
59039
+ autoFillMapping.forEach(function (item) {
59040
+ if(item.from !== "children"){
59041
+ optionQueryFields.push({ name: item.from });
59042
+ }
59043
+ defaultOptionQueryFields.push({ name: item.from });
59044
+ });
59045
+ }
59046
+
59047
+ const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
59048
+ expand: false,
59034
59049
  alias: "options",
59035
59050
  filters: "{__filters}"
59036
59051
  });
@@ -59041,7 +59056,8 @@ async function getSource(field, ctx) {
59041
59056
  // });
59042
59057
  // childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
59043
59058
  // 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" }], {
59059
+ const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
59060
+ expand: false,
59045
59061
  alias: "defaultValueOptions",
59046
59062
  filters: "{__options_filters}"
59047
59063
  });
@@ -59108,7 +59124,20 @@ async function getSource(field, ctx) {
59108
59124
  async function getDeferApi(field, ctx) {
59109
59125
  // data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
59110
59126
  const refObjectName = ctx.objectName;
59111
- const data = await getFindQuery({ name: "{__object_name}" }, null, [], {
59127
+ let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
59128
+
59129
+ // 把自动填充规则中依赖的字段也加到api请求中
59130
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59131
+ if (autoFillMapping && autoFillMapping.length) {
59132
+ autoFillMapping.forEach(function (item) {
59133
+ if(item.from !== "children"){
59134
+ optionQueryFields.push({ name: item.from });
59135
+ }
59136
+ });
59137
+ }
59138
+
59139
+ const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
59140
+ expand: false,
59112
59141
  alias: "options",
59113
59142
  // filters: "{__filters}",
59114
59143
  queryOptions: `filters: {__filters}, sort: "{__sort}"`
@@ -59123,8 +59152,6 @@ async function getDeferApi(field, ctx) {
59123
59152
  filters = filters(field);
59124
59153
  }
59125
59154
  data.query = data.query.replace(/,count\:.+/, "}");
59126
- // 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
59127
- data.query = data.query.replace("{_id}", "{{__fields}}");
59128
59155
  const requestAdaptor = `
59129
59156
  var dep = api.query.dep;
59130
59157
  var term = api.query.term;
@@ -59134,11 +59161,10 @@ async function getDeferApi(field, ctx) {
59134
59161
  var sort = "";
59135
59162
  if (dep) {
59136
59163
  objectName = "${refObjectName}";
59137
- fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
59138
59164
  filters = [['parent', '=', dep]];
59139
59165
  sort = "${ctx.sort}";
59140
59166
  }
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());
59167
+ api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
59142
59168
  return api;
59143
59169
  `;
59144
59170
  const adaptor = `
@@ -59492,6 +59518,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
59492
59518
  }
59493
59519
  });
59494
59520
 
59521
+ // 把自动填充规则中依赖的字段也加到api请求中
59522
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59523
+ if (autoFillMapping && autoFillMapping.length) {
59524
+ autoFillMapping.forEach(function (item) {
59525
+ if(!lodash.exports.find(tableFields, function(f){
59526
+ return f.name === item.from
59527
+ })){
59528
+ tableFields.push(refObjectConfig.fields[item.from]);
59529
+ }
59530
+ });
59531
+ }
59532
+
59495
59533
  lodash.exports.each(refObjectConfig.fields, function (field) {
59496
59534
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
59497
59535
  searchableFields.push(field.name);
@@ -59923,22 +59961,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
59923
59961
 
59924
59962
  let apiInfo;
59925
59963
  let defaultValueOptionsQueryData;
59964
+ const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59926
59965
  if(referenceTo){
59927
- // 字段值单独走一个请求合并到source的同一个GraphQL接口中
59928
- defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
59966
+ let queryFields = [
59929
59967
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
59930
59968
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
59931
- ], {
59969
+ ];
59970
+
59971
+ // 把自动填充规则中依赖的字段也加到api请求中
59972
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
59973
+ if (autoFillMapping && autoFillMapping.length) {
59974
+ autoFillMapping.forEach(function (item) {
59975
+ queryFields.push(refObjectConfig.fields[item.from]);
59976
+ });
59977
+ }
59978
+
59979
+ // 字段值单独走一个请求合并到source的同一个GraphQL接口中
59980
+ defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
59981
+ expand: false,
59932
59982
  alias: "defaultValueOptions",
59933
59983
  filters: "{__options_filters}",
59934
59984
  count: false
59935
59985
  });
59936
59986
  apiInfo = await getApi({
59937
59987
  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}"`});
59988
+ }, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
59942
59989
 
59943
59990
  apiInfo.adaptor = `
59944
59991
  const data = payload.data;
@@ -59962,7 +60009,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
59962
60009
  };
59963
60010
  }
59964
60011
 
59965
- const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59966
60012
  let listView = getLookupListView(refObjectConfig);
59967
60013
 
59968
60014
  let listviewFilter = getListViewFilter(listView);
@@ -60148,13 +60194,13 @@ async function getApi(object, recordId, fields, options){
60148
60194
  }
60149
60195
 
60150
60196
  async function getAutoFill(field, refObject) {
60151
- let autoFillMapping = field.auto_fill_mapping;
60197
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60152
60198
  if (autoFillMapping && autoFillMapping.length) {
60153
60199
  let fillMapping = {};
60154
- let fieldsForApi = [];
60200
+ // let fieldsForApi = [];
60155
60201
  autoFillMapping.forEach(function (item) {
60156
60202
  fillMapping[item.to] = `\${${item.from}}`;
60157
- fieldsForApi.push(item.from);
60203
+ // fieldsForApi.push(item.from);
60158
60204
  });
60159
60205
  // let api = {
60160
60206
  // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",