@canlooks/can-ui 0.0.130 → 0.0.132

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.
@@ -29,7 +29,7 @@ exports.Autocomplete = (0, react_1.memo)(({ children, loading, options, loadOpti
29
29
  const [innerLoading, innerLoadOptions] = (0, utils_1.useLoading)(async () => {
30
30
  loadOptions && setInnerOptions(await loadOptions(innerValue.current));
31
31
  }, loading);
32
- (0, react_1.useEffect)(() => {
32
+ (0, utils_1.useStrictEffect)(() => {
33
33
  !changedBySelect.current && innerLoadOptions();
34
34
  }, [innerValue.current]);
35
35
  /**
@@ -146,7 +146,7 @@ exports.Curd = (0, react_1.memo)((props) => {
146
146
  }
147
147
  }
148
148
  }, props.loading);
149
- (0, react_1.useEffect)(() => {
149
+ (0, utils_1.useStrictEffect)(() => {
150
150
  innerLoadRows().then();
151
151
  }, [innerPage.current, innerPageSize.current, innerOrderColumn.current, innerOrderType.current]);
152
152
  const reloadHandler = () => {
@@ -39,14 +39,13 @@ exports.Typography = (0, react_1.memo)(({ component: Component = 'p', color = 't
39
39
  * -------------------------------------------------------------------
40
40
  * 复制
41
41
  */
42
- const textRef = (0, react_1.useRef)(null);
43
42
  const [copied, setCopied] = (0, react_1.useState)(false);
44
43
  const unmounted = (0, utils_1.useUnmounted)();
45
44
  const copyHandler = () => {
46
45
  if (copied) {
47
46
  return;
48
47
  }
49
- const text = textRef.current.innerText;
48
+ const text = innerRef.current.innerText;
50
49
  navigator.clipboard.writeText(text).then();
51
50
  onCopy?.(text);
52
51
  setCopied(true);
@@ -64,7 +63,7 @@ exports.Typography = (0, react_1.memo)(({ component: Component = 'p', color = 't
64
63
  return editing
65
64
  ? (0, jsx_runtime_1.jsx)("div", { css: typography_style_1.editStyle, className: typography_style_1.classes.editWrap, style: { height: originHeight }, children: (0, jsx_runtime_1.jsx)(EditComponent, { ...editComponentProps, className: (0, utils_1.clsx)(typography_style_1.classes.editComponent, editComponentProps?.className), autoFocus: true, defaultValue: defaultText, onBlur: blurHandler, fullWidth: multipleRows ? true : void 0 }) })
66
65
  : (0, jsx_runtime_1.jsxs)(Component, { "data-component": typeof Component === 'string' ? Component : '', ...props, ref: (0, utils_1.cloneRef)(innerRef, props.ref), css: style, className: (0, utils_1.clsx)(typography_style_1.classes.root, props.className), "data-ellipsis-rows": expanded ? '0' : ellipsisRows, children: [ellipsisRows > 0
67
- ? (0, jsx_runtime_1.jsx)("span", { ref: textRef, className: typography_style_1.classes.text, style: {
66
+ ? (0, jsx_runtime_1.jsx)("span", { className: typography_style_1.classes.text, style: {
68
67
  WebkitLineClamp: ellipsisRows > 1 ? ellipsisRows : void 0,
69
68
  wordBreak
70
69
  }, children: props.children })
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx } from "@emotion/react/jsx-runtime";
2
- import { Children, isValidElement, memo, useCallback, useEffect, useMemo, useRef, useState } from 'react';
2
+ import { Children, isValidElement, memo, useCallback, useMemo, useRef, useState } from 'react';
3
3
  import { Popper } from '../popper';
4
4
  import { OptionsBase } from '../optionsBase';
5
5
  import { Input } from '../input';
6
- import { isUnset, useControlled, useDerivedState, useLoading, useSync, mergeComponentProps } from '../../utils';
6
+ import { isUnset, useControlled, useDerivedState, useLoading, useSync, mergeComponentProps, useStrictEffect } from '../../utils';
7
7
  import { classes } from './autocomplete.style';
8
8
  import { popperStyle } from '../popper/popper.style';
9
9
  export const Autocomplete = memo(({ children, loading, options, loadOptions, primaryKey = 'value', labelKey = 'label', onSelect, renderInput, popperProps, popperRef, defaultValue = '', value, onChange, ...props }) => {
@@ -26,7 +26,7 @@ export const Autocomplete = memo(({ children, loading, options, loadOptions, pri
26
26
  const [innerLoading, innerLoadOptions] = useLoading(async () => {
27
27
  loadOptions && setInnerOptions(await loadOptions(innerValue.current));
28
28
  }, loading);
29
- useEffect(() => {
29
+ useStrictEffect(() => {
30
30
  !changedBySelect.current && innerLoadOptions();
31
31
  }, [innerValue.current]);
32
32
  /**
@@ -4,7 +4,7 @@ import { DataGrid } from '../dataGrid';
4
4
  import { Form } from '../form';
5
5
  import { CurdFilterable } from './curdFilterable';
6
6
  import { classes, style } from './curd.style';
7
- import { clsx, useControlled, useCurdColumns, useDerivedState, useLoading, useSync, mergeComponentProps, CONTROL_COLUMN_KEY } from '../../utils';
7
+ import { clsx, useControlled, useCurdColumns, useDerivedState, useLoading, useSync, mergeComponentProps, CONTROL_COLUMN_KEY, useStrictEffect } from '../../utils';
8
8
  import { Button } from '../button';
9
9
  import { Tooltip } from '../tooltip';
10
10
  import { CurdColumnConfig } from './curdColumnConfig';
@@ -143,7 +143,7 @@ export const Curd = memo((props) => {
143
143
  }
144
144
  }
145
145
  }, props.loading);
146
- useEffect(() => {
146
+ useStrictEffect(() => {
147
147
  innerLoadRows().then();
148
148
  }, [innerPage.current, innerPageSize.current, innerOrderColumn.current, innerOrderType.current]);
149
149
  const reloadHandler = () => {
@@ -36,14 +36,13 @@ export const Typography = memo(({ component: Component = 'p', color = 'text.prim
36
36
  * -------------------------------------------------------------------
37
37
  * 复制
38
38
  */
39
- const textRef = useRef(null);
40
39
  const [copied, setCopied] = useState(false);
41
40
  const unmounted = useUnmounted();
42
41
  const copyHandler = () => {
43
42
  if (copied) {
44
43
  return;
45
44
  }
46
- const text = textRef.current.innerText;
45
+ const text = innerRef.current.innerText;
47
46
  navigator.clipboard.writeText(text).then();
48
47
  onCopy?.(text);
49
48
  setCopied(true);
@@ -61,7 +60,7 @@ export const Typography = memo(({ component: Component = 'p', color = 'text.prim
61
60
  return editing
62
61
  ? _jsx("div", { css: editStyle, className: classes.editWrap, style: { height: originHeight }, children: _jsx(EditComponent, { ...editComponentProps, className: clsx(classes.editComponent, editComponentProps?.className), autoFocus: true, defaultValue: defaultText, onBlur: blurHandler, fullWidth: multipleRows ? true : void 0 }) })
63
62
  : _jsxs(Component, { "data-component": typeof Component === 'string' ? Component : '', ...props, ref: cloneRef(innerRef, props.ref), css: style, className: clsx(classes.root, props.className), "data-ellipsis-rows": expanded ? '0' : ellipsisRows, children: [ellipsisRows > 0
64
- ? _jsx("span", { ref: textRef, className: classes.text, style: {
63
+ ? _jsx("span", { className: classes.text, style: {
65
64
  WebkitLineClamp: ellipsisRows > 1 ? ellipsisRows : void 0,
66
65
  wordBreak
67
66
  }, children: props.children })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.130",
3
+ "version": "0.0.132",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",