@seamapi/react 2.1.2 → 2.1.4

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.
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
2
3
  import { SupportedDeviceFilterResultRow } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.js';
3
4
  import { SupportedDeviceManufacturerSection } from '../../../../lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js';
4
5
  import { useFilteredDeviceModels, } from '../../../../lib/seam/components/SupportedDeviceTable/use-filtered-device-models.js';
@@ -10,6 +11,7 @@ export function SupportedDeviceContent({ resetFilterValue, filterValue, filters,
10
11
  manufacturers,
11
12
  excludedManufacturers,
12
13
  });
14
+ const groupedDeviceModels = useMemo(() => groupDeviceModelsByManufacturer(deviceModels ?? []), [deviceModels]);
13
15
  if (isLoading) {
14
16
  return (_jsx("div", { className: 'seam-supported-device-table-content-state-block', children: _jsx("p", { children: t.loading }) }));
15
17
  }
@@ -29,13 +31,17 @@ export function SupportedDeviceContent({ resetFilterValue, filterValue, filters,
29
31
  if (hasFilters) {
30
32
  return (_jsx("div", { className: 'seam-supported-device-table-content', children: deviceModels.map((deviceModel) => (_jsx(SupportedDeviceFilterResultRow, { deviceModel: deviceModel }, deviceModel.device_model_id))) }));
31
33
  }
32
- return (_jsx(_Fragment, { children: Object.entries(groupDeviceModelsByManufacturer(deviceModels)).map(([manufacturerId, models]) => (_jsx(SupportedDeviceManufacturerSection, { manufacturerId: manufacturerId, deviceModels: models }, manufacturerId))) }));
34
+ return (_jsx(_Fragment, { children: Object.entries(groupedDeviceModels)
35
+ .sort((e1, e2) => e1[1][0]?.manufacturer.display_name.localeCompare(e2[1][0]?.manufacturer.display_name ?? '') ?? 0)
36
+ .map(([manufacturerId, models]) => {
37
+ return (_jsx(SupportedDeviceManufacturerSection, { manufacturerId: manufacturerId, deviceModels: models }, manufacturerId));
38
+ }) }));
33
39
  }
34
40
  function EmptyResult({ filterValue, resetFilterValue, }) {
35
41
  const noMatchingRows = (_jsxs(_Fragment, { children: [_jsx("p", { children: t.noMatch }), _jsx(Button, { variant: 'outline', size: 'small', onClick: resetFilterValue, className: 'seam-supported-device-table-content-message-clear-search', children: t.clear })] }));
36
42
  return (_jsx("div", { className: 'seam-supported-device-table-content-message-row', children: _jsx("div", { children: _jsx("div", { className: 'seam-supported-device-table-content-message', children: filterValue.length === 0 ? _jsx("p", { children: t.noneFound }) : noMatchingRows }) }) }));
37
43
  }
38
- function groupDeviceModelsByManufacturer(deviceModels) {
44
+ const groupDeviceModelsByManufacturer = (deviceModels) => {
39
45
  const result = {};
40
46
  for (const model of deviceModels) {
41
47
  const { manufacturer } = model;
@@ -43,7 +49,7 @@ function groupDeviceModelsByManufacturer(deviceModels) {
43
49
  result[manufacturer.manufacturer_id] = [...list, model];
44
50
  }
45
51
  return result;
46
- }
52
+ };
47
53
  const t = {
48
54
  loading: 'Loading device models...',
49
55
  retry: 'Retry',
@@ -1 +1 @@
1
- {"version":3,"file":"SupportedDeviceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4EAA4E,CAAA;AAC3H,OAAO,EAAE,kCAAkC,EAAE,MAAM,gFAAgF,CAAA;AAEnI,OAAO,EAEL,uBAAuB,GACxB,MAAM,wEAAwE,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAUzC,MAAM,UAAU,sBAAsB,CAAC,EACrC,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,aAAa,EACb,qBAAqB,GACO;IAC5B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAC3E;QACE,WAAW;QACX,OAAO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ceContent.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/SupportedDeviceContent.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAE/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,4EAA4E,CAAA;AAC3H,OAAO,EAAE,kCAAkC,EAAE,MAAM,gFAAgF,CAAA;AAEnI,OAAO,EAEL,uBAAuB,GACxB,MAAM,wEAAwE,CAAA;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAUzC,MAAM,UAAU,sBAAsB,CAAC,EACrC,gBAAgB,EAChB,WAAW,EACX,OAAO,EACP,aAAa,EACb,qBAAqB,GACO;IAC5B,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,uBAAuB,CAC3E;QACE,WAAW;QACX,OAAO;QACP,aAAa;QACb,qBAAqB;KACtB,CACF,CAAA;IAED,MAAM,mBAAmB,GAAG,OAAO,CACjC,GAAG,EAAE,CAAC,+BAA+B,CAAC,YAAY,IAAI,EAAE,CAAC,EACzD,CAAC,YAAY,CAAC,CACf,CAAA;IAED,IAAI,SAAS,EAAE;QACb,OAAO,CACL,cAAK,SAAS,EAAC,iDAAiD,YAC9D,sBAAI,CAAC,CAAC,OAAO,GAAK,GACd,CACP,CAAA;KACF;IAED,IAAI,OAAO,EAAE;QACX,OAAO,CACL,eAAK,SAAS,EAAC,iDAAiD,aAC9D,sBAAI,CAAC,CAAC,KAAK,GAAK,EAChB,KAAC,MAAM,IACL,OAAO,EAAC,OAAO,EACf,IAAI,EAAC,OAAO,EACZ,OAAO,EAAE,GAAG,EAAE;wBACZ,KAAK,OAAO,EAAE,CAAA;oBAChB,CAAC,YAEA,CAAC,CAAC,KAAK,GACD,IACL,CACP,CAAA;KACF;IAED,IAAI,YAAY,IAAI,IAAI,EAAE;QACxB,OAAO,IAAI,CAAA;KACZ;IAED,MAAM,OAAO,GAAG,YA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I,EAAC,OAAO,EACZ,OAAO,EAAE,gBAAgB,EACzB,SAAS,EAAC,0DAA0D,YAEnE,CAAC,CAAC,KAAK,GACD,IACR,CACJ,CAAA;IAED,OAAO,CACL,cAAK,SAAS,EAAC,iDAAiD,YAC9D,wBACE,cAAK,SAAS,EAAC,6CAA6C,YACzD,WAAW,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,sBAAI,CAAC,CAAC,SAAS,GAAK,CAAC,CAAC,CAAC,cAAc,GAC7D,GACF,GACF,CACP,CAAA;AACH,CAAC;AAED,MAAM,+BAA+B,GAAG,CACtC,YAAiC,EACA,EAAE;IACnC,MAAM,MAAM,GAAoC,EAAE,CAAA;IAElD,KAAK,MAAM,KAAK,IAAI,YAAY,EAAE;QAChC,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAA;QAC9B,MAAM,IAAI,GAAG,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,EAAE,CAAA;QACvD,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,CAAA;KACxD;IACD,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AAED,MAAM,CAAC,GAAG;IACR,OAAO,EAAE,0BAA0B;IACnC,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,4CAA4C;IACnD,SAAS,EAAE,yBAAyB;IACpC,OAAO,EAAE,uCAAuC;IAChD,KAAK,EAAE,oBAAoB;CAC5B,CAAA"}
@@ -18,9 +18,9 @@ export const useFilteredDeviceModels = ({ filterValue, filters, ...manufacturers
18
18
  if (filters.manufacturer == null && manufacturers != null) {
19
19
  params.manufacturer_ids = manufacturers.map((m) => m.manufacturer_id);
20
20
  }
21
- const { deviceModels, ...query } = useDeviceModels(params);
21
+ const { deviceModels, ...rest } = useDeviceModels(params);
22
22
  return {
23
- ...query,
23
+ ...rest,
24
24
  deviceModels: deviceModels?.filter((deviceModel) => manufacturers?.some((manufacturer) => deviceModel.manufacturer.manufacturer_id ===
25
25
  manufacturer.manufacturer_id)),
26
26
  };
@@ -1 +1 @@
1
- {"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,+DAA+D,CAAA;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAO1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,WAAW,EACX,OAAO,EACP,GAAG,mBAAmB,EAMvB,EAAsC,EAAE;IACvC,MAAM,EAAE,aAAa,EAAE,GAAG,wBAAwB,CAAC,mBAAmB,CAAC,CAAA;IAEvE,MAAM,MAAM,GAA0B,EAAE,CAAA;IAExC,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,aAAa,EAAE;QACzB,MAAM,CAAC,kBAAkB,GAAG,QAAQ,CAAA;KACrC;IAED,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE;QACjC,MAAM,YAAY,GAAG,aAAa,EAAE,IAAI,CACtC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY,CACrE,CAAA;QAED,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;SACtD;KACF;IAED,IAAI,OAAO,CAAC,YAAY,IAAI,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE;QACzD,MAAM,CAAC,gBAAgB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;KACtE;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAE1D,OAAO;QACL,GAAG,KAAK;QACR,YAAY,EAAE,YAAY,EAAE,MAAM,CAChC,CAAC,WAAW,EAAE,EAAE,CACd,aAAa,EAAE,IAAI,CACjB,CAAC,YAAY,EAAE,EAAE,CACf,WAAW,CAAC,YAAY,CAAC,eAAe;YACxC,YAAY,CAAC,eAAe,CAC/B,CACJ;KACF,CAAA;AACH,CAAC,CAAA"}
1
+ {"version":3,"file":"use-filtered-device-models.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-device-models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAEhB,MAAM,+DAA+D,CAAA;AAEtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAA;AAO1E,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,EACtC,WAAW,EACX,OAAO,EACP,GAAG,mBAAmB,EAMvB,EAAsC,EAAE;IACvC,MAAM,EAAE,aAAa,EAAE,GAAG,wBAAwB,CAAC,mBAAmB,CAAC,CAAA;IAEvE,MAAM,MAAM,GAA0B,EAAE,CAAA;IAExC,IAAI,WAAW,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC7B,MAAM,CAAC,WAAW,GAAG,WAAW,CAAC,IAAI,EAAE,CAAA;KACxC;IAED,IAAI,OAAO,CAAC,aAAa,EAAE;QACzB,MAAM,CAAC,kBAAkB,GAAG,QAAQ,CAAA;KACrC;IAED,IAAI,OAAO,CAAC,YAAY,KAAK,IAAI,EAAE;QACjC,MAAM,YAAY,GAAG,aAAa,EAAE,IAAI,CACtC,CAAC,YAAY,EAAE,EAAE,CAAC,YAAY,CAAC,YAAY,KAAK,OAAO,CAAC,YAAY,CACrE,CAAA;QAED,IAAI,YAAY,IAAI,IAAI,EAAE;YACxB,MAAM,CAAC,eAAe,GAAG,YAAY,CAAC,eAAe,CAAA;SACtD;KACF;IAED,IAAI,OAAO,CAAC,YAAY,IAAI,IAAI,IAAI,aAAa,IAAI,IAAI,EAAE;QACzD,MAAM,CAAC,gBAAgB,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAA;KACtE;IAED,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAA;IAEzD,OAAO;QACL,GAAG,IAAI;QACP,YAAY,EAAE,YAAY,EAAE,MAAM,CAChC,CAAC,WAAW,EAAE,EAAE,CACd,aAAa,EAAE,IAAI,CACjB,CAAC,YAAY,EAAE,EAAE,CACf,WAAW,CAAC,YAAY,CAAC,eAAe;YACxC,YAAY,CAAC,eAAe,CAC/B,CACJ;KACF,CAAA;AACH,CAAC,CAAA"}
@@ -1,8 +1,12 @@
1
1
  import { useManufacturers } from '../../../../lib/seam/components/SupportedDeviceTable/use-manufacturers.js';
2
2
  export const useFilteredManufacturers = (params) => {
3
- return useManufacturers({
3
+ const { manufacturers, ...rest } = useManufacturers({
4
4
  liqe_query: createLiqeQuery(params),
5
5
  });
6
+ return {
7
+ ...rest,
8
+ manufacturers: manufacturers?.filter((manufacturer) => manufacturer.device_model_count > 0),
9
+ };
6
10
  };
7
11
  export const createLiqeQuery = ({ manufacturers, excludedManufacturers, }) => {
8
12
  if ((manufacturers?.some(isInvalidInput) ?? false) ||
@@ -1 +1 @@
1
- {"version":3,"file":"use-filtered-manufacturers.js","sourceRoot":"","sources":["../../../../src/lib/seam/components/SupportedDeviceTable/use-filtered-manufacturers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,+DAA+D,CAAA;AAMhG,MAAM,CAAC,MAAM,wBAAwB,GAAG,CACtC,MAAc,EACuB,EAAE;IACvC,OAAO,gBAAgB,CAAC;QACtB,UAAU,EAAE,eAAe,CAAC,MAAM,CAAC;KACpC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,eAAe,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AO,GAAG,2BAA2B,QAAQ,2BAA2B,EAAE,CAAA;AAC5E,CAAC,CAAA;AAED,MAAM,qBAAqB,GAAG,CAAC,KAAa,EAAU,EAAE;IACtD,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAC7C,IAAI,IAAI,IAAI,IAAI;QAAE,OAAO,oBAAoB,IAAI,GAAG,CAAA;IACpD,OAAO,iBAAiB,YAAY,GAAG,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,cAAc,GAAG,CAAC,KAAa,EAAW,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA"}
package/lib/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- declare const seamapiReactVersion = "2.1.2";
1
+ declare const seamapiReactVersion = "2.1.4";
2
2
  export default seamapiReactVersion;
package/lib/version.js CHANGED
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '2.1.2';
1
+ const seamapiReactVersion = '2.1.4';
2
2
  export default seamapiReactVersion;
3
3
  //# sourceMappingURL=version.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seamapi/react",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Seam Components.",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -140,10 +140,10 @@
140
140
  "@mui/icons-material": "^5.11.16",
141
141
  "@mui/material": "^5.12.2",
142
142
  "@rxfork/r2wc-react-to-web-component": "^2.4.0",
143
- "@seamapi/fake-devicedb": "^1.1.0",
144
- "@seamapi/fake-seam-connect": "^1.37.1",
143
+ "@seamapi/fake-devicedb": "^1.2.0",
144
+ "@seamapi/fake-seam-connect": "^1.41.0",
145
145
  "@seamapi/http": "^0.2.1",
146
- "@seamapi/types": "^1.28.0",
146
+ "@seamapi/types": "^1.32.0",
147
147
  "@storybook/addon-designs": "^7.0.1",
148
148
  "@storybook/addon-essentials": "^7.0.2",
149
149
  "@storybook/addon-links": "^7.0.2",
@@ -1,4 +1,5 @@
1
1
  import type { DeviceModelV1 } from '@seamapi/types/devicedb'
2
+ import { useMemo } from 'react'
2
3
 
3
4
  import { SupportedDeviceFilterResultRow } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceFilterResultRow.js'
4
5
  import { SupportedDeviceManufacturerSection } from 'lib/seam/components/SupportedDeviceTable/SupportedDeviceManufacturerSection.js'
@@ -33,6 +34,11 @@ export function SupportedDeviceContent({
33
34
  }
34
35
  )
35
36
 
37
+ const groupedDeviceModels = useMemo(
38
+ () => groupDeviceModelsByManufacturer(deviceModels ?? []),
39
+ [deviceModels]
40
+ )
41
+
36
42
  if (isLoading) {
37
43
  return (
38
44
  <div className='seam-supported-device-table-content-state-block'>
@@ -91,15 +97,22 @@ export function SupportedDeviceContent({
91
97
 
92
98
  return (
93
99
  <>
94
- {Object.entries(groupDeviceModelsByManufacturer(deviceModels)).map(
95
- ([manufacturerId, models]) => (
96
- <SupportedDeviceManufacturerSection
97
- key={manufacturerId}
98
- manufacturerId={manufacturerId}
99
- deviceModels={models}
100
- />
100
+ {Object.entries(groupedDeviceModels)
101
+ .sort(
102
+ (e1, e2) =>
103
+ e1[1][0]?.manufacturer.display_name.localeCompare(
104
+ e2[1][0]?.manufacturer.display_name ?? ''
105
+ ) ?? 0
101
106
  )
102
- )}
107
+ .map(([manufacturerId, models]) => {
108
+ return (
109
+ <SupportedDeviceManufacturerSection
110
+ key={manufacturerId}
111
+ manufacturerId={manufacturerId}
112
+ deviceModels={models}
113
+ />
114
+ )
115
+ })}
103
116
  </>
104
117
  )
105
118
  }
@@ -136,9 +149,9 @@ function EmptyResult({
136
149
  )
137
150
  }
138
151
 
139
- function groupDeviceModelsByManufacturer(
152
+ const groupDeviceModelsByManufacturer = (
140
153
  deviceModels: UseDeviceModelsData
141
- ): Record<string, DeviceModelV1[]> {
154
+ ): Record<string, DeviceModelV1[]> => {
142
155
  const result: Record<string, DeviceModelV1[]> = {}
143
156
 
144
157
  for (const model of deviceModels) {
@@ -46,10 +46,10 @@ export const useFilteredDeviceModels = ({
46
46
  params.manufacturer_ids = manufacturers.map((m) => m.manufacturer_id)
47
47
  }
48
48
 
49
- const { deviceModels, ...query } = useDeviceModels(params)
49
+ const { deviceModels, ...rest } = useDeviceModels(params)
50
50
 
51
51
  return {
52
- ...query,
52
+ ...rest,
53
53
  deviceModels: deviceModels?.filter(
54
54
  (deviceModel) =>
55
55
  manufacturers?.some(
@@ -7,9 +7,16 @@ interface Params {
7
7
  export const useFilteredManufacturers = (
8
8
  params: Params
9
9
  ): ReturnType<typeof useManufacturers> => {
10
- return useManufacturers({
10
+ const { manufacturers, ...rest } = useManufacturers({
11
11
  liqe_query: createLiqeQuery(params),
12
12
  })
13
+
14
+ return {
15
+ ...rest,
16
+ manufacturers: manufacturers?.filter(
17
+ (manufacturer) => manufacturer.device_model_count > 0
18
+ ),
19
+ }
13
20
  }
14
21
 
15
22
  export const createLiqeQuery = ({
@@ -1,3 +1,3 @@
1
- const seamapiReactVersion = '2.1.2'
1
+ const seamapiReactVersion = '2.1.4'
2
2
 
3
3
  export default seamapiReactVersion