decap-cms-widget-list 3.5.0 → 3.6.0
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/CHANGELOG.md +7 -0
- package/dist/decap-cms-widget-list.js +4 -4
- package/dist/decap-cms-widget-list.js.map +1 -1
- package/dist/esm/ListControl.js +10 -11
- package/package.json +4 -3
- package/src/ListControl.js +2 -3
- package/src/__tests__/ListControl.spec.js +1 -3
- package/src/__tests__/__snapshots__/ListControl.spec.js.snap +9 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decap-cms-widget-list",
|
|
3
3
|
"description": "Widget for editing lists in Decap CMS.",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.6.0",
|
|
5
5
|
"homepage": "https://www.decapcms.org/docs/widgets/#list",
|
|
6
6
|
"repository": "https://github.com/decaporg/decap-cms/tree/main/packages/decap-cms-widget-list",
|
|
7
7
|
"bugs": "https://github.com/decaporg/decap-cms/issues",
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@dnd-kit/core": "^6.0.8",
|
|
25
25
|
"@dnd-kit/modifiers": "^6.0.1",
|
|
26
|
-
"@dnd-kit/sortable": "^7.0.2"
|
|
26
|
+
"@dnd-kit/sortable": "^7.0.2",
|
|
27
|
+
"@dnd-kit/utilities": "^3.2.2"
|
|
27
28
|
},
|
|
28
29
|
"peerDependencies": {
|
|
29
30
|
"@emotion/react": "^11.11.1",
|
|
@@ -37,5 +38,5 @@
|
|
|
37
38
|
"react": "^19.1.0",
|
|
38
39
|
"react-immutable-proptypes": "^2.1.0"
|
|
39
40
|
},
|
|
40
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "567a80101f4846853701ad7d8abdc29b5e4fab56"
|
|
41
42
|
}
|
package/src/ListControl.js
CHANGED
|
@@ -7,7 +7,6 @@ import { List, Map, fromJS } from 'immutable';
|
|
|
7
7
|
import partial from 'lodash/partial';
|
|
8
8
|
import isEmpty from 'lodash/isEmpty';
|
|
9
9
|
import uniqueId from 'lodash/uniqueId';
|
|
10
|
-
import { v4 as uuid } from 'uuid';
|
|
11
10
|
import DecapCmsWidgetObject from 'decap-cms-widget-object';
|
|
12
11
|
import {
|
|
13
12
|
DndContext,
|
|
@@ -211,7 +210,7 @@ export default class ListControl extends React.Component {
|
|
|
211
210
|
const { field, value } = props;
|
|
212
211
|
const listCollapsed = field.get('collapsed', true);
|
|
213
212
|
const itemsCollapsed = (value && Array(value.size).fill(listCollapsed)) || [];
|
|
214
|
-
const keys = (value && Array.from({ length: value.size }, () =>
|
|
213
|
+
const keys = (value && Array.from({ length: value.size }, () => crypto.randomUUID())) || [];
|
|
215
214
|
|
|
216
215
|
this.state = {
|
|
217
216
|
listCollapsed,
|
|
@@ -353,7 +352,7 @@ export default class ListControl extends React.Component {
|
|
|
353
352
|
const { value, onChange, field } = this.props;
|
|
354
353
|
const addToTop = field.get('add_to_top', false);
|
|
355
354
|
|
|
356
|
-
const itemKey =
|
|
355
|
+
const itemKey = crypto.randomUUID();
|
|
357
356
|
this.setState({
|
|
358
357
|
itemsCollapsed: addToTop
|
|
359
358
|
? [false, ...this.state.itemsCollapsed]
|
|
@@ -34,7 +34,6 @@ jest.mock('decap-cms-ui-default', () => {
|
|
|
34
34
|
ListItemTopBar,
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
|
-
jest.mock('uuid');
|
|
38
37
|
|
|
39
38
|
describe('ListControl', () => {
|
|
40
39
|
const props = {
|
|
@@ -63,9 +62,8 @@ describe('ListControl', () => {
|
|
|
63
62
|
|
|
64
63
|
beforeEach(() => {
|
|
65
64
|
jest.clearAllMocks();
|
|
66
|
-
const uuid = require('uuid');
|
|
67
65
|
let id = 0;
|
|
68
|
-
|
|
66
|
+
global.crypto.randomUUID = jest.fn(() => {
|
|
69
67
|
return id++;
|
|
70
68
|
});
|
|
71
69
|
});
|
|
@@ -162,6 +162,7 @@ exports[`ListControl should add to list when add button is clicked 1`] = `
|
|
|
162
162
|
class="emotion-3 emotion-4"
|
|
163
163
|
>
|
|
164
164
|
<button
|
|
165
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
165
166
|
class="emotion-5 emotion-6"
|
|
166
167
|
data-testid="expand-button"
|
|
167
168
|
>
|
|
@@ -414,6 +415,7 @@ exports[`ListControl should remove from list when remove button is clicked 1`] =
|
|
|
414
415
|
class="emotion-3 emotion-4"
|
|
415
416
|
>
|
|
416
417
|
<button
|
|
418
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
417
419
|
class="emotion-5 emotion-6"
|
|
418
420
|
data-testid="expand-button"
|
|
419
421
|
>
|
|
@@ -696,6 +698,7 @@ exports[`ListControl should remove from list when remove button is clicked 2`] =
|
|
|
696
698
|
class="emotion-3 emotion-4"
|
|
697
699
|
>
|
|
698
700
|
<button
|
|
701
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
699
702
|
class="emotion-5 emotion-6"
|
|
700
703
|
data-testid="expand-button"
|
|
701
704
|
>
|
|
@@ -961,6 +964,7 @@ exports[`ListControl should render list with fields with collapse = "false" and
|
|
|
961
964
|
class="emotion-3 emotion-4"
|
|
962
965
|
>
|
|
963
966
|
<button
|
|
967
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
964
968
|
class="emotion-5 emotion-6"
|
|
965
969
|
data-testid="expand-button"
|
|
966
970
|
>
|
|
@@ -1243,6 +1247,7 @@ exports[`ListControl should render list with fields with collapse = "false" and
|
|
|
1243
1247
|
class="emotion-3 emotion-4"
|
|
1244
1248
|
>
|
|
1245
1249
|
<button
|
|
1250
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
1246
1251
|
class="emotion-5 emotion-6"
|
|
1247
1252
|
data-testid="expand-button"
|
|
1248
1253
|
>
|
|
@@ -1525,6 +1530,7 @@ exports[`ListControl should render list with fields with default collapse ("true
|
|
|
1525
1530
|
class="emotion-3 emotion-4"
|
|
1526
1531
|
>
|
|
1527
1532
|
<button
|
|
1533
|
+
aria-label="editor.editorWidgets.object.expand"
|
|
1528
1534
|
class="emotion-5 emotion-6"
|
|
1529
1535
|
data-testid="expand-button"
|
|
1530
1536
|
>
|
|
@@ -1790,6 +1796,7 @@ exports[`ListControl should render list with fields with default collapse ("true
|
|
|
1790
1796
|
class="emotion-3 emotion-4"
|
|
1791
1797
|
>
|
|
1792
1798
|
<button
|
|
1799
|
+
aria-label="editor.editorWidgets.object.expand"
|
|
1793
1800
|
class="emotion-5 emotion-6"
|
|
1794
1801
|
data-testid="expand-button"
|
|
1795
1802
|
>
|
|
@@ -1993,6 +2000,7 @@ exports[`ListControl should render list with nested object 1`] = `
|
|
|
1993
2000
|
class="emotion-3 emotion-4"
|
|
1994
2001
|
>
|
|
1995
2002
|
<button
|
|
2003
|
+
aria-label="editor.editorWidgets.object.expand"
|
|
1996
2004
|
class="emotion-5 emotion-6"
|
|
1997
2005
|
data-testid="expand-button"
|
|
1998
2006
|
>
|
|
@@ -2279,6 +2287,7 @@ exports[`ListControl should render list with nested object with collapse = false
|
|
|
2279
2287
|
class="emotion-3 emotion-4"
|
|
2280
2288
|
>
|
|
2281
2289
|
<button
|
|
2290
|
+
aria-label="editor.editorWidgets.object.collapse"
|
|
2282
2291
|
class="emotion-5 emotion-6"
|
|
2283
2292
|
data-testid="expand-button"
|
|
2284
2293
|
>
|