Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
34632db
feat: [Select] 支持下拉选项释义
liyuan-meng Jun 30, 2025
ea348b1
feat: [Select] 鼠标悬浮下拉选项时,右侧下拉选项释义面板不消失
liyuan-meng Jun 30, 2025
20c4567
feat: [Select] 解决报错
liyuan-meng Jun 30, 2025
1c69765
feat: [Cascader] 级联菜单支持 tips 提示
liyuan-meng Jun 30, 2025
6c59106
feat: [Select] 带有下拉释义的下拉选项,选中后展示tooltip
liyuan-meng Jun 30, 2025
358d42e
feat: [Tooltip] 添加 defaultPlacement 属性,在 placement为auto时,配置默认位置
liyuan-meng Jul 1, 2025
d27c472
fix: [Checkbox] 解决Checkbox.Group 嵌套 Select 后,Select 的 onChange 事件被 Ch…
liyuan-meng Jul 24, 2025
4c9e42b
feat: 新增 Format 组件
liyuan-meng Jul 24, 2025
d1849a1
feat: 新增 ImageText 组件
liyuan-meng Jul 24, 2025
55476fe
feat: 移除 Select 中 ImageText 的引用
liyuan-meng Jul 24, 2025
99de03f
feat: 新增 LightText 组件
liyuan-meng Jul 24, 2025
b8441b5
feat: 配置保存时自动格式化
liyuan-meng Jul 24, 2025
537469e
feat: 合并代码
liyuan-meng Jul 28, 2025
0778f67
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fi…
liyuan-meng Jul 28, 2025
6854e06
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 28, 2025
20ac6b6
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 28, 2025
28f2778
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 28, 2025
683ced9
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fi…
liyuan-meng Jul 28, 2025
160e8c5
feat: 更新组件 DEMO
liyuan-meng Jul 30, 2025
25fd99c
feat: 更新DEMO
liyuan-meng Jul 30, 2025
68a186d
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 30, 2025
0edcd16
feat: 代码格式化
liyuan-meng Jul 30, 2025
2af5b02
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 30, 2025
8c8340a
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fi…
liyuan-meng Jul 30, 2025
702d37b
fix: 解决报错
liyuan-meng Jul 30, 2025
e8f78fe
Merge branch 'fix-checkbox-mly' of github.com:ShuyunFF2E/cloud-react …
liyuan-meng Jul 30, 2025
28b52f6
Merge branch 'feat-select-tips' of github.com:ShuyunFF2E/cloud-react …
liyuan-meng Jul 30, 2025
6dc7236
feat: 解决报错
liyuan-meng Jul 30, 2025
381af38
feat: 解决报错
liyuan-meng Jul 30, 2025
530efde
Merge branch 'v1-master' of github.com:ShuyunFF2E/cloud-react into fe…
liyuan-meng Jul 31, 2025
2410530
feat: [Format] value 内容变化,重新计算是否展示 tooltip
liyuan-meng Aug 1, 2025
60ac31d
fix: [Format] NumberTpl 和 TimeTpl 支持使用 field
liyuan-meng Aug 5, 2025
73915d9
feat: [Format] value 内容变化,重新计算是否展示 tooltip
liyuan-meng Aug 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 35 additions & 18 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@
"semi": ["error", "always"],
"spaced-comment": ["error", "always"],
"no-multi-spaces": "error",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-expressions": [
"error",
{ "allowShortCircuit": true, "allowTernary": true }
],
"no-return-assign": "error",
"max-len": ["error", { "code": 200, "comments": 200 }],
"quote-props": ["error", "as-needed"],
Expand All @@ -58,20 +61,27 @@
"object-curly-spacing": ["error", "always", { "arraysInObjects": true }],
"comma-spacing": ["error", { "before": false, "after": true }],
"arrow-spacing": ["error", { "before": true, "after": true }],
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
"template-curly-spacing": ["error", "never"],
"space-infix-ops": ["error"],
"arrow-body-style": "off",
"no-undef": "error",
"no-multi-assign": "error",
"no-nested-ternary": "error",
"no-lonely-if": "error",
"no-unneeded-ternary": "error",
"no-case-declarations": "error",
"object-curly-newline": "off",
"array-bracket-spacing": "off",
"space-before-function-paren": "error",
"space-before-blocks": ["error", { "functions": "always", "keywords": "always", "classes": "always" }],
"lines-between-class-members": [
"error",
"always",
{ "exceptAfterSingleLine": true }
],
"template-curly-spacing": ["error", "never"],
"space-infix-ops": ["error"],
"arrow-body-style": "off",
"no-undef": "error",
"no-multi-assign": "error",
"no-nested-ternary": "error",
"no-lonely-if": "error",
"no-unneeded-ternary": "error",
"no-case-declarations": "error",
"object-curly-newline": "off",
"array-bracket-spacing": "off",
"space-before-function-paren": "error",
"space-before-blocks": [
"error",
{ "functions": "always", "keywords": "always", "classes": "always" }
],
"no-underscore-dangle": "off",
"global-require": "off",
"jsx-a11y/no-static-element-interactions": "off",
Expand All @@ -86,14 +96,17 @@
"import/extensions": "off",

