@dartech/arsenal-ui 1.3.66 → 1.3.68

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/index.js CHANGED
@@ -1212,12 +1212,16 @@ const deepParseJson = value => {
1212
1212
 
1213
1213
  const JsonView = /*#__PURE__*/forwardRef(({
1214
1214
  value,
1215
- height: _height = '200px',
1215
+ height: _height = 200,
1216
1216
  fontSize: _fontSize = 16
1217
1217
  }, ref) => {
1218
1218
  const [loading, setLoading] = useState(true);
1219
1219
  const onCreateEditor = useCallback(view => {
1220
1220
  const onScroll = e => {
1221
+ console.log();
1222
+ if (view.scrollDOM.scrollHeight - view.scrollDOM.offsetHeight - e.target.scrollTop < 10) {
1223
+ setTimeout(() => view.scrollDOM.scrollTo(0, 0), 200);
1224
+ }
1221
1225
  if (e.target.scrollTop === 0) {
1222
1226
  setLoading(false);
1223
1227
  view.scrollDOM.removeEventListener('scroll', onScroll);
@@ -1226,16 +1230,13 @@ const JsonView = /*#__PURE__*/forwardRef(({
1226
1230
  if (view.scrollDOM.scrollHeight > 30000) {
1227
1231
  setLoading(true);
1228
1232
  view.scrollDOM.addEventListener('scroll', onScroll);
1229
- view.scrollDOM.scrollTo(0, view.scrollDOM.scrollHeight - 300);
1233
+ view.scrollDOM.scrollTo(0, view.scrollDOM.scrollHeight - 1000);
1230
1234
  setTimeout(() => {
1231
1235
  view.scrollDOM.scrollTo({
1232
1236
  top: view.scrollDOM.scrollHeight,
1233
1237
  behavior: 'smooth'
1234
1238
  });
1235
1239
  }, 300);
1236
- setTimeout(() => {
1237
- view.scrollDOM.scrollTo(0, 0);
1238
- }, 500);
1239
1240
  } else {
1240
1241
  setLoading(false);
1241
1242
  }
@@ -1250,7 +1251,7 @@ const JsonView = /*#__PURE__*/forwardRef(({
1250
1251
  readOnly: true,
1251
1252
  width: "100%",
1252
1253
  value: typeof value === 'string' ? value : JSON.stringify(value, null, 2),
1253
- height: _height,
1254
+ height: `${_height}px`,
1254
1255
  basicSetup: {
1255
1256
  autocompletion: true,
1256
1257
  history: true,
@@ -1274,12 +1275,6 @@ const JsonModalView = ({
1274
1275
  jsonViewProps
1275
1276
  }) => {
1276
1277
  const editorRef = useRef();
1277
- // useEffect(() => {
1278
- // if (editorRef.current) {
1279
- // console.log(editorRef.current);
1280
- // editorRef.current.editor.scrollTop = 1000;
1281
- // }
1282
- // }, [open, editorRef]);
1283
1278
  return jsxs(Dialog, Object.assign({
1284
1279
  disableEscapeKeyDown: true,
1285
1280
  open: open,
@@ -3124,7 +3119,7 @@ const InfoItem = ({
3124
3119
  children: text
3125
3120
  })), json && jsx(JsonView, {
3126
3121
  value: json,
3127
- height: "300px"
3122
+ height: 300
3128
3123
  })]
3129
3124
  }));
3130
3125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dartech/arsenal-ui",
3
- "version": "1.3.66",
3
+ "version": "1.3.68",
4
4
  "author": "DAR",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -2,7 +2,7 @@
2
2
  import { ReactCodeMirrorRef } from '@uiw/react-codemirror';
3
3
  type Props = {
4
4
  value: unknown;
5
- height?: string;
5
+ height?: number;
6
6
  fontSize?: number;
7
7
  };
8
8
  export declare const JsonView: import("react").ForwardRefExoticComponent<Props & import("react").RefAttributes<ReactCodeMirrorRef>>;
@@ -4,7 +4,7 @@ type Props = {
4
4
  value: string;
5
5
  onClose: () => void;
6
6
  jsonViewProps?: {
7
- height?: string;
7
+ height?: number;
8
8
  fontSize?: number;
9
9
  };
10
10
  };