@adaptabletools/adaptable 18.0.0-canary.0 → 18.0.0-canary.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adaptabletools/adaptable",
3
- "version": "18.0.0-canary.0",
3
+ "version": "18.0.0-canary.2",
4
4
  "description": "Powerful data-agnostic HTML5 AG Grid extension which provides advanced, cutting-edge functionality to meet all DataGrid requirements",
5
5
  "keywords": [
6
6
  "web-components",
@@ -11,6 +11,6 @@ export declare class NotesApiImpl extends ApiBase implements NotesApi {
11
11
  getCellNotes(config: {
12
12
  PrimaryKeyValue: string | number;
13
13
  ColumnId: string;
14
- }): AdaptableNotes;
14
+ }): AdaptableNote[];
15
15
  getNoteByUuid(uuid: string): AdaptableNote | undefined;
16
16
  }
@@ -35,5 +35,5 @@ export declare const NotesReady: (note: NotesState) => NoteReadyAction;
35
35
  export declare const GetNotesSelector: (state: NotesState, config?: {
36
36
  PrimaryKeyValue: string | number;
37
37
  ColumnId: string;
38
- }) => import("../../PredefinedConfig/NotesState").AdaptableNotes;
38
+ }) => AdaptableNote[];
39
39
  export declare const NotesReducer: Redux.Reducer<NotesState>;
@@ -33,11 +33,11 @@ export const NotesReady = (note) => ({
33
33
  notesState: note,
34
34
  });
