@giteeteam/apps-team-components 1.10.8 → 1.11.0-alpha.1
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 +1 -0
- package/dist/components/fields/editor/ReadView.d.ts +3 -0
- package/dist/components/fields/editor/ReadView.js +27 -0
- package/dist/components/fields/long-text/ReadView.d.ts +4 -1
- package/dist/components/fields/long-text/ReadView.js +15 -4
- package/dist/components/fields/long-text/style/index.d.ts +1 -0
- package/dist/components/fields/long-text/style/index.js +5 -1
- package/dist/components/fields/status/style/index.d.ts +3 -3
- package/dist/components/fields/status/style/index.js +5 -5
- package/dist/components/fields/types.d.ts +1 -0
- package/dist/components/table-components/index.js +2 -1
- package/dist/components/table-components/utils.js +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/style/common.d.ts +2 -1
- package/dist/style/common.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from '@emotion/react/jsx-runtime';
|
|
2
|
+
import { memo, useEffect } from 'react';
|
|
3
|
+
import { css } from '@emotion/react';
|
|
4
|
+
import { proximaSdk } from '@giteeteam/proxima-sdk-js';
|
|
5
|
+
import EmptyField from '../../common/EmptyField.js';
|
|
6
|
+
|
|
7
|
+
const SPECIAL_EDITOR_KEY = '__editor__html';
|
|
8
|
+
const EditorCellStyle = css `
|
|
9
|
+
&.editor-cell {
|
|
10
|
+
white-space: pre-wrap;
|
|
11
|
+
word-break: break-word;
|
|
12
|
+
padding-top: 5px;
|
|
13
|
+
padding-bottom: 5px;
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
const EditorReadView = memo(({ itemValues, fieldKey }) => {
|
|
17
|
+
var _a;
|
|
18
|
+
const htmlStr = (_a = itemValues === null || itemValues === void 0 ? void 0 : itemValues[SPECIAL_EDITOR_KEY]) === null || _a === void 0 ? void 0 : _a[fieldKey];
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (fieldKey && htmlStr) {
|
|
21
|
+
proximaSdk.execute('ReadViewValueChange', { fieldKey, value: htmlStr });
|
|
22
|
+
}
|
|
23
|
+
}, [htmlStr, fieldKey]);
|
|
24
|
+
return htmlStr ? (jsx("div", { className: "editor-cell", css: EditorCellStyle, dangerouslySetInnerHTML: { __html: htmlStr } })) : (jsx(EmptyField, { readonly: true }));
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
export { EditorReadView as default };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { ReadViewBaseProps } from '../types';
|
|
2
|
-
|
|
2
|
+
type LongTextReadViewProps = ReadViewBaseProps & {
|
|
3
|
+
isReadingTableCell?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const LongTextReadView: import("react").NamedExoticComponent<LongTextReadViewProps>;
|
|
3
6
|
export default LongTextReadView;
|
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import { jsx, Fragment } from '@emotion/react/jsx-runtime';
|
|
2
|
-
import { memo } from 'react';
|
|
2
|
+
import { memo, useEffect } from 'react';
|
|
3
3
|
import { css } from '@emotion/react';
|
|
4
|
+
import { proximaSdk } from '@giteeteam/proxima-sdk-js';
|
|
4
5
|
import EmptyField from '../../common/EmptyField.js';
|
|
5
6
|
import BaseOverflowTooltip from '../../common/overflow-tooltip/BaseOverflowTooltip.js';
|
|
6
|
-
import { whiteSpacePreStyle } from './style/index.js';
|
|
7
|
+
import { whiteSpacePreStyle, textStyle } from './style/index.js';
|
|
7
8
|
|
|
8
|
-
const
|
|
9
|
-
|
|
9
|
+
const OverflowWrapper = ({ needOverflow, children }) => {
|
|
10
|
+
if (needOverflow)
|
|
11
|
+
return jsx(BaseOverflowTooltip, { maxline: 1, children: children });
|
|
12
|
+
return jsx(Fragment, { children: children });
|
|
13
|
+
};
|
|
14
|
+
const LongTextReadView = memo(({ value, readonly, isReadingTableCell, fieldKey }) => {
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (fieldKey && value) {
|
|
17
|
+
proximaSdk.execute('ReadViewValueChange', { fieldKey, value });
|
|
18
|
+
}
|
|
19
|
+
}, [value, fieldKey]);
|
|
20
|
+
return (jsx(Fragment, { children: value ? (jsx(OverflowWrapper, { needOverflow: !isReadingTableCell, children: jsx("span", { css: css(whiteSpacePreStyle, textStyle), dangerouslySetInnerHTML: { __html: value } }) })) : (jsx(EmptyField, { readonly: readonly })) }));
|
|
10
21
|
});
|
|
11
22
|
LongTextReadView.displayName = 'LongTextReadView';
|
|
12
23
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export declare const readViewWrapper = "\n display: -webkit-box;\n align-items: center;\n justify-content: center;\n min-width: 62px;\n height: 22px;\n padding: 0 8px;\n font-size: 12px;\n font-weight: 600;\n line-height: 22px;\n text-align: center;\n border-radius: 4px;\n";
|
|
1
|
+
export declare const readViewWrapper = "\n display: -webkit-box;\n align-items: center;\n justify-content: center;\n min-width: var(--status-cell-min-width, 62px);\n height: 22px;\n padding: 0 8px;\n font-size: 12px;\n font-weight: var(--status-cell-font-weight, 600);\n line-height: 22px;\n text-align: center;\n border-radius: 4px;\n";
|
|
2
2
|
export declare const workflowContentStyle = "\n max-width: 200px;\n text-align: left;\n";
|
|
3
3
|
export declare const statePopoverStyle: (antPrefix: string) => string;
|
|
4
4
|
export declare const flowNextStyle = "\n max-height: 260px;\n padding-top: 10px;\n overflow: auto;\n margin: -12px;\n";
|
|
5
5
|
export declare const flowWrapperStyle = "\n padding: 4px 0;\n";
|
|
6
|
-
export declare const flowStateStyle = "\n min-width: 62px;\n height: 24px;\n padding: 0 18px 0 8px;\n font-size: 12px;\n font-weight: 600;\n line-height: 24px;\n color: #fff;\n text-align: center;\n background: #cdcdcd;\n border-radius: 4px;\n box-shadow: none !important;\n\n span {\n text-decoration: none !important;\n }\n";
|
|
7
|
-
export declare const flowStateInWorkflowStyle = "\n &.status-btn:not(.add-weights) {\n min-width: 62px;\n height: 22px;\n padding: 0 8px;\n font-size: 12px;\n font-weight: 600;\n line-height: 22px;\n color: #fff;\n text-align: center;\n background: #cdcdcd;\n border-radius: 4px;\n\n display: flex;\n align-items: center;\n justify-content: center;\n }\n";
|
|
6
|
+
export declare const flowStateStyle = "\n min-width: var(--status-cell-min-width, 62px);\n height: 24px;\n padding: 0 18px 0 8px;\n font-size: 12px;\n font-weight: var(--status-cell-font-weight, 600);\n line-height: 24px;\n color: #fff;\n text-align: center;\n background: #cdcdcd;\n border-radius: 4px;\n box-shadow: none !important;\n\n span {\n text-decoration: none !important;\n }\n";
|
|
7
|
+
export declare const flowStateInWorkflowStyle = "\n &.status-btn:not(.add-weights) {\n min-width: var(--status-cell-min-width, 62px);\n height: 22px;\n padding: 0 8px;\n font-size: 12px;\n font-weight: var(--status-cell-font-weight, 600);\n line-height: 22px;\n color: #fff;\n text-align: center;\n background: #cdcdcd;\n border-radius: 4px;\n\n display: flex;\n align-items: center;\n justify-content: center;\n }\n";
|
|
8
8
|
export declare const flowStateButtonStyle = "\n &:not(.add-weights) > span {\n display: -webkit-box;\n }\n";
|
|
9
9
|
export declare const stateBtnStyle = "\n height: 22px;\n line-height: 22px;\n";
|
|
10
10
|
export declare const noStateStyle = "\n color: #909aaa;\n background: var(--color-gray-4, #F1F2F4);\n";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { statusCellMinWidth, fieldLabelColor, themeBgColorBase, gray7, blue1, gray4, gray6, gray10, blue6 } from '../../../../style/common.js';
|
|
1
|
+
import { statusCellMinWidth, statusCellFontWeight, fieldLabelColor, themeBgColorBase, gray7, blue1, gray4, gray6, gray10, blue6 } from '../../../../style/common.js';
|
|
2
2
|
|
|
3
3
|
const readViewWrapper = `
|
|
4
4
|
display: -webkit-box;
|
|
5
5
|
align-items: center;
|
|
6
6
|
justify-content: center;
|
|
7
|
-
min-width:
|
|
7
|
+
min-width: ${statusCellMinWidth};
|
|
8
8
|
height: 22px;
|
|
9
9
|
padding: 0 8px;
|
|
10
10
|
font-size: 12px;
|
|
11
|
-
font-weight:
|
|
11
|
+
font-weight: ${statusCellFontWeight};
|
|
12
12
|
line-height: 22px;
|
|
13
13
|
text-align: center;
|
|
14
14
|
border-radius: 4px;
|
|
@@ -44,7 +44,7 @@ const flowStateStyle = `
|
|
|
44
44
|
height: 24px;
|
|
45
45
|
padding: 0 18px 0 8px;
|
|
46
46
|
font-size: 12px;
|
|
47
|
-
font-weight:
|
|
47
|
+
font-weight: ${statusCellFontWeight};
|
|
48
48
|
line-height: 24px;
|
|
49
49
|
color: #fff;
|
|
50
50
|
text-align: center;
|
|
@@ -62,7 +62,7 @@ const flowStateInWorkflowStyle = `
|
|
|
62
62
|
height: 22px;
|
|
63
63
|
padding: 0 8px;
|
|
64
64
|
font-size: 12px;
|
|
65
|
-
font-weight:
|
|
65
|
+
font-weight: ${statusCellFontWeight};
|
|
66
66
|
line-height: 22px;
|
|
67
67
|
color: #fff;
|
|
68
68
|
text-align: center;
|
|
@@ -43,6 +43,7 @@ const BaseTableCell = ({ className, cellData, column, rowData, readComponents =
|
|
|
43
43
|
const timeoutCurrent = useRef();
|
|
44
44
|
const ReadComponent = readComponents[column.cellType] || readComponents[column.componentType];
|
|
45
45
|
const EditComponent = editComponents[column.cellType] || editComponents[column.componentType];
|
|
46
|
+
const fieldKey = column.dataIndex || column.dataKey || column.key;
|
|
46
47
|
const handleMouseOver = useCallback(() => {
|
|
47
48
|
if (!isEmpty(editComponents)) {
|
|
48
49
|
timeoutCurrent.current = setTimeout(() => {
|
|
@@ -56,7 +57,7 @@ const BaseTableCell = ({ className, cellData, column, rowData, readComponents =
|
|
|
56
57
|
return (jsx("div", { className: cls, children: jsx(EditTableCell, { Component: EditComponent, workspaceId: (_a = rowData.workspace) === null || _a === void 0 ? void 0 : _a.objectId, itemTypeId: (_b = rowData.itemType) === null || _b === void 0 ? void 0 : _b.objectId, property: property, data: data, id: rowData.objectId, readonly: readonly, objectId: objectId, text: cellData, type: column.componentType, handleChange: handleChange, dataSource: column.dataSource }) }));
|
|
57
58
|
}
|
|
58
59
|
if (ReadComponent) {
|
|
59
|
-
return (jsx("div", { className: cls, onMouseOver: handleMouseOver, children: jsx(ReadComponent, { readonly: readonly, value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData, objectId: column.objectId, dataSource: column.dataSource }) }));
|
|
60
|
+
return (jsx("div", { className: cls, onMouseOver: handleMouseOver, children: jsx(ReadComponent, { readonly: readonly, value: cellData, ...column.property, userData: column.data, options: ((_c = column.data) === null || _c === void 0 ? void 0 : _c.customData) || EMPTY_ARRAY, itemValues: rowData, objectId: column.objectId, dataSource: column.dataSource, fieldKey: fieldKey, isReadingTableCell: column.isReadingList }) }));
|
|
60
61
|
}
|
|
61
62
|
const text = transferItem(cellData !== null && cellData !== void 0 ? cellData : rowData[column.dataIndex], readonly);
|
|
62
63
|
return jsx("div", { className: cls, children: text });
|
|
@@ -12,6 +12,7 @@ import DataQuoteReadView from '../fields/data-quote/ReadView.js';
|
|
|
12
12
|
import DateReadView from '../fields/date/ReadView.js';
|
|
13
13
|
import DropdownCell from '../fields/dropdown/Cell.js';
|
|
14
14
|
import DropdownReadView from '../fields/dropdown/ReadView.js';
|
|
15
|
+
import EditorReadView from '../fields/editor/ReadView.js';
|
|
15
16
|
import FileReadView from '../fields/file/ReadView.js';
|
|
16
17
|
import FormulaReadView from '../fields/formula/ReadView.js';
|
|
17
18
|
import HyperLinkCell from '../fields/hyper-link/ReadView.js';
|
|
@@ -88,6 +89,7 @@ const getAllReadComponents = () => {
|
|
|
88
89
|
[FIELD_TYPE_KEY_MAPPINGS.Script]: ScriptReadView,
|
|
89
90
|
[FIELD_TYPE_KEY_MAPPINGS.Tree]: TreeReadView,
|
|
90
91
|
[FIELD_TYPE_KEY_MAPPINGS.Reporter]: ReporterReadView,
|
|
92
|
+
[FIELD_TYPE_KEY_MAPPINGS.Editor]: EditorReadView,
|
|
91
93
|
};
|
|
92
94
|
return allReadComponents;
|
|
93
95
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { default as DataQuoteReadView } from './components/fields/data-quote/Rea
|
|
|
14
14
|
export { default as DateReadView } from './components/fields/date/ReadView';
|
|
15
15
|
export { default as DropdownCell } from './components/fields/dropdown/Cell';
|
|
16
16
|
export { default as DropdownReadView } from './components/fields/dropdown/ReadView';
|
|
17
|
+
export { default as EditorReadView } from './components/fields/editor/ReadView';
|
|
17
18
|
export { default as FileReadView } from './components/fields/file/ReadView';
|
|
18
19
|
export { default as FormulaReadView } from './components/fields/formula/ReadView';
|
|
19
20
|
export { default as HyperLinkReadView } from './components/fields/hyper-link/ReadView';
|
package/dist/index.js
CHANGED
|
@@ -14,6 +14,7 @@ export { default as DataQuoteReadView } from './components/fields/data-quote/Rea
|
|
|
14
14
|
export { default as DateReadView } from './components/fields/date/ReadView.js';
|
|
15
15
|
export { default as DropdownCell } from './components/fields/dropdown/Cell.js';
|
|
16
16
|
export { default as DropdownReadView } from './components/fields/dropdown/ReadView.js';
|
|
17
|
+
export { default as EditorReadView } from './components/fields/editor/ReadView.js';
|
|
17
18
|
export { default as FileReadView } from './components/fields/file/ReadView.js';
|
|
18
19
|
export { default as FormulaReadView } from './components/fields/formula/ReadView.js';
|
|
19
20
|
export { default as HyperLinkReadView } from './components/fields/hyper-link/ReadView.js';
|
package/dist/style/common.d.ts
CHANGED
|
@@ -22,7 +22,8 @@ export declare const green4 = "var(--color-success-4, #4DD18B)";
|
|
|
22
22
|
export declare const green5 = "var(--color-success-5, #29c477)";
|
|
23
23
|
export declare const orange4 = "var(--color-orange-4, #ffd15e)";
|
|
24
24
|
export declare const orange5 = "var(--color-orange-5, #ffbf36)";
|
|
25
|
-
export declare const statusCellMinWidth = "62px";
|
|
25
|
+
export declare const statusCellMinWidth = "var(--status-cell-min-width, 62px)";
|
|
26
|
+
export declare const statusCellFontWeight = "var(--status-cell-font-weight, 600)";
|
|
26
27
|
export declare const fieldLabelColor = "#909aaa";
|
|
27
28
|
export declare const themeBgColorBase = "var(--color-gray-4, #F1F2F4)";
|
|
28
29
|
export declare const randomClassName: (name: string) => string;
|
package/dist/style/common.js
CHANGED
|
@@ -22,7 +22,8 @@ const green4 = 'var(--color-success-4, #4DD18B)';
|
|
|
22
22
|
const green5 = 'var(--color-success-5, #29c477)';
|
|
23
23
|
const orange4 = 'var(--color-orange-4, #ffd15e)';
|
|
24
24
|
const orange5 = 'var(--color-orange-5, #ffbf36)';
|
|
25
|
-
const statusCellMinWidth = '62px';
|
|
25
|
+
const statusCellMinWidth = 'var(--status-cell-min-width, 62px)';
|
|
26
|
+
const statusCellFontWeight = 'var(--status-cell-font-weight, 600)';
|
|
26
27
|
const fieldLabelColor = '#909aaa';
|
|
27
28
|
const themeBgColorBase = gray4;
|
|
28
29
|
const randomClassName = (name) => {
|
|
@@ -35,4 +36,4 @@ const randomClassName = (name) => {
|
|
|
35
36
|
return `${name}_${result}`;
|
|
36
37
|
};
|
|
37
38
|
|
|
38
|
-
export { blue1, blue10, blue2, blue3, blue4, blue5, blue6, blue7, blue8, blue9, fieldLabelColor, gray1, gray10, gray2, gray3, gray4, gray5, gray6, gray7, gray8, gray9, green4, green5, orange4, orange5, randomClassName, statusCellMinWidth, themeBgColorBase };
|
|
39
|
+
export { blue1, blue10, blue2, blue3, blue4, blue5, blue6, blue7, blue8, blue9, fieldLabelColor, gray1, gray10, gray2, gray3, gray4, gray5, gray6, gray7, gray8, gray9, green4, green5, orange4, orange5, randomClassName, statusCellFontWeight, statusCellMinWidth, themeBgColorBase };
|