@deephaven/jsapi-components 0.72.1-beta.4 → 0.72.1-core-plugins.9
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/dist/TableDropdown.d.ts.map +1 -1
- package/dist/TableDropdown.js +7 -1
- package/dist/TableDropdown.js.map +1 -1
- package/dist/TableInput.css.map +1 -1
- package/dist/spectrum/ComboBox.d.ts +7 -0
- package/dist/spectrum/ComboBox.d.ts.map +1 -0
- package/dist/spectrum/ComboBox.js +31 -0
- package/dist/spectrum/ComboBox.js.map +1 -0
- package/dist/spectrum/ListView.d.ts +14 -0
- package/dist/spectrum/ListView.d.ts.map +1 -0
- package/dist/spectrum/ListView.js +57 -0
- package/dist/spectrum/ListView.js.map +1 -0
- package/dist/spectrum/Picker.d.ts +2 -10
- package/dist/spectrum/Picker.d.ts.map +1 -1
- package/dist/spectrum/Picker.js +6 -80
- package/dist/spectrum/Picker.js.map +1 -1
- package/dist/spectrum/PickerProps.d.ts +12 -0
- package/dist/spectrum/PickerProps.d.ts.map +1 -0
- package/dist/spectrum/PickerProps.js +2 -0
- package/dist/spectrum/PickerProps.js.map +1 -0
- package/dist/spectrum/index.d.ts +3 -0
- package/dist/spectrum/index.d.ts.map +1 -1
- package/dist/spectrum/index.js +3 -0
- package/dist/spectrum/index.js.map +1 -1
- package/dist/spectrum/utils/index.d.ts +1 -0
- package/dist/spectrum/utils/index.d.ts.map +1 -1
- package/dist/spectrum/utils/index.js +1 -0
- package/dist/spectrum/utils/index.js.map +1 -1
- package/dist/spectrum/utils/useItemRowDeserializer.d.ts +6 -2
- package/dist/spectrum/utils/useItemRowDeserializer.d.ts.map +1 -1
- package/dist/spectrum/utils/useItemRowDeserializer.js +23 -4
- package/dist/spectrum/utils/useItemRowDeserializer.js.map +1 -1
- package/dist/spectrum/utils/usePickerProps.d.ts +22 -0
- package/dist/spectrum/utils/usePickerProps.d.ts.map +1 -0
- package/dist/spectrum/utils/usePickerProps.js +136 -0
- package/dist/spectrum/utils/usePickerProps.js.map +1 -0
- package/dist/useDebouncedViewportSelectionFilter.d.ts.map +1 -1
- package/dist/useDebouncedViewportSelectionFilter.js +2 -2
- package/dist/useDebouncedViewportSelectionFilter.js.map +1 -1
- package/dist/useGetItemIndexByValue.d.ts +1 -1
- package/dist/useGetItemIndexByValue.d.ts.map +1 -1
- package/dist/useGetItemIndexByValue.js +1 -1
- package/dist/useGetItemIndexByValue.js.map +1 -1
- package/dist/usePickerWithSelectedValues.d.ts +3 -1
- package/dist/usePickerWithSelectedValues.d.ts.map +1 -1
- package/dist/usePickerWithSelectedValues.js +10 -4
- package/dist/usePickerWithSelectedValues.js.map +1 -1
- package/dist/useSearchableViewportData.d.ts +15 -5
- package/dist/useSearchableViewportData.d.ts.map +1 -1
- package/dist/useSearchableViewportData.js +27 -12
- package/dist/useSearchableViewportData.js.map +1 -1
- package/dist/useTableSize.d.ts.map +1 -1
- package/dist/useTableSize.js +4 -3
- package/dist/useTableSize.js.map +1 -1
- package/dist/useViewportData.d.ts +1 -1
- package/dist/useViewportData.d.ts.map +1 -1
- package/dist/useViewportData.js +20 -3
- package/dist/useViewportData.js.map +1 -1
- package/package.json +10 -10
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDropdown.d.ts","sourceRoot":"","sources":["../src/TableDropdown.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAoBtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;IAErB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;IAEvB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,SAAS,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IAEzC,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,MAAoB,EACpB,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,SAAS,EACT,WAAgC,EAChC,OAAc,GACf,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,
|
|
1
|
+
{"version":3,"file":"TableDropdown.d.ts","sourceRoot":"","sources":["../src/TableDropdown.tsx"],"names":[],"mappings":";AAGA,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAoBtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC;IAErB,0GAA0G;IAC1G,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC;IAEvB,wDAAwD;IACxD,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IAEnC,mCAAmC;IACnC,MAAM,CAAC,EAAE,SAAS,MAAM,CAAC,eAAe,EAAE,CAAC;IAE3C,mCAAmC;IACnC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2CAA2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wDAAwD;IACxD,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,MAAM,CAAC;IAEzC,yCAAyC;IACzC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAC5B,MAAM,EACN,KAAK,EACL,MAAoB,EACpB,QAAQ,EACR,aAAa,EACb,QAAQ,EACR,SAAS,EACT,WAAgC,EAChC,OAAc,GACf,EAAE,kBAAkB,GAAG,GAAG,CAAC,OAAO,CA0ElC;AAED,eAAe,aAAa,CAAC"}
|
package/dist/TableDropdown.js
CHANGED
|
@@ -39,7 +39,13 @@ export function TableDropdown(_ref) {
|
|
|
39
39
|
var {
|
|
40
40
|
detail
|
|
41
41
|
} = event;
|
|
42
|
-
|
|
42
|
+
// Core JSAPI returns undefined for null table values,
|
|
43
|
+
// coalesce with null to differentiate null from no selection in the dropdown
|
|
44
|
+
// https://github.com/deephaven/deephaven-core/issues/5400
|
|
45
|
+
var newValues = detail.rows.map(row => {
|
|
46
|
+
var _row$get;
|
|
47
|
+
return (_row$get = row.get(tableColumn)) !== null && _row$get !== void 0 ? _row$get : null;
|
|
48
|
+
});
|
|
43
49
|
setValues(newValues);
|
|
44
50
|
});
|
|
45
51
|
return () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TableDropdown.js","names":["React","useCallback","useEffect","useMemo","useState","Option","Select","useApi","EMPTY_ARRAY","jsx","_jsx","isJavaObject","value","equals","defaultFormatValue","concat","TableDropdown","_ref","column","table","filter","onChange","selectedValue","disabled","className","formatValue","maxSize","dh","values","setValues","undefined","tableColumn","columns","applyFilter","subscription","setViewport","addEventListener","Table","EVENT_UPDATED","event","detail","newValues","rows","map","row","get","close","allValues","selectedIndex","findIndex","handleChange","newSelectedIndex","children","i"],"sources":["../src/TableDropdown.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { Option, Select } from '@deephaven/components';\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { dh as DhType } from '@deephaven/jsapi-types';\nimport { EMPTY_ARRAY } from '@deephaven/utils';\n\ntype JavaObject = {\n equals: (other: unknown) => boolean;\n};\n\nfunction isJavaObject(value: unknown): value is JavaObject {\n return (\n typeof value === 'object' &&\n value != null &&\n 'equals' in value &&\n typeof value.equals === 'function'\n );\n}\n\nfunction defaultFormatValue(value: unknown): string {\n return `${value}`;\n}\n\nexport type TableDropdownProps = {\n /** Table to use as the source of data. Does not own the table, does not close it on unmount. */\n table?: DhType.Table;\n\n /** Column to read data from the table. Defaults to the first column in the table if it's not provided. */\n column?: DhType.Column;\n\n /** Triggered when the dropdown selection has changed */\n onChange: (value: unknown) => void;\n\n /** Filter to apply on the table */\n filter?: readonly DhType.FilterCondition[];\n\n /** The currently selected value */\n selectedValue?: unknown;\n\n /** Whether the control is disabled */\n disabled?: boolean;\n\n /** Class to apply to the select element */\n className?: string;\n\n /** Optional function to format the value for display */\n formatValue?: (value: unknown) => string;\n\n /** Maximum number of elements to load */\n maxSize?: number;\n};\n\n/**\n * Dropdown that displays the values of a column in a table.\n */\nexport function TableDropdown({\n column,\n table,\n filter = EMPTY_ARRAY,\n onChange,\n selectedValue,\n disabled,\n className,\n formatValue = defaultFormatValue,\n maxSize = 1000,\n}: TableDropdownProps): JSX.Element {\n const dh = useApi();\n const [values, setValues] = useState<unknown[]>([]);\n\n useEffect(() => {\n if (table == null) {\n setValues([]);\n return undefined;\n }\n\n const tableColumn = column ?? table.columns[0];\n // Need to set a viewport on the table and start listening to get the values to populate the dropdown\n table.applyFilter(filter as DhType.FilterCondition[]);\n const subscription = table.setViewport(0, maxSize, [tableColumn]);\n\n subscription.addEventListener(\n dh.Table.EVENT_UPDATED,\n (event: CustomEvent<DhType.ViewportData>) => {\n const { detail } = event;\n const newValues = detail.rows.map(row => row.get(tableColumn));\n setValues(newValues);\n }\n );\n\n return () => {\n subscription.close();\n };\n }, [column, dh, filter, maxSize, table]);\n\n // If the selected value is undefined, add a placeholder item\n const allValues = useMemo(() => {\n if (selectedValue === undefined) {\n return [undefined, ...values];\n }\n return values;\n }, [selectedValue, values]);\n\n // Since values could be anything, not just strings, track the selected index based on the current data\n const selectedIndex = useMemo(\n // eslint-disable-next-line eqeqeq\n () =>\n allValues.findIndex(\n value =>\n value === selectedValue ||\n (isJavaObject(value) && value.equals(selectedValue))\n ),\n [selectedValue, allValues]\n );\n\n const handleChange = useCallback(\n newSelectedIndex => {\n onChange(allValues[newSelectedIndex]);\n },\n [onChange, allValues]\n );\n\n return (\n <Select\n className={className}\n value={selectedIndex}\n onChange={handleChange}\n disabled={disabled}\n >\n {allValues.map((value, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Option key={`${i}`} value={i}>\n {formatValue(value)}\n </Option>\n ))}\n </Select>\n );\n}\n\nexport default TableDropdown;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AACtD,SAASC,MAAM,QAAQ,4BAA4B;AAEnD,SAASC,WAAW,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM/C,SAASC,YAAYA,CAACC,KAAc,EAAuB;EACzD,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,IAAI,IAAI,IACb,QAAQ,IAAIA,KAAK,IACjB,OAAOA,KAAK,CAACC,MAAM,KAAK,UAAU;AAEtC;AAEA,SAASC,kBAAkBA,CAACF,KAAc,EAAU;EAClD,UAAAG,MAAA,CAAUH,KAAK;AACjB;AA+BA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAAAC,IAAA,EAUO;EAAA,IAVN;IAC5BC,MAAM;IACNC,KAAK;IACLC,MAAM,GAAGZ,WAAW;IACpBa,QAAQ;IACRC,aAAa;IACbC,QAAQ;IACRC,SAAS;IACTC,WAAW,GAAGX,kBAAkB;IAChCY,OAAO,GAAG;EACQ,CAAC,GAAAT,IAAA;EACnB,IAAMU,EAAE,GAAGpB,MAAM,CAAC,CAAC;EACnB,IAAM,CAACqB,MAAM,EAAEC,SAAS,CAAC,GAAGzB,QAAQ,CAAY,EAAE,CAAC;EAEnDF,SAAS,CAAC,MAAM;IACd,IAAIiB,KAAK,IAAI,IAAI,EAAE;MACjBU,SAAS,CAAC,EAAE,CAAC;MACb,OAAOC,SAAS;IAClB;IAEA,IAAMC,WAAW,GAAGb,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIC,KAAK,CAACa,OAAO,CAAC,CAAC,CAAC;IAC9C;IACAb,KAAK,CAACc,WAAW,CAACb,MAAkC,CAAC;IACrD,IAAMc,YAAY,GAAGf,KAAK,CAACgB,WAAW,CAAC,CAAC,EAAET,OAAO,EAAE,CAACK,WAAW,CAAC,CAAC;IAEjEG,YAAY,CAACE,gBAAgB,CAC3BT,EAAE,CAACU,KAAK,CAACC,aAAa,EACrBC,KAAuC,IAAK;MAC3C,IAAM;QAAEC;MAAO,CAAC,GAAGD,KAAK;MACxB,IAAME,SAAS,GAAGD,MAAM,CAACE,IAAI,CAACC,GAAG,CAACC,GAAG,
|
|
1
|
+
{"version":3,"file":"TableDropdown.js","names":["React","useCallback","useEffect","useMemo","useState","Option","Select","useApi","EMPTY_ARRAY","jsx","_jsx","isJavaObject","value","equals","defaultFormatValue","concat","TableDropdown","_ref","column","table","filter","onChange","selectedValue","disabled","className","formatValue","maxSize","dh","values","setValues","undefined","tableColumn","columns","applyFilter","subscription","setViewport","addEventListener","Table","EVENT_UPDATED","event","detail","newValues","rows","map","row","_row$get","get","close","allValues","selectedIndex","findIndex","handleChange","newSelectedIndex","children","i"],"sources":["../src/TableDropdown.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { Option, Select } from '@deephaven/components';\nimport { useApi } from '@deephaven/jsapi-bootstrap';\nimport { dh as DhType } from '@deephaven/jsapi-types';\nimport { EMPTY_ARRAY } from '@deephaven/utils';\n\ntype JavaObject = {\n equals: (other: unknown) => boolean;\n};\n\nfunction isJavaObject(value: unknown): value is JavaObject {\n return (\n typeof value === 'object' &&\n value != null &&\n 'equals' in value &&\n typeof value.equals === 'function'\n );\n}\n\nfunction defaultFormatValue(value: unknown): string {\n return `${value}`;\n}\n\nexport type TableDropdownProps = {\n /** Table to use as the source of data. Does not own the table, does not close it on unmount. */\n table?: DhType.Table;\n\n /** Column to read data from the table. Defaults to the first column in the table if it's not provided. */\n column?: DhType.Column;\n\n /** Triggered when the dropdown selection has changed */\n onChange: (value: unknown) => void;\n\n /** Filter to apply on the table */\n filter?: readonly DhType.FilterCondition[];\n\n /** The currently selected value */\n selectedValue?: unknown;\n\n /** Whether the control is disabled */\n disabled?: boolean;\n\n /** Class to apply to the select element */\n className?: string;\n\n /** Optional function to format the value for display */\n formatValue?: (value: unknown) => string;\n\n /** Maximum number of elements to load */\n maxSize?: number;\n};\n\n/**\n * Dropdown that displays the values of a column in a table.\n */\nexport function TableDropdown({\n column,\n table,\n filter = EMPTY_ARRAY,\n onChange,\n selectedValue,\n disabled,\n className,\n formatValue = defaultFormatValue,\n maxSize = 1000,\n}: TableDropdownProps): JSX.Element {\n const dh = useApi();\n const [values, setValues] = useState<unknown[]>([]);\n\n useEffect(() => {\n if (table == null) {\n setValues([]);\n return undefined;\n }\n\n const tableColumn = column ?? table.columns[0];\n // Need to set a viewport on the table and start listening to get the values to populate the dropdown\n table.applyFilter(filter as DhType.FilterCondition[]);\n const subscription = table.setViewport(0, maxSize, [tableColumn]);\n\n subscription.addEventListener(\n dh.Table.EVENT_UPDATED,\n (event: CustomEvent<DhType.ViewportData>) => {\n const { detail } = event;\n // Core JSAPI returns undefined for null table values,\n // coalesce with null to differentiate null from no selection in the dropdown\n // https://github.com/deephaven/deephaven-core/issues/5400\n const newValues = detail.rows.map(row => row.get(tableColumn) ?? null);\n setValues(newValues);\n }\n );\n\n return () => {\n subscription.close();\n };\n }, [column, dh, filter, maxSize, table]);\n\n // If the selected value is undefined, add a placeholder item\n const allValues = useMemo(() => {\n if (selectedValue === undefined) {\n return [undefined, ...values];\n }\n return values;\n }, [selectedValue, values]);\n\n // Since values could be anything, not just strings, track the selected index based on the current data\n const selectedIndex = useMemo(\n // eslint-disable-next-line eqeqeq\n () =>\n allValues.findIndex(\n value =>\n value === selectedValue ||\n (isJavaObject(value) && value.equals(selectedValue))\n ),\n [selectedValue, allValues]\n );\n\n const handleChange = useCallback(\n newSelectedIndex => {\n onChange(allValues[newSelectedIndex]);\n },\n [onChange, allValues]\n );\n\n return (\n <Select\n className={className}\n value={selectedIndex}\n onChange={handleChange}\n disabled={disabled}\n >\n {allValues.map((value, i) => (\n // eslint-disable-next-line react/no-array-index-key\n <Option key={`${i}`} value={i}>\n {formatValue(value)}\n </Option>\n ))}\n </Select>\n );\n}\n\nexport default TableDropdown;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,OAAO;AACxE,SAASC,MAAM,EAAEC,MAAM,QAAQ,uBAAuB;AACtD,SAASC,MAAM,QAAQ,4BAA4B;AAEnD,SAASC,WAAW,QAAQ,kBAAkB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAM/C,SAASC,YAAYA,CAACC,KAAc,EAAuB;EACzD,OACE,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,IAAI,IAAI,IACb,QAAQ,IAAIA,KAAK,IACjB,OAAOA,KAAK,CAACC,MAAM,KAAK,UAAU;AAEtC;AAEA,SAASC,kBAAkBA,CAACF,KAAc,EAAU;EAClD,UAAAG,MAAA,CAAUH,KAAK;AACjB;AA+BA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAAAC,IAAA,EAUO;EAAA,IAVN;IAC5BC,MAAM;IACNC,KAAK;IACLC,MAAM,GAAGZ,WAAW;IACpBa,QAAQ;IACRC,aAAa;IACbC,QAAQ;IACRC,SAAS;IACTC,WAAW,GAAGX,kBAAkB;IAChCY,OAAO,GAAG;EACQ,CAAC,GAAAT,IAAA;EACnB,IAAMU,EAAE,GAAGpB,MAAM,CAAC,CAAC;EACnB,IAAM,CAACqB,MAAM,EAAEC,SAAS,CAAC,GAAGzB,QAAQ,CAAY,EAAE,CAAC;EAEnDF,SAAS,CAAC,MAAM;IACd,IAAIiB,KAAK,IAAI,IAAI,EAAE;MACjBU,SAAS,CAAC,EAAE,CAAC;MACb,OAAOC,SAAS;IAClB;IAEA,IAAMC,WAAW,GAAGb,MAAM,aAANA,MAAM,cAANA,MAAM,GAAIC,KAAK,CAACa,OAAO,CAAC,CAAC,CAAC;IAC9C;IACAb,KAAK,CAACc,WAAW,CAACb,MAAkC,CAAC;IACrD,IAAMc,YAAY,GAAGf,KAAK,CAACgB,WAAW,CAAC,CAAC,EAAET,OAAO,EAAE,CAACK,WAAW,CAAC,CAAC;IAEjEG,YAAY,CAACE,gBAAgB,CAC3BT,EAAE,CAACU,KAAK,CAACC,aAAa,EACrBC,KAAuC,IAAK;MAC3C,IAAM;QAAEC;MAAO,CAAC,GAAGD,KAAK;MACxB;MACA;MACA;MACA,IAAME,SAAS,GAAGD,MAAM,CAACE,IAAI,CAACC,GAAG,CAACC,GAAG;QAAA,IAAAC,QAAA;QAAA,QAAAA,QAAA,GAAID,GAAG,CAACE,GAAG,CAACf,WAAW,CAAC,cAAAc,QAAA,cAAAA,QAAA,GAAI,IAAI;MAAA,EAAC;MACtEhB,SAAS,CAACY,SAAS,CAAC;IACtB,CACF,CAAC;IAED,OAAO,MAAM;MACXP,YAAY,CAACa,KAAK,CAAC,CAAC;IACtB,CAAC;EACH,CAAC,EAAE,CAAC7B,MAAM,EAAES,EAAE,EAAEP,MAAM,EAAEM,OAAO,EAAEP,KAAK,CAAC,CAAC;;EAExC;EACA,IAAM6B,SAAS,GAAG7C,OAAO,CAAC,MAAM;IAC9B,IAAImB,aAAa,KAAKQ,SAAS,EAAE;MAC/B,OAAO,CAACA,SAAS,EAAE,GAAGF,MAAM,CAAC;IAC/B;IACA,OAAOA,MAAM;EACf,CAAC,EAAE,CAACN,aAAa,EAAEM,MAAM,CAAC,CAAC;;EAE3B;EACA,IAAMqB,aAAa,GAAG9C,OAAO;EAC3B;EACA,MACE6C,SAAS,CAACE,SAAS,CACjBtC,KAAK,IACHA,KAAK,KAAKU,aAAa,IACtBX,YAAY,CAACC,KAAK,CAAC,IAAIA,KAAK,CAACC,MAAM,CAACS,aAAa,CACtD,CAAC,EACH,CAACA,aAAa,EAAE0B,SAAS,CAC3B,CAAC;EAED,IAAMG,YAAY,GAAGlD,WAAW,CAC9BmD,gBAAgB,IAAI;IAClB/B,QAAQ,CAAC2B,SAAS,CAACI,gBAAgB,CAAC,CAAC;EACvC,CAAC,EACD,CAAC/B,QAAQ,EAAE2B,SAAS,CACtB,CAAC;EAED,oBACEtC,IAAA,CAACJ,MAAM;IACLkB,SAAS,EAAEA,SAAU;IACrBZ,KAAK,EAAEqC,aAAc;IACrB5B,QAAQ,EAAE8B,YAAa;IACvB5B,QAAQ,EAAEA,QAAS;IAAA8B,QAAA,EAElBL,SAAS,CAACL,GAAG,CAAC,CAAC/B,KAAK,EAAE0C,CAAC;IAAA;IACtB;IACA5C,IAAA,CAACL,MAAM;MAAcO,KAAK,EAAE0C,CAAE;MAAAD,QAAA,EAC3B5B,WAAW,CAACb,KAAK;IAAC,MAAAG,MAAA,CADLuC,CAAC,CAET,CACT;EAAC,CACI,CAAC;AAEb;AAEA,eAAetC,aAAa"}
|
package/dist/TableInput.css.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../../../node_modules/@deephaven/components/scss/custom.scss","../../../node_modules/@deephaven/components/scss/bootstrap_overrides.scss","../src/TableInput.scss","../../../node_modules/@deephaven/components/scss/new_variables.scss"],"names":[],"mappings":"AAAA;AC6LA;AC1LE;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA,aCRO","file":"TableInput.css","sourcesContent":["/* stylelint-disable scss/at-import-no-partial-leading-underscore */\n// Consumers should be able to resolve bootstrap/ to node_modules/bootstrap\n\n//Make bootstrap functions available for use in overrides\n@import 'bootstrap/scss/_functions.scss';\n@import './bootstrap_overrides.scss';\n\n//_variable imports come after bootstrap default overrides,\n// makes all other variables and mixins from bootstrap available\n/// with just importing customer.scss\n@import 'bootstrap/scss/_variables.scss';\n@import 'bootstrap/scss/_mixins.scss';\n\n//New variables come after imports\n@import './new_variables.scss';\n@import './util.scss';\n","// Styling overrides for bootstrap\n@use 'sass:map';\n\n// Override / set color variables\n$red: var(--dh-color-visual-red);\n$orange: var(--dh-color-visual-orange);\n$yellow: var(--dh-color-visual-yellow);\n$green: var(--dh-color-visual-green);\n$blue: var(--dh-color-visual-blue);\n$purple: var(--dh-color-visual-purple);\n\n// Fallback colors are used if theme isn't loaded\n// this is required for error messages if the API doesn't load\n\n//Define our Gray scale\n$gray-100: var(--dh-color-gray-900, #fcfcfa);\n$gray-200: var(--dh-color-gray-800);\n$gray-300: var(--dh-color-gray-700);\n$gray-400: var(--dh-color-gray-600);\n$gray-500: var(--dh-color-gray-500);\n// intentional duplicate, scale doesn't line up otherwise\n// as we have gray-850 and spectrum doesn't and it is needed\n$gray-600: var(--dh-color-gray-500);\n$gray-700: var(--dh-color-gray-400);\n$gray-800: var(--dh-color-gray-300);\n$gray-850: var(--dh-color-gray-200);\n$gray-900: var(--dh-color-gray-75);\n$black: var(--dh-color-black, #1a171a);\n$white: var(--dh-color-white, #f0f0ee);\n\n//Define some UI colors\n$interfacegray: var(--dh-color-content-bg, #2d2a2e);\n$interfaceblue: var(--dh-color-accent-bg);\n$interfacewhite: $white;\n$interfaceblack: $black;\n$content-bg: var(--dh-color-content-bg, #2d2a2e);\n$background: var(--dh-color-bg, #1a171a);\n$foreground: var(--dh-color-fg, #f0f0ee);\n\n// Extend default Bootstrap $grays map\n$grays-custom: (\n '850': $gray-850,\n);\n$grays: () !default;\n$grays: map-merge($grays, $grays-custom);\n\n// Extend default Bootstrap $colors map\n$colors-custom: (\n 'black': $black,\n);\n$colors: () !default;\n$colors: map-merge($colors, $colors-custom);\n\n// Override default Bootstrap $theme-colors map by mapping each key to itself.\n// These will then be re-mapped inside of `button-outline-variant` and\n// `button-outline-variant` mixins in `bootstrap_override_mixins_buttons.scss`\n$theme-colors-self-map: ();\n@each $key\n in (\n 'primary',\n 'secondary',\n 'success',\n 'info',\n 'warning',\n 'danger',\n 'light',\n 'dark'\n )\n{\n $theme-colors-self-map: map.set($theme-colors-self-map, $key, $key);\n}\n$theme-colors: () !default;\n$theme-colors: map-merge($theme-colors, $theme-colors-self-map);\n\n// Used by bootstrap_override_mixins_buttons.scss to map Bootstrap colors to\n// DH semantic colors\n$bootstrap-dh-semantic-map: (\n 'primary': 'accent',\n 'secondary': 'neutral',\n 'success': 'positive',\n 'info': 'info',\n 'warning': 'notice',\n 'danger': 'negative',\n // We shouldn't be using these, but mapping so they work with our custom\n // `color-yiq` mixin. If we find a way to remove $light + $dark that are\n // defined in Bootstrap _variables.scss, we should remove these\n 'light': 'neutral',\n 'dark': 'neutral',\n);\n\n//Set default colors\n$body-bg: $black;\n$body-color: $interfacewhite;\n\n// Set brand colors\n$primary: var(--dh-color-accent-bg);\n$primary-hover: var(--dh-color-accent-hover-bg);\n$primary-dark: var(--dh-color-accent-down-bg);\n$secondary: var(--dh-color-neutral-bg);\n$secondary-hover: var(--dh-color-neutral-hover-bg);\n$success: $green;\n$info: $yellow;\n$warning: $orange;\n$danger: var(--dh-color-negative-bg);\n$danger-hover: var(--dh-color-negative-hover-bg);\n// We really don't want to use $light or $dark variables, but Bootstrap defines\n// them in _variables.scss. Explicitly setting them to ensure we are in control\n// of their values. If we can find a way to remove them, we should\n$light: var(--dh-color-gray-light);\n$dark: var(--dh-color-gray-dark);\n// Bootstrap doesn't define $mid, and we want to move away from this particular\n// semantic. Should be deleted by #1635\n$mid: var(--dh-color-gray-mid);\n\n$semantic-colors: (\n 'primary-hover': $primary-hover,\n 'primary-dark': $primary-dark,\n 'mid': $mid,\n 'content-bg': $interfacegray,\n 'background': $interfaceblack,\n 'foreground': $interfacewhite,\n 'secondary-hover': $secondary-hover,\n 'danger-hover': $danger-hover,\n);\n\n$component-active-bg: $primary;\n$theme-color-interval: 9%;\n$yiq-contrasted-threshold: 180;\n\n// Override fonts\n$font-family-sans-serif:\n 'Fira Sans',\n -apple-system,\n blinkmacsystemfont,\n 'Segoe UI',\n 'Roboto',\n 'Helvetica Neue',\n arial,\n sans-serif; //fira sans then native system ui fallbacks\n$font-family-monospace: 'Fira Mono', menlo, monaco, consolas, 'Liberation Mono',\n 'Courier New', monospace;\n$font-family-base: $font-family-sans-serif;\n\n$headings-font-weight: 400;\n\n//Text overides\n$text-muted: $gray-400;\n\n//Style Selection highlight color\n$text-select-color: var(--dh-color-text-highlight);\n\n//Grid variables, same value as default just making easily accessible\n$grid-gutter-width: 30px;\n\n//Visual Overrides\n$border-radius: 4px;\n$box-shadow: 0 0.1rem 1rem var(--dh-color-dropshadow);\n\n//Override Btn\n$btn-border-radius: 4rem;\n$btn-padding-x: 1.5rem;\n$btn-transition:\n color 0.12s ease-in-out,\n background-color 0.12s ease-in-out,\n border-color 0.12s ease-in-out,\n box-shadow 0.12s ease-in-out; //default 0.15 is too long\n$btn-border-width: 2px;\n$btn-font-weight: var(--spectrum-global-font-weight-bold);\n$btn-line-height: 1.3;\n\n//Override Inputs\n$input-bg: var(--dh-color-input-bg);\n$input-disabled-bg: var(--dh-color-input-disabled-bg);\n$input-color: var(--dh-color-input-fg);\n$input-border-color: var(--dh-color-input-border);\n$input-placeholder-color: var(--dh-color-input-placeholder);\n$input-focus-border-color: var(--dh-color-input-focus-border);\n\n$input-btn-focus-width: 0.2rem;\n$input-btn-focus-color: color-mix(\n in srgb,\n var(--dh-color-accent) 35%,\n transparent\n);\n$input-btn-focus-box-shadow: 0 0 0 $input-btn-focus-width $input-btn-focus-color;\n$input-btn-line-height: 1.3;\n// Bootstrap uses a calc expression to determine the input height (calc(line-height + 2*padding-y + border)).\n// The padding-y value has to be in rem to match units as it is a SASS calc.\n// Using 0.42145rem with 1.3 line height gets us to spectrum's 32px.\n/* stylelint-disable-next-line number-max-precision */\n$input-btn-padding-y: 0.42145rem;\n\n//checkbox\n$custom-control-indicator-bg: var(--dh-color-input-bg);\n$custom-control-indicator-border-color: var(--dh-color-input-border);\n$custom-checkbox-indicator-border-radius: 2px;\n$custom-control-indicator-border-width: 2px;\n$custom-control-indicator-active-bg: var(--dh-color-input-bg);\n$custom-control-indicator-active-border-color: var(--dh-color-input-fg);\n$custom-control-indicator-checked-bg: var(--dh-color-input-fg);\n$custom-control-indicator-checked-color: black; // used as mask fill color\n$custom-checkbox-indicator-indeterminate-bg: var(--dh-color-input-fg);\n$custom-control-indicator-bg-size: 75% 75%;\n$custom-control-indicator-disabled-bg: var(--dh-color-input-disabled-bg);\n$custom-control-indicator-checked-disabled-bg: var(\n --dh-color-input-disabled-bg\n);\n$custom-control-label-disabled-color: var(--dh-color-input-disabled-fg);\n\n// The $custom-select-indicator variable is used by Bootstrap to provide the\n// icon for the select dropdown. Inline svgs can't use CSS variables, so we hard\n// code the color to #929192 (the default value of --dh-color-gray-600). PR #1651\n// overrides this icon altogether for known dropdowns, so technically we may not\n// need this, but it's here in case there are any remaining instances.\n$custom-select-indicator-color: #929192;\n$custom-select-bg: var(--dh-color-selector-bg);\n$custom-select-bg-size: 16px 16px;\n//dhSort icon encoded\n$custom-select-indicator: str-replace(\n url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='#{$custom-select-indicator-color}' d='M4 7l-.4-.8 4-3.7h.8l4 3.7-.4.8H4zm0 2l-.4.8 4 3.7h.8l4-3.7L12 9H4z'/%3E%3C/svg%3E\"),\n '#',\n '%23'\n);\n$custom-select-focus-box-shadow: $input-btn-focus-box-shadow;\n$custom-select-disabled-color: $gray-500;\n$custom-select-disabled-bg: $gray-800;\n\n//modal\n$modal-content-bg: $content-bg;\n$modal-content-border-width: 0;\n$modal-md: 550px;\n$close-color: var(--dh-color-text);\n$close-text-shadow: none;\n\n// Toast notification\n$toast-bg: var(--dh-color-accent-100);\n$toast-color: var(--dh-color-text);\n$toast-error-bg: var(--dh-color-negative-bg);\n$toast-error-color: var(--dh-color-text);\n\n//tooltips\n$tooltip-bg: var(--dh-color-tooltip-bg);\n$tooltip-color: var(--dh-color-tooltip-fg);\n$tooltip-box-shadow: 0 0.1rem 1.5rem 0.1rem var(--dh-color-tooltip-box-shadow);\n\n//drowdowns\n$dropdown-bg: $gray-600;\n$dropdown-link-color: $foreground;\n$dropdown-link-hover-color: $foreground;\n$dropdown-link-hover-bg: var(--dh-color-item-list-hover-bg);\n$dropdown-divider-bg: $gray-700;\n\n//context menus\n$contextmenu-bg: var(--dh-color-popover-bg);\n$contextmenu-color: var(--dh-color-text);\n$contextmenu-disabled-color: var(--dh-color-input-disabled-fg);\n$contextmenu-keyboard-selected-bg: var(--dh-color-keyboard-selected-bg);\n$contextmenu-selected-bg: var(--dh-color-item-list-hover-bg);\n$contextmenu-selected-color: var(--dh-color-item-list-selected-fg);\n\n//hr\n$hr-border-color: var(--dh-color-hr);\n\n//links\n$link-color: $gray-400;\n$link-hover-color: $foreground;\n\n//progress-bar\n$progress-bg: $gray-600;\n$progress-border-radius: 1rem;\n\n// Set global options\n$enable-shadows: false;\n$enable-gradients: false;\n$enable-print-styles: false; //I don't think anyone should expect to \"print\" this app.\n\n// Transition times\n$transition: 0.15s;\n$transition-mid: 0.2s;\n$transition-long: 0.3s;\n$transition-slow: 0.6s;\n\n//form-validation icon, uses vsWarning icon encoded here as svg\n$form-feedback-icon-invalid-color: $danger;\n$form-feedback-icon-invalid: str-replace(\n url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cg fill='none'%3E%3Cg fill='#{$form-feedback-icon-invalid-color}'%3E%3Cpath d='M7.56 1h.88l6.54 12.26-.44.74H1.44L1 13.26 7.56 1zM8 2.28 2.28 13H13.7L8 2.28zM8.625 12v-1h-1.25v1h1.25zm-1.25-2V6h1.25v4h-1.25z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E \"),\n '#',\n '%23'\n);\n\n// This section of variables is not consumed directly by DH, but they need to be\n// defined for sass to compile _variables\n$table-dark-bg: $gray-800;\n$table-dark-accent-bg: var(--dh-color-highlight-hover);\n$table-dark-hover-bg: var(--dh-color-highlight-active);\n$table-dark-border-color: $gray-700;\n$popover-bg: var(--dh-color-tooltip-bg);\n$popover-border-color: var(--dh-color-overlay-modal-bg);\n$popover-header-bg: #000;\n$popover-arrow-outer-color: var(--dh-color-dropshadow);\n$custom-range-thumb-active-bg: var(--dh-color-accent-1100);\n","@import '@deephaven/components/scss/custom.scss';\n\n.table-input-container {\n .select-value-list-scroll-pane {\n min-height: 2.4rem;\n max-height: 12rem;\n z-index: 0;\n }\n .meta-row {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n padding-top: $spacer-1;\n }\n}\n","@use 'sass:math';\n\n//Set of spacer variables from the spacer map\n$spacer-0: map-get($spacers, 0); //0\n$spacer-1: map-get($spacers, 1);\n$spacer-2: map-get($spacers, 2);\n$spacer-3: map-get($spacers, 3);\n$spacer-4: map-get($spacers, 4);\n$spacer-5: map-get($spacers, 5);\n\n//Marching Ants for golden layout dropzone and drag and drop\n//top bottom, left right.\n//create 4 background images that are 50% color 1, 50% color 2 using graidents, two veritical, two horizontal\n//size them to ant-size and thickness\n//position those images along the egdes and make top/bottom repeat-x and left/right repeat-y\n//then offest each of those background positions by ant-size in animation to make them march.\n$ant-size: 8px;\n$ant-thickness: 1px;\n\n@mixin ants-base($color-1: black, $color-2: white) {\n background-image: linear-gradient(to right, $color-2 50%, $color-1 50%),\n linear-gradient(to right, $color-2 50%, $color-1 50%),\n linear-gradient(to bottom, $color-2 50%, $color-1 50%),\n linear-gradient(to bottom, $color-2 50%, $color-1 50%);\n background-size:\n $ant-size $ant-thickness,\n $ant-size $ant-thickness,\n $ant-thickness $ant-size,\n $ant-thickness $ant-size;\n background-position:\n 0 top,\n 0 bottom,\n left 0,\n right 0;\n background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;\n animation: march 0.5s;\n animation-timing-function: linear;\n animation-iteration-count: infinite;\n}\n\n@mixin drag-stack($pseudo-element) {\n &::#{$pseudo-element} {\n content: ' ';\n background: $primary;\n box-shadow: $box-shadow;\n border-radius: $border-radius;\n position: absolute;\n height: 100%;\n width: 100%;\n @content;\n }\n}\n\n$focus-bg-transparency: 12%;\n$hover-bg-transparency: 14%;\n$active-bg-transparency: 28%;\n$exception-transparency: 13%;\n"]}
|
|
1
|
+
{"version":3,"sourceRoot":"","sources":["../../../node_modules/@deephaven/components/scss/custom.scss","../../../node_modules/@deephaven/components/scss/bootstrap_overrides.scss","../src/TableInput.scss","../../../node_modules/@deephaven/components/scss/new_variables.scss"],"names":[],"mappings":"AAAA;AC6LA;AC1LE;EACE;EACA;EACA;;AAEF;EACE;EACA;EACA;EACA,aCRO","file":"TableInput.css","sourcesContent":["/* stylelint-disable scss/at-import-no-partial-leading-underscore */\n// Consumers should be able to resolve bootstrap/ to node_modules/bootstrap\n\n//Make bootstrap functions available for use in overrides\n@import 'bootstrap/scss/_functions.scss';\n@import './bootstrap_overrides.scss';\n\n//_variable imports come after bootstrap default overrides,\n// makes all other variables and mixins from bootstrap available\n/// with just importing customer.scss\n@import 'bootstrap/scss/_variables.scss';\n@import 'bootstrap/scss/_mixins.scss';\n\n//New variables come after imports\n@import './new_variables.scss';\n@import './util.scss';\n","// Styling overrides for bootstrap\n@use 'sass:map';\n\n// Override / set color variables\n$red: var(--dh-color-visual-red);\n$orange: var(--dh-color-visual-orange);\n$yellow: var(--dh-color-visual-yellow);\n$green: var(--dh-color-visual-green);\n$blue: var(--dh-color-visual-blue);\n$purple: var(--dh-color-visual-purple);\n\n// Fallback colors are used if theme isn't loaded\n// this is required for error messages if the API doesn't load\n\n//Define our Gray scale\n$gray-100: var(--dh-color-gray-900, #fcfcfa);\n$gray-200: var(--dh-color-gray-800);\n$gray-300: var(--dh-color-gray-700);\n$gray-400: var(--dh-color-gray-600);\n$gray-500: var(--dh-color-gray-500);\n// intentional duplicate, scale doesn't line up otherwise\n// as we have gray-850 and spectrum doesn't and it is needed\n$gray-600: var(--dh-color-gray-500);\n$gray-700: var(--dh-color-gray-400);\n$gray-800: var(--dh-color-gray-300);\n$gray-850: var(--dh-color-gray-200);\n$gray-900: var(--dh-color-gray-75);\n$black: var(--dh-color-black, #1a171a);\n$white: var(--dh-color-white, #f0f0ee);\n\n//Define some UI colors\n$interfacegray: var(--dh-color-content-bg, #2d2a2e);\n$interfaceblue: var(--dh-color-accent-bg);\n$interfacewhite: $white;\n$interfaceblack: $black;\n$content-bg: var(--dh-color-content-bg, #2d2a2e);\n$background: var(--dh-color-bg, #1a171a);\n$foreground: var(--dh-color-fg, #f0f0ee);\n\n// Extend default Bootstrap $grays map\n$grays-custom: (\n '850': $gray-850,\n);\n$grays: () !default;\n$grays: map-merge($grays, $grays-custom);\n\n// Extend default Bootstrap $colors map\n$colors-custom: (\n 'black': $black,\n);\n$colors: () !default;\n$colors: map-merge($colors, $colors-custom);\n\n// Override default Bootstrap $theme-colors map by mapping each key to itself.\n// These will then be re-mapped inside of `button-outline-variant` and\n// `button-outline-variant` mixins in `bootstrap_override_mixins_buttons.scss`\n$theme-colors-self-map: ();\n@each $key\n in (\n 'primary',\n 'secondary',\n 'success',\n 'info',\n 'warning',\n 'danger',\n 'light',\n 'dark'\n )\n{\n $theme-colors-self-map: map.set($theme-colors-self-map, $key, $key);\n}\n$theme-colors: () !default;\n$theme-colors: map-merge($theme-colors, $theme-colors-self-map);\n\n// Used by bootstrap_override_mixins_buttons.scss to map Bootstrap colors to\n// DH semantic colors\n$bootstrap-dh-semantic-map: (\n 'primary': 'accent',\n 'secondary': 'neutral',\n 'success': 'positive',\n 'info': 'info',\n 'warning': 'notice',\n 'danger': 'negative',\n // We shouldn't be using these, but mapping so they work with our custom\n // `color-yiq` mixin. If we find a way to remove $light + $dark that are\n // defined in Bootstrap _variables.scss, we should remove these\n 'light': 'neutral',\n 'dark': 'neutral',\n);\n\n//Set default colors\n$body-bg: $black;\n$body-color: $interfacewhite;\n\n// Set brand colors\n$primary: var(--dh-color-accent-bg);\n$primary-hover: var(--dh-color-accent-hover-bg);\n$primary-dark: var(--dh-color-accent-down-bg);\n$secondary: var(--dh-color-neutral-bg);\n$secondary-hover: var(--dh-color-neutral-hover-bg);\n$success: $green;\n$info: $yellow;\n$warning: $orange;\n$danger: var(--dh-color-negative-bg);\n$danger-hover: var(--dh-color-negative-hover-bg);\n// We really don't want to use $light or $dark variables, but Bootstrap defines\n// them in _variables.scss. Explicitly setting them to ensure we are in control\n// of their values. If we can find a way to remove them, we should\n$light: var(--dh-color-gray-light);\n$dark: var(--dh-color-gray-dark);\n// Bootstrap doesn't define $mid, and we want to move away from this particular\n// semantic. Should be deleted by #1635\n$mid: var(--dh-color-gray-mid);\n\n$semantic-colors: (\n 'primary-hover': $primary-hover,\n 'primary-dark': $primary-dark,\n 'mid': $mid,\n 'content-bg': $interfacegray,\n 'background': $interfaceblack,\n 'foreground': $interfacewhite,\n 'secondary-hover': $secondary-hover,\n 'danger-hover': $danger-hover,\n);\n\n$component-active-bg: $primary;\n$theme-color-interval: 9%;\n$yiq-contrasted-threshold: 180;\n\n// Override fonts\n$font-family-sans-serif:\n 'Fira Sans',\n -apple-system,\n blinkmacsystemfont,\n 'Segoe UI',\n 'Roboto',\n 'Helvetica Neue',\n arial,\n sans-serif; //fira sans then native system ui fallbacks\n$font-family-monospace: 'Fira Mono', menlo, monaco, consolas, 'Liberation Mono',\n 'Courier New', monospace;\n$font-family-base: $font-family-sans-serif;\n\n$headings-font-weight: 400;\n\n//Text overides\n$text-muted: $gray-400;\n\n//Style Selection highlight color\n$text-select-color: var(--dh-color-text-highlight);\n\n//Grid variables, same value as default just making easily accessible\n$grid-gutter-width: 30px;\n\n//Visual Overrides\n$border-radius: 4px;\n$box-shadow: 0 0.1rem 1rem var(--dh-color-dropshadow);\n\n//Override Btn\n$btn-border-radius: 4rem;\n$btn-padding-x: 1.5rem;\n$btn-transition:\n color 0.12s ease-in-out,\n background-color 0.12s ease-in-out,\n border-color 0.12s ease-in-out,\n box-shadow 0.12s ease-in-out; //default 0.15 is too long\n$btn-border-width: 2px;\n$btn-font-weight: var(--spectrum-global-font-weight-bold);\n$btn-line-height: 1.3;\n\n//Override Inputs\n$input-bg: var(--dh-color-input-bg);\n$input-disabled-bg: var(--dh-color-input-disabled-bg);\n$input-color: var(--dh-color-input-fg);\n$input-border-color: var(--dh-color-input-border);\n$input-placeholder-color: var(--dh-color-input-placeholder);\n$input-focus-border-color: var(--dh-color-input-focus-border);\n\n$input-btn-focus-width: 0.2rem;\n$input-btn-focus-color: color-mix(\n in srgb,\n var(--dh-color-accent) 35%,\n transparent\n);\n$input-btn-focus-box-shadow: 0 0 0 $input-btn-focus-width $input-btn-focus-color;\n$input-btn-line-height: 1.3;\n// Bootstrap uses a calc expression to determine the input height (calc(line-height + 2*padding-y + border)).\n// The padding-y value has to be in rem to match units as it is a SASS calc.\n// Using 0.42145rem with 1.3 line height gets us to spectrum's 32px.\n/* stylelint-disable-next-line number-max-precision */\n$input-btn-padding-y: 0.42145rem;\n\n//checkbox\n$custom-control-indicator-bg: var(--dh-color-input-bg);\n$custom-control-indicator-border-color: var(--dh-color-input-border);\n$custom-checkbox-indicator-border-radius: 2px;\n$custom-control-indicator-border-width: 2px;\n$custom-control-indicator-active-bg: var(--dh-color-input-bg);\n$custom-control-indicator-active-border-color: var(--dh-color-input-fg);\n$custom-control-indicator-checked-bg: var(--dh-color-input-fg);\n$custom-control-indicator-checked-color: black; // used as mask fill color\n$custom-checkbox-indicator-indeterminate-bg: var(--dh-color-input-fg);\n$custom-control-indicator-bg-size: 75% 75%;\n$custom-control-indicator-disabled-bg: var(--dh-color-input-disabled-bg);\n$custom-control-indicator-checked-disabled-bg: var(\n --dh-color-input-disabled-bg\n);\n$custom-control-label-disabled-color: var(--dh-color-input-disabled-fg);\n\n// The $custom-select-indicator variable is used by Bootstrap to provide the\n// icon for the select dropdown. Inline svgs can't use CSS variables, so we hard\n// code the color to #929192 (the default value of --dh-color-gray-600). PR #1651\n// overrides this icon altogether for known dropdowns, so technically we may not\n// need this, but it's here in case there are any remaining instances.\n$custom-select-indicator-color: #929192;\n$custom-select-bg: var(--dh-color-selector-bg);\n$custom-select-bg-size: 16px 16px;\n//dhSort icon encoded\n$custom-select-indicator: str-replace(\n url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='#{$custom-select-indicator-color}' d='M4 7l-.4-.8 4-3.7h.8l4 3.7-.4.8H4zm0 2l-.4.8 4 3.7h.8l4-3.7L12 9H4z'/%3E%3C/svg%3E\"),\n '#',\n '%23'\n);\n$custom-select-focus-box-shadow: $input-btn-focus-box-shadow;\n$custom-select-disabled-color: $gray-500;\n$custom-select-disabled-bg: $gray-800;\n\n//modal\n$modal-content-bg: $content-bg;\n$modal-content-border-width: 0;\n$modal-md: 550px;\n$close-color: var(--dh-color-text);\n$close-text-shadow: none;\n\n// Toast notification\n$toast-bg: var(--dh-color-accent-100);\n$toast-color: var(--dh-color-text);\n$toast-error-bg: var(--dh-color-negative-bg);\n$toast-error-color: var(--dh-color-text);\n\n//tooltips\n$tooltip-bg: var(--dh-color-tooltip-bg);\n$tooltip-color: var(--dh-color-tooltip-fg);\n$tooltip-box-shadow: 0 0.1rem 1.5rem 0.1rem var(--dh-color-tooltip-box-shadow);\n\n//drowdowns\n$dropdown-bg: $gray-600;\n$dropdown-link-color: $foreground;\n$dropdown-link-hover-color: $foreground;\n$dropdown-link-hover-bg: var(--dh-color-item-list-hover-bg);\n$dropdown-divider-bg: $gray-700;\n\n//context menus\n$contextmenu-bg: var(--dh-color-popover-bg);\n$contextmenu-color: var(--dh-color-text);\n$contextmenu-disabled-color: var(--dh-color-input-disabled-fg);\n$contextmenu-keyboard-selected-bg: var(--dh-color-keyboard-selected-bg);\n$contextmenu-selected-bg: var(--dh-color-item-list-hover-bg);\n$contextmenu-selected-color: var(--dh-color-item-list-selected-fg);\n\n//hr\n$hr-border-color: var(--dh-color-hr);\n\n//links\n$link-color: $gray-400;\n$link-hover-color: $foreground;\n\n//progress-bar\n$progress-bg: $gray-600;\n$progress-border-radius: 1rem;\n\n// Set global options\n$enable-shadows: false;\n$enable-gradients: false;\n$enable-print-styles: false; //I don't think anyone should expect to \"print\" this app.\n\n// Transition times\n$transition: 0.15s;\n$transition-mid: 0.2s;\n$transition-long: 0.3s;\n$transition-slow: 0.6s;\n\n//form-validation icon, uses vsWarning icon encoded here as svg\n$form-feedback-icon-invalid-color: $danger;\n$form-feedback-icon-invalid: str-replace(\n url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cg fill='none'%3E%3Cg fill='#{$form-feedback-icon-invalid-color}'%3E%3Cpath d='M7.56 1h.88l6.54 12.26-.44.74H1.44L1 13.26 7.56 1zM8 2.28 2.28 13H13.7L8 2.28zM8.625 12v-1h-1.25v1h1.25zm-1.25-2V6h1.25v4h-1.25z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E \"),\n '#',\n '%23'\n);\n\n// This section of variables is not consumed directly by DH, but they need to be\n// defined for sass to compile _variables\n$table-dark-bg: $gray-800;\n$table-dark-accent-bg: var(--dh-color-highlight-hover);\n$table-dark-hover-bg: var(--dh-color-highlight-active);\n$table-dark-border-color: $gray-700;\n$popover-bg: var(--dh-color-tooltip-bg);\n$popover-border-color: var(--dh-color-overlay-modal-bg);\n$popover-header-bg: #000;\n$popover-arrow-outer-color: var(--dh-color-dropshadow);\n$custom-range-thumb-active-bg: var(--dh-color-accent-1100);\n","@import '@deephaven/components/scss/custom.scss';\n\n.table-input-container {\n .select-value-list-scroll-pane {\n min-height: 2.4rem;\n max-height: 12rem;\n z-index: 0;\n }\n .meta-row {\n display: flex;\n flex-wrap: wrap;\n justify-content: space-between;\n padding-top: $spacer-1;\n }\n}\n","@use 'sass:math';\n\n//Set of spacer variables from the spacer map\n$spacer-0: map-get($spacers, 0); //0\n$spacer-1: map-get($spacers, 1);\n$spacer-2: map-get($spacers, 2);\n$spacer-3: map-get($spacers, 3);\n$spacer-4: map-get($spacers, 4);\n$spacer-5: map-get($spacers, 5);\n\n//Marching Ants for golden layout dropzone and drag and drop\n//top bottom, left right.\n//create 4 background images that are 50% color 1, 50% color 2 using graidents, two veritical, two horizontal\n//size them to ant-size and thickness\n//position those images along the egdes and make top/bottom repeat-x and left/right repeat-y\n//then offest each of those background positions by ant-size in animation to make them march.\n$ant-size: 8px;\n$ant-thickness: 1px;\n\n@mixin ants-base($color-1: black, $color-2: white) {\n background-image: linear-gradient(to right, $color-2 50%, $color-1 50%),\n linear-gradient(to right, $color-2 50%, $color-1 50%),\n linear-gradient(to bottom, $color-2 50%, $color-1 50%),\n linear-gradient(to bottom, $color-2 50%, $color-1 50%);\n background-size:\n $ant-size $ant-thickness,\n $ant-size $ant-thickness,\n $ant-thickness $ant-size,\n $ant-thickness $ant-size;\n background-position:\n 0 top,\n 0 bottom,\n left 0,\n right 0;\n background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;\n animation: march 0.5s;\n animation-timing-function: linear;\n animation-iteration-count: infinite;\n}\n\n@mixin drag-stack($pseudo-element) {\n &::#{$pseudo-element} {\n content: ' ';\n background: $primary;\n box-shadow: $box-shadow;\n border-radius: $border-radius;\n position: absolute;\n height: 100%;\n width: 100%;\n @content;\n }\n}\n\n$focus-bg-transparency: 12%;\n$hover-bg-transparency: 14%;\n$active-bg-transparency: 28%;\n$exception-transparency: 28%;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NormalizedItem, SpectrumComboBoxProps } from '@deephaven/components';
|
|
3
|
+
import { PickerWithTableProps } from './PickerProps';
|
|
4
|
+
export type ComboBoxProps = PickerWithTableProps<SpectrumComboBoxProps<NormalizedItem>>;
|
|
5
|
+
export declare function ComboBox(props: ComboBoxProps): JSX.Element;
|
|
6
|
+
export default ComboBox;
|
|
7
|
+
//# sourceMappingURL=ComboBox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboBox.d.ts","sourceRoot":"","sources":["../../src/spectrum/ComboBox.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,cAAc,EACd,qBAAqB,EACtB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAGrD,MAAM,MAAM,aAAa,GAAG,oBAAoB,CAC9C,qBAAqB,CAAC,cAAc,CAAC,CACtC,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAsB1D;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var _excluded = ["onInputChange", "onSearchTextChange"];
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import { ComboBoxNormalized } from '@deephaven/components';
|
|
10
|
+
import { useCallback } from 'react';
|
|
11
|
+
import { usePickerProps } from "./utils/index.js";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
export function ComboBox(props) {
|
|
14
|
+
var _usePickerProps = usePickerProps(props),
|
|
15
|
+
{
|
|
16
|
+
onInputChange: onInputChangeInternal,
|
|
17
|
+
onSearchTextChange
|
|
18
|
+
} = _usePickerProps,
|
|
19
|
+
pickerProps = _objectWithoutProperties(_usePickerProps, _excluded);
|
|
20
|
+
var onInputChange = useCallback(value => {
|
|
21
|
+
onInputChangeInternal === null || onInputChangeInternal === void 0 ? void 0 : onInputChangeInternal(value);
|
|
22
|
+
onSearchTextChange(value);
|
|
23
|
+
}, [onInputChangeInternal, onSearchTextChange]);
|
|
24
|
+
return /*#__PURE__*/_jsx(ComboBoxNormalized
|
|
25
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
26
|
+
, _objectSpread(_objectSpread({}, pickerProps), {}, {
|
|
27
|
+
onInputChange: onInputChange
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
export default ComboBox;
|
|
31
|
+
//# sourceMappingURL=ComboBox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ComboBox.js","names":["ComboBoxNormalized","useCallback","usePickerProps","jsx","_jsx","ComboBox","props","_usePickerProps","onInputChange","onInputChangeInternal","onSearchTextChange","pickerProps","_objectWithoutProperties","_excluded","value","_objectSpread"],"sources":["../../src/spectrum/ComboBox.tsx"],"sourcesContent":["import {\n ComboBoxNormalized,\n NormalizedItem,\n SpectrumComboBoxProps,\n} from '@deephaven/components';\nimport { useCallback } from 'react';\nimport { PickerWithTableProps } from './PickerProps';\nimport { usePickerProps } from './utils';\n\nexport type ComboBoxProps = PickerWithTableProps<\n SpectrumComboBoxProps<NormalizedItem>\n>;\n\nexport function ComboBox(props: ComboBoxProps): JSX.Element {\n const {\n onInputChange: onInputChangeInternal,\n onSearchTextChange,\n ...pickerProps\n } = usePickerProps<ComboBoxProps>(props);\n\n const onInputChange = useCallback(\n (value: string) => {\n onInputChangeInternal?.(value);\n onSearchTextChange(value);\n },\n [onInputChangeInternal, onSearchTextChange]\n );\n\n return (\n <ComboBoxNormalized\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n onInputChange={onInputChange}\n />\n );\n}\n\nexport default ComboBox;\n"],"mappings":";;;;;;;;AAAA,SACEA,kBAAkB,QAGb,uBAAuB;AAC9B,SAASC,WAAW,QAAQ,OAAO;AAAC,SAE3BC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAMvB,OAAO,SAASC,QAAQA,CAACC,KAAoB,EAAe;EAC1D,IAAAC,eAAA,GAIIL,cAAc,CAAgBI,KAAK,CAAC;IAJlC;MACJE,aAAa,EAAEC,qBAAqB;MACpCC;IAEF,CAAC,GAAAH,eAAA;IADII,WAAW,GAAAC,wBAAA,CAAAL,eAAA,EAAAM,SAAA;EAGhB,IAAML,aAAa,GAAGP,WAAW,CAC9Ba,KAAa,IAAK;IACjBL,qBAAqB,aAArBA,qBAAqB,uBAArBA,qBAAqB,CAAGK,KAAK,CAAC;IAC9BJ,kBAAkB,CAACI,KAAK,CAAC;EAC3B,CAAC,EACD,CAACL,qBAAqB,EAAEC,kBAAkB,CAC5C,CAAC;EAED,oBACEN,IAAA,CAACJ;EACC;EAAA,EAAAe,aAAA,CAAAA,aAAA,KACIJ,WAAW;IACfH,aAAa,EAAEA;EAAc,EAC9B,CAAC;AAEN;AAEA,eAAeH,QAAQ"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ListViewNormalizedProps } from '@deephaven/components';
|
|
3
|
+
import { dh as DhType } from '@deephaven/jsapi-types';
|
|
4
|
+
import { Settings } from '@deephaven/jsapi-utils';
|
|
5
|
+
export interface ListViewProps extends Omit<ListViewNormalizedProps, 'normalizedItems' | 'showItemIcons'> {
|
|
6
|
+
table: DhType.Table;
|
|
7
|
+
keyColumn?: string;
|
|
8
|
+
labelColumn?: string;
|
|
9
|
+
iconColumn?: string;
|
|
10
|
+
settings?: Settings;
|
|
11
|
+
}
|
|
12
|
+
export declare function ListView({ table, keyColumn: keyColumnName, labelColumn: labelColumnName, iconColumn: iconColumnName, settings, ...props }: ListViewProps): JSX.Element;
|
|
13
|
+
export default ListView;
|
|
14
|
+
//# sourceMappingURL=ListView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.d.ts","sourceRoot":"","sources":["../../src/spectrum/ListView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAEL,uBAAuB,EAGxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAMlD,MAAM,WAAW,aACf,SAAQ,IAAI,CAAC,uBAAuB,EAAE,iBAAiB,GAAG,eAAe,CAAC;IAC1E,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,SAAS,EAAE,aAAa,EACxB,WAAW,EAAE,eAAe,EAC5B,UAAU,EAAE,cAAc,EAC1B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,aAAa,GAAG,GAAG,CAAC,OAAO,CAiC7B;AAED,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
var _excluded = ["table", "keyColumn", "labelColumn", "iconColumn", "settings"];
|
|
2
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
8
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
9
|
+
import { ListViewNormalized, useSpectrumThemeProvider } from '@deephaven/components';
|
|
10
|
+
import { LIST_VIEW_ROW_HEIGHTS } from '@deephaven/utils';
|
|
11
|
+
import useFormatter from "../useFormatter.js";
|
|
12
|
+
import useViewportData from "../useViewportData.js";
|
|
13
|
+
import { useItemRowDeserializer } from "./utils/index.js";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
export function ListView(_ref) {
|
|
16
|
+
var _props$density;
|
|
17
|
+
var {
|
|
18
|
+
table,
|
|
19
|
+
keyColumn: keyColumnName,
|
|
20
|
+
labelColumn: labelColumnName,
|
|
21
|
+
iconColumn: iconColumnName,
|
|
22
|
+
settings
|
|
23
|
+
} = _ref,
|
|
24
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
25
|
+
var {
|
|
26
|
+
scale
|
|
27
|
+
} = useSpectrumThemeProvider();
|
|
28
|
+
var itemHeight = LIST_VIEW_ROW_HEIGHTS[(_props$density = props.density) !== null && _props$density !== void 0 ? _props$density : 'regular'][scale];
|
|
29
|
+
var {
|
|
30
|
+
getFormattedString: formatValue
|
|
31
|
+
} = useFormatter(settings);
|
|
32
|
+
var deserializeRow = useItemRowDeserializer({
|
|
33
|
+
table,
|
|
34
|
+
iconColumnName,
|
|
35
|
+
keyColumnName,
|
|
36
|
+
labelColumnName,
|
|
37
|
+
formatValue
|
|
38
|
+
});
|
|
39
|
+
var {
|
|
40
|
+
viewportData,
|
|
41
|
+
onScroll
|
|
42
|
+
} = useViewportData({
|
|
43
|
+
reuseItemsOnTableResize: true,
|
|
44
|
+
table,
|
|
45
|
+
itemHeight,
|
|
46
|
+
deserializeRow
|
|
47
|
+
});
|
|
48
|
+
return /*#__PURE__*/_jsx(ListViewNormalized
|
|
49
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
50
|
+
, _objectSpread(_objectSpread({}, props), {}, {
|
|
51
|
+
normalizedItems: viewportData.items,
|
|
52
|
+
showItemIcons: iconColumnName != null,
|
|
53
|
+
onScroll: onScroll
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
export default ListView;
|
|
57
|
+
//# sourceMappingURL=ListView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListView.js","names":["ListViewNormalized","useSpectrumThemeProvider","LIST_VIEW_ROW_HEIGHTS","useFormatter","useViewportData","useItemRowDeserializer","jsx","_jsx","ListView","_ref","_props$density","table","keyColumn","keyColumnName","labelColumn","labelColumnName","iconColumn","iconColumnName","settings","props","_objectWithoutProperties","_excluded","scale","itemHeight","density","getFormattedString","formatValue","deserializeRow","viewportData","onScroll","reuseItemsOnTableResize","_objectSpread","normalizedItems","items","showItemIcons"],"sources":["../../src/spectrum/ListView.tsx"],"sourcesContent":["import {\n ListViewNormalized,\n ListViewNormalizedProps,\n NormalizedItemData,\n useSpectrumThemeProvider,\n} from '@deephaven/components';\nimport { dh as DhType } from '@deephaven/jsapi-types';\nimport { Settings } from '@deephaven/jsapi-utils';\nimport { LIST_VIEW_ROW_HEIGHTS } from '@deephaven/utils';\nimport useFormatter from '../useFormatter';\nimport useViewportData from '../useViewportData';\nimport { useItemRowDeserializer } from './utils';\n\nexport interface ListViewProps\n extends Omit<ListViewNormalizedProps, 'normalizedItems' | 'showItemIcons'> {\n table: DhType.Table;\n /* The column of values to use as item keys. Defaults to the first column. */\n keyColumn?: string;\n /* The column of values to display as primary text. Defaults to the `keyColumn` value. */\n labelColumn?: string;\n\n /* The column of values to map to icons. */\n iconColumn?: string;\n\n settings?: Settings;\n}\n\nexport function ListView({\n table,\n keyColumn: keyColumnName,\n labelColumn: labelColumnName,\n iconColumn: iconColumnName,\n settings,\n ...props\n}: ListViewProps): JSX.Element {\n const { scale } = useSpectrumThemeProvider();\n const itemHeight = LIST_VIEW_ROW_HEIGHTS[props.density ?? 'regular'][scale];\n\n const { getFormattedString: formatValue } = useFormatter(settings);\n\n const deserializeRow = useItemRowDeserializer({\n table,\n iconColumnName,\n keyColumnName,\n labelColumnName,\n formatValue,\n });\n\n const { viewportData, onScroll } = useViewportData<\n NormalizedItemData,\n DhType.Table\n >({\n reuseItemsOnTableResize: true,\n table,\n itemHeight,\n deserializeRow,\n });\n\n return (\n <ListViewNormalized\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...props}\n normalizedItems={viewportData.items}\n showItemIcons={iconColumnName != null}\n onScroll={onScroll}\n />\n );\n}\n\nexport default ListView;\n"],"mappings":";;;;;;;;AAAA,SACEA,kBAAkB,EAGlBC,wBAAwB,QACnB,uBAAuB;AAG9B,SAASC,qBAAqB,QAAQ,kBAAkB;AAAC,OAClDC,YAAY;AAAA,OACZC,eAAe;AAAA,SACbC,sBAAsB;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAgB/B,OAAO,SAASC,QAAQA,CAAAC,IAAA,EAOO;EAAA,IAAAC,cAAA;EAAA,IAPN;MACvBC,KAAK;MACLC,SAAS,EAAEC,aAAa;MACxBC,WAAW,EAAEC,eAAe;MAC5BC,UAAU,EAAEC,cAAc;MAC1BC;IAEa,CAAC,GAAAT,IAAA;IADXU,KAAK,GAAAC,wBAAA,CAAAX,IAAA,EAAAY,SAAA;EAER,IAAM;IAAEC;EAAM,CAAC,GAAGrB,wBAAwB,CAAC,CAAC;EAC5C,IAAMsB,UAAU,GAAGrB,qBAAqB,EAAAQ,cAAA,GAACS,KAAK,CAACK,OAAO,cAAAd,cAAA,cAAAA,cAAA,GAAI,SAAS,CAAC,CAACY,KAAK,CAAC;EAE3E,IAAM;IAAEG,kBAAkB,EAAEC;EAAY,CAAC,GAAGvB,YAAY,CAACe,QAAQ,CAAC;EAElE,IAAMS,cAAc,GAAGtB,sBAAsB,CAAC;IAC5CM,KAAK;IACLM,cAAc;IACdJ,aAAa;IACbE,eAAe;IACfW;EACF,CAAC,CAAC;EAEF,IAAM;IAAEE,YAAY;IAAEC;EAAS,CAAC,GAAGzB,eAAe,CAGhD;IACA0B,uBAAuB,EAAE,IAAI;IAC7BnB,KAAK;IACLY,UAAU;IACVI;EACF,CAAC,CAAC;EAEF,oBACEpB,IAAA,CAACP;EACC;EAAA,EAAA+B,aAAA,CAAAA,aAAA,KACIZ,KAAK;IACTa,eAAe,EAAEJ,YAAY,CAACK,KAAM;IACpCC,aAAa,EAAEjB,cAAc,IAAI,IAAK;IACtCY,QAAQ,EAAEA;EAAS,EACpB,CAAC;AAEN;AAEA,eAAerB,QAAQ"}
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PickerProps
|
|
3
|
-
|
|
4
|
-
import { Settings } from '@deephaven/jsapi-utils';
|
|
5
|
-
export interface PickerProps extends Omit<PickerPropsBase, 'children'> {
|
|
6
|
-
table: DhType.Table;
|
|
7
|
-
keyColumn?: string;
|
|
8
|
-
labelColumn?: string;
|
|
9
|
-
settings?: Settings;
|
|
10
|
-
}
|
|
11
|
-
export declare function Picker({ table, keyColumn: keyColumnName, labelColumn: labelColumnName, selectedKey, settings, ...props }: PickerProps): JSX.Element;
|
|
2
|
+
import { PickerProps } from './PickerProps';
|
|
3
|
+
export declare function Picker(props: PickerProps): JSX.Element;
|
|
12
4
|
export default Picker;
|
|
13
5
|
//# sourceMappingURL=Picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../src/spectrum/Picker.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"Picker.d.ts","sourceRoot":"","sources":["../../src/spectrum/Picker.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAStD;AAED,eAAe,MAAM,CAAC"}
|
package/dist/spectrum/Picker.js
CHANGED
|
@@ -1,90 +1,16 @@
|
|
|
1
|
-
var _excluded = ["table", "keyColumn", "labelColumn", "selectedKey", "settings"];
|
|
2
1
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
3
2
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4
3
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
4
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
6
5
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
-
import { Picker as PickerBase } from '@deephaven/components';
|
|
12
|
-
import Log from '@deephaven/log';
|
|
13
|
-
import { PICKER_ITEM_HEIGHT, PICKER_TOP_OFFSET } from '@deephaven/utils';
|
|
14
|
-
import { useCallback, useEffect, useMemo } from 'react';
|
|
15
|
-
import useFormatter from "../useFormatter.js";
|
|
16
|
-
import useGetItemIndexByValue from "../useGetItemIndexByValue.js";
|
|
17
|
-
import { useViewportData } from "../useViewportData.js";
|
|
18
|
-
import { getItemKeyColumn } from "./utils/itemUtils.js";
|
|
19
|
-
import { useItemRowDeserializer } from "./utils/useItemRowDeserializer.js";
|
|
6
|
+
import { PickerNormalized } from '@deephaven/components';
|
|
7
|
+
import { usePickerProps } from "./utils/index.js";
|
|
20
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
table,
|
|
25
|
-
keyColumn: keyColumnName,
|
|
26
|
-
labelColumn: labelColumnName,
|
|
27
|
-
selectedKey,
|
|
28
|
-
settings
|
|
29
|
-
} = _ref,
|
|
30
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
31
|
-
var {
|
|
32
|
-
getFormattedString: formatValue
|
|
33
|
-
} = useFormatter(settings);
|
|
34
|
-
var keyColumn = useMemo(() => getItemKeyColumn(table, keyColumnName), [keyColumnName, table]);
|
|
35
|
-
var deserializeRow = useItemRowDeserializer({
|
|
36
|
-
table,
|
|
37
|
-
keyColumnName,
|
|
38
|
-
labelColumnName,
|
|
39
|
-
formatValue
|
|
40
|
-
});
|
|
41
|
-
var getItemIndexByValue = useGetItemIndexByValue({
|
|
42
|
-
table,
|
|
43
|
-
columnName: keyColumn.name,
|
|
44
|
-
value: selectedKey
|
|
45
|
-
});
|
|
46
|
-
var getInitialScrollPosition = useCallback( /*#__PURE__*/_asyncToGenerator(function* () {
|
|
47
|
-
var index = yield getItemIndexByValue();
|
|
48
|
-
if (index == null) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
return index * PICKER_ITEM_HEIGHT + PICKER_TOP_OFFSET;
|
|
52
|
-
}), [getItemIndexByValue]);
|
|
53
|
-
var {
|
|
54
|
-
viewportData,
|
|
55
|
-
onScroll,
|
|
56
|
-
setViewport
|
|
57
|
-
} = useViewportData({
|
|
58
|
-
reuseItemsOnTableResize: true,
|
|
59
|
-
table,
|
|
60
|
-
itemHeight: PICKER_ITEM_HEIGHT,
|
|
61
|
-
deserializeRow
|
|
62
|
-
});
|
|
63
|
-
useEffect(
|
|
64
|
-
// Set viewport to include the selected item so that its data will load and
|
|
65
|
-
// the real `key` will be available to show the selection in the UI.
|
|
66
|
-
function setViewportFromSelectedKey() {
|
|
67
|
-
var isCanceled = false;
|
|
68
|
-
getItemIndexByValue().then(index => {
|
|
69
|
-
if (index == null || isCanceled) {
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
setViewport(index);
|
|
73
|
-
}).catch(err => {
|
|
74
|
-
log.error('Error setting viewport from selected key', err);
|
|
75
|
-
});
|
|
76
|
-
return () => {
|
|
77
|
-
isCanceled = true;
|
|
78
|
-
};
|
|
79
|
-
}, [getItemIndexByValue, settings, setViewport]);
|
|
80
|
-
return /*#__PURE__*/_jsx(PickerBase
|
|
9
|
+
export function Picker(props) {
|
|
10
|
+
var pickerProps = usePickerProps(props);
|
|
11
|
+
return /*#__PURE__*/_jsx(PickerNormalized
|
|
81
12
|
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
82
|
-
, _objectSpread(
|
|
83
|
-
getInitialScrollPosition: getInitialScrollPosition,
|
|
84
|
-
selectedKey: selectedKey,
|
|
85
|
-
onScroll: onScroll,
|
|
86
|
-
children: viewportData.items
|
|
87
|
-
}));
|
|
13
|
+
, _objectSpread({}, pickerProps));
|
|
88
14
|
}
|
|
89
15
|
export default Picker;
|
|
90
16
|
//# sourceMappingURL=Picker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Picker.js","names":["
|
|
1
|
+
{"version":3,"file":"Picker.js","names":["PickerNormalized","usePickerProps","jsx","_jsx","Picker","props","pickerProps","_objectSpread"],"sources":["../../src/spectrum/Picker.tsx"],"sourcesContent":["import { PickerNormalized } from '@deephaven/components';\nimport { PickerProps } from './PickerProps';\nimport { usePickerProps } from './utils';\n\nexport function Picker(props: PickerProps): JSX.Element {\n const pickerProps = usePickerProps<PickerProps>(props);\n\n return (\n <PickerNormalized\n // eslint-disable-next-line react/jsx-props-no-spreading\n {...pickerProps}\n />\n );\n}\n\nexport default Picker;\n"],"mappings":";;;;;AAAA,SAASA,gBAAgB,QAAQ,uBAAuB;AAAC,SAEhDC,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAEvB,OAAO,SAASC,MAAMA,CAACC,KAAkB,EAAe;EACtD,IAAMC,WAAW,GAAGL,cAAc,CAAcI,KAAK,CAAC;EAEtD,oBACEF,IAAA,CAACH;EACC;EAAA,EAAAO,aAAA,KACID,WAAW,CAChB,CAAC;AAEN;AAEA,eAAeF,MAAM"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { NormalizedItem, PickerPropsT, SpectrumPickerProps } from '@deephaven/components';
|
|
2
|
+
import { dh as DhType } from '@deephaven/jsapi-types';
|
|
3
|
+
import { Settings } from '@deephaven/jsapi-utils';
|
|
4
|
+
export type PickerWithTableProps<TProps> = Omit<PickerPropsT<TProps>, 'children'> & {
|
|
5
|
+
table: DhType.Table;
|
|
6
|
+
keyColumn?: string;
|
|
7
|
+
labelColumn?: string;
|
|
8
|
+
iconColumn?: string;
|
|
9
|
+
settings?: Settings;
|
|
10
|
+
};
|
|
11
|
+
export type PickerProps = PickerWithTableProps<SpectrumPickerProps<NormalizedItem>>;
|
|
12
|
+
//# sourceMappingURL=PickerProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerProps.d.ts","sourceRoot":"","sources":["../../src/spectrum/PickerProps.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,mBAAmB,EACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAElD,MAAM,MAAM,oBAAoB,CAAC,MAAM,IAAI,IAAI,CAC7C,YAAY,CAAC,MAAM,CAAC,EACpB,UAAU,CACX,GAAG;IACF,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;IAEpB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,oBAAoB,CAC5C,mBAAmB,CAAC,cAAc,CAAC,CACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PickerProps.js","names":[],"sources":["../../src/spectrum/PickerProps.ts"],"sourcesContent":["import {\n NormalizedItem,\n PickerPropsT,\n SpectrumPickerProps,\n} from '@deephaven/components';\nimport { dh as DhType } from '@deephaven/jsapi-types';\nimport { Settings } from '@deephaven/jsapi-utils';\n\nexport type PickerWithTableProps<TProps> = Omit<\n PickerPropsT<TProps>,\n 'children'\n> & {\n table: DhType.Table;\n /* The column of values to use as item keys. Defaults to the first column. */\n keyColumn?: string;\n /* The column of values to display as primary text. Defaults to the `keyColumn` value. */\n labelColumn?: string;\n\n /* The column of values to map to icons. */\n iconColumn?: string;\n\n settings?: Settings;\n};\n\nexport type PickerProps = PickerWithTableProps<\n SpectrumPickerProps<NormalizedItem>\n>;\n"],"mappings":""}
|
package/dist/spectrum/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spectrum/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC"}
|
package/dist/spectrum/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["export * from './Picker';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/spectrum/index.ts"],"sourcesContent":["export * from './ComboBox';\nexport * from './ListView';\nexport * from './Picker';\nexport * from './PickerProps';\n"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/utils/index.ts"],"sourcesContent":["export * from './itemUtils';\nexport * from './useItemRowDeserializer';\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/spectrum/utils/index.ts"],"sourcesContent":["export * from './itemUtils';\nexport * from './useItemRowDeserializer';\nexport * from './usePickerProps';\n"],"mappings":""}
|
|
@@ -3,13 +3,17 @@ import { dh } from '@deephaven/jsapi-types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns a function that deserializes a row into a normalized item data object.
|
|
5
5
|
* @param table The table to get the key and label columns from
|
|
6
|
+
* @param descriptionColumnName The name of the column to use for description data
|
|
7
|
+
* @param iconColumnName The name of the column to use for icon data
|
|
6
8
|
* @param keyColumnName The name of the column to use for key data
|
|
7
9
|
* @param labelColumnName The name of the column to use for label data
|
|
8
10
|
* @param formatValue Optional function to format the label value
|
|
9
11
|
* @returns A function that deserializes a row into a normalized item data object
|
|
10
12
|
*/
|
|
11
|
-
export declare function useItemRowDeserializer({ table, keyColumnName, labelColumnName, formatValue, }: {
|
|
12
|
-
table
|
|
13
|
+
export declare function useItemRowDeserializer({ table, descriptionColumnName, iconColumnName, keyColumnName, labelColumnName, formatValue, }: {
|
|
14
|
+
table?: dh.Table | null;
|
|
15
|
+
descriptionColumnName?: string;
|
|
16
|
+
iconColumnName?: string;
|
|
13
17
|
keyColumnName?: string;
|
|
14
18
|
labelColumnName?: string;
|
|
15
19
|
formatValue?: (value: unknown, columnType: string) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useItemRowDeserializer.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useItemRowDeserializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"useItemRowDeserializer.d.ts","sourceRoot":"","sources":["../../../src/spectrum/utils/useItemRowDeserializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAC;AAoB5C;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,eAAe,EACf,WAAgC,GACjC,EAAE;IACD,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,MAAM,CAAC;CAC9D,GAAG,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,KAAK,kBAAkB,CA8DtC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useCallback, useMemo } from 'react';
|
|
2
|
+
import { assertNotNull } from '@deephaven/utils';
|
|
2
3
|
import { getItemKeyColumn, getItemLabelColumn } from "./itemUtils.js";
|
|
3
4
|
function defaultFormatKey(value) {
|
|
4
5
|
if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
|
|
@@ -13,6 +14,8 @@ function defaultFormatValue(value, _columnType) {
|
|
|
13
14
|
/**
|
|
14
15
|
* Returns a function that deserializes a row into a normalized item data object.
|
|
15
16
|
* @param table The table to get the key and label columns from
|
|
17
|
+
* @param descriptionColumnName The name of the column to use for description data
|
|
18
|
+
* @param iconColumnName The name of the column to use for icon data
|
|
16
19
|
* @param keyColumnName The name of the column to use for key data
|
|
17
20
|
* @param labelColumnName The name of the column to use for label data
|
|
18
21
|
* @param formatValue Optional function to format the label value
|
|
@@ -21,20 +24,36 @@ function defaultFormatValue(value, _columnType) {
|
|
|
21
24
|
export function useItemRowDeserializer(_ref) {
|
|
22
25
|
var {
|
|
23
26
|
table,
|
|
27
|
+
descriptionColumnName,
|
|
28
|
+
iconColumnName,
|
|
24
29
|
keyColumnName,
|
|
25
30
|
labelColumnName,
|
|
26
31
|
formatValue = defaultFormatValue
|
|
27
32
|
} = _ref;
|
|
28
|
-
var keyColumn = useMemo(() => getItemKeyColumn(table, keyColumnName), [keyColumnName, table]);
|
|
29
|
-
var labelColumn = useMemo(() => getItemLabelColumn(table, keyColumn, labelColumnName), [keyColumn, labelColumnName, table]);
|
|
33
|
+
var keyColumn = useMemo(() => table == null ? null : getItemKeyColumn(table, keyColumnName), [keyColumnName, table]);
|
|
34
|
+
var labelColumn = useMemo(() => table == null || keyColumn == null ? null : getItemLabelColumn(table, keyColumn, labelColumnName), [keyColumn, labelColumnName, table]);
|
|
35
|
+
var descriptionColumn = useMemo(() => table == null || descriptionColumnName == null ? null : table.findColumn(descriptionColumnName), [descriptionColumnName, table]);
|
|
36
|
+
var iconColumn = useMemo(() => table == null || iconColumnName == null ? null : table.findColumn(iconColumnName), [iconColumnName, table]);
|
|
30
37
|
var deserializeRow = useCallback(row => {
|
|
38
|
+
// `deserializeRow` can be created on a null `table` which results in null
|
|
39
|
+
// `keyColumn` + `labelColumn`, but it should never actually be called.
|
|
40
|
+
// The assumption is that the `table` will eventually be non-null,
|
|
41
|
+
// `deserializeRow` will be recreated, and then applied to the non-null
|
|
42
|
+
// table.
|
|
43
|
+
assertNotNull(keyColumn, 'keyColumn cannot be null.');
|
|
44
|
+
assertNotNull(labelColumn, 'labelColumn cannot be null.');
|
|
31
45
|
var key = defaultFormatKey(row.get(keyColumn));
|
|
32
46
|
var content = formatValue(row.get(labelColumn), labelColumn.type);
|
|
47
|
+
var description = descriptionColumn == null ? undefined : formatValue(row.get(descriptionColumn), descriptionColumn.type);
|
|
48
|
+
var icon = iconColumn == null ? undefined : row.get(iconColumn);
|
|
33
49
|
return {
|
|
34
50
|
key,
|
|
35
|
-
content
|
|
51
|
+
content,
|
|
52
|
+
textValue: content,
|
|
53
|
+
description,
|
|
54
|
+
icon
|
|
36
55
|
};
|
|
37
|
-
}, [formatValue, keyColumn, labelColumn]);
|
|
56
|
+
}, [descriptionColumn, formatValue, iconColumn, keyColumn, labelColumn]);
|
|
38
57
|
return deserializeRow;
|
|
39
58
|
}
|
|
40
59
|
export default useItemRowDeserializer;
|