@steedos-widgets/sortable 3.6.4-beta.1 → 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.1/dist/sortable.umd.js",
7
- "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.1/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.1/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.1/dist/meta.js",
21
- "design": "https://unpkg.com/@steedos-widgets/sortable@3.6.4-beta.1/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
  ]
@@ -54145,7 +54145,7 @@ function getNameTpl(field, ctx){
54145
54145
  if(ctx && ctx.isLookup){
54146
54146
  linkTarget = "target='_blank'";
54147
54147
  }
54148
- if(ctx.isRelated){
54148
+ if(ctx.isRelated && window.innerWidth >= 768){
54149
54149
  return `<a href="${href}" ${linkTarget} onclick="return false;">\${${field.name} | raw}</a>`
54150
54150
  }else {
54151
54151
  return `<a href="${href}" ${linkTarget}>\${${field.name} | raw}</a>`
@@ -54203,7 +54203,7 @@ function getRelatedFieldTpl(field, ctx){
54203
54203
  const href = Router.getObjectDetailPath({
54204
54204
  formFactor: ctx.formFactor, appId: "${appId}", objectName: `${objectNameTpl}`, recordId: `${recordIdTpl}`
54205
54205
  });
54206
- if(ctx.isRelated){
54206
+ if(ctx.isRelated && window.innerWidth >= 768){
54207
54207
  labelTpl = `<a href="${href}" ${linkTarget} onclick="return false;">${labelTpl}</a>`;
54208
54208
  }else {
54209
54209
  labelTpl = `<a href="${href}" ${linkTarget}>${labelTpl}</a>`;
@@ -55628,7 +55628,7 @@ async function getTableColumns(fields, options){
55628
55628
  columnItem.defaultColor = null;
55629
55629
  }
55630
55630
 
55631
- if(((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){
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
55632
 
55633
55633
  const drawerRecordDetailSchema = {
55634
55634
  "type": "steedos-record-detail",
@@ -55656,16 +55656,17 @@ async function getTableColumns(fields, options){
55656
55656
  "drawer": {
55657
55657
  "type": "drawer",
55658
55658
  "title": "&nbsp;",
55659
- "headerClassName": "",
55659
+ "headerClassName": "hidden",
55660
55660
  "size": "lg",
55661
- "bodyClassName": "p-0 m-0 border-t",
55661
+ "bodyClassName": "p-0 m-0",
55662
55662
  "closeOnEsc": true,
55663
+ "closeOnOutside": true,
55663
55664
  "resizable": true,
55664
55665
  "actions": [],
55665
55666
  "body": [
55666
55667
  drawerRecordDetailSchema
55667
55668
  ],
55668
- "className": "app-popover",
55669
+ "className": "steedos-record-detail-drawer app-popover",
55669
55670
  "id": "u:fc5f055afa8c"
55670
55671
  },
55671
55672
  "preventDefault": true
@@ -55723,7 +55724,7 @@ function getMobileLines(tpls){
55723
55724
  let isNewLine = false;
55724
55725
  let isLeft = true;
55725
55726
  let lineChildrenClassName = "";
55726
- let lineClassName = "flex items-center justify-between";
55727
+ let lineClassName = "flex items-center justify-between mb-1";
55727
55728
  tpls.forEach(function(item){
55728
55729
  if(isNewLine && lines.length < maxLineCount){
55729
55730
  lines.push({
@@ -59029,7 +59030,22 @@ if(typeof window != 'undefined'){
59029
59030
  async function getSource(field, ctx) {
59030
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} }"
59031
59032
  const refObjectName = ctx.objectName;
59032
- 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,
59033
59049
  alias: "options",
59034
59050
  filters: "{__filters}"
59035
59051
  });
@@ -59040,7 +59056,8 @@ async function getSource(field, ctx) {
59040
59056
  // });
59041
59057
  // childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
59042
59058
  // data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
59043
- 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,
59044
59061
  alias: "defaultValueOptions",
59045
59062
  filters: "{__options_filters}"
59046
59063
  });
@@ -59107,7 +59124,20 @@ async function getSource(field, ctx) {
59107
59124
  async function getDeferApi(field, ctx) {
59108
59125
  // data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
59109
59126
  const refObjectName = ctx.objectName;
59110
- 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,
59111
59141
  alias: "options",
59112
59142
  // filters: "{__filters}",
59113
59143
  queryOptions: `filters: {__filters}, sort: "{__sort}"`
@@ -59122,8 +59152,6 @@ async function getDeferApi(field, ctx) {
59122
59152
  filters = filters(field);
59123
59153
  }
59124
59154
  data.query = data.query.replace(/,count\:.+/, "}");
59125
- // 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
59126
- data.query = data.query.replace("{_id}", "{{__fields}}");
59127
59155
  const requestAdaptor = `
59128
59156
  var dep = api.query.dep;
59129
59157
  var term = api.query.term;
@@ -59133,11 +59161,10 @@ async function getDeferApi(field, ctx) {
59133
59161
  var sort = "";
59134
59162
  if (dep) {
59135
59163
  objectName = "${refObjectName}";
59136
- fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
59137
59164
  filters = [['parent', '=', dep]];
59138
59165
  sort = "${ctx.sort}";
59139
59166
  }
59140
- 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());
59141
59168
  return api;
59142
59169
  `;
59143
59170
  const adaptor = `
@@ -59491,6 +59518,18 @@ async function lookupToAmisPicker(field, readonly, ctx){
59491
59518
  }
59492
59519
  });
59493
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
+
59494
59533
  lodash.exports.each(refObjectConfig.fields, function (field) {
59495
59534
  if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
59496
59535
  searchableFields.push(field.name);
@@ -59922,22 +59961,31 @@ async function lookupToAmisSelect(field, readonly, ctx){
59922
59961
 
59923
59962
  let apiInfo;
59924
59963
  let defaultValueOptionsQueryData;
59964
+ const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59925
59965
  if(referenceTo){
59926
- // 字段值单独走一个请求合并到source的同一个GraphQL接口中
59927
- defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
59966
+ let queryFields = [
59928
59967
  Object.assign({}, referenceTo.labelField, {alias: 'label'}),
59929
59968
  Object.assign({}, referenceTo.valueField, {alias: 'value'})
59930
- ], {
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,
59931
59982
  alias: "defaultValueOptions",
59932
59983
  filters: "{__options_filters}",
59933
59984
  count: false
59934
59985
  });
59935
59986
  apiInfo = await getApi({
59936
59987
  name: referenceTo.objectName
59937
- }, null, [
59938
- Object.assign({}, referenceTo.labelField, {alias: 'label'}),
59939
- Object.assign({}, referenceTo.valueField, {alias: 'value'})
59940
- ], {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}"`});
59941
59989
 
59942
59990
  apiInfo.adaptor = `
59943
59991
  const data = payload.data;
@@ -59961,7 +60009,6 @@ async function lookupToAmisSelect(field, readonly, ctx){
59961
60009
  };
59962
60010
  }
59963
60011
 
59964
- const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
59965
60012
  let listView = getLookupListView(refObjectConfig);
59966
60013
 
59967
60014
  let listviewFilter = getListViewFilter(listView);
@@ -60146,6 +60193,33 @@ async function getApi(object, recordId, fields, options){
60146
60193
  }
60147
60194
  }
60148
60195
 
60196
+ async function getAutoFill(field, refObject) {
60197
+ let autoFillMapping = !field.multiple && field.auto_fill_mapping;
60198
+ if (autoFillMapping && autoFillMapping.length) {
60199
+ let fillMapping = {};
60200
+ // let fieldsForApi = [];
60201
+ autoFillMapping.forEach(function (item) {
60202
+ fillMapping[item.to] = `\${${item.from}}`;
60203
+ // fieldsForApi.push(item.from);
60204
+ });
60205
+ // let api = {
60206
+ // // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
60207
+ // "url": `/api/v1/${refObject.name}/\${${field.name}}?fields=${JSON.stringify(fieldsForApi)}`,
60208
+ // // "responseData": {
60209
+ // // "name": "${name}"
60210
+ // // },
60211
+ // "silent": false
60212
+ // }
60213
+ // return {
60214
+ // fillMapping,
60215
+ // // api
60216
+ // }
60217
+ // 因为autoFill中配置了api的话,在表单初始化(比如新建记录)时并不会触发执行autoFill,所以只能暂时不用api
60218
+ // 给amis报过问题了,见:https://github.com/baidu/amis/issues/9631
60219
+ return fillMapping;
60220
+ }
60221
+ }
60222
+
60149
60223
  async function lookupToAmis(field, readonly, ctx){
60150
60224
  if(!ctx){
60151
60225
  ctx = {};
@@ -60229,6 +60303,10 @@ async function lookupToAmis(field, readonly, ctx){
60229
60303
  amisSchema = lodash.exports.defaultsDeep({}, pageAmisSchema, amisSchema);
60230
60304
  }
60231
60305
  }
60306
+ const autoFill = await getAutoFill(field);
60307
+ if(autoFill){
60308
+ amisSchema.autoFill = autoFill;
60309
+ }
60232
60310
  return amisSchema;
60233
60311
  }
60234
60312
 
@@ -60400,6 +60478,7 @@ const getMarkdownFieldSchema = (field, readonly, ctx)=>{
60400
60478
  {
60401
60479
  "type": "editor",
60402
60480
  "name": field.name,
60481
+ "labelClassName": "none",
60403
60482
  "language": "markdown",
60404
60483
  }
60405
60484
  ]