@elliemae/ds-data-table 3.0.0-next.66 → 3.0.0-next.69

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.
@@ -69,6 +69,7 @@ const DataTable = (props) => {
69
69
  };
70
70
  DataTable.propTypes = import_DataTableSchema.DataTableSchema;
71
71
  DataTable.defaultProps = __spreadValues({}, import_DataTableContext.defaultProps);
72
+ DataTable.displayName = "DataTable";
72
73
  const DataTableWithSchema = (0, import_ds_utilities.describe)(DataTable).description("Data Table");
73
74
  DataTableWithSchema.propTypes = import_DataTableSchema.DataTableSchema;
74
75
  //# sourceMappingURL=DataTable.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/DataTable.tsx", "../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["import React, { useRef } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { TableContent } from './parts/TableContent';\nimport { TypescriptProps } from './types/props';\nimport { DataTableContext, defaultProps } from './DataTableContext';\nimport { DATA_TESTID } from './configs/constants';\nimport { useDatatableConfig } from './configs/useDatatableConfig';\nimport { FiltersBar } from './parts/FilterBar/FiltersBar';\nimport { DataTableSchema } from './DataTableSchema';\nimport { StyledDataTableWrapper } from './styled';\n\nexport const DataTable = (props: TypescriptProps): JSX.Element => {\n const { withFilterBar } = props;\n\n const tableWrapperRef = useRef();\n const tableContentWrapperRef = useRef();\n\n const ctx = useDatatableConfig(props);\n\n const {\n tableProps: { height, width },\n } = ctx;\n\n return (\n <DataTableContext.Provider value={ctx}>\n <StyledDataTableWrapper\n ref={tableWrapperRef}\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent ref={tableContentWrapperRef} />\n </StyledDataTableWrapper>\n </DataTableContext.Provider>\n );\n};\n\nDataTable.propTypes = DataTableSchema;\nDataTable.defaultProps = { ...defaultProps };\n\nexport const DataTableWithSchema = describe(DataTable).description('Data Table');\nDataTableWithSchema.propTypes = DataTableSchema;\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAC9B,0BAAyB;AACzB,0BAA6B;AAE7B,8BAA+C;AAC/C,uBAA4B;AAC5B,gCAAmC;AACnC,wBAA2B;AAC3B,6BAAgC;AAChC,oBAAuC;AAEhC,MAAM,YAAY,CAAC,UAAwC;AAChE,QAAM,EAAE,kBAAkB;AAE1B,QAAM,kBAAkB,yBAAO;AAC/B,QAAM,yBAAyB,yBAAO;AAEtC,QAAM,MAAM,kDAAmB,KAAK;AAEpC,QAAM;AAAA,IACJ,YAAY,EAAE,QAAQ;AAAA,MACpB;AAEJ,SACE,mDAAC,yCAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAChC,mDAAC;AAAA,IACC,KAAK;AAAA,IACL,eAAa,6BAAY;AAAA,IACzB;AAAA,IACA;AAAA,KAEC,gBAAgB,mDAAC,kCAAW,IAAK,MAClC,mDAAC;AAAA,IAAa,KAAK;AAAA,GAAwB,CAC7C,CACF;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe,mBAAK;AAEvB,MAAM,sBAAsB,kCAAS,SAAS,EAAE,YAAY,YAAY;AAC/E,oBAAoB,YAAY;",
