@steedos-widgets/sortable 1.3.13 → 1.3.15

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.
@@ -20443,6 +20443,7 @@
20443
20443
  var frontend_record_detail_tab_related$1 = "Related";
20444
20444
  var frontend_all_apps$1 = "All apps";
20445
20445
  var frontend_all_projects$1 = "All projects";
20446
+ var frontend_open_app_launcher$1 = "Open App Launcher";
20446
20447
  var frontend_application_launcher$1 = "Application launcher";
20447
20448
  var frontend_menu$1 = "Menu";
20448
20449
  var frontend_help$1 = "Help";
@@ -20528,6 +20529,7 @@
20528
20529
  frontend_record_detail_tab_related: frontend_record_detail_tab_related$1,
20529
20530
  frontend_all_apps: frontend_all_apps$1,
20530
20531
  frontend_all_projects: frontend_all_projects$1,
20532
+ frontend_open_app_launcher: frontend_open_app_launcher$1,
20531
20533
  frontend_application_launcher: frontend_application_launcher$1,
20532
20534
  frontend_menu: frontend_menu$1,
20533
20535
  frontend_help: frontend_help$1,
@@ -20615,6 +20617,7 @@
20615
20617
  var frontend_record_detail_tab_related = "相关";
20616
20618
  var frontend_all_apps = "所有应用";
20617
20619
  var frontend_all_projects = "所有项目";
20620
+ var frontend_open_app_launcher = "打开应用程序启动器";
20618
20621
  var frontend_application_launcher = "应用程序启动器";
20619
20622
  var frontend_menu = "菜单";
20620
20623
  var frontend_help = "帮助";
@@ -20701,6 +20704,7 @@
20701
20704
  frontend_record_detail_tab_related: frontend_record_detail_tab_related,
20702
20705
  frontend_all_apps: frontend_all_apps,
20703
20706
  frontend_all_projects: frontend_all_projects,
20707
+ frontend_open_app_launcher: frontend_open_app_launcher,
20704
20708
  frontend_application_launcher: frontend_application_launcher,
20705
20709
  frontend_menu: frontend_menu,
20706
20710
  frontend_help: frontend_help,
@@ -31937,6 +31941,12 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31937
31941
  "type": "tpl",
31938
31942
  "tpl": "${label}",
31939
31943
  }] : _r, _s = props.boardFooter, boardFooter = _s === void 0 ? [] : _s, _t = props.wrapperClassName, wrapperClassName = _t === void 0 ? "gap-2" : _t, _u = props.boardClassName, boardClassName = _u === void 0 ? "border rounded" : _u, _v = props.cardClassName, cardClassName = _v === void 0 ? "" : _v;
31944
+ if (!props.data) {
31945
+ // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
31946
+ // 如果data为undefined,dispatchEvent时第三个参数传入的current的data为undefined会报错
31947
+ props.data = {};
31948
+ }
31949
+ var MultipleContainersRef = React.useRef();
31940
31950
  value && delete (value.$$id);
31941
31951
  var _w = __read(React.useState(function () {
31942
31952
  var _a;
@@ -31961,7 +31971,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
31961
31971
  value = newItems || items;
31962
31972
  return [4 /*yield*/, amisDispatchEvent('change', createObject(amisData, {
31963
31973
  value: value
31964
- }))];
31974
+ }), MultipleContainersRef.current)];
31965
31975
  case 1:
31966
31976
  rendererEvent = _a.sent();
31967
31977
  if (rendererEvent === null || rendererEvent === void 0 ? void 0 : rendererEvent.prevented) {
@@ -32058,7 +32068,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
32058
32068
  recentlyMovedToNewContainer.current = false;
32059
32069
  });
32060
32070
  }, [items]);
32061
- return (React__default["default"].createElement(DndContext, { sensors: sensors, collisionDetection: collisionDetectionStrategy, measuring: {
32071
+ var multipleContainers = (React__default["default"].createElement(DndContext, __assign$1({ sensors: sensors, collisionDetection: collisionDetectionStrategy, measuring: {
32062
32072
  droppable: {
32063
32073
  strategy: MeasuringStrategy.Always,
32064
32074
  },
@@ -32184,7 +32194,7 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
32184
32194
  setActiveId(null);
32185
32195
  // console.log('拖动结束2,更新form value')
32186
32196
  handleChange(newItems);
32187
- }, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers },
32197
+ }, cancelDrop: cancelDrop, onDragCancel: onDragCancel, modifiers: modifiers }, props),
32188
32198
  React__default["default"].createElement("div", { style: {
32189
32199
  display: 'inline-grid',
32190
32200
  boxSizing: 'border-box',
@@ -32216,6 +32226,10 @@ crudService && crudService.setData({showFieldsFilter: toShowFieldsFilter});
32216
32226
  : renderSortableItemDragOverlay(activeId)
32217
32227
  : null), document.body),
32218
32228
  trashable && activeId && !containers.includes(activeId) ? (React__default["default"].createElement(Trash, { id: TRASH_ID })) : null)));
32229
+ // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
32230
+ // dispatchEvent时第三个参数传入的current必须是一个带props属性的对象
32231
+ MultipleContainersRef.current = multipleContainers;
32232
+ return multipleContainers;
32219
32233
  function renderSortableItemDragOverlay(id) {
32220
32234
  var item = lodash.exports.cloneDeep(lodash.exports.keyBy(cardSource, 'id')[id]) || { id: id, label: '' + id, columnSpan: 1 };
32221
32235
  if (item.columnSpan && item.columnSpan > columns)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos-widgets/sortable",
3
- "version": "1.3.13",
3
+ "version": "1.3.15",
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": "1.3.13"
48
+ "@steedos-widgets/amis-lib": "1.3.15"
49
49
  },
50
- "gitHead": "11697007cd418c8ce791321a167e9e709825680d"
50
+ "gitHead": "c2075c7a140975ac068732b2fc34cf031cef9def"
51
51
  }
@@ -213,6 +213,13 @@ export function MultipleContainers(props) {
213
213
  cardClassName = "",
214
214
  }: Props = props
215
215
 
216
+ if(!props.data){
217
+ // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
218
+ // 如果data为undefined,dispatchEvent时第三个参数传入的current的data为undefined会报错
219
+ props.data = {}
220
+ }
221
+ const MultipleContainersRef: any = useRef();
222
+
216
223
  value && delete(value.$$id);
217
224
 
218
225
  const [items, setItems] = useState<Items>(
@@ -244,7 +251,8 @@ export function MultipleContainers(props) {
244
251
  'change',
245
252
  createObject(amisData, {
246
253
  value
247
- })
254
+ }),
255
+ MultipleContainersRef.current
248
256
  );
249
257
  if (rendererEvent?.prevented) {
250
258
  return;
@@ -374,7 +382,7 @@ export function MultipleContainers(props) {
374
382
  });
375
383
  }, [items]);
376
384
 
377
- return (
385
+ let multipleContainers = (
378
386
  <DndContext
379
387
  sensors={sensors}
380
388
  collisionDetection={collisionDetectionStrategy}
@@ -554,6 +562,7 @@ export function MultipleContainers(props) {
554
562
  cancelDrop={cancelDrop}
555
563
  onDragCancel={onDragCancel}
556
564
  modifiers={modifiers}
565
+ {...props}//dispatchevent需要实例中的props有amis的各项属性,因此将所有props一起传下来
557
566
  >
558
567
  <div
559
568
  style={{
@@ -654,6 +663,11 @@ export function MultipleContainers(props) {
654
663
  </DndContext>
655
664
  );
656
665
 
666
+ // 为了解决3.2 dispatchevent不生效的问题, https://github.com/baidu/amis/issues/7488
667
+ // dispatchEvent时第三个参数传入的current必须是一个带props属性的对象
668
+ MultipleContainersRef.current = multipleContainers;
669
+ return multipleContainers;
670
+
657
671
  function renderSortableItemDragOverlay(id: UniqueIdentifier) {
658
672
  const item = cloneDeep(keyBy(cardSource, 'id')[id]) || {id: id, label: '' + id, columnSpan:1}
659
673
  if (item.columnSpan && item.columnSpan > columns)