@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 +5 -5
- package/dist/sortable.cjs.js +64 -18
- package/dist/sortable.cjs.js.map +1 -1
- package/dist/sortable.esm.js +64 -18
- package/dist/sortable.esm.js.map +1 -1
- package/dist/sortable.umd.js +64 -18
- package/package.json +3 -3
package/dist/sortable.umd.js
CHANGED
|
@@ -25331,7 +25331,22 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25331
25331
|
async function getSource(field, ctx) {
|
|
25332
25332
|
// 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} }"
|
|
25333
25333
|
const refObjectName = ctx.objectName;
|
|
25334
|
-
|
|
25334
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
25335
|
+
let defaultOptionQueryFields = optionQueryFields.filter(function (f) { return f.name !== "children" });
|
|
25336
|
+
|
|
25337
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
25338
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
25339
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
25340
|
+
autoFillMapping.forEach(function (item) {
|
|
25341
|
+
if(item.from !== "children"){
|
|
25342
|
+
optionQueryFields.push({ name: item.from });
|
|
25343
|
+
}
|
|
25344
|
+
defaultOptionQueryFields.push({ name: item.from });
|
|
25345
|
+
});
|
|
25346
|
+
}
|
|
25347
|
+
|
|
25348
|
+
const data = await getFindQuery({ name: refObjectName }, null, optionQueryFields, {
|
|
25349
|
+
expand: false,
|
|
25335
25350
|
alias: "options",
|
|
25336
25351
|
filters: "{__filters}"
|
|
25337
25352
|
});
|
|
@@ -25342,7 +25357,8 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25342
25357
|
// });
|
|
25343
25358
|
// childrenData.query = childrenData.query.replace(/,count\:.+/, "}");
|
|
25344
25359
|
// data.query = data.query.replace(/}$/, "," + childrenData.query.replace(/{(.+)}/, "$1}"));
|
|
25345
|
-
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null,
|
|
25360
|
+
const defaultValueOptionsData = await getFindQuery({ name: refObjectName }, null, defaultOptionQueryFields, {
|
|
25361
|
+
expand: false,
|
|
25346
25362
|
alias: "defaultValueOptions",
|
|
25347
25363
|
filters: "{__options_filters}"
|
|
25348
25364
|
});
|
|
@@ -25409,7 +25425,20 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25409
25425
|
async function getDeferApi(field, ctx) {
|
|
25410
25426
|
// data.query 最终格式 "{ \toptions:{__object_name}(filters:{__filters}){{__fields}} }"
|
|
25411
25427
|
const refObjectName = ctx.objectName;
|
|
25412
|
-
|
|
25428
|
+
let optionQueryFields = [{ name: ctx.valueField, alias: "value" }, { name: ctx.labelField, alias: "label" }, { name: "children" }];
|
|
25429
|
+
|
|
25430
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
25431
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
25432
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
25433
|
+
autoFillMapping.forEach(function (item) {
|
|
25434
|
+
if(item.from !== "children"){
|
|
25435
|
+
optionQueryFields.push({ name: item.from });
|
|
25436
|
+
}
|
|
25437
|
+
});
|
|
25438
|
+
}
|
|
25439
|
+
|
|
25440
|
+
const data = await getFindQuery({ name: "{__object_name}" }, null, optionQueryFields, {
|
|
25441
|
+
expand: false,
|
|
25413
25442
|
alias: "options",
|
|
25414
25443
|
// filters: "{__filters}",
|
|
25415
25444
|
queryOptions: `filters: {__filters}, sort: "{__sort}"`
|
|
@@ -25424,8 +25453,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25424
25453
|
filters = filters(field);
|
|
25425
25454
|
}
|
|
25426
25455
|
data.query = data.query.replace(/,count\:.+/, "}");
|
|
25427
|
-
// 字段要根据请求参数动态生成,写死为__fields后续在发送适配器中替换
|
|
25428
|
-
data.query = data.query.replace("{_id}", "{{__fields}}");
|
|
25429
25456
|
const requestAdaptor = `
|
|
25430
25457
|
var dep = api.query.dep;
|
|
25431
25458
|
var term = api.query.term;
|
|
@@ -25435,11 +25462,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25435
25462
|
var sort = "";
|
|
25436
25463
|
if (dep) {
|
|
25437
25464
|
objectName = "${refObjectName}";
|
|
25438
|
-
fields = "_id,value:${ctx.valueField},label:${ctx.labelField},children";
|
|
25439
25465
|
filters = [['parent', '=', dep]];
|
|
25440
25466
|
sort = "${ctx.sort}";
|
|
25441
25467
|
}
|
|
25442
|
-
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{
|
|
25468
|
+
api.data.query = api.data.query.replace(/{__object_name}/g, objectName).replace(/{__filters}/g, JSON.stringify(filters)).replace('{__sort}', sort.trim());
|
|
25443
25469
|
return api;
|
|
25444
25470
|
`;
|
|
25445
25471
|
const adaptor = `
|
|
@@ -25793,6 +25819,18 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
25793
25819
|
}
|
|
25794
25820
|
});
|
|
25795
25821
|
|
|
25822
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
25823
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
25824
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
25825
|
+
autoFillMapping.forEach(function (item) {
|
|
25826
|
+
if(!lodash.exports.find(tableFields, function(f){
|
|
25827
|
+
return f.name === item.from
|
|
25828
|
+
})){
|
|
25829
|
+
tableFields.push(refObjectConfig.fields[item.from]);
|
|
25830
|
+
}
|
|
25831
|
+
});
|
|
25832
|
+
}
|
|
25833
|
+
|
|
25796
25834
|
lodash.exports.each(refObjectConfig.fields, function (field) {
|
|
25797
25835
|
if(isFieldQuickSearchable(field, refObjectConfig.NAME_FIELD_KEY)){
|
|
25798
25836
|
searchableFields.push(field.name);
|
|
@@ -26224,22 +26262,31 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26224
26262
|
|
|
26225
26263
|
let apiInfo;
|
|
26226
26264
|
let defaultValueOptionsQueryData;
|
|
26265
|
+
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
26227
26266
|
if(referenceTo){
|
|
26228
|
-
|
|
26229
|
-
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, [
|
|
26267
|
+
let queryFields = [
|
|
26230
26268
|
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
26231
26269
|
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
26232
|
-
]
|
|
26270
|
+
];
|
|
26271
|
+
|
|
26272
|
+
// 把自动填充规则中依赖的字段也加到api请求中
|
|
26273
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
26274
|
+
if (autoFillMapping && autoFillMapping.length) {
|
|
26275
|
+
autoFillMapping.forEach(function (item) {
|
|
26276
|
+
queryFields.push(refObjectConfig.fields[item.from]);
|
|
26277
|
+
});
|
|
26278
|
+
}
|
|
26279
|
+
|
|
26280
|
+
// 字段值单独走一个请求合并到source的同一个GraphQL接口中
|
|
26281
|
+
defaultValueOptionsQueryData = await getFindQuery({ name: referenceTo.objectName }, null, queryFields, {
|
|
26282
|
+
expand: false,
|
|
26233
26283
|
alias: "defaultValueOptions",
|
|
26234
26284
|
filters: "{__options_filters}",
|
|
26235
26285
|
count: false
|
|
26236
26286
|
});
|
|
26237
26287
|
apiInfo = await getApi({
|
|
26238
26288
|
name: referenceTo.objectName
|
|
26239
|
-
}, null,
|
|
26240
|
-
Object.assign({}, referenceTo.labelField, {alias: 'label'}),
|
|
26241
|
-
Object.assign({}, referenceTo.valueField, {alias: 'value'})
|
|
26242
|
-
], {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
26289
|
+
}, null, queryFields, {expand: false, alias: 'options', queryOptions: `filters: {__filters}, top: {__top}, sort: "{__sort}"`});
|
|
26243
26290
|
|
|
26244
26291
|
apiInfo.adaptor = `
|
|
26245
26292
|
const data = payload.data;
|
|
@@ -26263,7 +26310,6 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26263
26310
|
};
|
|
26264
26311
|
}
|
|
26265
26312
|
|
|
26266
|
-
const refObjectConfig = referenceTo && await getUISchema(referenceTo.objectName);
|
|
26267
26313
|
let listView = getLookupListView(refObjectConfig);
|
|
26268
26314
|
|
|
26269
26315
|
let listviewFilter = getListViewFilter(listView);
|
|
@@ -26449,13 +26495,13 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
|
|
|
26449
26495
|
}
|
|
26450
26496
|
|
|
26451
26497
|
async function getAutoFill(field, refObject) {
|
|
26452
|
-
let autoFillMapping = field.auto_fill_mapping;
|
|
26498
|
+
let autoFillMapping = !field.multiple && field.auto_fill_mapping;
|
|
26453
26499
|
if (autoFillMapping && autoFillMapping.length) {
|
|
26454
26500
|
let fillMapping = {};
|
|
26455
|
-
let fieldsForApi = [];
|
|
26501
|
+
// let fieldsForApi = [];
|
|
26456
26502
|
autoFillMapping.forEach(function (item) {
|
|
26457
26503
|
fillMapping[item.to] = `\${${item.from}}`;
|
|
26458
|
-
fieldsForApi.push(item.from);
|
|
26504
|
+
// fieldsForApi.push(item.from);
|
|
26459
26505
|
});
|
|
26460
26506
|
// let api = {
|
|
26461
26507
|
// // "url": "/amis/api/mock2/form/autoUpdate?browser=${browser}&version=${version}",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos-widgets/sortable",
|
|
3
|
-
"version": "3.6.4-beta.
|
|
3
|
+
"version": "3.6.4-beta.3",
|
|
4
4
|
"main": "dist/sortable.cjs.js",
|
|
5
5
|
"module": "dist/sortable.esm.js",
|
|
6
6
|
"unpkg": "dist/sortable.umd.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@dnd-kit/core": "^6.0.5",
|
|
47
47
|
"@dnd-kit/sortable": "^7.0.1",
|
|
48
|
-
"@steedos-widgets/amis-lib": "3.6.4-beta.
|
|
48
|
+
"@steedos-widgets/amis-lib": "3.6.4-beta.3"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "f33eb2d6fa30e93496e57d81c6c28a8575377e73"
|
|
51
51
|
}
|