arengibook 3.4.6-main → 3.4.8-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 +91 -11
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -13904,9 +13904,34 @@ var css_248z$7 = "@charset \"UTF-8\";\n@keyframes fadeIn {\n from {\n opacit
13904
13904
  styleInject(css_248z$7);
13905
13905
 
13906
13906
  var _excluded$4 = ["value", "onChange", "placeholder", "dateFormat", "displayMask", "view", "invalid", "errorMessage", "disabled", "locale", "showTime", "showIcon", "icon", "iconBgButton", "iconPos", "name", "id", "fullWidth", "inputProps", "onBlur", "onSelect", "onClick", "showClear", "reopenOnClick", "autoOpen", "invalidDateMessage", "onPanelShow", "onPanelHide"];
13907
+
13908
+ // AAAA-MM-JJ, éventuellement suivi d'une heure et d'un décalage numérique (±hh:mm, ±hhmm).
13909
+ // Un suffixe « Z » est exclu exprès (voir normalizeDate).
13910
+ var DATE_ECRITE = /^(\d{4})-(\d{2})-(\d{2})(?:[T ]\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:[+-]\d{2}:?\d{2})?)?$/;
13911
+
13912
+ /**
13913
+ * Convertit la prop `value` en Date.
13914
+ *
13915
+ * Sans heure (`showTime` à false), la valeur est une date du calendrier, pas un instant :
13916
+ * on garde le jour écrit dans la chaîne au lieu de laisser `new Date()` la convertir dans
13917
+ * le fuseau du navigateur. Sinon « 2026-08-05T00:00:00+02:00 » (Twig `|date('c')`)
13918
+ * s'affiche 04/08 dans un navigateur en UTC, et « 2026-08-05 », lu en UTC par la norme,
13919
+ * s'affiche 04/08 aux Amériques (MEP-1054).
13920
+ *
13921
+ * Une chaîne en « Z » reste lue comme un instant : c'est ce que produit
13922
+ * `new Date(a, m, j).toISOString()` côté navigateur (minuit local écrit en UTC, par ex.
13923
+ * « 2026-08-04T22:00:00.000Z » pour le 05/08 à Paris), et le relire tel qu'écrit ferait
13924
+ * reculer d'un jour.
13925
+ */
13907
13926
  var normalizeDate = function normalizeDate(v) {
13927
+ var showTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
13908
13928
  if (!v) return null;
13909
- return v instanceof Date ? v : new Date(v);
13929
+ if (v instanceof Date) return v;
13930
+ if (!showTime && typeof v === 'string') {
13931
+ var m = DATE_ECRITE.exec(v.trim());
13932
+ if (m) return new Date(+m[1], +m[2] - 1, +m[3]);
13933
+ }
13934
+ return new Date(v);
13910
13935
  };
