@steedos-widgets/sortable 1.3.4-beta.17 → 1.3.4-beta.18

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.
@@ -55788,7 +55788,8 @@ const getCopyListviewButtonSchema = ()=>{
55788
55788
  "&": "${list_view}",
55789
55789
  "name":"",
55790
55790
  "label": instance.t('frontend_listview_control_clone_defaultData_label_start') + " ${list_view.label} " + instance.t('frontend_listview_control_clone_defaultData_label_end'),
55791
- "shared":false
55791
+ "shared":false,
55792
+ "object_name": "${targetObjectName}",
55792
55793
  },
55793
55794
  "fieldsExtend": fieldsExtend$3(),
55794
55795
  "fields": fields(),
@@ -57496,7 +57497,9 @@ async function lookupToAmisPicker(field, readonly, ctx){
57496
57497
  pickerSchema.headerToolbar = getObjectHeaderToolbar(refObjectConfig, fieldsArr, ctx.formFactor, { headerToolbarItems, isLookup: true, keywordsSearchBoxName });
57497
57498
  const isAllowCreate = refObjectConfig.permissions.allowCreate;
57498
57499
  const isCreate = lodash.exports.isBoolean(field.create) ? field.create : true;
57499
- if (isAllowCreate && isCreate) {
57500
+ // lookup字段配置过滤条件就强制不显示新建按钮
57501
+ let isHasFilters = (field.filters || field._filtersFunction) ? true : false;
57502
+ if (isAllowCreate && isCreate && !isHasFilters) {
57500
57503
  const new_button = await getSchema$5(refObjectConfig, { appId: ctx.appId, objectName: refObjectConfig.name, formFactor: ctx.formFactor });
57501
57504
  new_button.align = "right";
57502
57505
  // 保持快速搜索放在最左侧,新建按钮往里插,而不是push到最后
@@ -57873,7 +57876,7 @@ async function lookupToAmis(field, readonly, ctx){
57873
57876
  // 此处不参考 steedos 的 enable_enhanced_lookup 规则. 如果默认是开启弹出选择,用户选择过程操作太繁琐, 所以默认是关闭弹出选择.
57874
57877
  // 由于amis picker 目前不支持联动, 配置了depend_on时, 使用使用select ,以支持联动
57875
57878
  // TODO: 确认 amis picker 支持联动时, 清理field.depend_on判断
57876
- if(refObject.enable_enhanced_lookup == true && lodash.exports.isEmpty(field.depend_on)){
57879
+ if(refObject.enable_enhanced_lookup == true){
57877
57880
  return await lookupToAmisPicker(field, readonly, ctx);
57878
57881
  }else if(refObject.enable_tree) {
57879
57882
  return await lookupToAmisTreeSelect(field, readonly, Object.assign({}, ctx, {
@@ -58186,8 +58189,8 @@ function getAmisStaticFieldType(type, readonly, options){
58186
58189
  /*
58187
58190
  * @Author: baozhoutao@steedos.com
58188
58191
  * @Date: 2022-10-28 14:15:09
58189
- * @LastEditors: baozhoutao@steedos.com
58190
- * @LastEditTime: 2022-11-02 18:06:16
58192
+ * @LastEditors: liaodaxue
58193
+ * @LastEditTime: 2023-10-30 17:51:54
58191
58194
  * @Description:
58192
58195
  */
58193
58196
 
@@ -58238,11 +58241,26 @@ const getAmisFileEditSchema = (steedosField)=>{
58238
58241
  useChunk: false, // 关闭分块上传
58239
58242
  receiver: {
58240
58243
  method: "post",
58244
+ dataType: "form-data",
58241
58245
  url: `\${context.rootUrl}/s3/${tableName}`,
58242
- data: {
58243
- $: "$$",
58244
- context: `\${context}`,
58245
- },
58246
+ requestAdaptor: `
58247
+ const { _master, global,context } = api.body;
58248
+ // const { recordId, objectName } = _master;
58249
+ const { spaceId, userId, user } = global;
58250
+ /*
58251
+ record_id: recordId,
58252
+ parent: recordId,
58253
+ object_name: objectName,
58254
+ owner_name: user.name,
58255
+ space: spaceId,
58256
+ owner: userId
58257
+ */
58258
+ // 参考platform 2.2版本,附件字段保存时cfs.files.filerecord、cfs.images.filerecord表中的metadata下只保存space、owner两个属性值。
58259
+ api.data.append('space', spaceId);
58260
+ api.data.append('owner', userId);
58261
+
58262
+ return api;
58263
+ `,
58246
58264
  adaptor: `
58247
58265
  const { context } = api.body;
58248
58266
  var rootUrl = context.rootUrl + "/api/files/${tableName}/";
@@ -59284,7 +59302,7 @@ async function getTableColumns(fields, options){
59284
59302
  {
59285
59303
  "args": {
59286
59304
  "api": {
59287
- "url": "${context.rootUrl}/api/files/files/${versions[0]}?download=true",
59305
+ "url": "${(versions[0] && versions[0].url) ? versions[0].url+'?download=true' : context.rootUrl+'/api/files/files/'+versions[0]+'?download=true'}",
59288
59306
  "method": "get",
59289
59307
  "headers": {
59290
59308
  "Authorization": "Bearer ${context.tenantId},${context.authToken}"
@@ -59764,6 +59782,7 @@ async function getTableSchema$1(fields, options){
59764
59782
  }
59765
59783
  return {
59766
59784
  mode: "cards",
59785
+ perPageAvailable: [5, 10, 20, 50, 100, 500],
59767
59786
  name: "thelist",
59768
59787
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
59769
59788
  className: "",
@@ -59786,6 +59805,7 @@ async function getTableSchema$1(fields, options){
59786
59805
 
59787
59806
  return {
59788
59807
  mode: "table",
59808
+ perPageAvailable: [5, 10, 20, 50, 100, 500],
59789
59809
  name: "thelist",
59790
59810
  headerToolbarClassName: "py-2 px-2 border-gray-300 border-solid border-b",
59791
59811
  className: "",
@@ -65324,6 +65344,10 @@ function MultipleContainers(props) {
65324
65344
  };
65325
65345
  }), 2), items = _w[0], setItems = _w[1];
65326
65346
  var _x = __read(react.exports.useState(Object.keys(items)), 2), containers = _x[0], setContainers = _x[1];
65347
+ react.exports.useEffect(function () {
65348
+ setItems(value);
65349
+ setContainers(Object.keys(value));
65350
+ }, [value]);
65327
65351
  var handleChange = function (newItems) { return __awaiter(_this, void 0, void 0, function () {
65328
65352
  var value, rendererEvent;
65329
65353
  return __generator(this, function (_a) {
@@ -65340,7 +65364,7 @@ function MultipleContainers(props) {
65340
65364
  if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
65341
65365
  return [2 /*return*/];
65342
65366
  }
65343
- setTimeout(function () { return amisOnChange(value); }, 1000);
65367
+ setTimeout(function () { return amisOnChange(value); }, 500);
65344
65368
  return [2 /*return*/];
65345
65369
  }
65346
65370
  });
@@ -65443,6 +65467,7 @@ function MultipleContainers(props) {
65443
65467
  var active = _a.active, over = _a.over;
65444
65468
  var overId = over === null || over === void 0 ? void 0 : over.id;
65445
65469
  if (overId == null || overId === TRASH_ID || active.id in items) {
65470
+ // 拖动的是分组则跳过后面的逻辑
65446
65471
  return;
65447
65472
  }
65448
65473
  var overContainer = findContainer(overId);
@@ -65520,14 +65545,37 @@ function MultipleContainers(props) {
65520
65545
  var overContainer = findContainer(overId);
65521
65546
  var newItems = items;
65522
65547
  if (overContainer) {
65523
- var activeIndex_1 = items[activeContainer].indexOf(active.id);
65524
- var overIndex_1 = items[overContainer].indexOf(overId);
65525
- if (activeIndex_1 !== overIndex_1) {
65526
- setItems(function (items) {
65527
- var _a;
65528
- newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
65529
- return newItems;
65530
- });
65548
+ if (activeContainer !== overContainer) {
65549
+ // 拖动变更分组之间的顺序时,activeContainer overContainer 值不相等
65550
+ setTimeout(function () {
65551
+ var sortedGroups = over.data.current.sortable.items; //不加setTimeout的话,这里拿到的会是变更前的数据
65552
+ newItems = {};
65553
+ sortedGroups.forEach(function (groupKey) {
65554
+ newItems[groupKey] = items[groupKey];
65555
+ });
65556
+ delete newItems[TRASH_ID];
65557
+ delete newItems[PLACEHOLDER_ID];
65558
+ if (lodash.exports.keys(items).join(",") !== lodash.exports.keys(newItems).join(",")) {
65559
+ // 只有顺序发生变化时才触发change事件
65560
+ setItems(newItems);
65561
+ // console.log('拖动结束2,更新form value')
65562
+ handleChange(newItems);
65563
+ }
65564
+ setActiveId(null);
65565
+ }, 500);
65566
+ return;
65567
+ }
65568
+ else {
65569
+ // 同一个分组中字段顺序变更以及把一个字段从某个分组拖动到另一个分组内时,activeContainer 与 overContainer 值相等
65570
+ var activeIndex_1 = items[activeContainer].indexOf(active.id);
65571
+ var overIndex_1 = items[overContainer].indexOf(overId);
65572
+ if (activeIndex_1 !== overIndex_1) {
65573
+ setItems(function (items) {
65574
+ var _a;
65575
+ newItems = __assign$1(__assign$1({}, items), (_a = {}, _a[overContainer] = arrayMove(items[overContainer], activeIndex_1, overIndex_1), _a));
65576
+ return newItems;
65577
+ });
65578
+ }
65531
65579
  }
65532
65580
  }
65533
65581
  setActiveId(null);