4
+ "sourcesContent": ["import React, { useRef } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { TableContent } from './parts/TableContent';\nimport { TypescriptProps } from './types/props';\nimport { DataTableContext, defaultProps } from './DataTableContext';\nimport { DATA_TESTID } from './configs/constants';\nimport { useDatatableConfig } from './configs/useDatatableConfig';\nimport { FiltersBar } from './parts/FilterBar/FiltersBar';\nimport { DataTableSchema } from './DataTableSchema';\nimport { StyledDataTableWrapper } from './styled';\n\nexport const DataTable = (props: TypescriptProps): JSX.Element => {\n const { withFilterBar } = props;\n\n const tableWrapperRef = useRef();\n const tableContentWrapperRef = useRef();\n\n const ctx = useDatatableConfig(props);\n\n const {\n tableProps: { height, width },\n } = ctx;\n\n return (\n <DataTableContext.Provider value={ctx}>\n <StyledDataTableWrapper\n ref={tableWrapperRef}\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent ref={tableContentWrapperRef} />\n </StyledDataTableWrapper>\n </DataTableContext.Provider>\n );\n};\n\nDataTable.propTypes = DataTableSchema;\nDataTable.defaultProps = { ...defaultProps };\nDataTable.displayName = 'DataTable';\nexport const DataTableWithSchema = describe(DataTable).description('Data Table');\nDataTableWithSchema.propTypes = DataTableSchema;\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADAvB,mBAA8B;AAC9B,0BAAyB;AACzB,0BAA6B;AAE7B,8BAA+C;AAC/C,uBAA4B;AAC5B,gCAAmC;AACnC,wBAA2B;AAC3B,6BAAgC;AAChC,oBAAuC;AAEhC,MAAM,YAAY,CAAC,UAAwC;AAChE,QAAM,EAAE,kBAAkB;AAE1B,QAAM,kBAAkB,yBAAO;AAC/B,QAAM,yBAAyB,yBAAO;AAEtC,QAAM,MAAM,kDAAmB,KAAK;AAEpC,QAAM;AAAA,IACJ,YAAY,EAAE,QAAQ;AAAA,MACpB;AAEJ,SACE,mDAAC,yCAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAChC,mDAAC;AAAA,IACC,KAAK;AAAA,IACL,eAAa,6BAAY;AAAA,IACzB;AAAA,IACA;AAAA,KAEC,gBAAgB,mDAAC,kCAAW,IAAK,MAClC,mDAAC;AAAA,IAAa,KAAK;AAAA,GAAwB,CAC7C,CACF;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe,mBAAK;AAC9B,UAAU,cAAc;AACjB,MAAM,sBAAsB,kCAAS,SAAS,EAAE,YAAY,YAAY;AAC/E,oBAAoB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -73,7 +73,7 @@ const BaseSelectFilter = (props) => {
73
73
  }, [filterOptions]);
