@zjlab-fe/data-hub-ui 0.28.0 → 0.30.0

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.
package/README.md CHANGED
@@ -12,7 +12,7 @@ https://haina-datahub.zero2x.org/data-hub-ui/doc
12
12
 
13
13
  ### 新建组件
14
14
 
15
- 在`src/components`目录下新建组件目录,参考组件`input-tag`的代码目录
15
+ 使用`npm run init`创建组件,输入组件名后,脚本会在`src/components`目录下新建组件目录,参考组件`input-tag`的代码目录
16
16
 
17
17
  ```
18
18
  component-folder
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ declare const Demo: React.FC;
3
+ export default Demo;
@@ -0,0 +1,9 @@
1
+ export interface LimitCreditModalProps {
2
+ open?: boolean;
3
+ onCancel?: () => void;
4
+ }
5
+ declare const LimitCreditModal: {
6
+ (props: LimitCreditModalProps): import("react/jsx-runtime").JSX.Element;
7
+ open(): void;
8
+ };
9
+ export default LimitCreditModal;
@@ -1,7 +1,10 @@
1
1
  import React from 'react';
2
2
  type TagType = 'running' | 'failed' | 'success' | 'stopped' | 'pending';
3
+ type TagVariant = 'filled' | 'bordered' | 'dot';
3
4
  interface IProps {
4
5
  type?: TagType;
6
+ variant?: TagVariant;
7
+ className?: string;
5
8
  children?: React.ReactNode;
6
9
  }
7
10
  export default function StatusTag(props: IProps): import("react/jsx-runtime").JSX.Element;
@@ -41,6 +41,8 @@ export type { CorpusCardProps, ProcessTemplateListItem, ProcessTemplateLabel, La
41
41
  export { default as SDKModal } from './components/SDK-modal';
42
42
  export { default as TagView } from './components/tag-view';
43
43
  export { default as TagGroupFilter } from './components/tag-group-filter';
44
+ export { default as LimitCreditModal } from './components/limit-credit-modal';
45
+ export type { LimitCreditModalProps } from './components/limit-credit-modal';
44
46
  export { default as DatasetBatchAction } from './components/dataset-batch-action';
45
47
  export type { IConfirmParam, IFieldOption, IDatasetBatchActionParams, } from './components/dataset-batch-action';
46
48
  export { EDatasetBatchType } from './components/dataset-batch-action';
@@ -0,0 +1,36 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { Modal, Space, Button } from 'antd';
3
+ import { isPublicNetwork } from '@zjlab-fe/util';
4
+ import { createRoot } from 'react-dom/client';
5
+
6
+ const LimitCreditModal = (props) => {
7
+ const isPublic = isPublicNetwork();
8
+ const handleOk = () => {
9
+ if (isPublic) {
10
+ window.open('https://alidocs.dingtalk.com/notable/share/form/v018oLl952Q1vXkzlap_dv19yqvsgs3oebp3pcjys_1qX0QQ0?source=link');
11
+ }
12
+ else {
13
+ window.open('https://alidocs.dingtalk.com/notable/share/form/v011X3lE5jKezRB4lJb_dv19yqvsgs3oebp3pcjys_1qX0QQ0?source=link');
14
+ }
15
+ };
16
+ return (jsx(Modal, Object.assign({}, props, {
17
+ // classNames={{
18
+ // content: 'modal-content-layout',
19
+ // header: 'modal-title-font modal-title-layout',
20
+ // body: 'modal-content-font modal-body-layout',
21
+ // footer: 'modal-footer-layout',
22
+ // }}
23
+ title: jsx("div", { style: { textAlign: 'center', width: '100%' }, children: "\u63D0\u793A" }), footer: jsx("div", { style: { display: 'flex', justifyContent: 'center' }, children: jsxs(Space, { children: [jsx(Button, { onClick: props.onCancel, children: "\u53D6\u6D88" }), jsx(Button, { type: "primary", onClick: handleOk, children: "\u7533\u8BF7" })] }) }), children: jsx("div", { className: "modal-content-font", style: { textAlign: 'center' }, children: "\u989D\u5EA6\u5DF2\u7528\u5C3D\uFF0C\u8BF7\u70B9\u51FB\u7533\u8BF7\u3002" }) })));
24
+ };
25
+ LimitCreditModal.open = () => {
26
+ const div = document.createElement('div');
27
+ document.body.appendChild(div);
28
+ const root = createRoot(div);
29
+ const destroy = () => {
30
+ root.unmount();
31
+ div.remove();
32
+ };
33
+ root.render(jsx(LimitCreditModal, { open: true, onCancel: destroy }));
34
+ };
35
+
36
+ export { LimitCreditModal as default };
@@ -1,30 +1,42 @@
1
- import { jsx } from 'react/jsx-runtime';
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
2
  import { Tag } from 'antd';
3
+ import classNames from 'classnames';
4
+ import * as index_module from './index.module.scss.js';
5
+ import { statusDot, statusTag, dot } from './index.module.scss.js';
3
6
 
4
- const colorPresets = {
5
- running: '#0061FF', // 进行状态
6
- failed: '#FE4D4F', // 失败状态
7
- success: '#53C31B', // 成功状态
8
- stopped: '#545B64', // 停止状态
9
- pending: '#FAAD14', // 等待状态
7
+ const statusStyles = {
8
+ filled: {
9
+ running: { color: '#1775fe', backgroundColor: 'rgba(23, 117, 254, 0.1)' },
10
+ failed: { color: '#ff4d4f', backgroundColor: 'rgba(255, 77, 79, 0.1)' },
11
+ success: { color: '#52c41a', backgroundColor: 'rgba(82, 196, 26, 0.1)' },
12
+ stopped: { color: '#545b64', backgroundColor: '#edf2fc' },
13
+ pending: { color: '#fa8c16', backgroundColor: 'rgba(250, 140, 22, 0.1)' },
14
+ },
15
+ dot: {
16
+ running: { color: '#1775fe', dotColor: '#1775fe' },
17
+ failed: { color: '#ff4d4f', dotColor: '#ff4d4f' },
18
+ success: { color: '#52c41a', dotColor: '#52c41a' },
19
+ stopped: { color: 'rgba(0, 0, 0, 0.65)', dotColor: '#d9d9d9' },
20
+ pending: { color: '#fa8c16', dotColor: '#fa8c16' },
21
+ },
22
+ bordered: {
23
+ running: { color: '#1775fe', backgroundColor: '#ecf4ff', borderColor: '#b3d2ff' },
24
+ failed: { color: '#f5222d', backgroundColor: '#fff1f0', borderColor: '#ffa39e' },
25
+ success: { color: '#52c41a', backgroundColor: '#f6ffed', borderColor: '#b7eb8f' },
26
+ stopped: { color: 'rgba(0, 0, 0, 0.25)', backgroundColor: '#f5f5f5', borderColor: '#d9d9d9' },
27
+ pending: { color: '#fa8c16', backgroundColor: '#fff7e6', borderColor: '#fa8c16' },
28
+ },
10
29
  };
11
30
  function StatusTag(props) {
12
- const { type = 'running', children } = props;
13
- const colors = colorPresets[type];
14
- const hexToRgb = (hex) => {
15
- const bigint = parseInt(hex.replace('#', ''), 16);
16
- const r = (bigint >> 16) & 255;
17
- const g = (bigint >> 8) & 255;
18
- const b = bigint & 255;
19
- return `${r},${g},${b}`;
20
- };
21
- return (jsx(Tag, { bordered: false, style: {
22
- backgroundColor: `rgba(${hexToRgb(colors)},0.1)`,
23
- borderRadius: '4px',
24
- fontSize: '14px',
25
- color: `${colors}`,
26
- padding: '3px 8px',
27
- fontFamily: 'AlibabaPuHuiTi-3-55-RegularL3',
31
+ const { type = 'running', variant = 'filled', className, children } = props;
32
+ const preset = statusStyles[variant][type];
33
+ if (variant === 'dot') {
34
+ return (jsxs("span", { className: classNames(statusTag, dot, className), children: [jsx("span", { className: statusDot, style: { backgroundColor: preset.dotColor } }), jsx("span", { style: { color: preset.color }, children: children })] }));
35
+ }
36
+ return (jsx(Tag, { bordered: variant === 'bordered', className: classNames(statusTag, index_module[variant], className), style: {
37
+ color: preset.color,
38
+ backgroundColor: preset.backgroundColor,
39
+ borderColor: preset.borderColor,
28
40
  }, children: children }));
29
41
  }
30
42
 
@@ -0,0 +1,45 @@
1
+ var style = document.createElement('style');
2
+ style.textContent = `.index-module__statusTag___yRGEa {
3
+ display: inline-flex;
4
+ align-items: center;
5
+ margin-inline-end: 0;
6
+ font-family: "AlibabaPuHuiTi-3-55-RegularL3", "PingFang SC", sans-serif;
7
+ white-space: nowrap;
8
+ }
9
+
10
+ .index-module__filled___SKjTo {
11
+ border-radius: 4px;
12
+ padding: 1px 8px;
13
+ font-size: 12px;
14
+ line-height: 16px;
15
+ }
16
+
17
+ .index-module__bordered___x7xGX {
18
+ border-radius: 2px;
19
+ padding: 0 8px;
20
+ font-size: 12px;
21
+ line-height: 20px;
22
+ border-width: 1px;
23
+ border-style: solid;
24
+ }
25
+
26
+ .index-module__dot___rbWrB {
27
+ gap: 8px;
28
+ font-size: 14px;
29
+ line-height: 22px;
30
+ padding: 0;
31
+ background: transparent;
32
+ }
33
+
34
+ .index-module__statusDot___yMpG3 {
35
+ flex-shrink: 0;
36
+ width: 6px;
37
+ height: 6px;
38
+ border-radius: 50%;
39
+ }`;
40
+ document.head.appendChild(style);
41
+
42
+ var statusTag = "index-module__statusTag___yRGEa";var filled = "index-module__filled___SKjTo";var bordered = "index-module__bordered___x7xGX";var dot = "index-module__dot___rbWrB";var statusDot = "index-module__statusDot___yMpG3";
43
+ var styles = {"statusTag":"index-module__statusTag___yRGEa","filled":"index-module__filled___SKjTo","bordered":"index-module__bordered___x7xGX","dot":"index-module__dot___rbWrB","statusDot":"index-module__statusDot___yMpG3"};
44
+
45
+ export { bordered, styles as default, dot, filled, statusDot, statusTag };
@@ -0,0 +1,9 @@
1
+ import { jsxs, jsx } from 'react/jsx-runtime';
2
+ import useStyle from './index.scss.js';
3
+
4
+ useStyle();
5
+ const TestComponent = (props) => {
6
+ return (jsxs("div", { className: "data-hub-ui-test-component-container", children: ["TestComponent Component", jsx("div", { children: "This is template, please delete it after you create your component." })] }));
7
+ };
8
+
9
+ export { TestComponent as default };
@@ -0,0 +1,7 @@
1
+ function useStyle() {
2
+ var style = document.createElement('style');
3
+ style.textContent = ``;
4
+ document.head.appendChild(style);
5
+ }
6
+
7
+ export { useStyle as default };
package/es/index.js CHANGED
@@ -36,5 +36,6 @@ export { default as ModelCard } from './components/model-card/index.js';
36
36
  export { default as SDKModal } from './components/SDK-modal/index.js';
37
37
  export { default as TagView } from './components/tag-view/index.js';
38
38
  export { default as TagGroupFilter } from './components/tag-group-filter/index.js';
39
+ export { default as LimitCreditModal } from './components/limit-credit-modal/index.js';
39
40
  export { default as DatasetBatchAction, EDatasetBatchType } from './components/dataset-batch-action/index.js';
40
41
  export { default as UploadDrawerUploadStoreProvider } from './components/uploadDrawer/UploadStoreProvider.js';