@economic/taco 2.45.0-create.3 → 2.45.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. package/dist/components/AlertDialog/AlertDialog.d.ts +2 -1
  2. package/dist/components/AlertDialog/components/Content.d.ts +2 -0
  3. package/dist/components/Menu/components/Content.d.ts +1 -1
  4. package/dist/components/Menu/components/SubMenu.d.ts +1 -1
  5. package/dist/components/Popover/Popover.d.ts +1 -1
  6. package/dist/components/Provider/Localization.d.ts +0 -2
  7. package/dist/components/Report/Report.d.ts +1 -1
  8. package/dist/components/Select2/components/Search.d.ts +0 -6
  9. package/dist/components/Table3/Table3.d.ts +14 -2
  10. package/dist/components/Table3/components/Columns/Internal/EditingActionsMenu.d.ts +2 -1
  11. package/dist/components/Table3/components/Row/Editing/CreateRowButton.d.ts +11 -0
  12. package/dist/components/Table3/features/useTableEditing.d.ts +36 -24
  13. package/dist/components/Table3/types.d.ts +8 -23
  14. package/dist/components/Table3/useTable3.d.ts +0 -6
  15. package/dist/components/Table3/util/editing.d.ts +1 -0
  16. package/dist/esm/index.css +2 -6
  17. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js +17 -17
  18. package/dist/esm/node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js.map +1 -1
  19. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js +2 -1
  20. package/dist/esm/packages/taco/src/components/AlertDialog/AlertDialog.js.map +1 -1
  21. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js +7 -2
  22. package/dist/esm/packages/taco/src/components/AlertDialog/components/Content.js.map +1 -1
  23. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js +1 -0
  24. package/dist/esm/packages/taco/src/components/Dialog/components/Content.js.map +1 -1
  25. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js +1 -0
  26. package/dist/esm/packages/taco/src/components/Drawer/components/Content.js.map +1 -1
  27. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js +2 -2
  28. package/dist/esm/packages/taco/src/components/ModeSwitch/ModeSwitch.js.map +1 -1
  29. package/dist/esm/packages/taco/src/components/Popover/Popover.js.map +1 -1
  30. package/dist/esm/packages/taco/src/components/Provider/Localization.js +3 -5
  31. package/dist/esm/packages/taco/src/components/Provider/Localization.js.map +1 -1
  32. package/dist/esm/packages/taco/src/components/Select2/Select2.js +20 -39
  33. package/dist/esm/packages/taco/src/components/Select2/Select2.js.map +1 -1
  34. package/dist/esm/packages/taco/src/components/Select2/components/Search.js +2 -12
  35. package/dist/esm/packages/taco/src/components/Select2/components/Search.js.map +1 -1
  36. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js +19 -1
  37. package/dist/esm/packages/taco/src/components/Select2/components/Trigger.js.map +1 -1
  38. package/dist/esm/packages/taco/src/components/Switch/Switch.js +1 -1
  39. package/dist/esm/packages/taco/src/components/Switch/Switch.js.map +1 -1
  40. package/dist/esm/packages/taco/src/components/Table3/Table3.js +7 -21
  41. package/dist/esm/packages/taco/src/components/Table3/Table3.js.map +1 -1
  42. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js +18 -24
  43. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Cell/EditingControlCell.js.map +1 -1
  44. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js +36 -5
  45. package/dist/esm/packages/taco/src/components/Table3/components/Columns/Internal/EditingActionsMenu.js.map +1 -1
  46. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js +12 -17
  47. package/dist/esm/packages/taco/src/components/Table3/components/Editing/Alert.js.map +1 -1
  48. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js +90 -0
  49. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateRowButton.js.map +1 -0
  50. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js +14 -2
  51. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/SaveStatus.js.map +1 -1
  52. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js +3 -4
  53. package/dist/esm/packages/taco/src/components/Table3/components/Row/Row.js.map +1 -1
  54. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js +2 -7
  55. package/dist/esm/packages/taco/src/components/Table3/components/Toolbar/Editing/Editing.js.map +1 -1
  56. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js +406 -16
  57. package/dist/esm/packages/taco/src/components/Table3/features/useTableEditing.js.map +1 -1
  58. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js +32 -37
  59. package/dist/esm/packages/taco/src/components/Table3/listeners/useTableEditingListener.js.map +1 -1
  60. package/dist/esm/packages/taco/src/components/Table3/useTable3.js +7 -21
  61. package/dist/esm/packages/taco/src/components/Table3/useTable3.js.map +1 -1
  62. package/dist/esm/packages/taco/src/components/Table3/util/editing.js +25 -1
  63. package/dist/esm/packages/taco/src/components/Table3/util/editing.js.map +1 -1
  64. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js +0 -4
  65. package/dist/esm/packages/taco/src/primitives/Listbox2/components/Option.js.map +1 -1
  66. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js +4 -3
  67. package/dist/esm/packages/taco/src/primitives/Table/Core/Table.js.map +1 -1
  68. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js +3 -9
  69. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Cell/BuiltIns/GroupedCell.js.map +1 -1
  70. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js +3 -6
  71. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Columns/Internal/Actions.js.map +1 -1
  72. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js +1 -1
  73. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Footer/Footer.js.map +1 -1
  74. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js +1 -1
  75. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Row/BuiltIns/DisplayRow.js.map +1 -1
  76. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js +8 -1
  77. package/dist/esm/packages/taco/src/primitives/Table/Core/components/Toolbar/components/Filters/components/FilterValue.js.map +1 -1
  78. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js +1 -1
  79. package/dist/esm/packages/taco/src/primitives/Table/Core/features/useTableRenderer.js.map +1 -1
  80. package/dist/esm/packages/taco/src/primitives/Table/types.js.map +1 -1
  81. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js +1 -1
  82. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/useTableManager.js.map +1 -1
  83. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js +0 -11
  84. package/dist/esm/packages/taco/src/primitives/Table/useTableManager/util/setup.js.map +1 -1
  85. package/dist/esm/packages/taco/src/utils/dom.js +17 -13
  86. package/dist/esm/packages/taco/src/utils/dom.js.map +1 -1
  87. package/dist/index.css +2 -6
  88. package/dist/primitives/Table/Core/Table.d.ts +0 -1
  89. package/dist/primitives/Table/Core/components/Columns/Internal/Actions.d.ts +1 -3
  90. package/dist/primitives/Table/Core/components/Footer/Footer.d.ts +2 -2
  91. package/dist/primitives/Table/Core/features/useTableStyle.d.ts +3 -3
  92. package/dist/primitives/Table/types.d.ts +2 -2
  93. package/dist/primitives/Table/useTableManager/useTableManager.d.ts +1 -1
  94. package/dist/taco.cjs.development.js +691 -921
  95. package/dist/taco.cjs.development.js.map +1 -1
  96. package/dist/taco.cjs.production.min.js +1 -1
  97. package/dist/taco.cjs.production.min.js.map +1 -1
  98. package/dist/utils/dom.d.ts +0 -1
  99. package/package.json +17 -16
  100. package/dist/components/Table3/components/Editing/DiscardChangesConfirmationDialog.d.ts +0 -7
  101. package/dist/components/Table3/components/Row/Editing/CreateNewRow.d.ts +0 -13
  102. package/dist/components/Table3/components/Row/Editing/TemporaryRow.d.ts +0 -12
  103. package/dist/components/Table3/features/useEditingState.d.ts +0 -29
  104. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js +0 -34
  105. package/dist/esm/packages/taco/src/components/Table3/components/Editing/DiscardChangesConfirmationDialog.js.map +0 -1
  106. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js +0 -88
  107. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/CreateNewRow.js.map +0 -1
  108. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js +0 -93
  109. package/dist/esm/packages/taco/src/components/Table3/components/Row/Editing/TemporaryRow.js.map +0 -1
  110. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js +0 -514
  111. package/dist/esm/packages/taco/src/components/Table3/features/useEditingState.js.map +0 -1
@@ -1,514 +0,0 @@
1
- import React__default from 'react';
2
- import { useLocalization } from '../../Provider/Localization.js';
3
- import { v4 } from 'uuid';
4
- import { _forOf, _catch } from '../../../../../../node_modules/babel-plugin-transform-async-to-promises/helpers.mjs.js';
5
- import { willRowMove } from '../util/editing.js';
6
- import omit from 'lodash-es/omit';
7
- import setWith from 'lodash-es/setWith';
8
-
9
- const TEMPORARY_ROW_ID_PREFIX = 'temp-';
10
- const DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;
11
- function reducer(state, action) {
12
- const {
13
- type,
14
- rowId,
15
- payload
16
- } = action;
17
- switch (type) {
18
- case 'setCellValue':
19
- {
20
- const {
21
- columnId,
22
- row,
23
- value
24
- } = payload;
25
- return {
26
- ...state,
27
- changes: {
28
- ...state.changes,
29
- rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),
30
- originals: setWith(state.changes.originals, rowId, row, Object)
31
- }
32
- };
33
- }
34
- case 'removeCellValue':
35
- {
36
- const {
37
- columnId,
38
- rowIdentityAccessor
39
- } = payload;
40
- const changes = omit(state.changes.rows, `${rowId}.${columnId}`);
41
- // if there are no changes left, remove the row
42
- if (!Object.keys(changes[rowId]).length) {
43
- return reducer(state, {
44
- type: 'removeRow',
45
- rowId,
46
- payload: {
47
- rowIdentityAccessor
48
- }
49
- });
50
- }
51
- return {
52
- ...state,
53
- changes: {
54
- ...state.changes,
55
- rows: omit(state.changes.rows, `${rowId}.${columnId}`),
56
- errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),
57
- moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`)
58
- }
59
- };
60
- }
61
- case 'updateRow':
62
- {
63
- const {
64
- cellErrors,
65
- moveReasons,
66
- original,
67
- value
68
- } = payload;
69
- return {
70
- ...state,
71
- changes: {
72
- ...state.changes,
73
- rows: setWith(state.changes.rows, rowId, value, Object),
74
- errors: setWith(state.changes.errors, `${rowId}.cells`, cellErrors !== null && cellErrors !== void 0 ? cellErrors : state.changes.errors.cells[rowId], Object),
75
- originals: setWith(state.changes.originals, rowId, original !== null && original !== void 0 ? original : state.changes.originals[rowId], Object),
76
- moveReasons: setWith(state.changes.moveReasons, rowId, moveReasons !== null && moveReasons !== void 0 ? moveReasons : state.changes.moveReasons[rowId], Object),
77
- // status can be undefined, so don't use ??
78
- status: setWith(state.changes.status, rowId, undefined, Object)
79
- }
80
- };
81
- }
82
- case 'removeRow':
83
- {
84
- const {
85
- rowIdentityAccessor
86
- } = payload;
87
- return {
88
- ...state,
89
- changes: {
90
- ...state.changes,
91
- rows: omit(state.changes.rows, rowId),
92
- errors: omit(state.changes.errors, rowId),
93
- moveReasons: omit(state.changes.moveReasons, rowId),
94
- originals: omit(state.changes.originals, rowId),
95
- status: omit(state.changes.status, rowId)
96
- },
97
- temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId)
98
- };
99
- }
100
- case 'setRowStatus':
101
- {
102
- const {
103
- status
104
- } = payload;
105
- return {
106
- ...state,
107
- changes: {
108
- ...state.changes,
109
- status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId)
110
- }
111
- };
112
- }
113
- case 'setRowErrors':
114
- {
115
- const {
116
- ...errors
117
- } = payload;
118
- return {
119
- ...state,
120
- changes: {
121
- ...state.changes,
122
- errors: setWith(state.changes.errors, rowId, errors, Object)
123
- }
124
- };
125
- }
126
- case 'createRow':
127
- {
128
- const {
129
- value
130
- } = payload;
131
- return {
132
- ...state,
133
- temporaryRows: state.temporaryRows.concat(value),
134
- changes: {
135
- ...state.changes,
136
- rows: setWith(state.changes.rows, rowId, value, Object),
137
- originals: setWith(state.changes.originals, rowId, value, Object)
138
- }
139
- };
140
- }
141
- default:
142
- return state;
143
- }
144
- }
145
- function usePendingChangesState(handleSave, handleChange, rowIdentityAccessor, validator) {
146
- const saveChanges = function (table, rowId = undefined) {
147
- try {
148
- let _exit = false;
149
- if (!handleSave) {
150
- console.warn('Tried to save, but Table has no onEditingSave handler');
151
- return Promise.resolve(false);
152
- }
153
- // sometimes we only want to save one row
154
- const changes = rowId ? {
155
- [rowId]: state.changes.rows[rowId]
156
- } : state.changes.rows;
157
- let completed = true;
158
- const _temp9 = _forOf(Object.keys(changes), function (rowId) {
159
- const status = getRowStatus(rowId);
160
- return _catch(function () {
161
- var _changeSet$rowIdentit;
162
- function _temp8(_result) {
163
- return _exit ? _result : Promise.resolve(handleSave(changeSet)).then(function () {
164
- // cleanup changes, we don't need them after saving
165
- discardChanges(rowId, table);
166
- // show the saved status, then remove it after a delay
167
- setRowStatus(rowId, 'saved');
168
- setTimeout(() => {
169
- setRowStatus(rowId, undefined);
170
- }, DELAY_BEFORE_REMOVING_SAVE_STATUS);
171
- });
172
- }
173
- // don't try to save if - already saving, or there are known errors
174
- if (status === 'saving' || status === 'errored') {
175
- return;
176
- }
177
- setRowStatus(rowId, 'saving');
178
- const changeSet = {
179
- ...state.changes.originals[rowId],
180
- ...changes[rowId]
181
- };
182
- // if we had to create a temporary id, delete it first - it's our data, not theirs
183
- if ((_changeSet$rowIdentit = changeSet[rowIdentityAccessor]) !== null && _changeSet$rowIdentit !== void 0 && _changeSet$rowIdentit.startsWith(TEMPORARY_ROW_ID_PREFIX)) {
184
- delete changeSet[rowIdentityAccessor];
185
- }
186
- // re-run validation, maybe a cell is already invalid but has never been blurred
187
- const _temp7 = function () {
188
- if (validator) {
189
- return Promise.resolve(validator(changeSet)).then(function (errors) {
190
- if (errors && Object.keys(errors).length) {
191
- throw errors;
192
- }
193
- });
194
- }
195
- }();
196
- return _temp7 && _temp7.then ? _temp7.then(_temp8) : _temp8(_temp7); // send new data to the server
197
- }, function (error) {
198
- var _error$response;
199
- if (error instanceof ReferenceError || error instanceof TypeError || (error === null || error === void 0 ? void 0 : (_error$response = error.response) === null || _error$response === void 0 ? void 0 : _error$response.status) >= 500) {
200
- console.error(error);
201
- }
202
- // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc
203
- // this code handles those errors and maps them either to row errors or cell specific errors
204
- let rowError;
205
- let cellErrors;
206
- if (typeof error === 'string') {
207
- rowError = error;
208
- } else if (error instanceof Error) {
209
- var _error$response2;
210
- rowError = error.message;
211
- // most of our apis return error objects within this shape
212
- if (typeof ((_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : _error$response2.data) === 'object') {
213
- var _error$response3;
214
- cellErrors = (_error$response3 = error.response) === null || _error$response3 === void 0 ? void 0 : _error$response3.data;
215
- }
216
- } else if (typeof error === 'object') {
217
- cellErrors = error;
218
- }
219
- if (rowError || cellErrors) {
220
- dispatch({
221
- type: 'setRowErrors',
222
- rowId,
223
- payload: {
224
- row: rowError,
225
- cells: cellErrors,
226
- shouldShowErrorAlert: true
227
- }
228
- });
229
- }
230
- setRowStatus(rowId, 'errored');
231
- completed = false;
232
- });
233
- }, function () {
234
- return _exit;
235
- });
236
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function (_result3) {
237
- return _exit ? _result3 : completed;
238
- }) : _exit ? _temp9 : completed);
239
- } catch (e) {
240
- return Promise.reject(e);
241
- }
242
- };
243
- const onCellChanged = function (cell, rowIndex) {
244
- try {
245
- function _temp6() {
246
- var _state$changes$errors8;
247
- function _temp4() {
248
- // only set errors and move reasons for the cells we're currently acting on
249
- // why? because the UX is not good if we set them for cells the user hasn't touched yet
250
- const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];
251
- const allCells = cell.row._getAllCellsByColumnId();
252
- cellsToActOn.forEach(accessor => {
253
- if (validationErrors[accessor]) {
254
- nextCellErrors[accessor] = validationErrors[accessor];
255
- // don't show move indicator for cells with errors, they aren't valid and can't be saved
256
- delete nextMoveReasons[accessor];
257
- } else {
258
- var _allCells$accessor;
259
- // there isn't any error in this run, remove any error set in state
260
- delete nextCellErrors[accessor];
261
- if ((_allCells$accessor = allCells[accessor]) !== null && _allCells$accessor !== void 0 && _allCells$accessor.column.getIsSorted()) {
262
- // run row move determination
263
- const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);
264
- // if the row will move based on this change save why, otherwise delete any existing state
265
- if (reason) {
266
- nextMoveReasons[accessor] = reason;
267
- } else {
268
- delete nextMoveReasons[accessor];
269
- }
270
- }
271
- }
272
- });
273
- dispatch({
274
- type: 'updateRow',
275
- rowId: cell.row.id,
276
- payload: {
277
- cellErrors: nextCellErrors,
278
- moveReasons: nextMoveReasons,
279
- value: nextChanges
280
- }
281
- });
282
- }
283
- // create a projection of the next state, so we can act against it
284
- const nextChanges = {
285
- ...state.changes.rows[cell.row.id],
286
- ...updatesForOtherCells
287
- };
288
- const nextMoveReasons = {
289
- ...state.changes.moveReasons[cell.row.id]
290
- };
291
- const nextCellErrors = {
292
- ...((_state$changes$errors8 = state.changes.errors[cell.row.id]) === null || _state$changes$errors8 === void 0 ? void 0 : _state$changes$errors8.cells)
293
- };
294
- // run validation
295
- let validationErrors = {};
296
- const _temp3 = function () {
297
- if (validator) {
298
- const nextRowValue = {
299
- ...state.changes.originals[cell.row.id],
300
- ...changes,
301
- ...updatesForOtherCells
302
- };
303
- return Promise.resolve(validator(nextRowValue)).then(function (_validator2) {
304
- validationErrors = _validator2 !== null && _validator2 !== void 0 ? _validator2 : {};
305
- });
306
- }
307
- }();
308
- return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
309
- }
310
- const changes = state.changes.rows[cell.row.id];
311
- if (!changes) {
312
- return Promise.resolve();
313
- }
314
- let updatesForOtherCells = {};
315
- // run the updater handler if there is one, to see if there are any other cells to update
316
- const _temp5 = function () {
317
- if (typeof handleChange === 'function') {
318
- const previousRowValue = {
319
- ...state.changes.originals[cell.row.id]
320
- };
321
- const nextRowValue = {
322
- ...state.changes.originals[cell.row.id],
323
- ...changes
324
- };
325
- return Promise.resolve(handleChange(cell.column.id, changes[cell.column.id], nextRowValue, previousRowValue)).then(function (_handleChange) {
326
- updatesForOtherCells = _handleChange !== null && _handleChange !== void 0 ? _handleChange : {};
327
- });
328
- }
329
- }();
330
- return Promise.resolve(_temp5 && _temp5.then ? _temp5.then(_temp6) : _temp6(_temp5));
331
- } catch (e) {
332
- return Promise.reject(e);
333
- }
334
- }; // general
335
- const createRow = function (data) {
336
- try {
337
- const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${v4()}`;
338
- const value = {
339
- ...data,
340
- [rowIdentityAccessor]: newRowId
341
- };
342
- dispatch({
343
- type: 'createRow',
344
- rowId: newRowId,
345
- payload: {
346
- value
347
- }
348
- });
349
- return Promise.resolve(newRowId);
350
- } catch (e) {
351
- return Promise.reject(e);
352
- }
353
- }; // cells
354
- // rows
355
- const setRowValue = function (rowId, original, value) {
356
- try {
357
- function _temp2() {
358
- dispatch({
359
- type: 'updateRow',
360
- rowId,
361
- payload: {
362
- cellErrors,
363
- original,
364
- value
365
- }
366
- });
367
- }
368
- let cellErrors;
369
- const _temp = function () {
370
- if (validator) {
371
- const row = {
372
- ...original,
373
- ...value
374
- };
375
- return Promise.resolve(validator(row)).then(function (_validator) {
376
- cellErrors = _validator !== null && _validator !== void 0 ? _validator : {};
377
- });
378
- }
379
- }();
380
- return Promise.resolve(_temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp));
381
- } catch (e) {
382
- return Promise.reject(e);
383
- }
384
- };
385
- const localization = useLocalization();
386
- const [state, dispatch] = React__default.useReducer(reducer, {
387
- changes: {
388
- rows: {},
389
- errors: {},
390
- moveReasons: {},
391
- originals: {},
392
- status: {}
393
- },
394
- temporaryRows: []
395
- });
396
- function getRowValue(rowId) {
397
- var _state$changes$rows$r, _state$changes$rows;
398
- return (_state$changes$rows$r = (_state$changes$rows = state.changes.rows) === null || _state$changes$rows === void 0 ? void 0 : _state$changes$rows[rowId]) !== null && _state$changes$rows$r !== void 0 ? _state$changes$rows$r : undefined;
399
- }
400
- function getRowMoveReason(rowId) {
401
- var _Object$values$, _state$changes$moveRe, _state$changes$moveRe2;
402
- return (_Object$values$ = Object.values((_state$changes$moveRe = (_state$changes$moveRe2 = state.changes.moveReasons) === null || _state$changes$moveRe2 === void 0 ? void 0 : _state$changes$moveRe2[rowId]) !== null && _state$changes$moveRe !== void 0 ? _state$changes$moveRe : {})[0]) !== null && _Object$values$ !== void 0 ? _Object$values$ : undefined;
403
- }
404
- function hasRowErrors(rowId) {
405
- var _state$changes$errors, _state$changes$errors2, _state$changes$errors3;
406
- return !!((_state$changes$errors = state.changes.errors[rowId]) !== null && _state$changes$errors !== void 0 && _state$changes$errors.row) || !!Object.keys((_state$changes$errors2 = (_state$changes$errors3 = state.changes.errors[rowId]) === null || _state$changes$errors3 === void 0 ? void 0 : _state$changes$errors3.cells) !== null && _state$changes$errors2 !== void 0 ? _state$changes$errors2 : {}).length;
407
- }
408
- function hasRowErrorsShownInAlert(rowId) {
409
- var _state$changes$errors4;
410
- return hasRowErrors(rowId) && !!((_state$changes$errors4 = state.changes.errors[rowId]) !== null && _state$changes$errors4 !== void 0 && _state$changes$errors4.shouldShowErrorAlert);
411
- }
412
- function getRowStatus(rowId) {
413
- return state.changes.status[rowId];
414
- }
415
- function setRowStatus(rowId, status) {
416
- dispatch({
417
- type: 'setRowStatus',
418
- rowId,
419
- payload: {
420
- status
421
- }
422
- });
423
- }
424
- function setCellValue(cell, value) {
425
- const rowId = cell.row.id;
426
- const columnId = cell.column.id;
427
- // update if the change is different to the original value
428
- if (value !== cell.row.original[columnId]) {
429
- dispatch({
430
- type: 'setCellValue',
431
- rowId,
432
- payload: {
433
- columnId,
434
- row: cell.row.original,
435
- value
436
- }
437
- });
438
- }
439
- // otherwise remove any previous change - no point saving the same value
440
- else if (cell.row.id in state.changes.rows) {
441
- dispatch({
442
- type: 'removeCellValue',
443
- rowId,
444
- payload: {
445
- columnId,
446
- rowIdentityAccessor
447
- }
448
- });
449
- }
450
- }
451
- function getCellValue(cell) {
452
- var _state$changes$rows2, _state$changes$rows2$;
453
- return (_state$changes$rows2 = state.changes.rows) === null || _state$changes$rows2 === void 0 ? void 0 : (_state$changes$rows2$ = _state$changes$rows2[cell.row.id]) === null || _state$changes$rows2$ === void 0 ? void 0 : _state$changes$rows2$[cell.column.id];
454
- }
455
- function getCellError(cell) {
456
- var _state$changes$errors5, _state$changes$errors6, _state$changes$errors7;
457
- return (_state$changes$errors5 = state.changes.errors) === null || _state$changes$errors5 === void 0 ? void 0 : (_state$changes$errors6 = _state$changes$errors5[cell.row.id]) === null || _state$changes$errors6 === void 0 ? void 0 : (_state$changes$errors7 = _state$changes$errors6.cells) === null || _state$changes$errors7 === void 0 ? void 0 : _state$changes$errors7[cell.column.id];
458
- }
459
- function getErrorsShownInAlert() {
460
- const rowsWithErrors = Object.keys(state.changes.errors);
461
- if (!rowsWithErrors.length) {
462
- return [];
463
- }
464
- return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({
465
- rowId,
466
- changes: state.changes.rows[rowId],
467
- errors: state.changes.errors[rowId]
468
- }));
469
- }
470
- function hasSaved() {
471
- return !!Object.values(state.changes.status).filter(value => value === 'saved').length;
472
- }
473
- function hasChanges(rowId) {
474
- return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;
475
- }
476
- function discardChanges(rowId, table) {
477
- // remove any new rows from pinned state before discarding them
478
- table.resetRowPinning(true);
479
- dispatch({
480
- type: 'removeRow',
481
- rowId,
482
- payload: {
483
- rowIdentityAccessor
484
- }
485
- });
486
- }
487
- return {
488
- // row
489
- setRowValue,
490
- getRowValue,
491
- getRowMoveReason,
492
- hasRowErrors,
493
- hasRowErrorsShownInAlert,
494
- getRowStatus,
495
- setRowStatus,
496
- // cells
497
- setCellValue,
498
- getCellValue,
499
- getCellError,
500
- onCellChanged,
501
- // general
502
- getErrorsShownInAlert,
503
- hasChanges,
504
- saveChanges,
505
- discardChanges,
506
- hasSaved,
507
- // new rows
508
- createRow,
509
- temporaryRows: state.temporaryRows
510
- };
511
- }
512
-
513
- export { TEMPORARY_ROW_ID_PREFIX, usePendingChangesState };
514
- //# sourceMappingURL=useEditingState.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useEditingState.js","sources":["../../../../../../../../src/components/Table3/features/useEditingState.ts"],"sourcesContent":["import React from 'react';\nimport { Table as ReactTable, Cell as ReactTableCell } from '@tanstack/react-table';\nimport { v4 as uuid } from 'uuid';\nimport { Table3EditingChangeHandler, Table3EditingSaveHandler, Table3EditingValidatorFn } from '../types';\nimport { willRowMove } from '../util/editing';\nimport omit from 'lodash/omit';\nimport setWith from 'lodash/setWith';\nimport { useLocalization } from '../../Provider/Localization';\n\nexport const TEMPORARY_ROW_ID_PREFIX = 'temp-';\n\nconst DELAY_BEFORE_REMOVING_SAVE_STATUS = 3000;\n\ntype EditingError = {\n row: string;\n cells: Record<string, string>;\n shouldShowErrorAlert: boolean;\n};\ntype EditingRowMoveReason = Record<string, 'search' | 'sorting' | 'filter'>;\ntype EditingSaveState = 'saving' | 'saved' | 'errored';\ntype EditingChangeset<TType = unknown> = Partial<TType>;\ntype EditingState<TType = unknown> = {\n changes: {\n rows: Record<string, EditingChangeset<TType>>;\n errors: Record<string, EditingError>;\n moveReasons: Record<string, EditingRowMoveReason>;\n originals: Record<string, TType>;\n status: Record<string, EditingSaveState>;\n };\n temporaryRows: TType[];\n};\ntype EditingStateAction = {\n type:\n | 'setCellValue'\n | 'removeCellValue'\n | 'updateRow'\n | 'mergeRowValue'\n | 'removeRow'\n | 'setRowStatus'\n | 'setRowErrors'\n | 'createRow';\n rowId: string;\n payload?: any;\n};\n\nfunction reducer<TType = unknown>(state: EditingState<TType>, action: EditingStateAction) {\n const { type, rowId, payload } = action;\n\n switch (type) {\n case 'setCellValue': {\n const { columnId, row, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, `${rowId}.${columnId}`, value, Object),\n originals: setWith(state.changes.originals, rowId, row, Object),\n },\n };\n }\n\n case 'removeCellValue': {\n const { columnId, rowIdentityAccessor } = payload;\n const changes = omit(state.changes.rows, `${rowId}.${columnId}`);\n\n // if there are no changes left, remove the row\n if (!Object.keys(changes[rowId]).length) {\n return reducer(state, { type: 'removeRow', rowId, payload: { rowIdentityAccessor } });\n }\n\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, `${rowId}.${columnId}`),\n errors: omit(state.changes.errors, `${rowId}.cells.${columnId}`),\n moveReasons: omit(state.changes.moveReasons, `${rowId}.${columnId}`),\n },\n };\n }\n\n case 'updateRow': {\n const { cellErrors, moveReasons, original, value } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n errors: setWith(\n state.changes.errors,\n `${rowId}.cells`,\n cellErrors ?? state.changes.errors.cells[rowId],\n Object\n ),\n originals: setWith(state.changes.originals, rowId, original ?? state.changes.originals[rowId], Object),\n moveReasons: setWith(\n state.changes.moveReasons,\n rowId,\n moveReasons ?? state.changes.moveReasons[rowId],\n Object\n ),\n // status can be undefined, so don't use ??\n status: setWith(state.changes.status, rowId, undefined, Object),\n },\n };\n }\n\n case 'removeRow': {\n const { rowIdentityAccessor } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n rows: omit(state.changes.rows, rowId),\n errors: omit(state.changes.errors, rowId),\n moveReasons: omit(state.changes.moveReasons, rowId),\n originals: omit(state.changes.originals, rowId),\n status: omit(state.changes.status, rowId),\n },\n temporaryRows: state.temporaryRows.filter(row => row[rowIdentityAccessor] !== rowId),\n };\n }\n\n case 'setRowStatus': {\n const { status } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n status: status ? setWith(state.changes.status, rowId, status, Object) : omit(state.changes.status, rowId),\n },\n };\n }\n\n case 'setRowErrors': {\n const { ...errors } = payload;\n return {\n ...state,\n changes: {\n ...state.changes,\n errors: setWith(state.changes.errors, rowId, errors, Object),\n },\n };\n }\n\n case 'createRow': {\n const { value } = payload;\n return {\n ...state,\n temporaryRows: state.temporaryRows.concat(value),\n changes: {\n ...state.changes,\n rows: setWith(state.changes.rows, rowId, value, Object),\n originals: setWith(state.changes.originals, rowId, value, Object),\n },\n };\n }\n\n default:\n return state;\n }\n}\n\nexport function usePendingChangesState<TType = unknown>(\n handleSave: Table3EditingSaveHandler<TType> | undefined,\n handleChange: Table3EditingChangeHandler<TType> | undefined,\n rowIdentityAccessor: keyof TType,\n validator: Table3EditingValidatorFn<TType> | undefined\n) {\n const localization = useLocalization();\n const [state, dispatch] = React.useReducer(reducer, {\n changes: { rows: {}, errors: {}, moveReasons: {}, originals: {}, status: {} },\n temporaryRows: [],\n });\n\n // rows\n async function setRowValue<T extends TType>(rowId: string, original: T, value: Partial<T>) {\n let cellErrors;\n\n if (validator) {\n const row = { ...original, ...value } as T;\n cellErrors = ((await validator(row)) ?? {}) as Record<string, string>;\n }\n\n dispatch({\n type: 'updateRow',\n rowId,\n payload: { cellErrors, original, value },\n });\n }\n\n function getRowValue(rowId: string) {\n return state.changes.rows?.[rowId] ?? undefined;\n }\n\n function getRowMoveReason(rowId: string) {\n return Object.values(state.changes.moveReasons?.[rowId] ?? {})[0] ?? undefined;\n }\n\n function hasRowErrors(rowId: string) {\n return !!state.changes.errors[rowId]?.row || !!Object.keys(state.changes.errors[rowId]?.cells ?? {}).length;\n }\n\n function hasRowErrorsShownInAlert(rowId: string) {\n return hasRowErrors(rowId) && !!state.changes.errors[rowId]?.shouldShowErrorAlert;\n }\n\n function getRowStatus(rowId: string) {\n return state.changes.status[rowId];\n }\n\n function setRowStatus(rowId: string, status: EditingSaveState | undefined) {\n dispatch({\n type: 'setRowStatus',\n rowId,\n payload: {\n status,\n },\n });\n }\n\n async function createRow<T extends TType>(data: Partial<T>) {\n const newRowId = `${TEMPORARY_ROW_ID_PREFIX}${uuid()}`;\n const value: Partial<TType> = {\n ...data,\n [rowIdentityAccessor]: newRowId,\n };\n\n dispatch({\n type: 'createRow',\n rowId: newRowId,\n payload: { value },\n });\n\n return newRowId;\n }\n\n // cells\n function setCellValue<T extends TType>(cell: ReactTableCell<T, unknown>, value: unknown) {\n const rowId = cell.row.id;\n const columnId = cell.column.id;\n\n // update if the change is different to the original value\n if (value !== cell.row.original[columnId]) {\n dispatch({\n type: 'setCellValue',\n rowId,\n payload: {\n columnId,\n row: cell.row.original,\n value,\n },\n });\n }\n // otherwise remove any previous change - no point saving the same value\n else if (cell.row.id in state.changes.rows) {\n dispatch({\n type: 'removeCellValue',\n rowId,\n payload: {\n columnId,\n rowIdentityAccessor,\n },\n });\n }\n }\n\n function getCellValue<T extends TType>(cell: ReactTableCell<T, unknown>): unknown | undefined {\n return state.changes.rows?.[cell.row.id]?.[cell.column.id];\n }\n\n function getCellError<T extends TType>(cell: ReactTableCell<T, unknown>): string | undefined {\n return state.changes.errors?.[cell.row.id]?.cells?.[cell.column.id];\n }\n\n async function onCellChanged<T extends TType>(cell: ReactTableCell<T, unknown>, rowIndex: number) {\n const changes = state.changes.rows[cell.row.id];\n\n if (!changes) {\n return;\n }\n\n let updatesForOtherCells: Partial<T> = {};\n\n // run the updater handler if there is one, to see if there are any other cells to update\n if (typeof handleChange === 'function') {\n const previousRowValue = {\n ...state.changes.originals[cell.row.id],\n //...getRowChangeset(updatersRef.current[cell.row.id], rowIdentityAccessor),\n };\n const nextRowValue = {\n ...state.changes.originals[cell.row.id],\n ...changes,\n };\n updatesForOtherCells = ((await handleChange(\n cell.column.id,\n changes[cell.column.id],\n nextRowValue,\n previousRowValue\n )) ?? {}) as Partial<T>;\n }\n\n // create a projection of the next state, so we can act against it\n const nextChanges = { ...state.changes.rows[cell.row.id], ...updatesForOtherCells };\n const nextMoveReasons: EditingRowMoveReason = { ...state.changes.moveReasons[cell.row.id] };\n const nextCellErrors: Record<string, string> = { ...state.changes.errors[cell.row.id]?.cells };\n\n // run validation\n let validationErrors: Record<string, string> = {};\n\n if (validator) {\n const nextRowValue = { ...state.changes.originals[cell.row.id], ...changes, ...updatesForOtherCells };\n validationErrors = ((await validator(nextRowValue)) ?? {}) as Record<string, string>;\n }\n\n // only set errors and move reasons for the cells we're currently acting on\n // why? because the UX is not good if we set them for cells the user hasn't touched yet\n const cellsToActOn = [cell.column.id, ...Object.keys(updatesForOtherCells)];\n const allCells = cell.row._getAllCellsByColumnId();\n\n cellsToActOn.forEach(accessor => {\n if (validationErrors[accessor]) {\n nextCellErrors[accessor] = validationErrors[accessor];\n // don't show move indicator for cells with errors, they aren't valid and can't be saved\n delete nextMoveReasons[accessor];\n } else {\n // there isn't any error in this run, remove any error set in state\n delete nextCellErrors[accessor];\n\n if (allCells[accessor]?.column.getIsSorted()) {\n // run row move determination\n const reason = willRowMove(cell, nextChanges[accessor], rowIndex, localization);\n\n // if the row will move based on this change save why, otherwise delete any existing state\n if (reason) {\n nextMoveReasons[accessor] = reason;\n } else {\n delete nextMoveReasons[accessor];\n }\n }\n }\n });\n\n dispatch({\n type: 'updateRow',\n rowId: cell.row.id,\n payload: {\n cellErrors: nextCellErrors,\n moveReasons: nextMoveReasons,\n value: nextChanges,\n },\n });\n }\n\n // general\n function getErrorsShownInAlert<T extends TType>() {\n const rowsWithErrors = Object.keys(state.changes.errors);\n\n if (!rowsWithErrors.length) {\n return [];\n }\n\n return rowsWithErrors.filter(hasRowErrorsShownInAlert).map(rowId => ({\n rowId,\n changes: state.changes.rows[rowId] as EditingChangeset<T>,\n errors: state.changes.errors[rowId],\n }));\n }\n\n function hasSaved() {\n return !!Object.values(state.changes.status).filter(value => value === 'saved').length;\n }\n\n function hasChanges(rowId?: string) {\n return rowId ? !!state.changes.rows[rowId] : !!Object.keys(state.changes.rows).length;\n }\n\n async function saveChanges<T extends TType>(table: ReactTable<T>, rowId: string | undefined = undefined): Promise<boolean> {\n if (!handleSave) {\n console.warn('Tried to save, but Table has no onEditingSave handler');\n return false;\n }\n\n // sometimes we only want to save one row\n const changes = rowId ? { [rowId]: state.changes.rows[rowId] } : state.changes.rows;\n\n let completed = true;\n\n for (const rowId of Object.keys(changes)) {\n const status = getRowStatus(rowId);\n\n try {\n // don't try to save if - already saving, or there are known errors\n if (status === 'saving' || status === 'errored') {\n continue;\n }\n\n setRowStatus(rowId, 'saving');\n\n const changeSet = { ...state.changes.originals[rowId], ...changes[rowId] };\n\n // if we had to create a temporary id, delete it first - it's our data, not theirs\n if (changeSet[rowIdentityAccessor as string]?.startsWith(TEMPORARY_ROW_ID_PREFIX)) {\n delete changeSet[rowIdentityAccessor];\n }\n\n // re-run validation, maybe a cell is already invalid but has never been blurred\n if (validator) {\n const errors = await validator(changeSet);\n\n if (errors && Object.keys(errors).length) {\n throw errors;\n }\n }\n\n // send new data to the server\n await handleSave(changeSet);\n\n // cleanup changes, we don't need them after saving\n discardChanges(rowId, table);\n\n // show the saved status, then remove it after a delay\n setRowStatus(rowId, 'saved');\n setTimeout(() => {\n setRowStatus(rowId, undefined);\n }, DELAY_BEFORE_REMOVING_SAVE_STATUS);\n } catch (error) {\n if (error instanceof ReferenceError || error instanceof TypeError || (error as any)?.response?.status >= 500) {\n console.error(error);\n }\n\n // the onEditingSave handler should throw errors when something fails, e.g. validation, network errors etc\n // this code handles those errors and maps them either to row errors or cell specific errors\n let rowError: string | undefined;\n let cellErrors;\n\n if (typeof error === 'string') {\n rowError = error;\n } else if (error instanceof Error) {\n rowError = error.message;\n\n // most of our apis return error objects within this shape\n if (typeof (error as any).response?.data === 'object') {\n cellErrors = (error as any).response?.data;\n }\n } else if (typeof error === 'object') {\n cellErrors = error;\n }\n\n if (rowError || cellErrors) {\n dispatch({\n type: 'setRowErrors',\n rowId,\n payload: {\n row: rowError,\n cells: cellErrors,\n shouldShowErrorAlert: true,\n },\n });\n }\n\n setRowStatus(rowId, 'errored');\n completed = false;\n }\n }\n\n return completed;\n }\n\n function discardChanges<T extends TType>(rowId: string, table: ReactTable<T>) {\n // remove any new rows from pinned state before discarding them\n table.resetRowPinning(true);\n\n dispatch({\n type: 'removeRow',\n rowId,\n payload: { rowIdentityAccessor },\n });\n }\n\n return {\n // row\n setRowValue,\n getRowValue,\n getRowMoveReason,\n hasRowErrors,\n hasRowErrorsShownInAlert,\n getRowStatus,\n setRowStatus,\n // cells\n setCellValue,\n getCellValue,\n getCellError,\n onCellChanged,\n // general\n getErrorsShownInAlert,\n hasChanges,\n saveChanges,\n discardChanges,\n hasSaved,\n // new rows\n createRow,\n temporaryRows: state.temporaryRows,\n };\n}\n"],"names":["TEMPORARY_ROW_ID_PREFIX","DELAY_BEFORE_REMOVING_SAVE_STATUS","reducer","state","action","type","rowId","payload","columnId","row","value","changes","rows","setWith","Object","originals","rowIdentityAccessor","omit","keys","length","errors","moveReasons","cellErrors","original","cells","status","undefined","temporaryRows","filter","concat","usePendingChangesState","handleSave","handleChange","validator","saveChanges","table","console","warn","Promise","resolve","completed","_temp9","_forOf","getRowStatus","_catch","_changeSet$rowIdentit","_temp8","_result","_exit","changeSet","then","discardChanges","setRowStatus","setTimeout","startsWith","_temp7","error","_error$response","ReferenceError","TypeError","response","rowError","Error","_error$response2","message","data","_error$response3","dispatch","shouldShowErrorAlert","_result3","e","reject","onCellChanged","cell","rowIndex","cellsToActOn","column","id","updatesForOtherCells","allCells","_getAllCellsByColumnId","forEach","accessor","validationErrors","nextCellErrors","nextMoveReasons","_allCells$accessor","getIsSorted","reason","willRowMove","nextChanges","localization","_state$changes$errors8","_temp3","nextRowValue","_validator2","_temp4","_temp5","previousRowValue","_handleChange","_temp6","createRow","newRowId","uuid","setRowValue","_temp","_validator","_temp2","useLocalization","React","useReducer","getRowValue","_state$changes$rows$r","_state$changes$rows","getRowMoveReason","_Object$values$","values","_state$changes$moveRe","_state$changes$moveRe2","hasRowErrors","_state$changes$errors","_state$changes$errors2","_state$changes$errors3","hasRowErrorsShownInAlert","_state$changes$errors4","setCellValue","getCellValue","_state$changes$rows2","_state$changes$rows2$","getCellError","_state$changes$errors5","_state$changes$errors6","_state$changes$errors7","getErrorsShownInAlert","rowsWithErrors","map","hasSaved","hasChanges","resetRowPinning"],"mappings":";;;;;;;;MASaA,uBAAuB,GAAG;AAEvC,MAAMC,iCAAiC,GAAG,IAAI;AAkC9C,SAASC,OAAOA,CAAkBC,KAA0B,EAAEC,MAA0B;EACpF,MAAM;IAAEC,IAAI;IAAEC,KAAK;IAAEC;GAAS,GAAGH,MAAM;EAEvC,QAAQC,IAAI;IACR,KAAK,cAAc;MAAE;QACjB,MAAM;UAAEG,QAAQ;UAAEC,GAAG;UAAEC;SAAO,GAAGH,OAAO;QACxC,OAAO;UACH,GAAGJ,KAAK;UACRQ,OAAO,EAAE;YACL,GAAGR,KAAK,CAACQ,OAAO;YAChBC,IAAI,EAAEC,OAAO,CAACV,KAAK,CAACQ,OAAO,CAACC,IAAI,EAAE,GAAGN,KAAK,IAAIE,QAAQ,EAAE,EAAEE,KAAK,EAAEI,MAAM,CAAC;YACxEC,SAAS,EAAEF,OAAO,CAACV,KAAK,CAACQ,OAAO,CAACI,SAAS,EAAET,KAAK,EAAEG,GAAG,EAAEK,MAAM;;SAErE;;IAGL,KAAK,iBAAiB;MAAE;QACpB,MAAM;UAAEN,QAAQ;UAAEQ;SAAqB,GAAGT,OAAO;QACjD,MAAMI,OAAO,GAAGM,IAAI,CAACd,KAAK,CAACQ,OAAO,CAACC,IAAI,EAAE,GAAGN,KAAK,IAAIE,QAAQ,EAAE,CAAC;;QAGhE,IAAI,CAACM,MAAM,CAACI,IA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