@salt-ds/data-grid 0.0.0-snapshot-20230620094559 → 0.0.0-snapshot-20230705144029
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.
|
@@ -64,14 +64,14 @@ function DropdownCellEditor(props) {
|
|
|
64
64
|
children: [
|
|
65
65
|
/* @__PURE__ */ jsxRuntime.jsx("div", {
|
|
66
66
|
className: withBaseName("dropdownContainer"),
|
|
67
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(lab.Dropdown, {
|
|
67
|
+
children: options && options.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(lab.Dropdown, {
|
|
68
68
|
isOpen: true,
|
|
69
69
|
source: options,
|
|
70
70
|
defaultSelected: value,
|
|
71
71
|
onSelectionChange,
|
|
72
72
|
triggerComponent,
|
|
73
73
|
width: column.info.width - 5
|
|
74
|
-
})
|
|
74
|
+
}) : triggerComponent
|
|
75
75
|
}),
|
|
76
76
|
/* @__PURE__ */ jsxRuntime.jsx(CornerTag.CornerTag, {})
|
|
77
77
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownCellEditor.js","sources":["../src/DropdownCellEditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { Dropdown, SelectionChangeHandler } from \"@salt-ds/lab\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { useEditorContext } from \"./EditorContext\";\nimport { GridColumnModel, GridRowModel } from \"./Grid\";\nimport { CornerTag } from \"./CornerTag\";\nimport { Cell } from \"./internal\";\n\nimport dropdownCellEditorCss from \"./DropdownCellEditor.css\";\n\nconst withBaseName = makePrefixer(\"saltGridDropdownCellEditor\");\n\nexport interface DropdownCellEditorProps<T> {\n options: ReadonlyArray<string>;\n // Row and column are provided by the grid. See TableRow.tsx\n row?: GridRowModel<T>;\n column?: GridColumnModel<T>;\n}\n\nexport function DropdownCellEditor<T>(props: DropdownCellEditorProps<T>) {\n const { options, column, row } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dropdown-cell-editor\",\n css: dropdownCellEditorCss,\n window: targetWindow,\n });\n\n const triggerRef = useRef<HTMLDivElement>(null);\n\n const value = column!.info.props.getValue!(row!.data);\n\n const { endEditMode } = useEditorContext();\n\n const onSelectionChange: SelectionChangeHandler = (event, item) => {\n if (item) {\n endEditMode(item);\n }\n };\n\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.focus();\n }\n }, [triggerRef.current]);\n\n const triggerComponent = (\n <div\n tabIndex={0}\n ref={triggerRef}\n className={withBaseName(\"currentValue\")}\n data-testid=\"grid-cell-editor-trigger\"\n >\n {value}\n </div>\n );\n\n return (\n <Cell separator={column?.separator} className={withBaseName()}>\n <div className={withBaseName(\"dropdownContainer\")}>\n <Dropdown\n
|
|
1
|
+
{"version":3,"file":"DropdownCellEditor.js","sources":["../src/DropdownCellEditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { Dropdown, SelectionChangeHandler } from \"@salt-ds/lab\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { useEditorContext } from \"./EditorContext\";\nimport { GridColumnModel, GridRowModel } from \"./Grid\";\nimport { CornerTag } from \"./CornerTag\";\nimport { Cell } from \"./internal\";\n\nimport dropdownCellEditorCss from \"./DropdownCellEditor.css\";\n\nconst withBaseName = makePrefixer(\"saltGridDropdownCellEditor\");\n\nexport interface DropdownCellEditorProps<T> {\n options: ReadonlyArray<string>;\n // Row and column are provided by the grid. See TableRow.tsx\n row?: GridRowModel<T>;\n column?: GridColumnModel<T>;\n}\n\nexport function DropdownCellEditor<T>(props: DropdownCellEditorProps<T>) {\n const { options, column, row } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dropdown-cell-editor\",\n css: dropdownCellEditorCss,\n window: targetWindow,\n });\n\n const triggerRef = useRef<HTMLDivElement>(null);\n\n const value = column!.info.props.getValue!(row!.data);\n\n const { endEditMode } = useEditorContext();\n\n const onSelectionChange: SelectionChangeHandler = (event, item) => {\n if (item) {\n endEditMode(item);\n }\n };\n\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.focus();\n }\n }, [triggerRef.current]);\n\n const triggerComponent = (\n <div\n tabIndex={0}\n ref={triggerRef}\n className={withBaseName(\"currentValue\")}\n data-testid=\"grid-cell-editor-trigger\"\n >\n {value}\n </div>\n );\n\n return (\n <Cell separator={column?.separator} className={withBaseName()}>\n <div className={withBaseName(\"dropdownContainer\")}>\n {options && options.length > 0 ? (\n <Dropdown\n isOpen={true}\n source={options}\n defaultSelected={value}\n onSelectionChange={onSelectionChange}\n triggerComponent={triggerComponent}\n width={column!.info.width! - 5}\n />\n ) : (\n triggerComponent\n )}\n </div>\n <CornerTag />\n </Cell>\n );\n}\n"],"names":["makePrefixer","useWindow","useComponentCssInjection","dropdownCellEditorCss","useRef","useEditorContext","useEffect","jsx","jsxs","Cell","Dropdown","CornerTag"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAeA,kBAAa,4BAA4B,CAAA,CAAA;AASvD,SAAS,mBAAsB,KAAmC,EAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,GAAA,EAAQ,GAAA,KAAA,CAAA;AAEjC,EAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,EAAyBC,+BAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,2BAAA;AAAA,IACR,GAAK,EAAAC,oBAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAM,MAAA,UAAA,GAAaC,aAAuB,IAAI,CAAA,CAAA;AAE9C,EAAA,MAAM,QAAQ,MAAQ,CAAA,IAAA,CAAK,KAAM,CAAA,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GAAA,CAAA;AAAA,SAC/B,CAEA,GAAA,gBAAA;AAAA,OAEJ,CAAA;AAAA,qCACCC,mBAAU,EAAA,EAAA,CAAA;AAAA,KAAA;AAAA,GACb,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -60,14 +60,14 @@ function DropdownCellEditor(props) {
|
|
|
60
60
|
children: [
|
|
61
61
|
/* @__PURE__ */ jsx("div", {
|
|
62
62
|
className: withBaseName("dropdownContainer"),
|
|
63
|
-
children: /* @__PURE__ */ jsx(Dropdown, {
|
|
63
|
+
children: options && options.length > 0 ? /* @__PURE__ */ jsx(Dropdown, {
|
|
64
64
|
isOpen: true,
|
|
65
65
|
source: options,
|
|
66
66
|
defaultSelected: value,
|
|
67
67
|
onSelectionChange,
|
|
68
68
|
triggerComponent,
|
|
69
69
|
width: column.info.width - 5
|
|
70
|
-
})
|
|
70
|
+
}) : triggerComponent
|
|
71
71
|
}),
|
|
72
72
|
/* @__PURE__ */ jsx(CornerTag, {})
|
|
73
73
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownCellEditor.js","sources":["../src/DropdownCellEditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { Dropdown, SelectionChangeHandler } from \"@salt-ds/lab\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { useEditorContext } from \"./EditorContext\";\nimport { GridColumnModel, GridRowModel } from \"./Grid\";\nimport { CornerTag } from \"./CornerTag\";\nimport { Cell } from \"./internal\";\n\nimport dropdownCellEditorCss from \"./DropdownCellEditor.css\";\n\nconst withBaseName = makePrefixer(\"saltGridDropdownCellEditor\");\n\nexport interface DropdownCellEditorProps<T> {\n options: ReadonlyArray<string>;\n // Row and column are provided by the grid. See TableRow.tsx\n row?: GridRowModel<T>;\n column?: GridColumnModel<T>;\n}\n\nexport function DropdownCellEditor<T>(props: DropdownCellEditorProps<T>) {\n const { options, column, row } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dropdown-cell-editor\",\n css: dropdownCellEditorCss,\n window: targetWindow,\n });\n\n const triggerRef = useRef<HTMLDivElement>(null);\n\n const value = column!.info.props.getValue!(row!.data);\n\n const { endEditMode } = useEditorContext();\n\n const onSelectionChange: SelectionChangeHandler = (event, item) => {\n if (item) {\n endEditMode(item);\n }\n };\n\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.focus();\n }\n }, [triggerRef.current]);\n\n const triggerComponent = (\n <div\n tabIndex={0}\n ref={triggerRef}\n className={withBaseName(\"currentValue\")}\n data-testid=\"grid-cell-editor-trigger\"\n >\n {value}\n </div>\n );\n\n return (\n <Cell separator={column?.separator} className={withBaseName()}>\n <div className={withBaseName(\"dropdownContainer\")}>\n <Dropdown\n
|
|
1
|
+
{"version":3,"file":"DropdownCellEditor.js","sources":["../src/DropdownCellEditor.tsx"],"sourcesContent":["import { useEffect, useRef } from \"react\";\nimport { makePrefixer } from \"@salt-ds/core\";\nimport { Dropdown, SelectionChangeHandler } from \"@salt-ds/lab\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\nimport { useEditorContext } from \"./EditorContext\";\nimport { GridColumnModel, GridRowModel } from \"./Grid\";\nimport { CornerTag } from \"./CornerTag\";\nimport { Cell } from \"./internal\";\n\nimport dropdownCellEditorCss from \"./DropdownCellEditor.css\";\n\nconst withBaseName = makePrefixer(\"saltGridDropdownCellEditor\");\n\nexport interface DropdownCellEditorProps<T> {\n options: ReadonlyArray<string>;\n // Row and column are provided by the grid. See TableRow.tsx\n row?: GridRowModel<T>;\n column?: GridColumnModel<T>;\n}\n\nexport function DropdownCellEditor<T>(props: DropdownCellEditorProps<T>) {\n const { options, column, row } = props;\n\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-dropdown-cell-editor\",\n css: dropdownCellEditorCss,\n window: targetWindow,\n });\n\n const triggerRef = useRef<HTMLDivElement>(null);\n\n const value = column!.info.props.getValue!(row!.data);\n\n const { endEditMode } = useEditorContext();\n\n const onSelectionChange: SelectionChangeHandler = (event, item) => {\n if (item) {\n endEditMode(item);\n }\n };\n\n useEffect(() => {\n if (triggerRef.current) {\n triggerRef.current.focus();\n }\n }, [triggerRef.current]);\n\n const triggerComponent = (\n <div\n tabIndex={0}\n ref={triggerRef}\n className={withBaseName(\"currentValue\")}\n data-testid=\"grid-cell-editor-trigger\"\n >\n {value}\n </div>\n );\n\n return (\n <Cell separator={column?.separator} className={withBaseName()}>\n <div className={withBaseName(\"dropdownContainer\")}>\n {options && options.length > 0 ? (\n <Dropdown\n isOpen={true}\n source={options}\n defaultSelected={value}\n onSelectionChange={onSelectionChange}\n triggerComponent={triggerComponent}\n width={column!.info.width! - 5}\n />\n ) : (\n triggerComponent\n )}\n </div>\n <CornerTag />\n </Cell>\n );\n}\n"],"names":["dropdownCellEditorCss"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAaA,MAAM,YAAA,GAAe,aAAa,4BAA4B,CAAA,CAAA;AASvD,SAAS,mBAAsB,KAAmC,EAAA;AACvE,EAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,GAAA,EAAQ,GAAA,KAAA,CAAA;AAEjC,EAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,EAAyB,wBAAA,CAAA;AAAA,IACvB,MAAQ,EAAA,2BAAA;AAAA,IACR,GAAK,EAAAA,QAAA;AAAA,IACL,MAAQ,EAAA,YAAA;AAAA,GACT,CAAA,CAAA;AAED,EAAM,MAAA,UAAA,GAAa,OAAuB,IAAI,CAAA,CAAA;AAE9C,EAAA,MAAM,QAAQ,MAAQ,CAAA,IAAA,CAAK,KAAM,CAAA,QAAA,CAAU,IAAK,IAAI,CAAA,CAAA;AAEpD,EAAM,MAAA,EAAE,WAAY,EAAA,GAAI,gBAAiB,EAAA,CAAA;AAEzC,EAAM,MAAA,iBAAA,GA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EJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/data-grid",
|
|
3
|
-
"version": "0.0.0-snapshot-
|
|
3
|
+
"version": "0.0.0-snapshot-20230705144029",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist-cjs/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -16,17 +16,18 @@
|
|
|
16
16
|
},
|
|
17
17
|
"publishConfig": {
|
|
18
18
|
"directory": "../../dist/salt-ds-data-grid",
|
|
19
|
-
"tag": "next"
|
|
19
|
+
"tag": "next",
|
|
20
|
+
"provenance": true
|
|
20
21
|
},
|
|
21
22
|
"module": "dist-es/index.js",
|
|
22
23
|
"typings": "dist-types/index.d.ts",
|
|
23
24
|
"dependencies": {
|
|
24
25
|
"clsx": "^1.2.1",
|
|
25
|
-
"@salt-ds/core": "^0.0.0-snapshot-
|
|
26
|
-
"@salt-ds/window": "^0.
|
|
27
|
-
"@salt-ds/styles": "^0.
|
|
28
|
-
"@salt-ds/icons": "^
|
|
29
|
-
"@salt-ds/lab": "^0.0.0-snapshot-
|
|
26
|
+
"@salt-ds/core": "^0.0.0-snapshot-20230705144029",
|
|
27
|
+
"@salt-ds/window": "^0.0.0-snapshot-20230705144029",
|
|
28
|
+
"@salt-ds/styles": "^0.0.0-snapshot-20230705144029",
|
|
29
|
+
"@salt-ds/icons": "^0.0.0-snapshot-20230705144029",
|
|
30
|
+
"@salt-ds/lab": "^0.0.0-snapshot-20230705144029"
|
|
30
31
|
},
|
|
31
32
|
"files": [
|
|
32
33
|
"dist-cjs",
|