35
35
  export const GetNotesSelector = (state, config) => {
36
- var _a, _b;
36
+ var _a;
37
37
  if (!config) {
38
- return (_a = state === null || state === void 0 ? void 0 : state.Notes) !== null && _a !== void 0 ? _a : [];
38
+ return [];
39
39
  }
40
- return ((_b = state === null || state === void 0 ? void 0 : state.Notes) !== null && _b !== void 0 ? _b : []).filter((note) => {
40
+ return ((_a = state === null || state === void 0 ? void 0 : state.Notes) !== null && _a !== void 0 ? _a : []).filter((note) => {
41
41
  if (note.PrimaryKeyValue === config.PrimaryKeyValue && note.ColumnId === config.ColumnId) {
42
42
  // happy check
43
43
  return true;
@@ -1,10 +1,10 @@
1
1
  import * as React from 'react';
2
- import { Flex } from 'rebass';
2
+ import { Box, Flex } from 'rebass';
3
+ import StringExtensions from '../../Utilities/Extensions/StringExtensions';
3
4
  import DropdownButton from '../../components/DropdownButton';
4
5
  import FieldWrap from '../../components/FieldWrap';
6
+ import Textarea from '../../components/Textarea';
5
7
  import { Icon } from '../../components/icons';
6
- import Input from '../../components/Input';
7
- import StringExtensions from '../../Utilities/Extensions/StringExtensions';
8
8
  import { ButtonClear } from '../Components/Buttons/ButtonClear';
9
9
  import { ButtonExpand } from '../Components/Buttons/ButtonExpand';
10
10
  import { ButtonInvalid } from '../Components/Buttons/ButtonInvalid';
@@ -28,16 +28,50 @@ const QueryViewPanelComponent = (props) => {
28
28
  };
29
29
  const buttonExpand = (React.createElement(ButtonExpand, { disabled: disabled, accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", onClick: onExpand, tooltip: "Edit the Expression in UI", marginLeft: 1 }));
30
30
  const renderTextInput = () => {
31
- return props.viewType === 'Toolbar' ? (React.createElement(FieldWrap, { marginRight: 1, width: 500 },
31
+ return props.viewType === 'Toolbar' ? (React.createElement(FieldWrap, { marginRight: 1, width: 500, style: { overflow: 'visible' } },
32
32
  buttonExpand,
33
- React.createElement(Input, { disabled: disabled, type: "text", "data-name": "grid-filter-input", placeholder: "Grid Filter", spellCheck: false, value: expression, onChange: (x) => setExpression(x.target.value), style: { fontFamily: 'monospace', fontSize: 12 } }),
33
+ React.createElement(Box, { style: {
34
+ position: 'relative',
35
+ height: '100%',
36
+ }, flex: 1 },
37
+ React.createElement(Textarea, { "data-name": "grid-filter-input", autoResizeOnFocus: true, style: {
38
+ left: 0,
39
+ top: 0,
40
+ right: 0,
41
+ border: 0,
42
+ position: 'absolute',
43
+ resize: 'none',
44
+ fontFamily: 'monospace',
45
+ fontSize: 12,
46
+ maxHeight: 52,
47
+ height: 21,
48
+ paddingTop: 7,
49
+ zIndex: 100,
50
+ }, placehoder: "Grid Filter", onChange: (x) => setExpression(x.target.value), value: expression })),
34
51
  isExpressionValid && (React.createElement(ButtonPlay, { onClick: () => runQuery(), tooltip: '', accessLevel: gridFilterAccessLevel, variant: "text", tone: "neutral", disabled: disabled || expression == '' || expression == (gridFilter === null || gridFilter === void 0 ? void 0 : gridFilter.Expression), marginRight: 1 })),
35
52
  gridFilter && !isExpressionValid && (React.createElement(ButtonInvalid, { variant: "text", tone: "neutral", tooltip: "Invalid Grid Filter", marginRight: 1 })),
36
53
  ' ',
37
- StringExtensions.IsNotNullOrEmpty(expression) && (React.createElement(ButtonClear, { onClick: () => clearQuery(), tooltip: "Clear Grid Filter", accessLevel: gridFilterAccessLevel })))) : (React.createElement(FieldWrap, null,
54
+ StringExtensions.IsNotNullOrEmpty(expression) && (React.createElement(ButtonClear, { onClick: () => clearQuery(), tooltip: "Clear Grid Filter", accessLevel: gridFilterAccessLevel })))) : (React.createElement(FieldWrap, { width: "100%", overflow: "visible" },
38
55
  ' ',
39
56
  buttonExpand,
40
- React.createElement(Input, { disabled: disabled, type: "text", "data-name": "grid-filter-input", placeholder: "Grid Filter", spellCheck: false, value: expression, onChange: (x) => setExpression(x.target.value), style: { width: '100%' } })));
57
+ React.createElement(Box, { style: {
58
+ position: 'relative',
59
+ minHeight: 40,
60
+ width: '100%',
61
+ }, flex: 1 },
62
+ React.createElement(Textarea, { "data-name": "grid-filter-input", autoResizeOnFocus: true, style: {
63
+ left: 0,
64
+ top: 0,
65
+ right: 0,
66
+ border: 0,
67
+ position: 'absolute',
68
+ resize: 'none',
69
+ fontFamily: 'monospace',
70
+ fontSize: 12,
71
+ maxHeight: 60,
72
+ paddingTop: 7,
73
+ zIndex: 100,
74
+ }, placehoder: "Grid Filter", onChange: (x) => setExpression(x.target.value), value: expression }))));
41
75
  };
42
76
  const saveButton = (React.createElement(ButtonSave, { onClick: () => saveQuery(), tooltip: "Save as Named Query", accessLevel: namedQueryModuleAccessLevel, disabled: disabled || !isExpressionValid || isExpressionNamedQuery || expression == '', variant: "text", tone: "neutral", marginRight: 1 }));
43
77
  const suspendButton = (React.createElement(ButtonPause, { onClick: () => suspendGridFilter(), tooltip: "Suspend Grid Filter", accessLevel: gridFilterAccessLevel, disabled: disabled || !isExpressionValid, variant: "text", tone: "neutral", marginRight: 1 }));
@@ -61,7 +95,7 @@ const QueryViewPanelComponent = (props) => {
61
95
  namedQuerySelector));
62
96
  };
63
97
  return (React.createElement(Flex, { onKeyDown: handleEnter, flexDirection: "row", className: `ab-${elementType}__Query__wrap`, flexWrap: props.viewType === 'ToolPanel' ? 'wrap' : 'nowrap' },
64
- React.createElement(Flex, null, renderTextInput()),
98
+ React.createElement(Flex, { width: props.viewType === 'ToolPanel' ? '100%' : 'auto' }, renderTextInput()),
65
99
  React.createElement(Flex, null, renderButtons())));
66
100
  };
67
101
  export const GridFilterPanelControl = QueryViewPanelComponent;
@@ -2,16 +2,25 @@ import * as React from 'react';
2
2
  import { BoxProps } from 'rebass';
3
3
  import { HTMLProps } from 'react';
4
4
  export declare const baseClassName = "ab-Textarea";
5
+ /**
6
+ * Autoheight strategy:
7
+ * - save initial height
8
+ * - when focused, expand to fit content - max x px
9
+ * - when blurred, shrink to initial height
10
+ * - when typing, expand to fit content - max x px
11
+ */
5
12
  export type TextareaProps = Omit<HTMLProps<HTMLTextAreaElement>, 'ref'> & {
6
13
  placehoder?: string;
7
14
  type?: string;
8
15
  disabled?: boolean;
9
16
  value?: string;
17
+ autoResizeOnFocus?: boolean;
10
18
  } & Omit<BoxProps, 'ref'>;
11
19
  declare const Textarea: React.ForwardRefExoticComponent<Omit<React.HTMLProps<HTMLTextAreaElement>, "ref"> & {
12
20
  placehoder?: string;
13
21
  type?: string;
14
22
  disabled?: boolean;
15
23
  value?: string;
24
+ autoResizeOnFocus?: boolean;
16
25
  } & Omit<BoxProps, "ref"> & React.RefAttributes<HTMLDivElement | HTMLInputElement | HTMLTextAreaElement>>;
17
26
  export default Textarea;
@@ -4,7 +4,9 @@ import { Box } from 'rebass';
4
4
  import join from '../utils/join';
5
5
  export const baseClassName = 'ab-Textarea';
6
6
  const Textarea = React.forwardRef((props, ref) => {
7
- let { disabled, className } = props, textareaProps = __rest(props, ["disabled", "className"]);
7
+ const internalRef = React.useRef(null);
8
+ let { disabled, autoResizeOnFocus, className } = props, textareaProps = __rest(props, ["disabled", "autoResizeOnFocus", "className"]);
9
+ const initialHeight = React.useRef(null);
8
10
  let type = 'text';
9
11
  if (textareaProps && textareaProps.type) {
10
12
  type = textareaProps.type;
@@ -12,6 +14,52 @@ const Textarea = React.forwardRef((props, ref) => {
12
14
  if (type === 'string') {
13
15
  type = 'text';
14
16
  }
15
- return (React.createElement(Box, Object.assign({ ref: ref, as: "textarea" }, textareaProps, { type: type, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : '') })));
17
+ const expandToFitContent = () => {
18
+ if (autoResizeOnFocus && initialHeight.current !== null && internalRef.current) {
19
+ internalRef.current.style.height = `0px`; // makes sure it shrinks when needed
20
+ const height = internalRef.current.scrollHeight;
21
+ internalRef.current.style.height = `${height}px`;
22
+ }
23
+ };
24
+ const shrinkToInitialHeight = () => {
25
+ if (autoResizeOnFocus) {
26
+ internalRef.current.style.height = `${initialHeight.current}px`;
27
+ }
28
+ };
29
+ return (React.createElement(Box, Object.assign({}, textareaProps, { onFocus: (e) => {
30
+ var _a;
31
+ expandToFitContent();
32
+ (_a = props.onFocus) === null || _a === void 0 ? void 0 : _a.call(props, e);
33
+ if (internalRef.current && initialHeight.current === null) {
34
+ const height = internalRef.current.getBoundingClientRect().height;
35
+ initialHeight.current = height;
36
+ }
37
+ }, onBlur: (e) => {
38
+ var _a;
39
+ shrinkToInitialHeight();
40
+ (_a = props.onBlur) === null || _a === void 0 ? void 0 : _a.call(props, e);
41
+ }, ref: (elRef) => {
42
+ // SAVE INITIAL HEIGHT
43
+ // if (elRef && initialHeight.current === null) {
44
+ // const height = elRef.getBoundingClientRect().height;
45
+ // initialHeight.current = isNaN(height) ? 'auto' : height;
46
+ // }
47
+ // SAVE REF
48
+ if (internalRef) {
49
+ internalRef.current = elRef;
50
+ }
51
+ // CALL EXTERNAL REF
52
+ if (ref) {
53
+ if (typeof ref === 'function') {
54
+ ref(elRef);
55
+ }
56
+ else {
57
+ ref.current = elRef;
58
+ }
59
+ }
60
+ }, onChange: (e) => {
61
+ expandToFitContent();
62
+ props.onChange && props.onChange(e);
63
+ }, as: "textarea", type: type, disabled: disabled, className: join(className, baseClassName, disabled ? `${baseClassName}--disabled` : ''), spellCheck: false })));
16
64
  });
17
65
  export default Textarea;
package/src/env.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export default {
2
2
  INFINITE_TABLE_LICENSE_KEY: "StartDate=2021-06-29|EndDate=2030-01-01|Owner=Adaptable|Type=distribution|TS=1624971462479|C=137829811,1004007071,2756196225,1839832928,3994409405,636616862" || '',
3
- PUBLISH_TIMESTAMP: 1707834216788 || Date.now(),
4
- VERSION: "18.0.0-canary.0" || '--current-version--',
3
+ PUBLISH_TIMESTAMP: 1707925044939 || Date.now(),
4
+ VERSION: "18.0.0-canary.2" || '--current-version--',
5
5
  };
@@ -3513,6 +3513,11 @@ export const ADAPTABLE_METAMODEL = {
3513
3513
  "name": "defaultAgGridMenuItems",
3514
3514
  "kind": "a",
3515
3515
  "desc": "Default AG Grid Menu Items"
3516
+ },
3517
+ {
3518
+ "name": "structuredAdaptableMenuItems",
3519
+ "kind": "a",
3520
+ "desc": "All Adaptable Menu Items sorted and grouped"
3516
3521
  }
3517
3522
  ]
3518
3523
  },
@@ -3535,6 +3540,11 @@ export const ADAPTABLE_METAMODEL = {
3535
3540
  "name": "defaultAgGridMenuItems",
3536
3541
  "kind": "a",
3537
3542
  "desc": "Default AG Grid Menu Items"
3543
+ },
3544
+ {
3545
+ "name": "structuredAdaptableMenuItems",
3546
+ "kind": "a",
3547
+ "desc": "All Adaptable Menu Items sorted and grouped"
3538
3548
  }
3539
3549
  ]
3540
3550
  },