13911
13936
  var CustomCalendar = /*#__PURE__*/forwardRef(function (props, ref) {
13912
13937
  return /*#__PURE__*/React__default.createElement(Calendar, _extends$G({}, props, {
@@ -13959,13 +13984,13 @@ var DatePicker = function DatePicker(_ref) {
13959
13984
  onPanelHide = _ref.onPanelHide,
13960
13985
  rest = _objectWithoutProperties$1(_ref, _excluded$4);
13961
13986
  var _useState = useState(function () {
13962
- return normalizeDate(value);
13987
+ return normalizeDate(value, showTime);
13963
13988
  }),
13964
13989
  _useState2 = _slicedToArray$b(_useState, 2),
13965
13990
  valeur = _useState2[0],
13966
13991
  setValeur = _useState2[1];
13967
13992
  var _useState3 = useState(function () {
13968
- return normalizeDate(value) || new Date();
13993
+ return normalizeDate(value, showTime) || new Date();
13969
13994
  }),
13970
13995
  _useState4 = _slicedToArray$b(_useState3, 2),
13971
13996
  viewDate = _useState4[0],
@@ -14052,12 +14077,12 @@ var DatePicker = function DatePicker(_ref) {
14052
14077
  }
14053
14078
  }, [iconBgButton]);
14054
14079
  useEffect(function () {
14055
- var normalized = normalizeDate(value);
14080
+ var normalized = normalizeDate(value, showTime);
14056
14081
  setValeur(normalized);
14057
14082
  if (normalized) {
14058
14083
  setViewDate(normalized);
14059
14084
  }
14060
- }, [value]);
14085
+ }, [value, showTime]);
14061
14086
  useEffect(function () {
14062
14087
  if (inputRef.current) {
14063
14088
  Object.entries(inputProps).forEach(function (_ref2) {
@@ -14470,9 +14495,9 @@ var DatePicker = function DatePicker(_ref) {
14470
14495
  setStory("date");
14471
14496
  setMode('date');
14472
14497
  setValeur(function () {
14473
- return normalizeDate(value);
14498
+ return normalizeDate(value, showTime);
14474
14499
  });
14475
- syncInputText(normalizeDate(value));
14500
+ syncInputText(normalizeDate(value, showTime));
14476
14501
  if (calendarRef.current) {
14477
14502
  calendarRef.current.hide();
14478
14503
  }
@@ -54230,6 +54255,10 @@ styleInject(css_248z$2);
54230
54255
  * Retirer un ∞ rend exactement l'état d'avant sa pose. Sortie : `onChange` (rattachements, parents ∞
54231
54256
  * compris) + `onInducedChange` (les parents en ∞).
54232
54257
  *
54258
+ * Sélection en cascade (`cascadeSelection`, mode checkbox hors induit) : cocher un parent coche toute
54259
+ * sa descendance ; décocher un nœud décoche sa descendance ET tous ses ancêtres (un parent coché veut
54260
+ * dire « tout ce qui est dessous l'est aussi »). Cocher tous les enfants ne coche pas le parent.
54261
+ *
54233
54262
  * Le style (SCSS) ne définit que le chrome neutre : toutes les couleurs de
54234
54263
  * périmètre sont dérivées à l'exécution à partir de `node.color`.
54235
54264
  *
@@ -54661,6 +54690,8 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
54661
54690
  showChildrenCount = _ref2$showChildrenCou === void 0 ? true : _ref2$showChildrenCou,
54662
54691
  _ref2$showExpand = _ref2.showExpand,
54663
54692
  showExpand = _ref2$showExpand === void 0 ? true : _ref2$showExpand,
54693
+ _ref2$cascadeSelectio = _ref2.cascadeSelection,
54694
+ cascadeSelection = _ref2$cascadeSelectio === void 0 ? false : _ref2$cascadeSelectio,
54664
54695
  _ref2$induced = _ref2.induced,
54665
54696
  induced = _ref2$induced === void 0 ? false : _ref2$induced,
54666
54697
  inducedValue = _ref2.inducedValue,
@@ -54695,6 +54726,7 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
54695
54726
  _ref2.appendTo;
54696
54727
  var checkboxMode = selectionMode === 'checkbox';
54697
54728
  var inducedMode = induced && checkboxMode;
54729
+ var cascadeMode = cascadeSelection && checkboxMode && !inducedMode;
54698
54730
  var inert = disabled || loading; // champ non interactif
54699
54731
 
54700
54732
  // Chargement asynchrone (lazy) : enfants chargés à la demande sur les nœuds `lazy: true`.
@@ -54896,6 +54928,27 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
54896
54928
  return statusOf(id, set, rules) !== 'none';
54897
54929
  };
54898
54930
 
54931
+ // --- Sélection en cascade ---
54932
+ var ancestorIds = function ancestorIds(id) {
54933
+ var out = [];
54934
+ var cur = parentMap[id];
54935
+ while (cur) {
54936
+ out.push(cur);
54937
+ cur = parentMap[cur];
54938
+ }
54939
+ return out;
54940
+ };
54941
+ // Décoche le nœud, sa descendance et ses ancêtres (mutation de `set`).
54942
+ var removeCascade = function removeCascade(set, node) {
54943
+ set["delete"](node.id);
54944
+ valueIdsInclusive(node, []).forEach(function (id) {
54945
+ return set["delete"](id);
54946
+ });
54947
+ ancestorIds(node.id).forEach(function (id) {
54948
+ return set["delete"](id);
54949
+ });
54950
+ };
54951
+
54899
54952
  // Recherche débouncée (filterDelay).
54900
54953
  var _useState27 = useState(''),
54901
54954
  _useState28 = _slicedToArray$b(_useState27, 2),
@@ -55128,7 +55181,12 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55128
55181
  setDraft(function (prev) {
55129
55182
  var n = new Set(prev);
55130
55183
  ids.forEach(function (id) {
55131
- if (all) n["delete"](id);else if (!isIncluded(id)) n.add(id);
55184
+ if (all) {
55185
+ n["delete"](id);
55186
+ if (cascadeMode) ancestorIds(id).forEach(function (a) {
55187
+ return n["delete"](a);
55188
+ }); // cascade : les ancêtres partent avec
55189
+ } else if (!isIncluded(id)) n.add(id);
55132
55190
  });
55133
55191
  return n;
55134
55192
  });
@@ -55149,6 +55207,12 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55149
55207
  var toggleElement = function toggleElement(node) {
55150
55208
  return setDraft(function (prev) {
55151
55209
  var n = new Set(prev);
55210
+ if (cascadeMode) {
55211
+ if (n.has(node.id)) removeCascade(n, node);else valueIdsInclusive(node, []).forEach(function (id) {
55212
+ return n.add(id);
55213
+ });
55214
+ return n;
55215
+ }
55152
55216
  n.has(node.id) ? n["delete"](node.id) : n.add(node.id);
55153
55217
  return n;
55154
55218
  });
@@ -55274,6 +55338,19 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55274
55338
  setLazyChildren(function (p) {
55275
55339
  return _objectSpread2(_objectSpread2({}, p), {}, _defineProperty$e({}, node.id, kids || []));
55276
55340
  });
55341
+ // Cascade : un parent déjà coché coche aussi les enfants qui arrivent.
55342
+ if (cascadeMode) {
55343
+ setDraft(function (p) {
55344
+ if (!p.has(node.id)) return p;
55345
+ var n = new Set(p);
55346
+ (kids || []).forEach(function (k) {
55347
+ return valueIdsInclusive(k, []).forEach(function (id) {
55348
+ return n.add(id);
55349
+ });
55350
+ });
55351
+ return n;
55352
+ });
55353
+ }
55277
55354
  setLoadingIds(function (p) {
55278
55355
  var n = new Set(p);
55279
55356
  n["delete"](node.id);
@@ -55298,7 +55375,8 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55298
55375
  };
55299
55376
  var removeChip = function removeChip(id) {
55300
55377
  var n = new Set(committed);
55301
- n["delete"](id);
55378
+ var chipNode = cascadeMode ? findNode(data, id) : null;
55379
+ if (chipNode) removeCascade(n, chipNode);else n["delete"](id);
55302
55380
  var r = new Set(committedRules);
55303
55381
  r["delete"](id);
55304
55382
  setCommitted(n, r);
@@ -55600,7 +55678,7 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55600
55678
  onMouseEnter: function onMouseEnter(e) {
55601
55679
  // Aperçu de sélection : uniquement pour un nœud « value » sélectionnable.
55602
55680
  if (isValue && !locked && selectableNode && !isCov) setPreview({
55603
- kind: inducedMode && hasChildren ? 'tout' : 'element',
55681
+ kind: (inducedMode || cascadeMode) && hasChildren ? 'tout' : 'element',
55604
55682
  id: node.id
55605
55683
  });
55606
55684
  // Fil d'Ariane : sur TOUTES les options (feuilles comprises) quand showChipPath
@@ -55620,7 +55698,9 @@ var TreeSelectMaquette = function TreeSelectMaquette(_ref2) {
55620
55698
  } else if (isRule) showTooltip(e, "Induit \xB7 ".concat(node.label), "Rattach\xE9 \xE0 ".concat(node.label, " seul. Ses enfants en d\xE9coulent. Cliquer le nom : passe en explicite."), ariane);else if (hasChildren) showTooltip(e, "Explicite \xB7 ".concat(node.label), "".concat(node.label, " et ses enfants d'aujourd'hui, nomm\xE9s un par un."), ariane);else showTooltip(e, node.label, "Rattache ".concat(node.label, "."), ariane);
55621
55699
  return;
55622
55700
  }
55623
- if (checkboxMode) showTooltip(e, "\xC9l\xE9ment \xB7 ".concat(node.label), "Coche ".concat(node.label, " seul, comme valeur, sans toucher les enfants."), ariane);else if (selectionMode === 'single') showTooltip(e, node.label, "S\xE9lectionne ".concat(node.label, "."), ariane);else showTooltip(e, node.label, "S\xE9lectionne ou retire ".concat(node.label, "."), ariane);
55701
+ if (cascadeMode) {
55702
+ if (hasChildren) showTooltip(e, node.label, "Coche ".concat(node.label, " et toute sa descendance. D\xE9cocher un enfant d\xE9coche ").concat(node.label, "."), ariane);else showTooltip(e, node.label, "Coche ".concat(node.label, ". Le d\xE9cocher d\xE9coche aussi ses parents."), ariane);
55703
+ } else if (checkboxMode) showTooltip(e, "\xC9l\xE9ment \xB7 ".concat(node.label), "Coche ".concat(node.label, " seul, comme valeur, sans toucher les enfants."), ariane);else if (selectionMode === 'single') showTooltip(e, node.label, "S\xE9lectionne ".concat(node.label, "."), ariane);else showTooltip(e, node.label, "S\xE9lectionne ou retire ".concat(node.label, "."), ariane);
55624
55704
  },
55625
55705
  onMouseLeave: function onMouseLeave() {
55626
55706
  if (isValue) setPreview(null);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "3.4.6-main",
4
+ "version": "3.4.8-main",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {