arengibook 3.1.281-main → 3.1.283-main

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.
Files changed (2) hide show
  1. package/dist/index.js +51 -12
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -55361,6 +55361,7 @@ var SelfEditableCell = function SelfEditableCell(_ref11) {
55361
55361
  localValueRef.current = localValue;
55362
55362
  }, [localValue]);
55363
55363
  useEffect(function () {
55364
+ console.log('[sync-effect] field=', col.field, '| isRowEditing=', isRowEditing, '| editing=', editing);
55364
55365
  if (isRowEditing && !editing) {
55365
55366
  committedRef.current = false;
55366
55367
  daySelectedRef.current = false;
@@ -55372,17 +55373,29 @@ var SelfEditableCell = function SelfEditableCell(_ref11) {
55372
55373
  // eslint-disable-next-line react-hooks/exhaustive-deps
55373
55374
  }, [isRowEditing]);
55374
55375
  var commit = useCallback(function (val) {
55376
+ console.log('[commit] APPEL | val=', val, '| committedRef=', committedRef.current, '| editing=', editing, '| isRowEditing=', isRowEditing, '| field=', col.field);
55375
55377
  pendingValRef.current = val;
55376
55378
  clearTimeout(commitTimerRef.current);
55377
55379
  commitTimerRef.current = setTimeout(function () {
55378
- if (committedRef.current) return;
55380
+ console.log('[commit:tick] | committedRef=', committedRef.current, '| pending=', pendingValRef.current, '| field=', col.field);
55381
+ if (committedRef.current) {
55382
+ console.log('[commit:tick] ⛔ AVALÉ (committedRef déjà true) | field=', col.field);
55383
+ return;
55384
+ }
55379
55385
  committedRef.current = true;
55380
55386
  var v = pendingValRef.current;
55387
+ console.log('[commit:tick] ✅ → onSave(', v, ') | field=', col.field);
55381
55388
  onSave(v);
55382
55389
  setLocalValue(v);
55383
- if (!isRowEditing) setEditing(false);else committedRef.current = false;
55390
+ if (!isRowEditing) {
55391
+ console.log('[commit:tick] → setEditing(false) | field=', col.field);
55392
+ setEditing(false);
55393
+ } else {
55394
+ committedRef.current = false;
55395
+ }
55384
55396
  }, 0);
55385
- }, [isRowEditing, onSave]);
55397
+ // eslint-disable-next-line react-hooks/exhaustive-deps
55398
+ }, [isRowEditing, onSave, editing, col.field]);
55386
55399
  useEffect(function () {
55387
55400
  if (!editing || isRowEditing || col.type === 'date') return;
55388
55401
  var handler = function handler(e) {
@@ -55401,6 +55414,7 @@ var SelfEditableCell = function SelfEditableCell(_ref11) {
55401
55414
  return /*#__PURE__*/React__default.createElement("div", {
55402
55415
  onClick: function onClick(e) {
55403
55416
  if (editable && !e.target.closest('.ghost-btnBox')) {
55417
+ console.log('[open] CLIC ouverture | field=', col.field, '| committedRef reset→false, daySelectedRef reset→false');
55404
55418
  committedRef.current = false;
55405
55419
  daySelectedRef.current = false;
55406
55420
  setEditing(true);
@@ -55485,23 +55499,44 @@ var SelfEditableCell = function SelfEditableCell(_ref11) {
55485
55499
  var parsed = parseDateAuto(localValue);
55486
55500
  var dateObj = (_parsed$date = parsed === null || parsed === void 0 ? void 0 : parsed.date) !== null && _parsed$date !== void 0 ? _parsed$date : new Date();
55487
55501
  var primeFormat = col.dbDateFormat ? dbDateFormatToPrime(col.dbDateFormat) : (_parsed$primeFormat = parsed === null || parsed === void 0 ? void 0 : parsed.primeFormat) !== null && _parsed$primeFormat !== void 0 ? _parsed$primeFormat : 'dd/mm/yy';
55488
- var commitDate = function commitDate(v) {
55489
- committedRef.current = true;
55490
- onSave(v);
55491
- setLocalValue(v);
55492
- if (!isRowEditing) setEditing(false);else committedRef.current = false;
55493
- };
55502
+ console.log('[date:render] field=', col.field, '| localValue=', localValue, '| parsed=', parsed, '| primeFormat=', primeFormat, '| committedRef=', committedRef.current, '| daySelectedRef=', daySelectedRef.current);
55494
55503
  return /*#__PURE__*/React__default.createElement("div", {
55495
55504
  ref: containerRef
55496
55505
  }, /*#__PURE__*/React__default.createElement(DatePicker, {
55497
55506
  value: dateObj,
55498
55507
  dateFormat: primeFormat,
55499
55508
  onChange: function onChange(e) {
55500
- daySelectedRef.current = true;
55501
- commitDate(e.value ? fmtDateISO(e.value, primeFormat) : null);
55509
+ console.log('[date:onChange] field=', col.field, '| e.value=', e.value, '| typeof=', _typeof$g(e.value), '| instanceof Date=', e.value instanceof Date);
55510
+ if (e.value) {
55511
+ daySelectedRef.current = true;
55512
+ var iso = fmtDateISO(e.value, primeFormat);
55513
+ console.log('[date:onChange] → commit(', iso, ')');
55514
+ commit(iso);
55515
+ } else {
55516
+ console.log('[date:onChange] e.value falsy → aucun commit');
55517
+ }
55518
+ },
55519
+ onSelect: function onSelect(date, meta) {
55520
+ console.log('[date:onSelect] field=', col.field, '| date=', date, '| meta=', meta);
55521
+ if ((meta === null || meta === void 0 ? void 0 : meta.type) === 'clear') {
55522
+ daySelectedRef.current = true;
55523
+ console.log('[date:onSelect] clear → commit(null)');
55524
+ commit(null);
55525
+ } else if (date) {
55526
+ daySelectedRef.current = true;
55527
+ var iso = fmtDateISO(date, primeFormat);
55528
+ console.log('[date:onSelect] → commit(', iso, ')');
55529
+ commit(iso);
55530
+ } else {
55531
+ console.log('[date:onSelect] ni clear ni date → rien');
55532
+ }
55502
55533
  },
55503
55534
  onPanelHide: function onPanelHide() {
55504
- if (!daySelectedRef.current && !isRowEditing) setEditing(false);
55535
+ console.log('[date:onPanelHide] field=', col.field, '| daySelectedRef=', daySelectedRef.current, '| isRowEditing=', isRowEditing);
55536
+ if (!daySelectedRef.current && !isRowEditing) {
55537
+ console.log('[date:onPanelHide] → setEditing(false)');
55538
+ setEditing(false);
55539
+ }
55505
55540
  daySelectedRef.current = false;
55506
55541
  }
55507
55542
  }));
@@ -55775,10 +55810,12 @@ var Table$1 = function Table(_ref13) {
55775
55810
  });
55776
55811
  };
55777
55812
  var updateRow = useCallback(function (rowId, field, newVal) {
55813
+ console.log('[updateRow] APPEL | rowId=', rowId, '| field=', field, '| newVal=', newVal);
55778
55814
  setData(function (prev) {
55779
55815
  var updated = prev.map(function (row) {
55780
55816
  return row.id === rowId ? _objectSpread2(_objectSpread2({}, row), {}, _defineProperty$g({}, field, newVal)) : row;
55781
55817
  });
55818
+ console.log('[updateRow] → onChange?(updated) | typeof onChange=', _typeof$g(onChange));
55782
55819
  onChange === null || onChange === void 0 || onChange(updated);
55783
55820
  return updated;
55784
55821
  });
@@ -56932,6 +56969,7 @@ var Table$1 = function Table(_ref13) {
56932
56969
  isRowEditing: !!editingRows[rowData.id],
56933
56970
  onSave: function onSave(v) {
56934
56971
  var _onCellChangeRef$curr2;
56972
+ console.log('[onSave inline] field=', col.field, '| v=', v, '| rowId=', rowData.id);
56935
56973
  var enrichedFields = _defineProperty$g({}, col.field, v);
56936
56974
  if (col.updates) {
56937
56975
  var _col$options8;
@@ -56951,6 +56989,7 @@ var Table$1 = function Table(_ref13) {
56951
56989
  var updated = prev.map(function (r) {
56952
56990
  return r.id === rowData.id ? _objectSpread2(_objectSpread2({}, r), enrichedFields) : r;
56953
56991
  });
56992
+ console.log('[onSave inline] → onChange?(updated) | typeof onChange=', _typeof$g(onChange));
56954
56993
  onChange === null || onChange === void 0 || onChange(updated);
56955
56994
  return updated;
56956
56995
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "3.1.281-main",
4
+ "version": "3.1.283-main",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {