@teselagen/ui 0.7.5 → 0.7.6

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.
@@ -1,7 +1,10 @@
1
- export function EditableCell({ cancelEdit, dataTest, finishEdit, isNumeric, initialValue }: {
1
+ export function EditableCell({ cancelEdit, dataTest, finishEdit, initialValue, isEditableCellInitialValue, isNumeric, shouldSelectAll, stopSelectAll }: {
2
2
  cancelEdit: any;
3
3
  dataTest: any;
4
4
  finishEdit: any;
5
- isNumeric: any;
6
5
  initialValue: any;
6
+ isEditableCellInitialValue: any;
7
+ isNumeric: any;
8
+ shouldSelectAll: any;
9
+ stopSelectAll: any;
7
10
  }): import("react/jsx-runtime").JSX.Element;
package/index.cjs.js CHANGED
@@ -67554,10 +67554,8 @@ const Uploader = /* @__PURE__ */ __name(({
67554
67554
  Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
67555
67555
  (results) => {
67556
67556
  const resolved = flatMap(results, (r2) => r2.value);
67557
+ setAcceptLoading(false);
67557
67558
  setResolvedAccept(resolved);
67558
- setTimeout(() => {
67559
- setAcceptLoading(false);
67560
- }, 100);
67561
67559
  }
67562
67560
  );
67563
67561
  }
package/index.es.js CHANGED
@@ -67536,10 +67536,8 @@ const Uploader = /* @__PURE__ */ __name(({
67536
67536
  Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
67537
67537
  (results) => {
67538
67538
  const resolved = flatMap(results, (r2) => r2.value);
67539
+ setAcceptLoading(false);
67539
67540
  setResolvedAccept(resolved);
67540
- setTimeout(() => {
67541
- setAcceptLoading(false);
67542
- }, 100);
67543
67541
  }
67544
67542
  );
67545
67543
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teselagen/ui",
3
- "version": "0.7.5",
3
+ "version": "0.7.6",
4
4
  "main": "./src/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -4,8 +4,11 @@ export const EditableCell = ({
4
4
  cancelEdit,
5
5
  dataTest,
6
6
  finishEdit,
7
+ initialValue,
8
+ isEditableCellInitialValue,
7
9
  isNumeric,
8
- initialValue
10
+ shouldSelectAll,
11
+ stopSelectAll
9
12
  }) => {
10
13
  const [value, setValue] = useState(initialValue);
11
14
  const inputRef = useRef(null);
@@ -13,8 +16,15 @@ export const EditableCell = ({
13
16
  useEffect(() => {
14
17
  if (inputRef.current) {
15
18
  inputRef.current.focus();
19
+ if (isEditableCellInitialValue && !isNumeric) {
20
+ inputRef.current.selectionStart = inputRef.current.value.length;
21
+ inputRef.current.selectionEnd = inputRef.current.value.length;
22
+ } else if (shouldSelectAll) {
23
+ inputRef.current.select();
24
+ stopSelectAll();
25
+ }
16
26
  }
17
- }, [isNumeric]);
27
+ }, [isEditableCellInitialValue, isNumeric, shouldSelectAll, stopSelectAll]);
18
28
 
19
29
  return (
20
30
  <input
@@ -28,10 +38,11 @@ export const EditableCell = ({
28
38
  {...dataTest}
29
39
  autoFocus
30
40
  onKeyDown={e => {
31
- e.stopPropagation();
32
41
  if (e.key === "Enter") {
33
- e.target.blur();
42
+ finishEdit(value);
43
+ e.stopPropagation();
34
44
  } else if (e.key === "Escape") {
45
+ e.stopPropagation();
35
46
  cancelEdit();
36
47
  }
37
48
  }}
@@ -369,11 +369,8 @@ const Uploader = ({
369
369
  Promise.allSettled(Array.isArray(__accept) ? __accept : [__accept]).then(
370
370
  results => {
371
371
  const resolved = flatMap(results, r => r.value);
372
+ setAcceptLoading(false);
372
373
  setResolvedAccept(resolved);
373
- setTimeout(() => {
374
- // give the resolved accept a full JS cycle to update before allowing actionability on the dropzone
375
- setAcceptLoading(false);
376
- }, 100);
377
374
  }
378
375
  );
379
376
  }
@@ -1 +0,0 @@
1
- export function useDeepEqualMemo(value: any): undefined;
@@ -1,49 +0,0 @@
1
- /**
2
- * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
3
- *
4
- * @export
5
- *
6
- * @param {compOrOpts} compOrOpts
7
- * @typedef {object} compOrOpts
8
- * @property {*string} formName - required unique identifier for the table
9
- * @property {Object | Function} schema - The data table schema or a function returning it. The function wll be called with props as the argument.
10
- * @property {boolean} urlConnected - whether the table should connect to/update the URL
11
- * @property {boolean} withSelectedEntities - whether or not to pass the selected entities
12
- * @property {boolean} isCodeModel - whether the model is keyed by code instead of id in the db
13
- * @property {object} defaults - tableParam defaults such as pageSize, filter, etc
14
- * @property {boolean} noOrderError - won't console an error if an order is not found on schema
15
- */
16
- export default function useTableParams(props: any): any;
17
- /**
18
- * Note all these options can be passed at Design Time or at Runtime (like reduxForm())
19
- */
20
- export type compOrOpts = {
21
- /**
22
- * } formName - required unique identifier for the table
23
- */
24
- string: any;
25
- /**
26
- * - The data table schema or a function returning it. The function wll be called with props as the argument.
27
- */
28
- schema: Object | Function;
29
- /**
30
- * - whether the table should connect to/update the URL
31
- */
32
- urlConnected: boolean;
33
- /**
34
- * - whether or not to pass the selected entities
35
- */
36
- withSelectedEntities: boolean;
37
- /**
38
- * - whether the model is keyed by code instead of id in the db
39
- */
40
- isCodeModel: boolean;
41
- /**
42
- * - tableParam defaults such as pageSize, filter, etc
43
- */
44
- defaults: object;
45
- /**
46
- * - won't console an error if an order is not found on schema
47
- */
48
- noOrderError: boolean;
49
- };