@canlooks/can-ui 0.0.93 → 0.0.94

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.
@@ -14,6 +14,7 @@ const treeSelect_style_1 = require("./treeSelect.style");
14
14
  const selectionContext_1 = require("../selectionContext");
15
15
  const icon_1 = require("../icon");
16
16
  const faChevronDown_1 = require("@fortawesome/free-solid-svg-icons/faChevronDown");
17
+ const placeholder_1 = require("../placeholder");
17
18
  exports.TreeSelect = (0, react_1.memo)(({ inputProps, popperProps, popperRef, nodes, options, defaultValue, value, onChange, sizeAdaptable, loading, defaultOpen, open, onOpenChange, renderBackfill,
18
19
  // 以下属性转发至<InputBase/>
19
20
  placeholder = '请选择', autoFocus, clearable, onClear, ...props }) => {
@@ -71,7 +72,9 @@ placeholder = '请选择', autoFocus, clearable, onClear, ...props }) => {
71
72
  }
72
73
  return ((0, jsx_runtime_1.jsx)("div", { className: treeSelect_style_1.classes.backfillWrap, children: optionsMap.get(innerValue)?.[props.labelKey] ?? innerValue }));
73
74
  };
74
- return ((0, jsx_runtime_1.jsx)(popper_1.Popper, { css: popper_style_1.popperStyle, open: innerOpen.current, onOpenChange: openChangeHandler, placement: "bottom", variant: "collapse", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, sizeAdaptable: sizeAdaptable, content: (0, jsx_runtime_1.jsx)(tree_1.Tree, { primaryKey: "value", ...props, nodes: options, value: innerValue, onChange: setInnerValue }), ...popperProps, popperRef: popperRef, onPointerDown: e => {
75
+ return ((0, jsx_runtime_1.jsx)(popper_1.Popper, { css: popper_style_1.popperStyle, open: innerOpen.current, onOpenChange: openChangeHandler, placement: "bottom", variant: "collapse", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, sizeAdaptable: sizeAdaptable, content: options?.length
76
+ ? (0, jsx_runtime_1.jsx)(tree_1.Tree, { primaryKey: "value", ...props, nodes: options, value: innerValue, onChange: setInnerValue })
77
+ : (0, jsx_runtime_1.jsx)(placeholder_1.Placeholder, {}), ...popperProps, popperRef: popperRef, onPointerDown: e => {
75
78
  popperProps?.onPointerDown?.(e);
76
79
  e.preventDefault();
77
80
  }, children: (0, jsx_runtime_1.jsx)(inputBase_1.InputBase, { clearable: !!props.multiple, css: treeSelect_style_1.style, className: (0, utils_1.clsx)(treeSelect_style_1.classes.root, props.className), "data-focused": open, value: innerValue, onClear: clearHandler, placeholder: placeholder, autoFocus: autoFocus, disabled: props.disabled, readOnly: props.readOnly, children: inputBaseProps => (0, jsx_runtime_1.jsxs)("div", { className: treeSelect_style_1.classes.contentWrap, children: [(0, utils_1.isNoValue)(innerValue)
@@ -59,12 +59,6 @@ exports.Typography = (0, react_1.memo)(({ component: Component = 'p', color = 't
59
59
  * 省略
60
60
  */
61
61
  const [expanded, setExpanded] = (0, react_1.useState)(false);
62
- (0, react_1.useLayoutEffect)(() => {
63
- if (textRef.current && ellipsisRows > 1) {
64
- const { lineHeight } = getComputedStyle(textRef.current);
65
- textRef.current.style.height = parseFloat(lineHeight) * ellipsisRows + 'px';
66
- }
67
- });
68
62
  const style = (0, typography_style_1.useStyle)({ color: color || 'text.primary' });
69
63
  const EditComponent = multipleRows ? textarea_1.Textarea : input_1.Input;
70
64
  return editing
@@ -11,6 +11,7 @@ import { classes, style } from './treeSelect.style';
11
11
  import { useSelection } from '../selectionContext';
12
12
  import { Icon } from '../icon';
13
13
  import { faChevronDown } from '@fortawesome/free-solid-svg-icons/faChevronDown';
14
+ import { Placeholder } from '../placeholder';
14
15
  export const TreeSelect = memo(({ inputProps, popperProps, popperRef, nodes, options, defaultValue, value, onChange, sizeAdaptable, loading, defaultOpen, open, onOpenChange, renderBackfill,
15
16
  // 以下属性转发至<InputBase/>
16
17
  placeholder = '请选择', autoFocus, clearable, onClear, ...props }) => {
@@ -68,7 +69,9 @@ placeholder = '请选择', autoFocus, clearable, onClear, ...props }) => {
68
69
  }
69
70
  return (_jsx("div", { className: classes.backfillWrap, children: optionsMap.get(innerValue)?.[props.labelKey] ?? innerValue }));
70
71
  };
71
- return (_jsx(Popper, { css: popperStyle, open: innerOpen.current, onOpenChange: openChangeHandler, placement: "bottom", variant: "collapse", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, sizeAdaptable: sizeAdaptable, content: _jsx(Tree, { primaryKey: "value", ...props, nodes: options, value: innerValue, onChange: setInnerValue }), ...popperProps, popperRef: popperRef, onPointerDown: e => {
72
+ return (_jsx(Popper, { css: popperStyle, open: innerOpen.current, onOpenChange: openChangeHandler, placement: "bottom", variant: "collapse", trigger: ['click', 'enter'], disabled: props.disabled || props.readOnly, sizeAdaptable: sizeAdaptable, content: options?.length
73
+ ? _jsx(Tree, { primaryKey: "value", ...props, nodes: options, value: innerValue, onChange: setInnerValue })
74
+ : _jsx(Placeholder, {}), ...popperProps, popperRef: popperRef, onPointerDown: e => {
72
75
  popperProps?.onPointerDown?.(e);
73
76
  e.preventDefault();
74
77
  }, children: _jsx(InputBase, { clearable: !!props.multiple, css: style, className: clsx(classes.root, props.className), "data-focused": open, value: innerValue, onClear: clearHandler, placeholder: placeholder, autoFocus: autoFocus, disabled: props.disabled, readOnly: props.readOnly, children: inputBaseProps => _jsxs("div", { className: classes.contentWrap, children: [isNoValue(innerValue)
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
2
- import { memo, useLayoutEffect, useRef, useState } from 'react';
2
+ import { memo, useRef, useState } from 'react';
3
3
  import { clsx, cloneRef, useUnmounted } from '../../utils';
4
4
  import { useStyle, classes, editStyle } from './typography.style';
5
5
  import { Button } from '../button';
@@ -56,12 +56,6 @@ export const Typography = memo(({ component: Component = 'p', color = 'text.prim
56
56
  * 省略
57
57
  */
58
58
  const [expanded, setExpanded] = useState(false);
59
- useLayoutEffect(() => {
60
- if (textRef.current && ellipsisRows > 1) {
61
- const { lineHeight } = getComputedStyle(textRef.current);
62
- textRef.current.style.height = parseFloat(lineHeight) * ellipsisRows + 'px';
63
- }
64
- });
65
59
  const style = useStyle({ color: color || 'text.primary' });
66
60
  const EditComponent = multipleRows ? Textarea : Input;
67
61
  return editing
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canlooks/can-ui",
3
- "version": "0.0.93",
3
+ "version": "0.0.94",
4
4
  "author": "C.CanLiang <canlooks@gmail.com>",
5
5
  "description": "My ui framework",
6
6
  "license": "MIT",