74
74
  const Select = /* @__PURE__ */ import_react.default.createElement(import_ds_grid.Grid, {
75
75
  "data-testid": isMulti ? import_configs.DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : import_configs.DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER,
76
- style: { background: "#fff", position: "relative", width: filterMinWidth }
76
+ style: { background: "#fff", position: "relative", width: filterMinWidth ?? column.ref?.current?.offsetWidth }
77
77
  }, /* @__PURE__ */ import_react.default.createElement(import_ds_controlled_form.DSComboBox, {
78
78
  inline: true,
79
79
  autoFocus: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../src/addons/Filters/Components/SelectFilter/BaseSelectFilter.tsx", "../../../../../../../../scripts/build/transpile/react-shim.js"],
4
- "sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useCallback, useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBox } from '@elliemae/ds-controlled-form';\nimport { SearchXsmall } from '@elliemae/ds-icons';\nimport { FilterPopover } from '../../../../exported-related';\nimport { FilterProps } from '../../../../types/props';\nimport { DATA_TESTID } from '../../../../configs';\nimport DataTableContext from '../../../../DataTableContext';\n\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface BaseSelectProps {\n isSingle?: boolean;\n isMulti?: boolean;\n selectedItems?: FilterOptionT[] | FilterOptionT;\n type: string;\n}\n\nexport const BaseSelectFilter: React.ComponentType<FilterProps & BaseSelectProps> = (props) => {\n const {\n isMulti = false,\n selectedItems = null,\n column,\n type,\n column: { id, filterOptions: userFilterOptions, filterMinWidth },\n ctx: {\n tableProps: { data },\n },\n reduxHeader,\n innerRef,\n onValueChange,\n } = props;\n\n const { patchHeaderFilterButtonAndMenu } = useContext(DataTableContext);\n\n const filterOptions: FilterOptionT[] = useMemo(() => {\n // If the user didn't provide options, use the available ones\n if (!userFilterOptions) {\n const automaticFilters = [\n ...new Set(data.map((datum) => datum?.[id]?.toString()).filter((val) => val !== undefined)),\n ].map((item) => ({\n type: 'option',\n dsId: item,\n value: item,\n label: item,\n }));\n\n return automaticFilters;\n }\n\n // If user provided the array itself, use it\n if (Array.isArray(userFilterOptions)) return userFilterOptions;\n // Otherwise, it is a function\n return userFilterOptions();\n }, [data, id, userFilterOptions]);\n\n const handleOnChange = (value) => {\n onValueChange(type, value);\n if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);\n };\n\n const [filters, setFilteredOptions] = useState(filterOptions);\n\n useEffect(() => {\n setFilteredOptions(filterOptions);\n }, [filterOptions]);\n\n const Select = (\n <Grid\n data-testid={\n isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER\n }\n style={{ background: '#fff', position: 'relative', width: filterMinWidth }}\n >\n <DSComboBox\n inline\n autoFocus\n allOptions={filterOptions}\n filteredOptions={filters}\n onChange={handleOnChange}\n selectedValues={selectedItems}\n onFilter={setFilteredOptions}\n menuMaxHeight={300}\n />\n </Grid>\n );\n\n const handleOnClickOutside = () => {\n setFilteredOptions(filterOptions);\n };\n return (\n <FilterPopover\n reduxHeader={reduxHeader}\n column={column}\n columnId={column.id}\n menuContent={Select}\n triggerIcon={<SearchXsmall />}\n innerRef={innerRef}\n ariaLabel=\"Open Selection Filter\"\n onClickOutsideMenu={handleOnClickOutside}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA6E;AAC7E,qBAAqB;AACrB,gCAA2B;AAC3B,s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,IACN,WAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAe;AAAA,GACjB,CACF;AAGF,QAAM,uBAAuB,MAAM;AACjC,uBAAmB,aAAa;AAAA,EAClC;AACA,SACE,mDAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,aAAa;AAAA,IACb,aAAa,mDAAC,kCAAa;AAAA,IAC3B;AAAA,IACA,WAAU;AAAA,IACV,oBAAoB;AAAA,GACtB;AAEJ;",
4
+ "sourcesContent": ["/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useCallback, useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBox } from '@elliemae/ds-controlled-form';\nimport { SearchXsmall } from '@elliemae/ds-icons';\nimport { FilterPopover } from '../../../../exported-related';\nimport { FilterProps } from '../../../../types/props';\nimport { DATA_TESTID } from '../../../../configs';\nimport DataTableContext from '../../../../DataTableContext';\n\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface BaseSelectProps {\n isSingle?: boolean;\n isMulti?: boolean;\n selectedItems?: FilterOptionT[] | FilterOptionT;\n type: string;\n}\n\nexport const BaseSelectFilter: React.ComponentType<FilterProps & BaseSelectProps> = (props) => {\n const {\n isMulti = false,\n selectedItems = null,\n column,\n type,\n column: { id, filterOptions: userFilterOptions, filterMinWidth },\n ctx: {\n tableProps: { data },\n },\n reduxHeader,\n innerRef,\n onValueChange,\n } = props;\n\n const { patchHeaderFilterButtonAndMenu } = useContext(DataTableContext);\n\n const filterOptions: FilterOptionT[] = useMemo(() => {\n // If the user didn't provide options, use the available ones\n if (!userFilterOptions) {\n const automaticFilters = [\n ...new Set(data.map((datum) => datum?.[id]?.toString()).filter((val) => val !== undefined)),\n ].map((item) => ({\n type: 'option',\n dsId: item,\n value: item,\n label: item,\n }));\n\n return automaticFilters;\n }\n\n // If user provided the array itself, use it\n if (Array.isArray(userFilterOptions)) return userFilterOptions;\n // Otherwise, it is a function\n return userFilterOptions();\n }, [data, id, userFilterOptions]);\n\n const handleOnChange = (value) => {\n onValueChange(type, value);\n if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);\n };\n\n const [filters, setFilteredOptions] = useState(filterOptions);\n\n useEffect(() => {\n setFilteredOptions(filterOptions);\n }, [filterOptions]);\n\n const Select = (\n <Grid\n data-testid={\n isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER\n }\n style={{ background: '#fff', position: 'relative', width: filterMinWidth ?? column.ref?.current?.offsetWidth }}\n >\n <DSComboBox\n inline\n autoFocus\n allOptions={filterOptions}\n filteredOptions={filters}\n onChange={handleOnChange}\n selectedValues={selectedItems}\n onFilter={setFilteredOptions}\n menuMaxHeight={300}\n />\n </Grid>\n );\n\n const handleOnClickOutside = () => {\n setFilteredOptions(filterOptions);\n };\n return (\n <FilterPopover\n reduxHeader={reduxHeader}\n column={column}\n columnId={column.id}\n menuContent={Select}\n triggerIcon={<SearchXsmall />}\n innerRef={innerRef}\n ariaLabel=\"Open Selection Filter\"\n onClickOutsideMenu={handleOnClickOutside}\n />\n );\n};\n", "import * as React from 'react';\nexport { React };\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;ACAA,YAAuB;ADCvB,mBAA6E;AAC7E,qBAAqB;AACrB,gCAA2B;AAC3B,sBAA6B;AAC7B,8BAA8B;AAE9B,qBAA4B;AAC5B,8BAA6B;AAgBtB,MAAM,mBAAuE,CAAC,UAAU;AAC7F,QAAM;AAAA,IACJ,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,QAAQ,EAAE,IAAI,eAAe,mBAAmB;AAAA,IAChD,KAAK;AAAA,MACH,YAAY,EAAE;AAAA;AAA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IACA;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,aAAa;AAAA,IACb,aAAa,mDAAC,kCAAa;AAAA,IAC3B;AAAA,IACA,WAAU;AAAA,IACV,oBAAoB;AAAA,GACtB;AAEJ;",
6
6
  "names": []
7
7
  }
@@ -45,6 +45,7 @@ const DataTable = (props) => {
45
45
  };
46
46
  DataTable.propTypes = DataTableSchema;
47
47
  DataTable.defaultProps = __spreadValues({}, defaultProps);
48
+ DataTable.displayName = "DataTable";
48
49
  const DataTableWithSchema = describe(DataTable).description("Data Table");
49
50
  DataTableWithSchema.propTypes = DataTableSchema;
50
51
  export {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../scripts/build/transpile/react-shim.js", "../../src/DataTable.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { TableContent } from './parts/TableContent';\nimport { TypescriptProps } from './types/props';\nimport { DataTableContext, defaultProps } from './DataTableContext';\nimport { DATA_TESTID } from './configs/constants';\nimport { useDatatableConfig } from './configs/useDatatableConfig';\nimport { FiltersBar } from './parts/FilterBar/FiltersBar';\nimport { DataTableSchema } from './DataTableSchema';\nimport { StyledDataTableWrapper } from './styled';\n\nexport const DataTable = (props: TypescriptProps): JSX.Element => {\n const { withFilterBar } = props;\n\n const tableWrapperRef = useRef();\n const tableContentWrapperRef = useRef();\n\n const ctx = useDatatableConfig(props);\n\n const {\n tableProps: { height, width },\n } = ctx;\n\n return (\n <DataTableContext.Provider value={ctx}>\n <StyledDataTableWrapper\n ref={tableWrapperRef}\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent ref={tableContentWrapperRef} />\n </StyledDataTableWrapper>\n </DataTableContext.Provider>\n );\n};\n\nDataTable.propTypes = DataTableSchema;\nDataTable.defaultProps = { ...defaultProps };\n\nexport const DataTableWithSchema = describe(DataTable).description('Data Table');\nDataTableWithSchema.propTypes = DataTableSchema;\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,YAAY,CAAC,UAAwC;AAChE,QAAM,EAAE,kBAAkB;AAE1B,QAAM,kBAAkB,OAAO;AAC/B,QAAM,yBAAyB,OAAO;AAEtC,QAAM,MAAM,mBAAmB,KAAK;AAEpC,QAAM;AAAA,IACJ,YAAY,EAAE,QAAQ;AAAA,MACpB;AAEJ,SACE,qCAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAChC,qCAAC;AAAA,IACC,KAAK;AAAA,IACL,eAAa,YAAY;AAAA,IACzB;AAAA,IACA;AAAA,KAEC,gBAAgB,qCAAC,gBAAW,IAAK,MAClC,qCAAC;AAAA,IAAa,KAAK;AAAA,GAAwB,CAC7C,CACF;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe,mBAAK;AAEvB,MAAM,sBAAsB,SAAS,SAAS,EAAE,YAAY,YAAY;AAC/E,oBAAoB,YAAY;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "import React, { useRef } from 'react';\nimport { describe } from '@elliemae/ds-utilities';\nimport { TableContent } from './parts/TableContent';\nimport { TypescriptProps } from './types/props';\nimport { DataTableContext, defaultProps } from './DataTableContext';\nimport { DATA_TESTID } from './configs/constants';\nimport { useDatatableConfig } from './configs/useDatatableConfig';\nimport { FiltersBar } from './parts/FilterBar/FiltersBar';\nimport { DataTableSchema } from './DataTableSchema';\nimport { StyledDataTableWrapper } from './styled';\n\nexport const DataTable = (props: TypescriptProps): JSX.Element => {\n const { withFilterBar } = props;\n\n const tableWrapperRef = useRef();\n const tableContentWrapperRef = useRef();\n\n const ctx = useDatatableConfig(props);\n\n const {\n tableProps: { height, width },\n } = ctx;\n\n return (\n <DataTableContext.Provider value={ctx}>\n <StyledDataTableWrapper\n ref={tableWrapperRef}\n data-testid={DATA_TESTID.DATA_TABLE_WRAPPER}\n height={height}\n width={width}\n >\n {withFilterBar ? <FiltersBar /> : null}\n <TableContent ref={tableContentWrapperRef} />\n </StyledDataTableWrapper>\n </DataTableContext.Provider>\n );\n};\n\nDataTable.propTypes = DataTableSchema;\nDataTable.defaultProps = { ...defaultProps };\nDataTable.displayName = 'DataTable';\nexport const DataTableWithSchema = describe(DataTable).description('Data Table');\nDataTableWithSchema.propTypes = DataTableSchema;\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;AAAA;ACAA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AAEO,MAAM,YAAY,CAAC,UAAwC;AAChE,QAAM,EAAE,kBAAkB;AAE1B,QAAM,kBAAkB,OAAO;AAC/B,QAAM,yBAAyB,OAAO;AAEtC,QAAM,MAAM,mBAAmB,KAAK;AAEpC,QAAM;AAAA,IACJ,YAAY,EAAE,QAAQ;AAAA,MACpB;AAEJ,SACE,qCAAC,iBAAiB,UAAjB;AAAA,IAA0B,OAAO;AAAA,KAChC,qCAAC;AAAA,IACC,KAAK;AAAA,IACL,eAAa,YAAY;AAAA,IACzB;AAAA,IACA;AAAA,KAEC,gBAAgB,qCAAC,gBAAW,IAAK,MAClC,qCAAC;AAAA,IAAa,KAAK;AAAA,GAAwB,CAC7C,CACF;AAEJ;AAEA,UAAU,YAAY;AACtB,UAAU,eAAe,mBAAK;AAC9B,UAAU,cAAc;AACjB,MAAM,sBAAsB,SAAS,SAAS,EAAE,YAAY,YAAY;AAC/E,oBAAoB,YAAY;",
6
6
  "names": []
7
7
  }
@@ -48,7 +48,7 @@ const BaseSelectFilter = (props) => {
48
48
  }, [filterOptions]);
49
49
  const Select = /* @__PURE__ */ React2.createElement(Grid, {
50
50
  "data-testid": isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER,
51
- style: { background: "#fff", position: "relative", width: filterMinWidth }
51
+ style: { background: "#fff", position: "relative", width: filterMinWidth ?? column.ref?.current?.offsetWidth }
52
52
  }, /* @__PURE__ */ React2.createElement(DSComboBox, {
53
53
  inline: true,
54
54
  autoFocus: true,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../../../../../scripts/build/transpile/react-shim.js", "../../../../../../src/addons/Filters/Components/SelectFilter/BaseSelectFilter.tsx"],
4
- "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useCallback, useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBox } from '@elliemae/ds-controlled-form';\nimport { SearchXsmall } from '@elliemae/ds-icons';\nimport { FilterPopover } from '../../../../exported-related';\nimport { FilterProps } from '../../../../types/props';\nimport { DATA_TESTID } from '../../../../configs';\nimport DataTableContext from '../../../../DataTableContext';\n\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface BaseSelectProps {\n isSingle?: boolean;\n isMulti?: boolean;\n selectedItems?: FilterOptionT[] | FilterOptionT;\n type: string;\n}\n\nexport const BaseSelectFilter: React.ComponentType<FilterProps & BaseSelectProps> = (props) => {\n const {\n isMulti = false,\n selectedItems = null,\n column,\n type,\n column: { id, filterOptions: userFilterOptions, filterMinWidth },\n ctx: {\n tableProps: { data },\n },\n reduxHeader,\n innerRef,\n onValueChange,\n } = props;\n\n const { patchHeaderFilterButtonAndMenu } = useContext(DataTableContext);\n\n const filterOptions: FilterOptionT[] = useMemo(() => {\n // If the user didn't provide options, use the available ones\n if (!userFilterOptions) {\n const automaticFilters = [\n ...new Set(data.map((datum) => datum?.[id]?.toString()).filter((val) => val !== undefined)),\n ].map((item) => ({\n type: 'option',\n dsId: item,\n value: item,\n label: item,\n }));\n\n return automaticFilters;\n }\n\n // If user provided the array itself, use it\n if (Array.isArray(userFilterOptions)) return userFilterOptions;\n // Otherwise, it is a function\n return userFilterOptions();\n }, [data, id, userFilterOptions]);\n\n const handleOnChange = (value) => {\n onValueChange(type, value);\n if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);\n };\n\n const [filters, setFilteredOptions] = useState(filterOptions);\n\n useEffect(() => {\n setFilteredOptions(filterOptions);\n }, [filterOptions]);\n\n const Select = (\n <Grid\n data-testid={\n isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER\n }\n style={{ background: '#fff', position: 'relative', width: filterMinWidth }}\n >\n <DSComboBox\n inline\n autoFocus\n allOptions={filterOptions}\n filteredOptions={filters}\n onChange={handleOnChange}\n selectedValues={selectedItems}\n onFilter={setFilteredOptions}\n menuMaxHeight={300}\n />\n </Grid>\n );\n\n const handleOnClickOutside = () => {\n setFilteredOptions(filterOptions);\n };\n return (\n <FilterPopover\n reduxHeader={reduxHeader}\n column={column}\n columnId={column.id}\n menuContent={Select}\n triggerIcon={<SearchXsmall />}\n innerRef={innerRef}\n ariaLabel=\"Open Selection Filter\"\n onClickOutsideMenu={handleOnClickOutside}\n />\n );\n};\n"],
5
- "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAEA;AACA;AAgBO,MAAM,mBAAuE,CAAC,UAAU;AAC7F,QAAM;AAAA,IACJ,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,QAAQ,EAAE,IAAI,eAAe,mBAAmB;AAAA,IAChD,KAAK;AAAA,MACH,YAAY,EAAE;AAAA;AAAA,IAEhB;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,EAAE,mCAAmC,WAAW,gBAAgB;AAEtE,QAAM,gBAAiC,QAAQ,MAAM;AAEnD,QAAI,CAAC,mBAAmB;AACtB,YAAM,mBAAmB;AAAA,QACvB,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,UAAU,QAAQ,KAAK,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,QAAQ,MAAS,CAAC;AAAA,MAC5F,EAAE,IAAI,CAAC,SAAU;AAAA,QACf,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO;AAAA,MACT,EAAE;AAEF,aAAO;AAAA,IACT;AAGA,QAAI,MAAM,QAAQ,iBAAiB;AAAG,aAAO;AAE7C,WAAO,kBAAkB;AAAA,EAC3B,GAAG,CAAC,MAAM,IAAI,iBAAiB,CAAC;AAEhC,QAAM,iBAAiB,CAAC,UAAU;AAChC,kBAAc,MAAM,KAAK;AACzB,QAAI,CAAC;AAAS,qCAA+B,OAAO,IAAI,IAAI;AAAA,EAC9D;AAEA,QAAM,CAAC,SAAS,sBAAsB,SAAS,aAAa;AAE5D,YAAU,MAAM;AACd,uBAAmB,aAAa;AAAA,EAClC,GAAG,CAAC,aAAa,CAAC;AAElB,QAAM,SACJ,qCAAC;AAAA,IACC,eACE,UAAU,YAAY,oCAAoC,YAAY;AAAA,IAExE,OAAO,EAAE,YAAY,QAAQ,UAAU,YAAY,OAAO,eAAe;AAAA,KAEzE,qCAAC;AAAA,IACC,QAAM;AAAA,IACN,WAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAe;AAAA,GACjB,CACF;AAGF,QAAM,uBAAuB,MAAM;AACjC,uBAAmB,aAAa;AAAA,EAClC;AACA,SACE,qCAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,aAAa;AAAA,IACb,aAAa,qCAAC,kBAAa;AAAA,IAC3B;AAAA,IACA,WAAU;AAAA,IACV,oBAAoB;AAAA,GACtB;AAEJ;",
4
+ "sourcesContent": ["import * as React from 'react';\nexport { React };\n", "/* eslint-disable react/prop-types */\nimport React, { useState, useEffect, useMemo, useCallback, useContext } from 'react';\nimport { Grid } from '@elliemae/ds-grid';\nimport { DSComboBox } from '@elliemae/ds-controlled-form';\nimport { SearchXsmall } from '@elliemae/ds-icons';\nimport { FilterPopover } from '../../../../exported-related';\nimport { FilterProps } from '../../../../types/props';\nimport { DATA_TESTID } from '../../../../configs';\nimport DataTableContext from '../../../../DataTableContext';\n\ninterface FilterOptionT {\n dsId: string;\n type: string;\n value: string;\n label: string;\n}\n\ninterface BaseSelectProps {\n isSingle?: boolean;\n isMulti?: boolean;\n selectedItems?: FilterOptionT[] | FilterOptionT;\n type: string;\n}\n\nexport const BaseSelectFilter: React.ComponentType<FilterProps & BaseSelectProps> = (props) => {\n const {\n isMulti = false,\n selectedItems = null,\n column,\n type,\n column: { id, filterOptions: userFilterOptions, filterMinWidth },\n ctx: {\n tableProps: { data },\n },\n reduxHeader,\n innerRef,\n onValueChange,\n } = props;\n\n const { patchHeaderFilterButtonAndMenu } = useContext(DataTableContext);\n\n const filterOptions: FilterOptionT[] = useMemo(() => {\n // If the user didn't provide options, use the available ones\n if (!userFilterOptions) {\n const automaticFilters = [\n ...new Set(data.map((datum) => datum?.[id]?.toString()).filter((val) => val !== undefined)),\n ].map((item) => ({\n type: 'option',\n dsId: item,\n value: item,\n label: item,\n }));\n\n return automaticFilters;\n }\n\n // If user provided the array itself, use it\n if (Array.isArray(userFilterOptions)) return userFilterOptions;\n // Otherwise, it is a function\n return userFilterOptions();\n }, [data, id, userFilterOptions]);\n\n const handleOnChange = (value) => {\n onValueChange(type, value);\n if (!isMulti) patchHeaderFilterButtonAndMenu(column.id, true);\n };\n\n const [filters, setFilteredOptions] = useState(filterOptions);\n\n useEffect(() => {\n setFilteredOptions(filterOptions);\n }, [filterOptions]);\n\n const Select = (\n <Grid\n data-testid={\n isMulti ? DATA_TESTID.DATA_TABLE_MULTISELECT_CONTROLLER : DATA_TESTID.DATA_TABLE_SINGLESELECT_CONTROLLER\n }\n style={{ background: '#fff', position: 'relative', width: filterMinWidth ?? column.ref?.current?.offsetWidth }}\n >\n <DSComboBox\n inline\n autoFocus\n allOptions={filterOptions}\n filteredOptions={filters}\n onChange={handleOnChange}\n selectedValues={selectedItems}\n onFilter={setFilteredOptions}\n menuMaxHeight={300}\n />\n </Grid>\n );\n\n const handleOnClickOutside = () => {\n setFilteredOptions(filterOptions);\n };\n return (\n <FilterPopover\n reduxHeader={reduxHeader}\n column={column}\n columnId={column.id}\n menuContent={Select}\n triggerIcon={<SearchXsmall />}\n innerRef={innerRef}\n ariaLabel=\"Open Selection Filter\"\n onClickOutsideMenu={handleOnClickOutside}\n />\n );\n};\n"],
5
+ "mappings": "AAAA;ACCA;AACA;AACA;AACA;AACA;AAEA;AACA;AAgBO,MAAM,mBAAuE,CAAC,UAAU;AAC7F,QAAM;AAAA,IACJ,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB;AAAA,IACA;AAAA,IACA,QAAQ,EAAE,IAAI,eAAe,mBAAmB;AAAA,IAChD,KAAK;AAAA,MACH,YAAY,EAAE;AAAA;AAAA,IAEhB;AAAA,IACA;AAAA,IACA;AAAA,MACE;AAEJ,QAAM,EAAE,mCAAmC,WAAW,gBAAgB;AAEtE,QAAM,gBAAiC,QAAQ,MAAM;AAEnD,QAAI,CAAC,mBAAmB;AACtB,YAAM,mBAAmB;AAAA,QACvB,GAAG,IAAI,IAAI,KAAK,IAAI,CAAC,UAAU,QAAQ,KAAK,SAAS,CAAC,EAAE,OAAO,CAAC,QAAQ,QAAQ,MAAS,CAAC;AAAA,MAC5F,EAAE,IAAI,CAAC,SAAU;AAAA,QACf,MAAM;AAAA,QACN,MAAM;AAAA,QACN,OAAO;AAAA,QACP,OAAO;AAAA,MACT,EAAE;AAEF,aAAO;AAAA,IACT;AAGA,QAAI,MAAM,QAAQ,iBAAiB;AAAG,aAAO;AAE7C,WAAO,kBAAkB;AAAA,EAC3B,GAAG,CAAC,MAAM,IAAI,iBAAiB,CAAC;AAEhC,QAAM,iBAAiB,CAAC,UAAU;AAChC,kBAAc,MAAM,KAAK;AACzB,QAAI,CAAC;AAAS,qCAA+B,OAAO,IAAI,IAAI;AAAA,EAC9D;AAEA,QAAM,CAAC,SAAS,sBAAsB,SAAS,aAAa;AAE5D,YAAU,MAAM;AACd,uBAAmB,aAAa;AAAA,EAClC,GAAG,CAAC,aAAa,CAAC;AAElB,QAAM,SACJ,qCAAC;AAAA,IACC,eACE,UAAU,YAAY,oCAAoC,YAAY;AAAA,IAExE,OAAO,EAAE,YAAY,QAAQ,UAAU,YAAY,OAAO,kBAAkB,OAAO,KAAK,SAAS,YAAY;AAAA,KAE7G,qCAAC;AAAA,IACC,QAAM;AAAA,IACN,WAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB;AAAA,IACjB,UAAU;AAAA,IACV,gBAAgB;AAAA,IAChB,UAAU;AAAA,IACV,eAAe;AAAA,GACjB,CACF;AAGF,QAAM,uBAAuB,MAAM;AACjC,uBAAmB,aAAa;AAAA,EAClC;AACA,SACE,qCAAC;AAAA,IACC;AAAA,IACA;AAAA,IACA,UAAU,OAAO;AAAA,IACjB,aAAa;AAAA,IACb,aAAa,qCAAC,kBAAa;AAAA,IAC3B;AAAA,IACA,WAAU;AAAA,IACV,oBAAoB;AAAA,GACtB;AAEJ;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elliemae/ds-data-table",
3
- "version": "3.0.0-next.66",
3
+ "version": "3.0.0-next.69",
4
4
  "license": "MIT",
5
5
  "description": "ICE MT - Dimsum - Data Table",
6
6
  "files": [