// react (eslint-plugin-react required)
"react/jsx-filename-extension": ["error", { "extensions": [".js", ".jsx"] }],
"react/jsx-filename-extension": [
"error",
{ "extensions": [".js", ".jsx"] }
],
"react/jsx-no-duplicate-props": ["error"],
"react/jsx-indent-props": "off",
"react/jsx-indent": "off",
"no-promise-executor-return": "off",
"no-param-reassign": "off",
"class-methods-use-this": "off",
"react/jsx-first-prop-new-line": [ "error", "multiline" ],
"react/jsx-first-prop-new-line": ["error", "multiline"],
"react/prop-types": "off",
"react/no-children-prop": "off",

Expand Down Expand Up @@ -123,7 +136,11 @@
"react/function-component-definition": [
"warn",
{
"namedComponents": ["function-declaration", "arrow-function", "function-expression"],
"namedComponents": [
"function-declaration",
"arrow-function",
"function-expression"
],
"unnamedComponents": ["arrow-function", "function-expression"]
}
],
Expand Down
1 change: 1 addition & 0 deletions .umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default defineConfig({
.__dumi-default-layout-hero img { margin-top: -50px }
.__dumi-default-layout-hero h1 { color: white !important }
.__dumi-default-layout-hero .markdown { color: white !important }
.markdown .icon.icon-link { display: none }
`,
],
});
21 changes: 20 additions & 1 deletion src/components/c-cascader/demos/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,18 @@ desc: 默认样式

```jsx
import React, { useState, useEffect } from "react";
import { CCascader } from "cloud-react";
import { CCascader, Tooltip, Icon } from "cloud-react";
const addressOptions = [
{
value: "zhejiang",
label: "Zhejiang",
info: "说明",

children: [
{
value: "hangzhou",
label: "Hangzhou",
info: "说明",
children: [
{
value: "xihu",
Expand Down Expand Up @@ -128,6 +130,23 @@ export default function Demo() {
onChange={onChange}
placeholder="Please select"
style={{ width: 328 }}
optionRender={(option) => {
return (
<label title={option.title} style={{ display: "flex", gap: 4 }}>
{option.label}
{option.info && (
<Tooltip
content={option.info}
theme="light"
placement="right"
overlayStyle={{ zIndex: 10000 }}
>
<Icon type="question-circle" />
</Tooltip>
)}
</label>
);
}}
/>
<div style={{ marginBottom: 24, marginTop: 40 }}>任意选项支持选择</div>
<CCascader
Expand Down
18 changes: 16 additions & 2 deletions src/components/c-picker/demos/date-picker.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ desc: 基本用法,日期选择器。
import React from "react";
import moment from "moment";
import { CPicker as DatePicker, Form, Field, Toggle } from "cloud-react";

const { TimePicker } = DatePicker;

const presets = [
Expand Down Expand Up @@ -47,6 +46,7 @@ class DatePickerDemo extends React.Component {
state = {
value: moment("2021/12/01 16:05:33", "yyyy/MM/DD HH:mm:ss").toDate(),
time: "17:58:58",
value1: moment("2021/12/01 16:05", "yyyy/MM/DD HH:mm").toDate(),
};

onChange = (value) => {
Expand All @@ -60,7 +60,7 @@ class DatePickerDemo extends React.Component {
};

render() {
const { value, time, disabled } = this.state;
const { value, value1, time, disabled } = this.state;
const { init } = this.field;
return (
<Form
Expand Down Expand Up @@ -118,6 +118,20 @@ class DatePickerDemo extends React.Component {
presets={presets}
/>
</Form.Item>
<Form.Item label="日期选择器(不显示秒)">
<DatePicker
value={value}
onChange={this.onChange}
showToday
showTimePicker={{
showSecond: false,
format: "HH:mm",
}}
format="YYYY-MM-DD HH:mm"
disabled={disabled}
presets={presets}
/>
</Form.Item>
<Form.Item label="时间选择器">
<TimePicker
value={time}
Expand Down
2 changes: 1 addition & 1 deletion src/components/c-table/columnTpl/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function LinkTpl({ value, row, linkKey, link, onClick, line = 1,
setTooltipContent(value);
}
}
}, [tooltipValue]);
}, [value, tooltipValue]);

if (isVoid(value)) {
return '-';
Expand Down
33 changes: 22 additions & 11 deletions src/components/c-table/columnTpl/number.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useEffect, useState, useCallback } from 'react';
import PropTypes from 'prop-types';
import { formatThousands, isVoid } from '../util';

Expand All @@ -8,17 +9,27 @@ export default function NumberTpl({
prefix = '',
suffix = '',
}) {
let number = value;
if (isVoid(number)) {
return '-';
}
if (precision > 0) {
number = Number(number).toFixed(precision);
}
if (isThousands) {
number = formatThousands(number);
}
return `${prefix || ''}${number}${suffix || ''}`;
const [resolvedValue, setResolvedValue] = useState(value);

const getNumberVal = useCallback(() => {
let number = value;
if (isVoid(number)) {
return '';
}
if (precision > 0) {
number = Number(number).toFixed(precision);
}
if (isThousands) {
number = formatThousands(number);
}
return `${prefix || ''}${number}${suffix || ''}`;
}, [value, precision, isThousands, prefix, suffix]);

useEffect(() => {
setResolvedValue(getNumberVal());
}, [getNumberVal]);

return resolvedValue || '-';
}

NumberTpl.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/c-table/columnTpl/text.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default function TextTpl({ value, line = 1, tooltipValue }) {
setTooltipContent(value);
}
}
}, [tooltipValue]);
}, [value, tooltipValue]);

if (isVoid(value)) {
return '-';
Expand Down
21 changes: 14 additions & 7 deletions src/components/c-table/columnTpl/time.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import { useEffect, useState } from 'react';
import PropTypes from 'prop-types';
import moment from 'moment';
import { isVoid } from '../util';

export default function TimeTpl({ value, format }) {
if (isVoid(value)) {
return '-';
}
if (format) {
return moment(value).format(format);
}
return `${value}`.replaceAll('/', '-');
const [time, setTime] = useState(value);

useEffect(() => {
if (isVoid(value)) {
setTime('');
} else if (format) {
setTime(moment(value).format(format));
} else {
setTime(`${value}`.replaceAll('/', '-'));
}
}, [value, format]);

return time || '-';
}

TimeTpl.propTypes = {
Expand Down
2 changes: 2 additions & 0 deletions src/components/c-table/js/rowTooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class RowTooltip extends Component {
tooltipEle,
checkboxEle || radioEle,
'top-left',
undefined,
'top',
);

const isInModal = document.querySelector(`.${prefixCls}-modal-mask`);
Expand Down
59 changes: 33 additions & 26 deletions src/components/checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,37 @@ function Group(props) {

let checkedValue = value ? [ ...value ] : value;

const group = Children.map(children, (child) => cloneElement(child, {
disabled: disabled === undefined ? child.props.disabled : disabled,

checked:
checkedValue === undefined
? undefined
: checkedValue.indexOf(child.props.value) > -1,

onChange(checked, val) {
if (checkedValue === undefined) {
checkedValue = [];
}

const index = checkedValue.indexOf(val);

if (index > -1 && !checked) {
checkedValue.splice(index, 1);
}

if (index === -1 && checked) {
checkedValue.push(val);
}

onChange(checkedValue);
},
}));
const group = Children.map(children, (child) => {
if (child && child.type && [ 'Checkbox', 'ComplexCheckbox' ].includes(child.type.displayName)) {
return cloneElement(child, {
disabled: disabled === undefined ? child.props.disabled : disabled,

checked:
checkedValue === undefined
? undefined
: checkedValue.indexOf(child.props.value) > -1,

onChange(checked, val) {
if (checkedValue === undefined) {
checkedValue = [];
}

const index = checkedValue.indexOf(val);

if (index > -1 && !checked) {
checkedValue.splice(index, 1);
}

if (index === -1 && checked) {
checkedValue.push(val);
}

onChange(checkedValue);
},
});
}
return child;
});

const classes = classNames(`${classSelector}-group`, {
vertical: layout === 'v',
Expand Down Expand Up @@ -159,4 +164,6 @@ class Checkbox extends React.Component {
}
}

Checkbox.displayName = 'Checkbox';

export default Checkbox;
2 changes: 2 additions & 0 deletions src/components/complex-checkbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ export default function ComplexCheckbox(props) {
);
}

ComplexCheckbox.displayName = 'ComplexCheckbox';

ComplexCheckbox.propTypes = {
content: PropTypes.oneOfType([PropTypes.string, PropTypes.element]),
imgSrc: PropTypes.string,
Expand Down
Loading