@vuu-ui/vuu-table 1.0.2 → 1.0.3
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/cjs/useMeasuredHeight.js
CHANGED
|
@@ -9,6 +9,11 @@ const useMeasuredHeight = ({
|
|
|
9
9
|
}) => {
|
|
10
10
|
const [measuredHeight, setMeasuredHeight] = react.useState(heightProp);
|
|
11
11
|
const lastMeasuredHeight = react.useRef(-1);
|
|
12
|
+
react.useMemo(() => {
|
|
13
|
+
if (heightProp !== 0) {
|
|
14
|
+
setMeasuredHeight(heightProp);
|
|
15
|
+
}
|
|
16
|
+
}, [heightProp]);
|
|
12
17
|
const resizeObserver = react.useMemo(() => {
|
|
13
18
|
return new ResizeObserver((entries) => {
|
|
14
19
|
for (const entry of entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMeasuredHeight.js","sources":["../../../packages/vuu-table/src/useMeasuredHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface MeasuredHeightHookProps {\n onHeightMeasured?: (height: number) => void;\n height?: number;\n}\n\nexport const useMeasuredHeight = ({\n onHeightMeasured,\n height: heightProp = 0,\n}: MeasuredHeightHookProps) => {\n const [measuredHeight, setMeasuredHeight] = useState(heightProp);\n const lastMeasuredHeight = useRef(-1);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (lastMeasuredHeight.current !== newHeight) {\n if (isValidNumber(newHeight)) {\n lastMeasuredHeight.current = newHeight;\n setMeasuredHeight(newHeight);\n onHeightMeasured?.(newHeight);\n }\n }\n }\n });\n }, [onHeightMeasured]);\n\n const measuredRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (heightProp === 0) {\n const { height } = el.getBoundingClientRect();\n resizeObserver.observe(el);\n // avoids tiny sub-pixel discrepancies\n const measuredHeight = Math.round(height);\n setMeasuredHeight(measuredHeight);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, heightProp],\n );\n return { measuredHeight, measuredRef };\n};\n"],"names":["useState","useRef","useMemo","isValidNumber","useCallback","measuredHeight"],"mappings":";;;;;AAQO,MAAM,oBAAoB,CAAC;AAAA,EAChC,gBAAA;AAAA,EACA,QAAQ,UAAa,GAAA;AACvB,CAA+B,KAAA;AAC7B,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAIA,eAAS,UAAU,CAAA;AAC/D,EAAM,MAAA,kBAAA,GAAqBC,aAAO,CAAE,CAAA,CAAA;AAEpC,EAAM,MAAA,cAAA,
|
|
1
|
+
{"version":3,"file":"useMeasuredHeight.js","sources":["../../../packages/vuu-table/src/useMeasuredHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface MeasuredHeightHookProps {\n onHeightMeasured?: (height: number) => void;\n height?: number;\n}\n\nexport const useMeasuredHeight = ({\n onHeightMeasured,\n height: heightProp = 0,\n}: MeasuredHeightHookProps) => {\n const [measuredHeight, setMeasuredHeight] = useState(heightProp);\n const lastMeasuredHeight = useRef(-1);\n\n useMemo(() => {\n if (heightProp !== 0) {\n setMeasuredHeight(heightProp);\n }\n }, [heightProp]);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (lastMeasuredHeight.current !== newHeight) {\n if (isValidNumber(newHeight)) {\n lastMeasuredHeight.current = newHeight;\n setMeasuredHeight(newHeight);\n onHeightMeasured?.(newHeight);\n }\n }\n }\n });\n }, [onHeightMeasured]);\n\n const measuredRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (heightProp === 0) {\n const { height } = el.getBoundingClientRect();\n resizeObserver.observe(el);\n // avoids tiny sub-pixel discrepancies\n const measuredHeight = Math.round(height);\n setMeasuredHeight(measuredHeight);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, heightProp],\n );\n return { measuredHeight, measuredRef };\n};\n"],"names":["useState","useRef","useMemo","isValidNumber","useCallback","measuredHeight"],"mappings":";;;;;AAQO,MAAM,oBAAoB,CAAC;AAAA,EAChC,gBAAA;AAAA,EACA,QAAQ,UAAa,GAAA;AACvB,CAA+B,KAAA;AAC7B,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAIA,eAAS,UAAU,CAAA;AAC/D,EAAM,MAAA,kBAAA,GAAqBC,aAAO,CAAE,CAAA,CAAA;AAEpC,EAAAC,aAAA,CAAQ,MAAM;AACZ,IAAA,IAAI,eAAe,CAAG,EAAA;AACpB,MAAA,iBAAA,CAAkB,UAAU,CAAA;AAAA;AAC9B,GACF,EAAG,CAAC,UAAU,CAAC,CAAA;AAEf,EAAM,MAAA,cAAA,GAAiBA,cAAQ,MAAM;AACnC,IAAO,OAAA,IAAI,cAAe,CAAA,CAAC,OAAmC,KAAA;AAC5D,MAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,QAAA,MAAM,CAAC,EAAE,SAAA,EAAW,YAAa,EAAC,IAAI,KAAM,CAAA,aAAA;AAC5C,QAAM,MAAA,SAAA,GAAY,IAAK,CAAA,KAAA,CAAM,YAAY,CAAA;AACzC,QAAI,IAAA,kBAAA,CAAmB,YAAY,SAAW,EAAA;AAC5C,UAAI,IAAAC,sBAAA,CAAc,SAAS,CAAG,EAAA;AAC5B,YAAA,kBAAA,CAAmB,OAAU,GAAA,SAAA;AAC7B,YAAA,iBAAA,CAAkB,SAAS,CAAA;AAC3B,YAAA,gBAAA,GAAmB,SAAS,CAAA;AAAA;AAC9B;AACF;AACF,KACD,CAAA;AAAA,GACH,EAAG,CAAC,gBAAgB,CAAC,CAAA;AAErB,EAAA,MAAM,WAAc,GAAAC,iBAAA;AAAA,IAClB,CAAC,EAAO,KAAA;AACN,MAAA,IAAI,EAAI,EAAA;AACN,QAAA,IAAI,eAAe,CAAG,EAAA;AACpB,UAAA,MAAM,EAAE,MAAA,EAAW,GAAA,EAAA,CAAG,qBAAsB,EAAA;AAC5C,UAAA,cAAA,CAAe,QAAQ,EAAE,CAAA;AAEzB,UAAMC,MAAAA,eAAAA,GAAiB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA;AACxC,UAAA,iBAAA,CAAkBA,eAAc,CAAA;AAAA;AAClC,OACK,MAAA;AACL,QAAA,cAAA,CAAe,UAAW,EAAA;AAAA;AAC5B,KACF;AAAA,IACA,CAAC,gBAAgB,UAAU;AAAA,GAC7B;AACA,EAAO,OAAA,EAAE,gBAAgB,WAAY,EAAA;AACvC;;;;"}
|
package/esm/useMeasuredHeight.js
CHANGED
|
@@ -7,6 +7,11 @@ const useMeasuredHeight = ({
|
|
|
7
7
|
}) => {
|
|
8
8
|
const [measuredHeight, setMeasuredHeight] = useState(heightProp);
|
|
9
9
|
const lastMeasuredHeight = useRef(-1);
|
|
10
|
+
useMemo(() => {
|
|
11
|
+
if (heightProp !== 0) {
|
|
12
|
+
setMeasuredHeight(heightProp);
|
|
13
|
+
}
|
|
14
|
+
}, [heightProp]);
|
|
10
15
|
const resizeObserver = useMemo(() => {
|
|
11
16
|
return new ResizeObserver((entries) => {
|
|
12
17
|
for (const entry of entries) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMeasuredHeight.js","sources":["../../../packages/vuu-table/src/useMeasuredHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface MeasuredHeightHookProps {\n onHeightMeasured?: (height: number) => void;\n height?: number;\n}\n\nexport const useMeasuredHeight = ({\n onHeightMeasured,\n height: heightProp = 0,\n}: MeasuredHeightHookProps) => {\n const [measuredHeight, setMeasuredHeight] = useState(heightProp);\n const lastMeasuredHeight = useRef(-1);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (lastMeasuredHeight.current !== newHeight) {\n if (isValidNumber(newHeight)) {\n lastMeasuredHeight.current = newHeight;\n setMeasuredHeight(newHeight);\n onHeightMeasured?.(newHeight);\n }\n }\n }\n });\n }, [onHeightMeasured]);\n\n const measuredRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (heightProp === 0) {\n const { height } = el.getBoundingClientRect();\n resizeObserver.observe(el);\n // avoids tiny sub-pixel discrepancies\n const measuredHeight = Math.round(height);\n setMeasuredHeight(measuredHeight);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, heightProp],\n );\n return { measuredHeight, measuredRef };\n};\n"],"names":["measuredHeight"],"mappings":";;;AAQO,MAAM,oBAAoB,CAAC;AAAA,EAChC,gBAAA;AAAA,EACA,QAAQ,UAAa,GAAA;AACvB,CAA+B,KAAA;AAC7B,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAS,UAAU,CAAA;AAC/D,EAAM,MAAA,kBAAA,GAAqB,OAAO,CAAE,CAAA,CAAA;AAEpC,EAAM,MAAA,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAO,OAAA,IAAI,cAAe,CAAA,CAAC,OAAmC,KAAA;AAC5D,MAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,QAAA,MAAM,CAAC,EAAE,SAAA,EAAW,YAAa,EAAC,IAAI,KAAM,CAAA,aAAA;AAC5C,QAAM,MAAA,SAAA,GAAY,IAAK,CAAA,KAAA,CAAM,YAAY,CAAA;AACzC,QAAI,IAAA,kBAAA,CAAmB,YAAY,SAAW,EAAA;AAC5C,UAAI,IAAA,aAAA,CAAc,SAAS,CAAG,EAAA;AAC5B,YAAA,kBAAA,CAAmB,OAAU,GAAA,SAAA;AAC7B,YAAA,iBAAA,CAAkB,SAAS,CAAA;AAC3B,YAAA,gBAAA,GAAmB,SAAS,CAAA;AAAA;AAC9B;AACF;AACF,KACD,CAAA;AAAA,GACH,EAAG,CAAC,gBAAgB,CAAC,CAAA;AAErB,EAAA,MAAM,WAAc,GAAA,WAAA;AAAA,IAClB,CAAC,EAAO,KAAA;AACN,MAAA,IAAI,EAAI,EAAA;AACN,QAAA,IAAI,eAAe,CAAG,EAAA;AACpB,UAAA,MAAM,EAAE,MAAA,EAAW,GAAA,EAAA,CAAG,qBAAsB,EAAA;AAC5C,UAAA,cAAA,CAAe,QAAQ,EAAE,CAAA;AAEzB,UAAMA,MAAAA,eAAAA,GAAiB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA;AACxC,UAAA,iBAAA,CAAkBA,eAAc,CAAA;AAAA;AAClC,OACK,MAAA;AACL,QAAA,cAAA,CAAe,UAAW,EAAA;AAAA;AAC5B,KACF;AAAA,IACA,CAAC,gBAAgB,UAAU;AAAA,GAC7B;AACA,EAAO,OAAA,EAAE,gBAAgB,WAAY,EAAA;AACvC;;;;"}
|
|
1
|
+
{"version":3,"file":"useMeasuredHeight.js","sources":["../../../packages/vuu-table/src/useMeasuredHeight.ts"],"sourcesContent":["import { isValidNumber } from \"@vuu-ui/vuu-utils\";\nimport { RefCallback, useCallback, useMemo, useRef, useState } from \"react\";\n\ninterface MeasuredHeightHookProps {\n onHeightMeasured?: (height: number) => void;\n height?: number;\n}\n\nexport const useMeasuredHeight = ({\n onHeightMeasured,\n height: heightProp = 0,\n}: MeasuredHeightHookProps) => {\n const [measuredHeight, setMeasuredHeight] = useState(heightProp);\n const lastMeasuredHeight = useRef(-1);\n\n useMemo(() => {\n if (heightProp !== 0) {\n setMeasuredHeight(heightProp);\n }\n }, [heightProp]);\n\n const resizeObserver = useMemo(() => {\n return new ResizeObserver((entries: ResizeObserverEntry[]) => {\n for (const entry of entries) {\n const [{ blockSize: measuredSize }] = entry.borderBoxSize;\n const newHeight = Math.round(measuredSize);\n if (lastMeasuredHeight.current !== newHeight) {\n if (isValidNumber(newHeight)) {\n lastMeasuredHeight.current = newHeight;\n setMeasuredHeight(newHeight);\n onHeightMeasured?.(newHeight);\n }\n }\n }\n });\n }, [onHeightMeasured]);\n\n const measuredRef = useCallback<RefCallback<HTMLDivElement>>(\n (el) => {\n if (el) {\n if (heightProp === 0) {\n const { height } = el.getBoundingClientRect();\n resizeObserver.observe(el);\n // avoids tiny sub-pixel discrepancies\n const measuredHeight = Math.round(height);\n setMeasuredHeight(measuredHeight);\n }\n } else {\n resizeObserver.disconnect();\n }\n },\n [resizeObserver, heightProp],\n );\n return { measuredHeight, measuredRef };\n};\n"],"names":["measuredHeight"],"mappings":";;;AAQO,MAAM,oBAAoB,CAAC;AAAA,EAChC,gBAAA;AAAA,EACA,QAAQ,UAAa,GAAA;AACvB,CAA+B,KAAA;AAC7B,EAAA,MAAM,CAAC,cAAA,EAAgB,iBAAiB,CAAA,GAAI,SAAS,UAAU,CAAA;AAC/D,EAAM,MAAA,kBAAA,GAAqB,OAAO,CAAE,CAAA,CAAA;AAEpC,EAAA,OAAA,CAAQ,MAAM;AACZ,IAAA,IAAI,eAAe,CAAG,EAAA;AACpB,MAAA,iBAAA,CAAkB,UAAU,CAAA;AAAA;AAC9B,GACF,EAAG,CAAC,UAAU,CAAC,CAAA;AAEf,EAAM,MAAA,cAAA,GAAiB,QAAQ,MAAM;AACnC,IAAO,OAAA,IAAI,cAAe,CAAA,CAAC,OAAmC,KAAA;AAC5D,MAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,QAAA,MAAM,CAAC,EAAE,SAAA,EAAW,YAAa,EAAC,IAAI,KAAM,CAAA,aAAA;AAC5C,QAAM,MAAA,SAAA,GAAY,IAAK,CAAA,KAAA,CAAM,YAAY,CAAA;AACzC,QAAI,IAAA,kBAAA,CAAmB,YAAY,SAAW,EAAA;AAC5C,UAAI,IAAA,aAAA,CAAc,SAAS,CAAG,EAAA;AAC5B,YAAA,kBAAA,CAAmB,OAAU,GAAA,SAAA;AAC7B,YAAA,iBAAA,CAAkB,SAAS,CAAA;AAC3B,YAAA,gBAAA,GAAmB,SAAS,CAAA;AAAA;AAC9B;AACF;AACF,KACD,CAAA;AAAA,GACH,EAAG,CAAC,gBAAgB,CAAC,CAAA;AAErB,EAAA,MAAM,WAAc,GAAA,WAAA;AAAA,IAClB,CAAC,EAAO,KAAA;AACN,MAAA,IAAI,EAAI,EAAA;AACN,QAAA,IAAI,eAAe,CAAG,EAAA;AACpB,UAAA,MAAM,EAAE,MAAA,EAAW,GAAA,EAAA,CAAG,qBAAsB,EAAA;AAC5C,UAAA,cAAA,CAAe,QAAQ,EAAE,CAAA;AAEzB,UAAMA,MAAAA,eAAAA,GAAiB,IAAK,CAAA,KAAA,CAAM,MAAM,CAAA;AACxC,UAAA,iBAAA,CAAkBA,eAAc,CAAA;AAAA;AAClC,OACK,MAAA;AACL,QAAA,cAAA,CAAe,UAAW,EAAA;AAAA;AAC5B,KACF;AAAA,IACA,CAAC,gBAAgB,UAAU;AAAA,GAC7B;AACA,EAAO,OAAA,EAAE,gBAAgB,WAAY,EAAA;AACvC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "1.0.
|
|
2
|
+
"version": "1.0.3",
|
|
3
3
|
"author": "heswell",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"devDependencies": {
|
|
6
|
-
"@vuu-ui/vuu-data-types": "1.0.
|
|
7
|
-
"@vuu-ui/vuu-table-types": "1.0.
|
|
8
|
-
"@vuu-ui/vuu-protocol-types": "1.0.
|
|
6
|
+
"@vuu-ui/vuu-data-types": "1.0.3",
|
|
7
|
+
"@vuu-ui/vuu-table-types": "1.0.3",
|
|
8
|
+
"@vuu-ui/vuu-protocol-types": "1.0.3"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@salt-ds/core": "1.54.1",
|
|
12
12
|
"@salt-ds/styles": "0.2.1",
|
|
13
13
|
"@salt-ds/window": "0.1.1",
|
|
14
|
-
"@vuu-ui/vuu-context-menu": "1.0.
|
|
15
|
-
"@vuu-ui/vuu-data-react": "1.0.
|
|
16
|
-
"@vuu-ui/vuu-popups": "1.0.
|
|
17
|
-
"@vuu-ui/vuu-table-extras": "1.0.
|
|
18
|
-
"@vuu-ui/vuu-ui-controls": "1.0.
|
|
19
|
-
"@vuu-ui/vuu-utils": "1.0.
|
|
14
|
+
"@vuu-ui/vuu-context-menu": "1.0.3",
|
|
15
|
+
"@vuu-ui/vuu-data-react": "1.0.3",
|
|
16
|
+
"@vuu-ui/vuu-popups": "1.0.3",
|
|
17
|
+
"@vuu-ui/vuu-table-extras": "1.0.3",
|
|
18
|
+
"@vuu-ui/vuu-ui-controls": "1.0.3",
|
|
19
|
+
"@vuu-ui/vuu-utils": "1.0.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"clsx": "^2.0.0",
|