Skip to content

Commit 137295d

Browse files
g-fengchenwb-fc932227
andauthored
新增环境变量组件 (#49)
Co-authored-by: wb-fc932227 <[email protected]>
1 parent 91f4105 commit 137295d

File tree

24 files changed

+26785
-9
lines changed

24 files changed

+26785
-9
lines changed

packages/dingtalk-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@serverless-cd/dingtalk-ui",
3-
"version": "0.0.9",
3+
"version": "0.0.12",
44
"scripts": {
55
"start": "dumi dev",
66
"docs:build": "dumi build",

packages/dingtalk-ui/src/index.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Demo:
55
```tsx
66
import React, { useEffect, useState, useRef } from 'react';
77
import '@alicloud/console-components/dist/wind.css';
8-
import { Field, Button } from '@alicloud/console-components';
8+
import { Field, Button, Loading } from '@alicloud/console-components';
99
import DingTalk from '@serverless-cd/dingtalk-ui';
1010

1111
// 使用方式
@@ -14,7 +14,9 @@ import DingTalk from '@serverless-cd/dingtalk-ui';
1414
export default () => {
1515
const field = Field.useField();
1616
const { init, getValue, setValue, getValues, validate } = field;
17-
const [disabled, setDisabled] = useState(true);
17+
const [disabled, setDisabled] = useState(false);
18+
const [visible, setVisible] = useState(false);
19+
1820
const values = getValues();
1921
const dingdingRef = useRef(null);
2022
const onVerify = () => {
@@ -34,6 +36,14 @@ export default () => {
3436
console.log(getValue('dingding'), 'dingding');
3537
};
3638

39+
const onAsync = () => {
40+
setVisible(true);
41+
setTimeout(() => {
42+
setVisible(false);
43+
setValue('dingding', { ...initValue, webhook: 'https://111.com' });
44+
}, [1000]);
45+
};
46+
3747
const initValue = {
3848
webhook: 'https://xxxxx.com',
3949
enable: true,
@@ -46,17 +56,20 @@ export default () => {
4656
};
4757

4858
return (
49-
<>
59+
<Loading visible={visible}>
5060
<DingTalk
51-
{...init('dingding', { initValue })}
61+
{...init('dingding', {
62+
initValue: {},
63+
})}
5264
isPreview={disabled}
5365
initValue={initValue}
5466
ref={dingdingRef}
5567
/>
5668
<Button onClick={onVerify}>校验</Button>
5769
<Button onClick={onEdit}>{disabled ? '编辑' : '保存'}</Button>
5870
<Button onClick={onSubmit}>提交</Button>
59-
</>
71+
<Button onClick={onAsync}>异步回填数据</Button>
72+
</Loading>
6073
);
6174
};
6275
```

packages/dingtalk-ui/src/index.tsx

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const dataSource = [
1313
];
1414

1515
const DingTalk = (props: IProps, ref) => {
16-
const { value = {}, onChange = noop, className = {}, isPreview } = props;
16+
const { value = {}, onChange = noop, className = {}, isPreview, messageHelp = '' } = props;
1717
const field = Field.useField({
1818
onChange: () => {
1919
onChange(getValues());
@@ -88,10 +88,21 @@ const DingTalk = (props: IProps, ref) => {
8888
</Form.Item>
8989
<Form.Item
9090
label={i18n('ui.notifiy.messageContent.label')}
91-
help={HELP_RENDER[HELP_TYPE.MESSAGE_CONTENT]}
91+
extra={
92+
<span
93+
style={{ display: 'inline-block', textAlign: 'justify' }}
94+
dangerouslySetInnerHTML={{
95+
__html: messageHelp,
96+
}}
97+
></span>
98+
}
99+
required
92100
>
93101
<Input.TextArea
94-
{...init('messageContent', { initValue: value['messageContent'] })}
102+
{...init('messageContent', {
103+
initValue: value['messageContent'],
104+
rules: [{ required: true, message: i18n('ui.notifiy.help.message.text') }],
105+
})}
95106
placeholder={i18n('ui.notifiy.messageContent.placeholder')}
96107
className="full-width"
97108
/>

packages/dingtalk-ui/src/types.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export interface IProps {
2222
onChange?: Function;
2323
className?: object | any;
2424
isPreview?: boolean;
25+
messageHelp?: string | any;
2526
}
2627

2728
export enum HELP_TYPE {

packages/dingtalk-ui/src/utils/i18n/en.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ export default {
3939
'If you need @multiple users, you can use English comma "," to split, for example: dfounderliu, mydingding',
4040
'ui.notifiy.help.enable.text':
4141
'After the DingTalk robot needs to be activated and configured here, the DingTalk robot notifications in each process of the pipeline will take effect.',
42+
'ui.notifiy.help.message.text': 'A custom message is required',
4243
};

packages/dingtalk-ui/src/utils/i18n/ja.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,5 @@ export default {
3939
'@複数のユーザーが必要な場合は、英語のカンマ「,」を使用して分割できます。例: dfounderliu, mydingding',
4040
'ui.notifiy.help.enable.text':
4141
'ここで DingTalk ロボットをアクティブ化して構成する必要があると、パイプラインの各プロセスでの DingTalk ロボット通知が有効になります。',
42+
'ui.notifiy.help.message.text': 'カスタム メッセージが必要です',
4243
};

packages/dingtalk-ui/src/utils/i18n/zh.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@ export default {
3434
'如果需要@多个用户,可以用英文逗号“,”进行分割,例如:dfounderliu, mydingding',
3535
'ui.notifiy.help.enable.text':
3636
'需要在此处开通并配置钉钉机器人后,流水线各个流程中的钉钉机器人通知才会生效。',
37+
'ui.notifiy.help.message.text': '自定义消息是必填项',
3738
};

packages/variable-ui/.fatherrc.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export default {
2+
// more father 4 config: https://github.com/umijs/father-next/blob/master/docs/config.md
3+
esm: {},
4+
};

packages/variable-ui/.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
legacy-peer-deps=true

0 commit comments

Comments
 (0)