arengibook 2.4.604 → 2.4.606

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 +45 -18
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -35963,7 +35963,7 @@ var Dropdown = function Dropdown(_ref) {
35963
35963
  _ref$objValue = _ref.objValue,
35964
35964
  objValue = _ref$objValue === void 0 ? null : _ref$objValue,
35965
35965
  _ref$placeholder = _ref.placeholder,
35966
- placeholder = _ref$placeholder === void 0 ? 'Sélectionnez une option' : _ref$placeholder,
35966
+ placeholder = _ref$placeholder === void 0 ? null : _ref$placeholder,
35967
35967
  _ref$disabled = _ref.disabled,
35968
35968
  disabled = _ref$disabled === void 0 ? false : _ref$disabled,
35969
35969
  _ref$filter = _ref.filter,
@@ -35984,6 +35984,8 @@ var Dropdown = function Dropdown(_ref) {
35984
35984
  onChange = _ref.onChange,
35985
35985
  _ref$optionStyle = _ref.optionStyle,
35986
35986
  optionStyle = _ref$optionStyle === void 0 ? {} : _ref$optionStyle,
35987
+ _ref$editable = _ref.editable,
35988
+ editable = _ref$editable === void 0 ? false : _ref$editable,
35987
35989
  name = _ref.name,
35988
35990
  _ref$showClear = _ref.showClear,
35989
35991
  showClear = _ref$showClear === void 0 ? false : _ref$showClear,
@@ -36018,7 +36020,7 @@ var Dropdown = function Dropdown(_ref) {
36018
36020
  _useState6 = _slicedToArray$8(_useState5, 2),
36019
36021
  loadedOptions = _useState6[0],
36020
36022
  setLoadedOptions = _useState6[1];
36021
- var isOptionLoadFunction = typeof options === 'function';
36023
+ var isOptionLoadFunction = typeof options === 'function'; // (détecte si l'option est une fonction donc fonction asynchrone)
36022
36024
  var filterRef = useRef('');
36023
36025
  var dropdownRef = useRef(null);
36024
36026
  var _useState7 = useState(null),
@@ -36027,6 +36029,7 @@ var Dropdown = function Dropdown(_ref) {
36027
36029
  setValueToOptionMap = _useState8[1];
36028
36030
  useEffect(function () {
36029
36031
  if (isOptionLoadFunction && objValue && isSelectMeta) {
36032
+ console.log("objValue");
36030
36033
  setValueToOptionMap(objValue);
36031
36034
  }
36032
36035
  var handleScroll = function handleScroll(e) {
@@ -36058,10 +36061,14 @@ var Dropdown = function Dropdown(_ref) {
36058
36061
  setLoading(true);
36059
36062
  _context.p = 1;
36060
36063
  _context.n = 2;
36061
- return options();
36064
+ return options('', [], {
36065
+ page: 1
36066
+ });
36062
36067
  case 2:
36063
36068
  result = _context.v;
36064
36069
  setLoadedOptions(Array.isArray(result.options) ? result.options : []);
36070
+ console.log(loadedOptions);
36071
+ console.log(loadedOptions.length);
36065
36072
  _context.n = 4;
36066
36073
  break;
36067
36074
  case 3:
@@ -36128,6 +36135,8 @@ var Dropdown = function Dropdown(_ref) {
36128
36135
  var styleLabel = {
36129
36136
  marginLeft: '10px'
36130
36137
  };
36138
+ var virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
36139
+ if (virtualscroll) virtualscroll.style.height = "auto";
36131
36140
  return /*#__PURE__*/React__default.createElement("div", {
36132
36141
  className: "flex align-items-center",
36133
36142
  style: {
@@ -36206,7 +36215,8 @@ var Dropdown = function Dropdown(_ref) {
36206
36215
  return _regenerator().w(function (_context2) {
36207
36216
  while (1) switch (_context2.n) {
36208
36217
  case 0:
36209
- if (isOptionLoadFunction) {
36218
+ console.log('onLazyLoad appelé avec :', event);
36219
+ if (!(!isOptionLoadFunction || loading)) {
36210
36220
  _context2.n = 1;
36211
36221
  break;
36212
36222
  }
@@ -36237,7 +36247,7 @@ var Dropdown = function Dropdown(_ref) {
36237
36247
  _context2.p = 5;
36238
36248
  setLoading(false);
36239
36249
  virtualscroll = document.querySelector('.p-virtualscroller.p-dropdown-items-wrapper');
36240
- virtualscroll.style.height = "auto";
36250
+ if (virtualscroll) virtualscroll.style.height = "auto";
36241
36251
  return _context2.f(5);
36242
36252
  case 6:
36243
36253
  return _context2.a(2);
@@ -36342,19 +36352,30 @@ var Dropdown = function Dropdown(_ref) {
36342
36352
  itemTemplate: optionTemplate,
36343
36353
  valueTemplate: valueTemplate,
36344
36354
  showClear: showClear,
36345
- optionGroupTemplate: isGroupedOption ? groupedItemTemplate : null
36355
+ optionGroupTemplate: isGroupedOption ? groupedItemTemplate : null,
36356
+ editable: editable
36346
36357
  }, isGroupedOption && {
36347
36358
  optionGroupLabel: 'label',
36348
36359
  optionGroupChildren: 'items'
36349
36360
  }, (isSelectMeta || isOptionLoadFunction) && {
36350
- virtualScrollerOptions: {
36351
- lazy: true,
36352
- onLazyLoad: onLazyLoad,
36353
- itemSize: 38,
36354
- showLoader: true,
36355
- loading: loading,
36356
- delay: 250
36357
- }
36361
+ /* virtualScrollerOptions: {
36362
+ onLazyLoad: onLazyLoad,
36363
+ itemSize: 38,
36364
+ lazy: false,
36365
+ showLoader: false,
36366
+ loading: loading,
36367
+ totalrecords: 17,
36368
+ }, */
36369
+
36370
+ /* virtualScrollerOptions: {
36371
+ lazy: true,
36372
+ onLazyLoad: onLazyLoad,
36373
+ itemSize: 0,
36374
+ showLoader: true,
36375
+ loading: false,
36376
+ delay: 0,
36377
+ totalrecords: 0,
36378
+ }, */
36358
36379
  })), name && /*#__PURE__*/React__default.createElement("input", {
36359
36380
  type: "hidden",
36360
36381
  name: name,
@@ -36491,6 +36512,7 @@ var DropdownPresets = {
36491
36512
  placeholder: 'Sélectionnez une couleur',
36492
36513
  options: optionsWithColors,
36493
36514
  isSelectMeta: true,
36515
+ editable: true,
36494
36516
  selectMetaConfig: {
36495
36517
  generalIcon: 'pi pi-circle-fill'
36496
36518
  },
@@ -36505,9 +36527,14 @@ var DropdownPresets = {
36505
36527
  }
36506
36528
  },
36507
36529
  SelectMetaAsyncLoad: {
36508
- placeholder: 'Chargement distant simulé',
36509
- value: 2,
36510
- // objValue: { label: 'Option 2', value: 2, color: 'green' }, // simule un affichage direct de l'option dans l'input si celle-ci a été enregistrée (si options asynchrones uniquement
36530
+ editable: true,
36531
+ // value: 2,
36532
+ objValue: {
36533
+ label: 'Option 2',
36534
+ value: 2,
36535
+ color: '#000000'
36536
+ },
36537
+ // simule un affichage direct de l'option dans l'input si celle-ci a été enregistrée (si options asynchrones uniquement
36511
36538
  options: function () {
36512
36539
  var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(search, loadedOptions, _ref) {
36513
36540
  var page, length, start, data;
@@ -36515,7 +36542,7 @@ var DropdownPresets = {
36515
36542
  while (1) switch (_context.n) {
36516
36543
  case 0:
36517
36544
  page = _ref.page;
36518
- length = 2;
36545
+ length = 20;
36519
36546
  start = (page - 1) * length; // Simule un délai réseau
36520
36547
  _context.n = 1;
36521
36548
  return new Promise(function (res) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "2.4.604",
4
+ "version": "2.4.606",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {