arengibook 2.4.630 → 2.4.632

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 +138 -168
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -36820,12 +36820,12 @@ var DropdownPresets = {
36820
36820
  }
36821
36821
  };
36822
36822
 
36823
- var simulateNetworkDelay$2 = function simulateNetworkDelay() {
36823
+ var simulateNetworkDelay = function simulateNetworkDelay() {
36824
36824
  return new Promise(function (res) {
36825
36825
  return setTimeout(res, 400);
36826
36826
  });
36827
36827
  };
36828
- var createFakeOptions$2 = function createFakeOptions(start, length) {
36828
+ var createFakeOptions = function createFakeOptions(start, length) {
36829
36829
  var options = [];
36830
36830
  for (var i = start; i < start + length; i++) {
36831
36831
  options.push({
@@ -36854,9 +36854,9 @@ var DropdownSelectMetaAsyncPresets = {
36854
36854
  search = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
36855
36855
  _ref = _args.length > 2 ? _args[2] : undefined, page = _ref.page;
36856
36856
  _context.n = 1;
36857
- return simulateNetworkDelay$2();
36857
+ return simulateNetworkDelay();
36858
36858
  case 1:
36859
- allOptions = createFakeOptions$2(0, 100);
36859
+ allOptions = createFakeOptions(0, 100);
36860
36860
  filtered = allOptions.filter(function (opt) {
36861
36861
  return opt.label.toLowerCase().includes(search.toLowerCase());
36862
36862
  });
@@ -39110,7 +39110,9 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
39110
39110
  _ref$showSelectAll = _ref.showSelectAll,
39111
39111
  showSelectAll = _ref$showSelectAll === void 0 ? true : _ref$showSelectAll;
39112
39112
  // const [selectedOptions, setSelectedOptions] = useState(value ?? []);
39113
- var _useState = useState(null),
39113
+ var _useState = useState(objValue ? _toConsumableArray$7(objValue.map(function (opt) {
39114
+ return opt[optionValue];
39115
+ })) : value !== null && value !== void 0 ? value : []),
39114
39116
  _useState2 = _slicedToArray$9(_useState, 2),
39115
39117
  selectedOptions = _useState2[0],
39116
39118
  setSelectedOptions = _useState2[1];
@@ -39130,26 +39132,6 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
39130
39132
  var loadLazyTimeout = useRef();
39131
39133
  var currentPageRef = useRef(1);
39132
39134
  var isOptionsArray = Array.isArray(options);
39133
- var numObjValue = objValue.map(function (opt) {
39134
- return _objectSpread2(_objectSpread2({}, opt), {}, _defineProperty$b({}, optionValue, typeof opt[optionValue] === 'string' ? parseInt(opt[optionValue], 10) : opt[optionValue]));
39135
- });
39136
- var numValue = function numValue() {
39137
- if (value && Array.isArray(value) && value.length) {
39138
- return value;
39139
- } else if (objValue && Array.isArray(objValue) && objValue.length) {
39140
- return objValue.map(function (opt) {
39141
- return parseInt(opt.value);
39142
- });
39143
- } else {
39144
- return [];
39145
- }
39146
- };
39147
- useEffect(function () {
39148
- var _numValue;
39149
- setSelectedOptions(objValue ? _toConsumableArray$7(numObjValue.map(function (opt) {
39150
- return opt[optionValue];
39151
- })) : (_numValue = numValue()) !== null && _numValue !== void 0 ? _numValue : []);
39152
- }, []);
39153
39135
  useEffect(function () {
39154
39136
  if (isOptionsArray) {
39155
39137
  setLoadedOptions(options);
@@ -39347,7 +39329,7 @@ var MultiSelectMetaAsync = function MultiSelectMetaAsync(_ref) {
39347
39329
  }), name && /*#__PURE__*/React__default.createElement("input", {
39348
39330
  type: "hidden",
39349
39331
  name: name,
39350
- value: (Array.isArray(selectedOptions) ? selectedOptions : []).map(function (opt) {
39332
+ value: selectedOptions.map(function (opt) {
39351
39333
  return opt[optionValue];
39352
39334
  }).join(',')
39353
39335
  }), invalid && /*#__PURE__*/React__default.createElement("div", null, /*#__PURE__*/React__default.createElement("small", {
@@ -39674,11 +39656,6 @@ var MultiSelect = function MultiSelect(props) {
39674
39656
  }, errorMessage || 'Sélection invalide')));
39675
39657
  };
39676
39658
 
39677
- var simulateNetworkDelay$1 = function simulateNetworkDelay() {
39678
- return new Promise(function (res) {
39679
- return setTimeout(res, 400);
39680
- });
39681
- };
39682
39659
  var optionsExample = [{
39683
39660
  label: 'New York',
39684
39661
  value: 'NY'
@@ -39765,17 +39742,68 @@ var syncOptions$1 = [{
39765
39742
  value: '5',
39766
39743
  color: '#ec4899'
39767
39744
  }];
39768
- var createFakeOptions$1 = function createFakeOptions(start, length) {
39769
- var options = [];
39770
- for (var i = start; i < start + length; i++) {
39771
- options.push({
39772
- value: i,
39773
- label: "Option ".concat(i),
39774
- color: 'black'
39775
- });
39776
- }
39777
- return options;
39778
- };
39745
+ var asyncOptions$1 = /*#__PURE__*/function () {
39746
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(search, _, _ref) {
39747
+ var page, mockOptions, startIndex, paginatedOptions;
39748
+ return _regenerator().w(function (_context) {
39749
+ while (1) switch (_context.n) {
39750
+ case 0:
39751
+ page = _ref.page;
39752
+ mockOptions = [{
39753
+ label: 'Option 1',
39754
+ value: '1',
39755
+ color: '#ff9900'
39756
+ }, {
39757
+ label: 'Option 2',
39758
+ value: '2',
39759
+ color: '#3b82f6'
39760
+ }, {
39761
+ label: 'Option 3',
39762
+ value: '3',
39763
+ color: '#10b981'
39764
+ }, {
39765
+ label: 'Option 4',
39766
+ value: '4',
39767
+ color: '#8b5cf6'
39768
+ }, {
39769
+ label: 'Option 5',
39770
+ value: '5',
39771
+ color: '#ec4899'
39772
+ }, {
39773
+ label: 'Option 6',
39774
+ value: '6',
39775
+ color: '#f59e0b'
39776
+ }, {
39777
+ label: 'Option 7',
39778
+ value: '7',
39779
+ color: '#ef4444'
39780
+ }, {
39781
+ label: 'Option 8',
39782
+ value: '8',
39783
+ color: '#10b981'
39784
+ }, {
39785
+ label: 'Option 9',
39786
+ value: '9',
39787
+ color: '#3b82f6'
39788
+ }, {
39789
+ label: 'Option 10',
39790
+ value: '10',
39791
+ color: '#8b5cf6'
39792
+ }]; // Simulation de pagination
39793
+ startIndex = (page - 1) * 5;
39794
+ paginatedOptions = mockOptions.slice(startIndex, startIndex + 5);
39795
+ return _context.a(2, {
39796
+ options: search ? mockOptions.filter(function (opt) {
39797
+ return opt.label.toLowerCase().includes(search.toLowerCase());
39798
+ }) : paginatedOptions
39799
+ });
39800
+ }
39801
+ }, _callee);
39802
+ }));
39803
+ return function asyncOptions(_x, _x2, _x3) {
39804
+ return _ref2.apply(this, arguments);
39805
+ };
39806
+ }();
39779
39807
  var MultiSelectPresets = {
39780
39808
  Default: {
39781
39809
  placeholder: 'Sélectionnez des options',
@@ -39860,55 +39888,17 @@ var MultiSelectPresets = {
39860
39888
  // Configuration pour les options asynchrones
39861
39889
  SelectMetaAsync: {
39862
39890
  isSelectMeta: true,
39891
+ // value: ['3', '4', '5'],
39863
39892
  objValue: [{
39864
- label: 'Option 9',
39865
- value: '9',
39893
+ label: 'Option 2',
39894
+ value: '2',
39866
39895
  color: '#ff9900'
39867
39896
  }, {
39868
39897
  label: 'Option 4',
39869
39898
  value: '4',
39870
39899
  color: 'black'
39871
39900
  }],
39872
- // value: ['3', '4'],
39873
- options: function () {
39874
- var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
39875
- var search,
39876
- _ref3,
39877
- page,
39878
- allOptions,
39879
- filtered,
39880
- pageSize,
39881
- start,
39882
- _args2 = arguments;
39883
- return _regenerator().w(function (_context2) {
39884
- while (1) switch (_context2.n) {
39885
- case 0:
39886
- search = _args2.length > 0 && _args2[0] !== undefined ? _args2[0] : '';
39887
- _ref3 = _args2.length > 2 ? _args2[2] : undefined, page = _ref3.page;
39888
- _context2.n = 1;
39889
- return simulateNetworkDelay$1();
39890
- case 1:
39891
- allOptions = createFakeOptions$1(0, 100);
39892
- filtered = allOptions.filter(function (opt) {
39893
- return opt.label.toLowerCase().includes(search.toLowerCase());
39894
- });
39895
- pageSize = 30;
39896
- start = (page - 1) * pageSize;
39897
- return _context2.a(2, {
39898
- options: filtered.slice(start, start + pageSize),
39899
- hasMore: start + pageSize < filtered.length,
39900
- additional: {
39901
- page: page + 1
39902
- }
39903
- });
39904
- }
39905
- }, _callee2);
39906
- }));
39907
- function options() {
39908
- return _options.apply(this, arguments);
39909
- }
39910
- return options;
39911
- }(),
39901
+ options: asyncOptions$1,
39912
39902
  placeholder: 'Sélectionnez une ou plusieurs options',
39913
39903
  optionLabel: 'label',
39914
39904
  optionValue: 'value',
@@ -39929,12 +39919,6 @@ var MultiSelectPresets = {
39929
39919
  }
39930
39920
  };
39931
39921
 
39932
- var simulateNetworkDelay = function simulateNetworkDelay() {
39933
- return new Promise(function (res) {
39934
- return setTimeout(res, 400);
39935
- });
39936
- };
39937
-
39938
39922
  // Options synchrones (tableau)
39939
39923
  var syncOptions = [{
39940
39924
  label: 'Option 1',
@@ -39959,44 +39943,68 @@ var syncOptions = [{
39959
39943
  }];
39960
39944
 
39961
39945
  // Fonction pour simuler des options asynchrones
39962
- // const asyncOptions = async (search, _, { page }) => {
39963
- // const mockOptions = [
39964
- // { label: 'Option 1', value: '1', color: '#ff9900' },
39965
- // { label: 'Option 2', value: '2', color: '#3b82f6' },
39966
- // { label: 'Option 3', value: '3', color: '#10b981' },
39967
- // { label: 'Option 4', value: '4', color: '#8b5cf6' },
39968
- // { label: 'Option 5', value: '5', color: '#ec4899' },
39969
- // { label: 'Option 6', value: '6', color: '#f59e0b' },
39970
- // { label: 'Option 7', value: '7', color: '#ef4444' },
39971
- // { label: 'Option 8', value: '8', color: '#10b981' },
39972
- // { label: 'Option 9', value: '9', color: '#3b82f6' },
39973
- // { label: 'Option 10', value: '10', color: '#8b5cf6' },
39974
- // ];
39975
- //
39976
- // // Simulation de pagination
39977
- // const startIndex = (page - 1) * 5;
39978
- // const paginatedOptions = mockOptions.slice(startIndex, startIndex + 5);
39979
- //
39980
- // return {
39981
- // options: search
39982
- // ? mockOptions.filter(opt =>
39983
- // opt.label.toLowerCase().includes(search.toLowerCase())
39984
- // )
39985
- // : paginatedOptions,
39986
- // };
39987
- // };
39988
-
39989
- var createFakeOptions = function createFakeOptions(start, length) {
39990
- var options = [];
39991
- for (var i = start; i < start + length; i++) {
39992
- options.push({
39993
- value: i,
39994
- label: "Option ".concat(i),
39995
- color: 'black'
39996
- });
39997
- }
39998
- return options;
39999
- };
39946
+ var asyncOptions = /*#__PURE__*/function () {
39947
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(search, _, _ref) {
39948
+ var page, mockOptions, startIndex, paginatedOptions;
39949
+ return _regenerator().w(function (_context) {
39950
+ while (1) switch (_context.n) {
39951
+ case 0:
39952
+ page = _ref.page;
39953
+ mockOptions = [{
39954
+ label: 'Option 1',
39955
+ value: '1',
39956
+ color: '#ff9900'
39957
+ }, {
39958
+ label: 'Option 2',
39959
+ value: '2',
39960
+ color: '#3b82f6'
39961
+ }, {
39962
+ label: 'Option 3',
39963
+ value: '3',
39964
+ color: '#10b981'
39965
+ }, {
39966
+ label: 'Option 4',
39967
+ value: '4',
39968
+ color: '#8b5cf6'
39969
+ }, {
39970
+ label: 'Option 5',
39971
+ value: '5',
39972
+ color: '#ec4899'
39973
+ }, {
39974
+ label: 'Option 6',
39975
+ value: '6',
39976
+ color: '#f59e0b'
39977
+ }, {
39978
+ label: 'Option 7',
39979
+ value: '7',
39980
+ color: '#ef4444'
39981
+ }, {
39982
+ label: 'Option 8',
39983
+ value: '8',
39984
+ color: '#10b981'
39985
+ }, {
39986
+ label: 'Option 9',
39987
+ value: '9',
39988
+ color: '#3b82f6'
39989
+ }, {
39990
+ label: 'Option 10',
39991
+ value: '10',
39992
+ color: '#8b5cf6'
39993
+ }]; // Simulation de pagination
39994
+ startIndex = (page - 1) * 5;
39995
+ paginatedOptions = mockOptions.slice(startIndex, startIndex + 5);
39996
+ return _context.a(2, {
39997
+ options: search ? mockOptions.filter(function (opt) {
39998
+ return opt.label.toLowerCase().includes(search.toLowerCase());
39999
+ }) : paginatedOptions
40000
+ });
40001
+ }
40002
+ }, _callee);
40003
+ }));
40004
+ return function asyncOptions(_x, _x2, _x3) {
40005
+ return _ref2.apply(this, arguments);
40006
+ };
40007
+ }();
40000
40008
  var MultiSelectMetaAsyncPresets = {
40001
40009
  // Configuration pour les options synchrones
40002
40010
  SyncOptions: {
@@ -40022,46 +40030,8 @@ var MultiSelectMetaAsyncPresets = {
40022
40030
  },
40023
40031
  // Configuration pour les options asynchrones
40024
40032
  AsyncOptions: {
40025
- value: ['3', '4'],
40026
- options: function () {
40027
- var _options = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
40028
- var search,
40029
- _ref,
40030
- page,
40031
- allOptions,
40032
- filtered,
40033
- pageSize,
40034
- start,
40035
- _args = arguments;
40036
- return _regenerator().w(function (_context) {
40037
- while (1) switch (_context.n) {
40038
- case 0:
40039
- search = _args.length > 0 && _args[0] !== undefined ? _args[0] : '';
40040
- _ref = _args.length > 2 ? _args[2] : undefined, page = _ref.page;
40041
- _context.n = 1;
40042
- return simulateNetworkDelay();
40043
- case 1:
40044
- allOptions = createFakeOptions(0, 100);
40045
- filtered = allOptions.filter(function (opt) {
40046
- return opt.label.toLowerCase().includes(search.toLowerCase());
40047
- });
40048
- pageSize = 30;
40049
- start = (page - 1) * pageSize;
40050
- return _context.a(2, {
40051
- options: filtered.slice(start, start + pageSize),
40052
- hasMore: start + pageSize < filtered.length,
40053
- additional: {
40054
- page: page + 1
40055
- }
40056
- });
40057
- }
40058
- }, _callee);
40059
- }));
40060
- function options() {
40061
- return _options.apply(this, arguments);
40062
- }
40063
- return options;
40064
- }(),
40033
+ value: ['1', '2'],
40034
+ options: asyncOptions,
40065
40035
  placeholder: 'Sélectionnez une ou plusieurs options',
40066
40036
  optionLabel: 'label',
40067
40037
  optionValue: 'value',
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "arengibook",
3
3
  "private": false,
4
- "version": "2.4.630",
4
+ "version": "2.4.632",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
7
7
  "exports": {