@mtes-mct/monitor-ui 8.4.0 → 8.6.0

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,36 @@
1
+ # [8.5.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.4.0...v8.5.0) (2023-08-20)
2
+
3
+
4
+ ### Features
5
+
6
+ * add internal Native types ([41f0329](https://github.com/MTES-MCT/monitor-ui/commit/41f03299a08b32e12ffefaf55c5f1331a5ac08f3))
7
+ * **types:** add public type UndefineExceptArrays ([931edc8](https://github.com/MTES-MCT/monitor-ui/commit/931edc814a333be0333e8ccc2a6ef59e95ff43a7))
8
+ * **utils:** add getOptionsFromIdAndName() ([e9b8865](https://github.com/MTES-MCT/monitor-ui/commit/e9b8865243215b66e9ae8cdd067f55d7fa0ad60a))
9
+ * **utils:** add getOptionsFromLabelledEnum() ([c4b185e](https://github.com/MTES-MCT/monitor-ui/commit/c4b185e5f7ada189d5a101ec29feda6e31aeb86b))
10
+ * **utils:** add isArray() ([7d9bd10](https://github.com/MTES-MCT/monitor-ui/commit/7d9bd10b66908949fa4b65794597cb23653a1ba9))
11
+ * **utils:** add isDefined() ([0e49bc9](https://github.com/MTES-MCT/monitor-ui/commit/0e49bc9b9a7663dff61cc9dc0ab64abace81e60c))
12
+ * **utils:** add isObject() ([9e1595a](https://github.com/MTES-MCT/monitor-ui/commit/9e1595a330ff3f3f7afb4af9cabdea592558434b))
13
+ * **utils:** add nullify() ([9d21221](https://github.com/MTES-MCT/monitor-ui/commit/9d21221d126e1d27e5aa56b038ebae24766175f2))
14
+ * **utils:** add undefine() ([2fbfcf4](https://github.com/MTES-MCT/monitor-ui/commit/2fbfcf4064822efbbf6aca5a386ff3f4e3c2c1a6))
15
+
16
+ # [8.4.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.3.0...v8.4.0) (2023-08-17)
17
+
18
+
19
+ ### Bug Fixes
20
+
21
+ * **ci:** fix ci for dependabot ([d386c4d](https://github.com/MTES-MCT/monitor-ui/commit/d386c4d952a0695678475af7f4c727dfd35b4948))
22
+ * **components:** fix MapMenuModal z-index ([802e9fa](https://github.com/MTES-MCT/monitor-ui/commit/802e9fa32561932823fa0eaf4a5931a709454859))
23
+ * **components:** fix MapMenuModal.Footer z-index ([03f55fc](https://github.com/MTES-MCT/monitor-ui/commit/03f55fca037894f3e6abe2082c0456b6666130de))
24
+ * **components:** fix SingleTag component max size ([fb20e3a](https://github.com/MTES-MCT/monitor-ui/commit/fb20e3a87af185c7fa2ba218a865e71f1985da48))
25
+ * **fields:** add style for single calendar in DateRangePicker component ([f70380f](https://github.com/MTES-MCT/monitor-ui/commit/f70380f2de3ca7a82b4a265ed042ea8694d07a13))
26
+ * **fields:** update dateRangePicker style ([8a783a8](https://github.com/MTES-MCT/monitor-ui/commit/8a783a850c21ef3b787218fdd2778d7e21a10677))
27
+ * **tests:** update DateRangePicker story ([c20a373](https://github.com/MTES-MCT/monitor-ui/commit/c20a373c37e487b2d5cdc0bdf7d70feedf2089ea))
28
+
29
+
30
+ ### Features
31
+
32
+ * **fields:** add showOneCalendar prop to DateRangerPicker component ([804296a](https://github.com/MTES-MCT/monitor-ui/commit/804296afb955f329f0cd55973d8d1c7ea28db9fc))
33
+
1
34
  # [8.3.0](https://github.com/MTES-MCT/monitor-ui/compare/v8.2.0...v8.3.0) (2023-08-11)
2
35
 
3
36
 
package/index.js CHANGED
@@ -1913,6 +1913,39 @@ _curry1(function empty(x) {
1913
1913
  ;
1914
1914
  });
1915
1915
 
1916
+ /**
1917
+ * Creates a new object from a list key-value pairs. If a key appears in
1918
+ * multiple pairs, the rightmost pair is included in the object.
1919
+ *
1920
+ * @func
1921
+ * @memberOf R
1922
+ * @since v0.3.0
1923
+ * @category List
1924
+ * @sig [[k,v]] -> {k: v}
1925
+ * @param {Array} pairs An array of two-element arrays that will be the keys and values of the output object.
1926
+ * @return {Object} The object made by pairing up `keys` and `values`.
1927
+ * @see R.toPairs, R.pair
1928
+ * @example
1929
+ *
1930
+ * R.fromPairs([['a', 1], ['b', 2], ['c', 3]]); //=> {a: 1, b: 2, c: 3}
1931
+ */
1932
+
1933
+ var fromPairs =
1934
+ /*#__PURE__*/
1935
+ _curry1(function fromPairs(pairs) {
1936
+ var result = {};
1937
+ var idx = 0;
1938
+
1939
+ while (idx < pairs.length) {
1940
+ result[pairs[idx][0]] = pairs[idx][1];
1941
+ idx += 1;
1942
+ }
1943
+
1944
+ return result;
1945
+ });
1946
+
1947
+ var fromPairs$1 = fromPairs;
1948
+
1916
1949
  /**
1917
1950
  * Returns `true` if the specified value is equal, in [`R.equals`](#equals)
1918
1951
  * terms, to at least one element of the given list; `false` otherwise.
@@ -2095,6 +2128,41 @@ _curry2(function mergeDeepRight(lObj, rObj) {
2095
2128
 
2096
2129
  var mergeDeepRight$1 = mergeDeepRight;
2097
2130
 
2131
+ /**
2132
+ * Converts an object into an array of key, value arrays. Only the object's
2133
+ * own properties are used.
2134
+ * Note that the order of the output array is not guaranteed to be consistent
2135
+ * across different JS platforms.
2136
+ *
2137
+ * @func
2138
+ * @memberOf R
2139
+ * @since v0.4.0
2140
+ * @category Object
2141
+ * @sig {String: *} -> [[String,*]]
2142
+ * @param {Object} obj The object to extract from
2143
+ * @return {Array} An array of key, value arrays from the object's own properties.
2144
+ * @see R.fromPairs, R.keys, R.values
2145
+ * @example
2146
+ *
2147
+ * R.toPairs({a: 1, b: 2, c: 3}); //=> [['a', 1], ['b', 2], ['c', 3]]
2148
+ */
2149
+
2150
+ var toPairs =
2151
+ /*#__PURE__*/
2152
+ _curry1(function toPairs(obj) {
2153
+ var pairs = [];
2154
+
2155
+ for (var prop in obj) {
2156
+ if (_has(prop, obj)) {
2157
+ pairs[pairs.length] = [prop, obj[prop]];
2158
+ }
2159
+ }
2160
+
2161
+ return pairs;
2162
+ });
2163
+
2164
+ var toPairs$1 = toPairs;
2165
+
2098
2166
  const UntypedStyledComponentsThemeProvider = ThemeProvider$1;
2099
2167
  function ThemeProvider({ children, theme = {} }) {
2100
2168
  const finalTheme = mergeDeepRight$1(THEME, theme);
@@ -23114,7 +23182,7 @@ diacritics.diacriticsMap = diacriticsMap;
23114
23182
  * http://www.apache.org/licenses/LICENSE-2.0
23115
23183
  */
23116
23184
 
23117
- function isArray(value) {
23185
+ function isArray$1(value) {
23118
23186
  return !Array.isArray
23119
23187
  ? getTag(value) === '[object Array]'
23120
23188
  : Array.isArray(value)
@@ -23152,16 +23220,16 @@ function isBoolean(value) {
23152
23220
  )
23153
23221
  }
23154
23222
 
23155
- function isObject$1(value) {
23223
+ function isObject$2(value) {
23156
23224
  return typeof value === 'object'
23157
23225
  }
23158
23226
 
23159
23227
  // Checks if `value` is object-like.
23160
23228
  function isObjectLike(value) {
23161
- return isObject$1(value) && value !== null
23229
+ return isObject$2(value) && value !== null
23162
23230
  }
23163
23231
 
23164
- function isDefined(value) {
23232
+ function isDefined$1(value) {
23165
23233
  return value !== undefined && value !== null
23166
23234
  }
23167
23235
 
@@ -23237,7 +23305,7 @@ function createKey(key) {
23237
23305
  let weight = 1;
23238
23306
  let getFn = null;
23239
23307
 
23240
- if (isString$2(key) || isArray(key)) {
23308
+ if (isString$2(key) || isArray$1(key)) {
23241
23309
  src = key;
23242
23310
  path = createKeyPath(key);
23243
23311
  id = createKeyId(key);
@@ -23266,11 +23334,11 @@ function createKey(key) {
23266
23334
  }
23267
23335
 
23268
23336
  function createKeyPath(key) {
23269
- return isArray(key) ? key : key.split('.')
23337
+ return isArray$1(key) ? key : key.split('.')
23270
23338
  }
23271
23339
 
23272
23340
  function createKeyId(key) {
23273
- return isArray(key) ? key.join('.') : key
23341
+ return isArray$1(key) ? key.join('.') : key
23274
23342
  }
23275
23343
 
23276
23344
  function get$3(obj, path) {
@@ -23278,7 +23346,7 @@ function get$3(obj, path) {
23278
23346
  let arr = false;
23279
23347
 
23280
23348
  const deepGet = (obj, path, index) => {
23281
- if (!isDefined(obj)) {
23349
+ if (!isDefined$1(obj)) {
23282
23350
  return
23283
23351
  }
23284
23352
  if (!path[index]) {
@@ -23289,7 +23357,7 @@ function get$3(obj, path) {
23289
23357
 
23290
23358
  const value = obj[key];
23291
23359
 
23292
- if (!isDefined(value)) {
23360
+ if (!isDefined$1(value)) {
23293
23361
  return
23294
23362
  }
23295
23363
 
@@ -23300,7 +23368,7 @@ function get$3(obj, path) {
23300
23368
  (isString$2(value) || isNumber(value) || isBoolean(value))
23301
23369
  ) {
23302
23370
  list.push(toString(value));
23303
- } else if (isArray(value)) {
23371
+ } else if (isArray$1(value)) {
23304
23372
  arr = true;
23305
23373
  // Search each item in the array.
23306
23374
  for (let i = 0, len = value.length; i < len; i += 1) {
@@ -23488,7 +23556,7 @@ class FuseIndex {
23488
23556
  return this.records.length
23489
23557
  }
23490
23558
  _addString(doc, docIndex) {
23491
- if (!isDefined(doc) || isBlank(doc)) {
23559
+ if (!isDefined$1(doc) || isBlank(doc)) {
23492
23560
  return
23493
23561
  }
23494
23562
 
@@ -23507,18 +23575,18 @@ class FuseIndex {
23507
23575
  this.keys.forEach((key, keyIndex) => {
23508
23576
  let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path);
23509
23577
 
23510
- if (!isDefined(value)) {
23578
+ if (!isDefined$1(value)) {
23511
23579
  return
23512
23580
  }
23513
23581
 
23514
- if (isArray(value)) {
23582
+ if (isArray$1(value)) {
23515
23583
  let subRecords = [];
23516
23584
  const stack = [{ nestedArrIndex: -1, value }];
23517
23585
 
23518
23586
  while (stack.length) {
23519
23587
  const { nestedArrIndex, value } = stack.pop();
23520
23588
 
23521
- if (!isDefined(value)) {
23589
+ if (!isDefined$1(value)) {
23522
23590
  continue
23523
23591
  }
23524
23592
 
@@ -23530,7 +23598,7 @@ class FuseIndex {
23530
23598
  };
23531
23599
 
23532
23600
  subRecords.push(subRecord);
23533
- } else if (isArray(value)) {
23601
+ } else if (isArray$1(value)) {
23534
23602
  value.forEach((item, k) => {
23535
23603
  stack.push({
23536
23604
  nestedArrIndex: k,
@@ -24456,7 +24524,7 @@ const isExpression = (query) =>
24456
24524
  const isPath = (query) => !!query[KeyType.PATH];
24457
24525
 
24458
24526
  const isLeaf = (query) =>
24459
- !isArray(query) && isObject$1(query) && !isExpression(query);
24527
+ !isArray$1(query) && isObject$2(query) && !isExpression(query);
24460
24528
 
24461
24529
  const convertToExplicit = (query) => ({
24462
24530
  [LogicalOperator.AND]: Object.keys(query).map((key) => ({
@@ -24505,7 +24573,7 @@ function parse(query, options, { auto = true } = {}) {
24505
24573
  keys.forEach((key) => {
24506
24574
  const value = query[key];
24507
24575
 
24508
- if (isArray(value)) {
24576
+ if (isArray$1(value)) {
24509
24577
  value.forEach((item) => {
24510
24578
  node.children.push(next(item));
24511
24579
  });
@@ -24547,12 +24615,12 @@ function transformMatches(result, data) {
24547
24615
  const matches = result.matches;
24548
24616
  data.matches = [];
24549
24617
 
24550
- if (!isDefined(matches)) {
24618
+ if (!isDefined$1(matches)) {
24551
24619
  return
24552
24620
  }
24553
24621
 
24554
24622
  matches.forEach((match) => {
24555
- if (!isDefined(match.indices) || !match.indices.length) {
24623
+ if (!isDefined$1(match.indices) || !match.indices.length) {
24556
24624
  return
24557
24625
  }
24558
24626
 
@@ -24642,7 +24710,7 @@ class Fuse {
24642
24710
  }
24643
24711
 
24644
24712
  add(doc) {
24645
- if (!isDefined(doc)) {
24713
+ if (!isDefined$1(doc)) {
24646
24714
  return
24647
24715
  }
24648
24716
 
@@ -24714,7 +24782,7 @@ class Fuse {
24714
24782
 
24715
24783
  // Iterate over every string in the index
24716
24784
  records.forEach(({ v: text, i: idx, n: norm }) => {
24717
- if (!isDefined(text)) {
24785
+ if (!isDefined$1(text)) {
24718
24786
  return
24719
24787
  }
24720
24788
 
@@ -24777,7 +24845,7 @@ class Fuse {
24777
24845
  const results = [];
24778
24846
 
24779
24847
  records.forEach(({ $: item, i: idx }) => {
24780
- if (isDefined(item)) {
24848
+ if (isDefined$1(item)) {
24781
24849
  let expResults = evaluate(expression, item, idx);
24782
24850
 
24783
24851
  if (expResults.length) {
@@ -24803,7 +24871,7 @@ class Fuse {
24803
24871
 
24804
24872
  // List is Array<Object>
24805
24873
  records.forEach(({ $: item, i: idx }) => {
24806
- if (!isDefined(item)) {
24874
+ if (!isDefined$1(item)) {
24807
24875
  return
24808
24876
  }
24809
24877
 
@@ -24832,15 +24900,15 @@ class Fuse {
24832
24900
  return results
24833
24901
  }
24834
24902
  _findMatches({ key, value, searcher }) {
24835
- if (!isDefined(value)) {
24903
+ if (!isDefined$1(value)) {
24836
24904
  return []
24837
24905
  }
24838
24906
 
24839
24907
  let matches = [];
24840
24908
 
24841
- if (isArray(value)) {
24909
+ if (isArray$1(value)) {
24842
24910
  value.forEach(({ v: text, i: idx, n: norm }) => {
24843
- if (!isDefined(text)) {
24911
+ if (!isDefined$1(text)) {
24844
24912
  return
24845
24913
  }
24846
24914
 
@@ -31650,7 +31718,7 @@ function isString(str) {
31650
31718
  }
31651
31719
 
31652
31720
  /** Checks if value is object */
31653
- function isObject(obj) {
31721
+ function isObject$1(obj) {
31654
31722
  var _obj$constructor;
31655
31723
  return typeof obj === 'object' && obj != null && (obj == null || (_obj$constructor = obj.constructor) == null ? void 0 : _obj$constructor.name) === 'Object';
31656
31724
  }
@@ -31854,7 +31922,7 @@ function normalizeOpts(opts) {
31854
31922
  ...instanceOpts
31855
31923
  } = opts instanceof IMask.Masked ? {
31856
31924
  mask: opts
31857
- } : isObject(opts) && opts.mask instanceof IMask.Masked ? opts : {};
31925
+ } : isObject$1(opts) && opts.mask instanceof IMask.Masked ? opts : {};
31858
31926
  if (mask) {
31859
31927
  const _mask = mask.mask;
31860
31928
  return {
@@ -31865,7 +31933,7 @@ function normalizeOpts(opts) {
31865
31933
  };
31866
31934
  }
31867
31935
  }
31868
- if (!isObject(opts)) return {
31936
+ if (!isObject$1(opts)) return {
31869
31937
  mask: opts
31870
31938
  };
31871
31939
  return {
@@ -36544,6 +36612,38 @@ function useNewWindow() {
36544
36612
  return contextValue;
36545
36613
  }
36546
36614
 
36615
+ function getOptionsFromIdAndName(collection) {
36616
+ return collection?.map(({ id, name }) => ({
36617
+ label: name,
36618
+ value: id
36619
+ }));
36620
+ }
36621
+
36622
+ function getOptionsFromLabelledEnum(labelledEnum) {
36623
+ return fp.sortBy(['label'], Object.entries(labelledEnum).map(([value, label]) => ({
36624
+ label,
36625
+ value
36626
+ })));
36627
+ }
36628
+
36629
+ function isArray(value) {
36630
+ // eslint-disable-next-line no-null/no-null
36631
+ return typeof value === 'object' && value !== null && Array.isArray(value);
36632
+ }
36633
+
36634
+ /**
36635
+ * Is the value defined and non-null?
36636
+ */
36637
+ function isDefined(value) {
36638
+ // eslint-disable-next-line no-null/no-null
36639
+ return value !== undefined && value !== null;
36640
+ }
36641
+
36642
+ function isObject(value) {
36643
+ // eslint-disable-next-line no-null/no-null
36644
+ return typeof value === 'object' && value !== null && !Array.isArray(value) && value.constructor.name === 'Object';
36645
+ }
36646
+
36547
36647
  /* eslint-disable no-console */
36548
36648
  function logSoftError({ context = {}, isSideWindowError = false, message, originalError, userMessage }) {
36549
36649
  console.group(`Soft Error: ${message}`);
@@ -36565,5 +36665,57 @@ function logSoftError({ context = {}, isSideWindowError = false, message, origin
36565
36665
  }
36566
36666
  }
36567
36667
 
36568
- export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MapMenuModal, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, logSoftError, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
36668
+ /* eslint-disable no-null/no-null */
36669
+ const nullifyArrayValues = (list) => list.map(nullify);
36670
+ const nullifyObjectProps = (record) => pipe$1(toPairs$1, map$1(nullifyObjectPropPair), fromPairs$1)(record);
36671
+ const nullifyObjectPropPair = ([key, value]) => [key, nullify(value)];
36672
+ /**
36673
+ * Transform all `undefined` values into `null` ones in any type of value
36674
+ *
36675
+ * @description
36676
+ * The value must be of native type and only contains native types.
36677
+ */
36678
+ function nullify(value) {
36679
+ if (value === null || value === undefined) {
36680
+ return null;
36681
+ }
36682
+ if (typeof value === 'object') {
36683
+ if (isArray(value)) {
36684
+ return nullifyArrayValues(value);
36685
+ }
36686
+ if (isObject(value)) {
36687
+ return nullifyObjectProps(value);
36688
+ }
36689
+ throw new Error(`Can't handle type \`${value.constructor.name}\`.`);
36690
+ }
36691
+ return value;
36692
+ }
36693
+
36694
+ /* eslint-disable no-null/no-null */
36695
+ const undefineArrayValues = (list) => list.map(undefine);
36696
+ const undefineObjectProps = (record) => pipe$1(toPairs$1, map$1(undefineObjectPropPair), fromPairs$1)(record);
36697
+ const undefineObjectPropPair = ([key, value]) => [key, undefine(value)];
36698
+ /**
36699
+ * Transform all `null` values into `undefined` ones in any type of value
36700
+ *
36701
+ * @description
36702
+ * The value must be of native type and only contains native types.
36703
+ */
36704
+ function undefine(value) {
36705
+ if (value === null || value === undefined) {
36706
+ return undefined;
36707
+ }
36708
+ if (typeof value === 'object') {
36709
+ if (isArray(value)) {
36710
+ return undefineArrayValues(value);
36711
+ }
36712
+ if (isObject(value)) {
36713
+ return undefineObjectProps(value);
36714
+ }
36715
+ throw new Error(`Can't handle type \`${value.constructor.name}\`.`);
36716
+ }
36717
+ return value;
36718
+ }
36719
+
36720
+ export { Accent, Button$1 as Button, Checkbox, CoordinatesFormat, CoordinatesInput, CustomSearch, DatePicker, DateRangePicker, Dialog, Dropdown, Field$2 as Field, FieldError, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MapMenuModal, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NotificationEvent, Notifier, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SideMenu, SimpleTable, SingleTag, Size, THEME, TableWithSelectableRows, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getOptionsFromIdAndName, getOptionsFromLabelledEnum, getPseudoRandomString, getUtcizedDayjs, isArray, isDefined, isNumeric, isObject, logSoftError, nullify, stopMouseEventPropagation, undefine, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
36569
36721
  //# sourceMappingURL=index.js.map