@mtes-mct/monitor-ui 5.7.1 → 5.8.1

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,26 @@
1
+ # [5.8.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.7.1...v5.8.0) (2023-05-04)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **components:** retype onChangeFocus callback param in NewWindow ([da16a87](https://github.com/MTES-MCT/monitor-ui/commit/da16a87d9e461de08beb61b0f6875742ea22c19a))
7
+ * **elements:** code review of SimpleTable ([34d7466](https://github.com/MTES-MCT/monitor-ui/commit/34d7466117fd8d08c6921e8f04e17b251ebbc957))
8
+ * **elements:** improve style of SimpleTable ([6bfac8d](https://github.com/MTES-MCT/monitor-ui/commit/6bfac8d58141e7c3911f8f5aed605d3dc5df1abf))
9
+ * **elements:** lint and type of SimpleTable ([9e45fde](https://github.com/MTES-MCT/monitor-ui/commit/9e45fde0e47089a0f053b48e6b702660d942050a))
10
+
11
+
12
+ ### Features
13
+
14
+ * **elements:** add SimpleTable ([6517305](https://github.com/MTES-MCT/monitor-ui/commit/6517305af0b999c7dd2090460ed05d18ee797818))
15
+ * **elements:** export component and move story in elements folder ([ca7c012](https://github.com/MTES-MCT/monitor-ui/commit/ca7c0122eae40a60f1fa405b29541e41d432525b))
16
+
17
+ ## [5.7.1](https://github.com/MTES-MCT/monitor-ui/compare/v5.7.0...v5.7.1) (2023-05-03)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **components:** type all allowed features in NewWindow ([1883816](https://github.com/MTES-MCT/monitor-ui/commit/18838169cc7a642c0e0d6e12fc833c23f5c69416))
23
+
1
24
  # [5.7.0](https://github.com/MTES-MCT/monitor-ui/compare/v5.6.0...v5.7.0) (2023-05-03)
2
25
 
3
26
 
@@ -19,7 +19,7 @@ export type NewWindowProps = {
19
19
  }> | undefined;
20
20
  name?: string | undefined;
21
21
  onBlock?: ((a: null) => Promisable<void>) | undefined;
22
- onChangeFocus?: ((visibility: 'hidden' | 'visible') => Promisable<void>) | undefined;
22
+ onChangeFocus?: ((isFocused: boolean) => Promisable<void>) | undefined;
23
23
  onOpen?: ((window: Window) => Promisable<void>) | undefined;
24
24
  onUnload?: ((a: null) => Promisable<void>) | undefined;
25
25
  shouldHaveFocus?: boolean | undefined;
@@ -0,0 +1,8 @@
1
+ export declare const SimpleTable: {
2
+ BodyTr: import("styled-components").StyledComponent<"tr", import("styled-components").DefaultTheme, {}, never>;
3
+ Head: import("styled-components").StyledComponent<"thead", import("styled-components").DefaultTheme, {}, never>;
4
+ SortContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ Table: import("styled-components").StyledComponent<"table", import("styled-components").DefaultTheme, {}, never>;
6
+ Td: import("styled-components").StyledComponent<"td", import("styled-components").DefaultTheme, {}, never>;
7
+ Th: import("styled-components").StyledComponent<"th", import("styled-components").DefaultTheme, {}, never>;
8
+ };
@@ -37,6 +37,7 @@ export interface DatePickerProps extends Omit<HTMLAttributes<HTMLFieldSetElement
37
37
  isLabelHidden?: boolean | undefined;
38
38
  isLight?: boolean | undefined;
39
39
  isStringDate?: boolean | undefined;
40
+ isUndefinedWhenDisabled?: boolean | undefined;
40
41
  label: string;
41
42
  /**
42
43
  * Range of minutes used to generate the time picker list.
@@ -40,6 +40,7 @@ export interface DateRangePickerProps extends Omit<HTMLAttributes<HTMLFieldSetEl
40
40
  isLabelHidden?: boolean | undefined;
41
41
  isLight?: boolean | undefined;
42
42
  isStringDate?: boolean | undefined;
43
+ isUndefinedWhenDisabled?: boolean | undefined;
43
44
  label: string;
44
45
  /**
45
46
  * Range of minutes used to generate the time picker list.
package/index.d.ts CHANGED
@@ -21,6 +21,7 @@ export { Label } from './elements/Label';
21
21
  export { Legend } from './elements/Legend';
22
22
  export { Tag } from './elements/Tag';
23
23
  export { TagGroup } from './elements/TagGroup';
24
+ export { SimpleTable } from './elements/Table/SimpleTable';
24
25
  export { Search } from './fields/Search';
25
26
  export { Checkbox } from './fields/Checkbox';
26
27
  export { DatePicker } from './fields/DatePicker';
package/index.js CHANGED
@@ -2269,10 +2269,10 @@ class NewWindow extends PureComponent {
2269
2269
  this.setState({ mounted: true });
2270
2270
  this.window?.addEventListener('beforeunload', this.beforeUnloadListener, { capture: true });
2271
2271
  this.window?.addEventListener('blur', () => {
2272
- onChangeFocus('hidden');
2272
+ onChangeFocus(false);
2273
2273
  });
2274
2274
  this.window?.addEventListener('focus', () => {
2275
- onChangeFocus('visible');
2275
+ onChangeFocus(true);
2276
2276
  });
2277
2277
  }
2278
2278
  componentDidUpdate(prevProps) {
@@ -3331,6 +3331,80 @@ const TagGroup = styled.div `
3331
3331
  gap: 8px;
3332
3332
  `;
3333
3333
 
3334
+ const Table = styled.table `
3335
+ width: 100%;
3336
+ table-layout: auto;
3337
+ overflow: auto;
3338
+ border-collapse: separate;
3339
+ `;
3340
+ const Head = styled.thead `
3341
+ position: sticky;
3342
+ top: 0;
3343
+ z-index: 1;
3344
+
3345
+ th:first-child {
3346
+ border-left: 1px solid ${p => p.theme.color.lightGray};
3347
+ }
3348
+ `;
3349
+ const SortContainer = styled.div `
3350
+ display: flex;
3351
+ justify-content: space-between;
3352
+ align-items: center;
3353
+ cursor: default;
3354
+
3355
+ &.cursor-pointer {
3356
+ cursor: pointer;
3357
+ }
3358
+ `;
3359
+ const Th = styled.th `
3360
+ background-color: ${p => p.theme.color.gainsboro};
3361
+ border-top: 1px solid ${p => p.theme.color.lightGray};
3362
+ border-bottom: 1px solid ${p => p.theme.color.lightGray};
3363
+ border-right: 1px solid ${p => p.theme.color.lightGray};
3364
+ color: ${p => p.theme.color.slateGray};
3365
+ font-size: 13px;
3366
+ font-weight: 500;
3367
+ padding: 10px;
3368
+ overflow: hidden;
3369
+ text-overflow: ellipsis;
3370
+ white-space: nowrap;
3371
+ `;
3372
+ const BodyTr = styled.tr `
3373
+ :hover {
3374
+ background-color: ${p => p.theme.color.blueYonder[25]};
3375
+ }
3376
+ td:first-child {
3377
+ border-left: 1px solid ${p => p.theme.color.lightGray};
3378
+ }
3379
+
3380
+ td:nth-child(10) {
3381
+ text-align: center;
3382
+ }
3383
+ td:nth-child(11) {
3384
+ text-align: center;
3385
+ }
3386
+ `;
3387
+ const Td = styled.td `
3388
+ font-size: 13px;
3389
+ font-weight: 500;
3390
+ color: ${p => p.theme.color.gunMetal};
3391
+ text-align: left;
3392
+ border-bottom: 1px solid ${p => p.theme.color.lightGray};
3393
+ border-right: 1px solid ${p => p.theme.color.lightGray};
3394
+ overflow: hidden;
3395
+ padding: 10px;
3396
+ text-overflow: ellipsis;
3397
+ white-space: nowrap;
3398
+ `;
3399
+ const SimpleTable = {
3400
+ BodyTr,
3401
+ Head,
3402
+ SortContainer,
3403
+ Table,
3404
+ Td,
3405
+ Th
3406
+ };
3407
+
3334
3408
  // eslint-lint-disable-next-line @typescript-eslint/naming-convention
3335
3409
  class HTTPError extends Error {
3336
3410
  constructor(response, request, options) {
@@ -22133,7 +22207,7 @@ const InputGroup = styled.div `
22133
22207
  }
22134
22208
  `;
22135
22209
 
22136
- function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22210
+ function DatePicker({ baseContainer, className, defaultValue, disabled = false, error, isCompact = false, isEndDate = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22137
22211
  /* eslint-disable no-null/no-null */
22138
22212
  const boxRef = useRef(null);
22139
22213
  const dateInputRef = useRef(null);
@@ -22253,7 +22327,7 @@ function DatePicker({ baseContainer, className, defaultValue, disabled = false,
22253
22327
  isCalendarPickerOpenRef.current = true;
22254
22328
  forceUpdate();
22255
22329
  }, [forceUpdate]);
22256
- useFieldUndefineEffect(disabled, onChange, handleDisable);
22330
+ useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange, handleDisable);
22257
22331
  useClickOutsideEffect(boxRef, closeCalendarPicker, baseContainer);
22258
22332
  useEffect(() => {
22259
22333
  if (!hasMountedRef.current) {
@@ -22502,7 +22576,7 @@ var DateRangePosition;
22502
22576
  DateRangePosition["START"] = "START";
22503
22577
  })(DateRangePosition || (DateRangePosition = {}));
22504
22578
 
22505
- function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22579
+ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error, isCompact = false, isErrorMessageHidden = false, isHistorical = false, isLabelHidden = false, isLight = false, isStringDate = false, isUndefinedWhenDisabled = false, label, minutesRange = 15, onChange, withTime = false, ...nativeProps }) {
22506
22580
  /* eslint-disable no-null/no-null */
22507
22581
  const startDateInputRef = useRef(null);
22508
22582
  const startTimeInputRef = useRef(null);
@@ -22699,7 +22773,7 @@ function DateRangePicker({ baseContainer, defaultValue, disabled = false, error,
22699
22773
  isRangeCalendarPickerOpenRef.current = true;
22700
22774
  forceUpdate();
22701
22775
  }, [forceUpdate]);
22702
- useFieldUndefineEffect(disabled, onChange, handleDisable);
22776
+ useFieldUndefineEffect(isUndefinedWhenDisabled && disabled, onChange, handleDisable);
22703
22777
  useClickOutsideEffect([endDateInputRef, startDateInputRef], closeRangeCalendarPicker, baseContainer);
22704
22778
  useEffect(() => {
22705
22779
  if (!hasMountedRef.current) {
@@ -32374,5 +32448,5 @@ function useNewWindow() {
32374
32448
  return contextValue;
32375
32449
  }
32376
32450
 
32377
- export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32451
+ export { Accent, Button, Checkbox, CoordinatesFormat, CoordinatesInput, DatePicker, DateRangePicker, Dropdown, Field$2 as Field, Fieldset, FormikCheckbox, FormikCoordinatesInput, FormikDatePicker, FormikDateRangePicker, FormikEffect, FormikMultiCheckbox, FormikMultiRadio, FormikMultiSelect, FormikNumberInput, FormikSearch, FormikSelect, FormikTextInput, FormikTextarea, GlobalStyle, index as Icon, IconButton, Label, Legend, MultiCheckbox, MultiRadio, MultiSelect, MultiZoneEditor, NewWindow, NewWindowContext, NumberInput, OPENLAYERS_PROJECTION, OnlyFontGlobalStyle, Search, Select, SimpleTable, SingleTag, Size, THEME, Tag, TagBullet, TagGroup, TextInput, Textarea, ThemeProvider, WSG84_PROJECTION, coordinatesAreDistinct, customDayjs, getCoordinates, getLocalizedDayjs, getPseudoRandomString, getUtcizedDayjs, isNumeric, noop, stopMouseEventPropagation, useClickOutsideEffect, useFieldControl, useForceUpdate, useKey, useNewWindow, usePrevious };
32378
32452
  //# sourceMappingURL=index.js.map