@antscorp/antsomi-ui 1.3.2-beta.22 → 1.3.2-beta.24
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/dist/index.js +1 -1
- package/es/components/molecules/GradientSetting/index.d.ts +55 -0
- package/es/components/molecules/GradientSetting/index.js +122 -0
- package/es/components/molecules/InputNumber/index.js +2 -2
- package/es/components/molecules/InputNumberWithUnit/index.js +3 -5
- package/es/components/molecules/InputNumberWithUnit/styled.js +2 -10
- package/es/components/molecules/index.d.ts +1 -0
- package/es/components/molecules/index.js +1 -0
- package/es/constants/theme.js +1 -0
- package/es/locales/en/translation.json +33 -0
- package/es/locales/i18n.d.ts +66 -0
- package/es/locales/translations.d.ts +33 -0
- package/es/locales/vi/translation.json +33 -0
- package/es/test.js +7 -1
- package/es/utils/common.d.ts +6 -0
- package/es/utils/common.js +33 -0
- package/package.json +2 -2
- package/es/components/molecules/InputNumber/styled.d.ts +0 -9
- package/es/components/molecules/InputNumber/styled.js +0 -95
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface GradientColor {
|
|
3
|
+
gradientColor: string;
|
|
4
|
+
gradientColorLocation: number;
|
|
5
|
+
}
|
|
6
|
+
declare const POSITION: {
|
|
7
|
+
readonly LEFT_TOP: {
|
|
8
|
+
readonly value: "left top";
|
|
9
|
+
readonly label: string;
|
|
10
|
+
};
|
|
11
|
+
readonly LEFT_CENTER: {
|
|
12
|
+
readonly value: "left center";
|
|
13
|
+
readonly label: string;
|
|
14
|
+
};
|
|
15
|
+
readonly LEFT_BOTTOM: {
|
|
16
|
+
readonly value: "left bottom";
|
|
17
|
+
readonly label: string;
|
|
18
|
+
};
|
|
19
|
+
readonly RIGHT_TOP: {
|
|
20
|
+
readonly value: "right top";
|
|
21
|
+
readonly label: string;
|
|
22
|
+
};
|
|
23
|
+
readonly RIGHT_CENTER: {
|
|
24
|
+
readonly value: "right center";
|
|
25
|
+
readonly label: string;
|
|
26
|
+
};
|
|
27
|
+
readonly RIGHT_BOTTOM: {
|
|
28
|
+
readonly value: "right bottom";
|
|
29
|
+
readonly label: string;
|
|
30
|
+
};
|
|
31
|
+
readonly CENTER_TOP: {
|
|
32
|
+
readonly value: "center top";
|
|
33
|
+
readonly label: string;
|
|
34
|
+
};
|
|
35
|
+
readonly CENTER_CENTER: {
|
|
36
|
+
readonly value: "center center";
|
|
37
|
+
readonly label: string;
|
|
38
|
+
};
|
|
39
|
+
readonly CENTER_BOTTOM: {
|
|
40
|
+
readonly value: "center bottom";
|
|
41
|
+
readonly label: string;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
type PositionValue = (typeof POSITION)[keyof typeof POSITION]['value'];
|
|
45
|
+
interface GradientConfig {
|
|
46
|
+
gradients: GradientColor[];
|
|
47
|
+
gradientType: 'linear-gradient' | 'radial-gradient';
|
|
48
|
+
radialPosition: PositionValue;
|
|
49
|
+
linearAngle: number;
|
|
50
|
+
}
|
|
51
|
+
interface GradientSettingProps {
|
|
52
|
+
onChange?: (gradientConfig: GradientConfig) => void;
|
|
53
|
+
}
|
|
54
|
+
export declare const GradientSetting: React.FC<GradientSettingProps>;
|
|
55
|
+
export {};
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
// Libraries
|
|
2
|
+
import React, { useEffect, useState } from 'react';
|
|
3
|
+
import { useTranslation } from 'react-i18next';
|
|
4
|
+
// Locales
|
|
5
|
+
import { getTranslateMessage, translations } from '@antscorp/antsomi-ui/es/locales/translations';
|
|
6
|
+
// Components
|
|
7
|
+
import { ColorSetting, Select, SettingWrapper, SliderWithInputNumber, } from '@antscorp/antsomi-ui/es/components/molecules';
|
|
8
|
+
// Utils
|
|
9
|
+
import { Button } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
10
|
+
import Icon from '@antscorp/icons';
|
|
11
|
+
import { mapNumberToOrdinalText } from '@antscorp/antsomi-ui/es/utils';
|
|
12
|
+
import { cloneDeep } from 'lodash';
|
|
13
|
+
const GRADIENT_TYPE = {
|
|
14
|
+
LINEAR: {
|
|
15
|
+
value: 'linear-gradient',
|
|
16
|
+
label: getTranslateMessage(translations.linear),
|
|
17
|
+
},
|
|
18
|
+
RADIAL: {
|
|
19
|
+
value: 'radial-gradient',
|
|
20
|
+
label: getTranslateMessage(translations.radial),
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
const POSITION = {
|
|
24
|
+
LEFT_TOP: {
|
|
25
|
+
value: 'left top',
|
|
26
|
+
label: getTranslateMessage(translations.leftTop),
|
|
27
|
+
},
|
|
28
|
+
LEFT_CENTER: {
|
|
29
|
+
value: 'left center',
|
|
30
|
+
label: getTranslateMessage(translations.leftCenter),
|
|
31
|
+
},
|
|
32
|
+
LEFT_BOTTOM: {
|
|
33
|
+
value: 'left bottom',
|
|
34
|
+
label: getTranslateMessage(translations.leftBottom),
|
|
35
|
+
},
|
|
36
|
+
RIGHT_TOP: {
|
|
37
|
+
value: 'right top',
|
|
38
|
+
label: getTranslateMessage(translations.rightTop),
|
|
39
|
+
},
|
|
40
|
+
RIGHT_CENTER: {
|
|
41
|
+
value: 'right center',
|
|
42
|
+
label: getTranslateMessage(translations.rightCenter),
|
|
43
|
+
},
|
|
44
|
+
RIGHT_BOTTOM: {
|
|
45
|
+
value: 'right bottom',
|
|
46
|
+
label: getTranslateMessage(translations.rightBottom),
|
|
47
|
+
},
|
|
48
|
+
CENTER_TOP: {
|
|
49
|
+
value: 'center top',
|
|
50
|
+
label: getTranslateMessage(translations.centerTop),
|
|
51
|
+
},
|
|
52
|
+
CENTER_CENTER: {
|
|
53
|
+
value: 'center center',
|
|
54
|
+
label: getTranslateMessage(translations.centerCenter),
|
|
55
|
+
},
|
|
56
|
+
CENTER_BOTTOM: {
|
|
57
|
+
value: 'center bottom',
|
|
58
|
+
label: getTranslateMessage(translations.centerBottom),
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
const GRADIENT_MIN = 2;
|
|
62
|
+
const GRADIENT_MAX = 5;
|
|
63
|
+
const DEFAULT_GRADIENTS = [
|
|
64
|
+
{ gradientColor: '#D11A66', gradientColorLocation: 0 },
|
|
65
|
+
{ gradientColor: '#FFBD64', gradientColorLocation: 50 },
|
|
66
|
+
];
|
|
67
|
+
export const GradientSetting = ({ onChange }) => {
|
|
68
|
+
const { t } = useTranslation();
|
|
69
|
+
const [gradients, setGradients] = useState(DEFAULT_GRADIENTS);
|
|
70
|
+
const [gradientType, setGradientType] = useState('linear-gradient');
|
|
71
|
+
const [radialPosition, setRadialPosition] = useState('center center');
|
|
72
|
+
const [linearAngle, setLinearAngle] = useState(90);
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
onChange && onChange({ gradients, gradientType, radialPosition, linearAngle });
|
|
75
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
76
|
+
}, [JSON.stringify(gradients), gradientType, radialPosition, linearAngle]);
|
|
77
|
+
return (React.createElement(React.Fragment, null,
|
|
78
|
+
React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: t(translations.gradientStyle) },
|
|
79
|
+
React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(GRADIENT_TYPE), value: gradientType, onChange: value => setGradientType(value) })),
|
|
80
|
+
gradientType === GRADIENT_TYPE.LINEAR.value ? (React.createElement(SliderWithInputNumber, { className: "ants-mb-[15px]", label: t(translations.angle), min: 0, max: 360, value: linearAngle, onAfterChange: value => setLinearAngle(value) })) : (React.createElement(SettingWrapper, { className: "ants-mb-[15px]", label: t(translations.position) },
|
|
81
|
+
React.createElement(Select, { className: "ants-w-[112px]", options: Object.values(POSITION), value: radialPosition, onChange: value => setRadialPosition(value) }))),
|
|
82
|
+
Array.isArray(gradients) && gradients.length
|
|
83
|
+
? gradients.map((gradient, index) => {
|
|
84
|
+
const { gradientColor, gradientColorLocation } = gradient;
|
|
85
|
+
return (React.createElement("div", { className: "ants-flex ants-gap-x-2 ants-mb-[15px]", key: index },
|
|
86
|
+
React.createElement("div", { className: "ants-grid md:ants-grid-cols-5 ants-grid-cols-1 ants-gap-y-5" },
|
|
87
|
+
React.createElement("div", { className: "ants-col-span-2" },
|
|
88
|
+
React.createElement(ColorSetting, { labelClassName: "!ants-text-cus-base", label: t(translations.gradientColor, {
|
|
89
|
+
name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
|
|
90
|
+
}), color: gradientColor, positionInput: "right", onChange: color => {
|
|
91
|
+
setGradients(prev => {
|
|
92
|
+
const clonePrev = cloneDeep(prev);
|
|
93
|
+
clonePrev[index].gradientColor = color;
|
|
94
|
+
return clonePrev;
|
|
95
|
+
});
|
|
96
|
+
} })),
|
|
97
|
+
React.createElement("div", { className: "ants-col-span-3" },
|
|
98
|
+
React.createElement(SliderWithInputNumber, { label: t(translations.gradientLocation, {
|
|
99
|
+
name: t(translations.ordinalText[mapNumberToOrdinalText(index + 1)]),
|
|
100
|
+
}), min: 0, max: 100, value: gradientColorLocation, onAfterChange: color => {
|
|
101
|
+
setGradients(prev => {
|
|
102
|
+
const clonePrev = cloneDeep(prev);
|
|
103
|
+
clonePrev[index].gradientColorLocation = color;
|
|
104
|
+
return clonePrev;
|
|
105
|
+
});
|
|
106
|
+
} }))),
|
|
107
|
+
(gradients === null || gradients === void 0 ? void 0 : gradients.length) > GRADIENT_MIN && (React.createElement(Icon, { type: "icon-ants-outline-delete", className: "ants-text-primary ants-cursor-pointer", style: { alignSelf: 'flex-end', marginBottom: '10px', fontSize: '16px' }, onClick: () => {
|
|
108
|
+
const clonePrev = cloneDeep(gradients);
|
|
109
|
+
clonePrev.splice(index, 1);
|
|
110
|
+
setGradients(clonePrev);
|
|
111
|
+
} }))));
|
|
112
|
+
})
|
|
113
|
+
: null,
|
|
114
|
+
(gradients === null || gradients === void 0 ? void 0 : gradients.length) < GRADIENT_MAX && (React.createElement(Button, { type: "text", onClick: () => {
|
|
115
|
+
// eslint-disable-next-line arrow-body-style
|
|
116
|
+
setGradients(prev => {
|
|
117
|
+
return [...prev, { gradientColor: '#000000', gradientColorLocation: 0 }];
|
|
118
|
+
});
|
|
119
|
+
} },
|
|
120
|
+
"+ ",
|
|
121
|
+
t(translations.addColor)))));
|
|
122
|
+
};
|
|
@@ -11,9 +11,9 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
11
11
|
};
|
|
12
12
|
// Libraries
|
|
13
13
|
import React, { useEffect, useMemo, useState } from 'react';
|
|
14
|
+
import { InputNumber as AntdInputNumber } from 'antd';
|
|
14
15
|
// Components
|
|
15
16
|
import { Icon, RequiredLabel, Text } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
16
|
-
import { InputNumberWrapper } from './styled';
|
|
17
17
|
// Utils
|
|
18
18
|
import { getPreventKeyboardAction } from '@antscorp/antsomi-ui/es/utils/web';
|
|
19
19
|
import { handleError } from '@antscorp/antsomi-ui/es/utils';
|
|
@@ -67,7 +67,7 @@ export const InputNumber = props => {
|
|
|
67
67
|
}
|
|
68
68
|
return (React.createElement("div", null,
|
|
69
69
|
label && renderRequiredLabel(label),
|
|
70
|
-
React.createElement(
|
|
70
|
+
React.createElement(AntdInputNumber, Object.assign({}, restOf, { className: "--show-handler", required: required, onChange: onChangeInputNumber, onBlur: e => {
|
|
71
71
|
if (!focused) {
|
|
72
72
|
setFocused(true);
|
|
73
73
|
}
|
|
@@ -27,12 +27,10 @@ const DEFAULT_UNIT = {
|
|
|
27
27
|
};
|
|
28
28
|
export const InputNumberWithUnit = props => {
|
|
29
29
|
// Props
|
|
30
|
-
const { unit, unitData, onChangeUnit } = props, restOf = __rest(props, ["unit", "unitData", "onChangeUnit"]);
|
|
31
|
-
return (React.createElement(InputNumberWithUnitWrapper,
|
|
30
|
+
const { unit, unitData, onChangeUnit, className } = props, restOf = __rest(props, ["unit", "unitData", "onChangeUnit", "className"]);
|
|
31
|
+
return (React.createElement(InputNumberWithUnitWrapper, { className: className },
|
|
32
32
|
React.createElement(InputNumber, Object.assign({}, restOf)),
|
|
33
|
-
React.createElement(
|
|
34
|
-
' ',
|
|
35
|
-
Object.values(unitData || DEFAULT_UNIT).map(({ value, label }) => (React.createElement(Text, { key: value, className: `${unit === value ? 'selected' : ''}`, onClick: () => onChangeUnit(value) }, label))))));
|
|
33
|
+
Object.values(unitData || DEFAULT_UNIT).map(({ value, label }) => (React.createElement(Text, { key: value, className: `unit-label ${unit === value ? 'selected' : ''}`, onClick: () => onChangeUnit(value) }, label)))));
|
|
36
34
|
};
|
|
37
35
|
InputNumberWithUnit.defaultProps = {
|
|
38
36
|
unit: 'px',
|
|
@@ -6,19 +6,11 @@ import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
|
6
6
|
export const InputNumberWithUnitWrapper = styled.div `
|
|
7
7
|
display: flex;
|
|
8
8
|
align-items: center;
|
|
9
|
-
margin-left: 10px;
|
|
10
|
-
margin-right: 10px;
|
|
11
9
|
|
|
12
|
-
.unit-
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.unit-selector > div {
|
|
10
|
+
.unit-label {
|
|
18
11
|
cursor: pointer;
|
|
19
|
-
color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorIcon};
|
|
20
12
|
margin-left: 10px;
|
|
21
|
-
|
|
13
|
+
color: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorIcon};
|
|
22
14
|
|
|
23
15
|
&.selected {
|
|
24
16
|
color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.colorPrimary};
|
|
@@ -22,6 +22,7 @@ export { TreeSelect } from './TreeSelect';
|
|
|
22
22
|
export { Result } from './Result';
|
|
23
23
|
export { Card } from './Card';
|
|
24
24
|
export { InputNumberWithUnit } from './InputNumberWithUnit';
|
|
25
|
+
export { GradientSetting } from './GradientSetting';
|
|
25
26
|
export type { AdvancedPickerProps, TAdvancedPickerOption, TAdvancedRangePickerTimeRange, } from './DatePicker';
|
|
26
27
|
export type { ColorPickerProps } from './ColorPicker';
|
|
27
28
|
export type { AlignEditProps, AlignSettingProps } from './AlignSetting';
|
package/es/constants/theme.js
CHANGED
|
@@ -108,6 +108,7 @@ THEME.components = {
|
|
|
108
108
|
borderRadiusLG: 0,
|
|
109
109
|
borderRadiusSM: 0,
|
|
110
110
|
borderRadiusOuter: 0,
|
|
111
|
+
controlHeight: 30,
|
|
111
112
|
borderRadiusXS: 0,
|
|
112
113
|
colorBorder: (_m = THEME.token) === null || _m === void 0 ? void 0 : _m.blue1,
|
|
113
114
|
controlItemBgActive: '#E0EBF7',
|
|
@@ -29,5 +29,38 @@
|
|
|
29
29
|
"months": "Months",
|
|
30
30
|
"quarters": "Quarters",
|
|
31
31
|
"years": "Years"
|
|
32
|
+
},
|
|
33
|
+
"linear": "Linear",
|
|
34
|
+
"radial": "Radial",
|
|
35
|
+
"gradientStyle": "Gradient Style",
|
|
36
|
+
"angle": "Angle",
|
|
37
|
+
"gradientColor": "{{name}} Color",
|
|
38
|
+
"gradientLocation": "{{name}} Color Location",
|
|
39
|
+
"firstColor": "First Color",
|
|
40
|
+
"secondColor": "Second Color",
|
|
41
|
+
"firstColorLocation": "First Color Location",
|
|
42
|
+
"secondColorLocation": "Second Color Location",
|
|
43
|
+
"leftTop": "Left Top",
|
|
44
|
+
"leftCenter": "Left Center",
|
|
45
|
+
"leftBottom": "Left Bottom",
|
|
46
|
+
"rightTop": "Right Top",
|
|
47
|
+
"rightCenter": "Right Center",
|
|
48
|
+
"rightBottom": "Right Bottom",
|
|
49
|
+
"centerTop": "Center Top",
|
|
50
|
+
"centerCenter": "Center Center",
|
|
51
|
+
"centerBottom": "Center Bottom",
|
|
52
|
+
"position": "Position",
|
|
53
|
+
"addColor": "Add color",
|
|
54
|
+
"ordinalText": {
|
|
55
|
+
"first": "First",
|
|
56
|
+
"second": "Second",
|
|
57
|
+
"third": "Third",
|
|
58
|
+
"fourth": "Fourth",
|
|
59
|
+
"fifth": "Fifth",
|
|
60
|
+
"sixth": "Sixth",
|
|
61
|
+
"seventh": "Seventh",
|
|
62
|
+
"eighth": "Eighth",
|
|
63
|
+
"ninth": "Ninth",
|
|
64
|
+
"tenth": "Tenth"
|
|
32
65
|
}
|
|
33
66
|
}
|
package/es/locales/i18n.d.ts
CHANGED
|
@@ -32,6 +32,39 @@ export declare const translationsJson: {
|
|
|
32
32
|
quarters: string;
|
|
33
33
|
years: string;
|
|
34
34
|
};
|
|
35
|
+
linear: string;
|
|
36
|
+
radial: string;
|
|
37
|
+
gradientStyle: string;
|
|
38
|
+
angle: string;
|
|
39
|
+
gradientColor: string;
|
|
40
|
+
gradientLocation: string;
|
|
41
|
+
firstColor: string;
|
|
42
|
+
secondColor: string;
|
|
43
|
+
firstColorLocation: string;
|
|
44
|
+
secondColorLocation: string;
|
|
45
|
+
leftTop: string;
|
|
46
|
+
leftCenter: string;
|
|
47
|
+
leftBottom: string;
|
|
48
|
+
rightTop: string;
|
|
49
|
+
rightCenter: string;
|
|
50
|
+
rightBottom: string;
|
|
51
|
+
centerTop: string;
|
|
52
|
+
centerCenter: string;
|
|
53
|
+
centerBottom: string;
|
|
54
|
+
position: string;
|
|
55
|
+
addColor: string;
|
|
56
|
+
ordinalText: {
|
|
57
|
+
first: string;
|
|
58
|
+
second: string;
|
|
59
|
+
third: string;
|
|
60
|
+
fourth: string;
|
|
61
|
+
fifth: string;
|
|
62
|
+
sixth: string;
|
|
63
|
+
seventh: string;
|
|
64
|
+
eighth: string;
|
|
65
|
+
ninth: string;
|
|
66
|
+
tenth: string;
|
|
67
|
+
};
|
|
35
68
|
};
|
|
36
69
|
};
|
|
37
70
|
vi: {
|
|
@@ -67,6 +100,39 @@ export declare const translationsJson: {
|
|
|
67
100
|
quarters: string;
|
|
68
101
|
years: string;
|
|
69
102
|
};
|
|
103
|
+
addColor: string;
|
|
104
|
+
linear: string;
|
|
105
|
+
radial: string;
|
|
106
|
+
gradientStyle: string;
|
|
107
|
+
angle: string;
|
|
108
|
+
gradientColor: string;
|
|
109
|
+
gradientLocation: string;
|
|
110
|
+
firstColor: string;
|
|
111
|
+
secondColor: string;
|
|
112
|
+
firstColorLocation: string;
|
|
113
|
+
secondColorLocation: string;
|
|
114
|
+
leftTop: string;
|
|
115
|
+
leftCenter: string;
|
|
116
|
+
leftBottom: string;
|
|
117
|
+
rightTop: string;
|
|
118
|
+
rightCenter: string;
|
|
119
|
+
rightBottom: string;
|
|
120
|
+
centerTop: string;
|
|
121
|
+
centerCenter: string;
|
|
122
|
+
centerBottom: string;
|
|
123
|
+
position: string;
|
|
124
|
+
ordinalText: {
|
|
125
|
+
first: string;
|
|
126
|
+
second: string;
|
|
127
|
+
third: string;
|
|
128
|
+
fourth: string;
|
|
129
|
+
fifth: string;
|
|
130
|
+
sixth: string;
|
|
131
|
+
seventh: string;
|
|
132
|
+
eighth: string;
|
|
133
|
+
ninth: string;
|
|
134
|
+
tenth: string;
|
|
135
|
+
};
|
|
70
136
|
};
|
|
71
137
|
};
|
|
72
138
|
};
|
|
@@ -32,6 +32,39 @@ export declare const convertLanguageJsonToObject: (json: any, objToConvertTo?: C
|
|
|
32
32
|
quarters: string;
|
|
33
33
|
years: string;
|
|
34
34
|
};
|
|
35
|
+
linear: string;
|
|
36
|
+
radial: string;
|
|
37
|
+
gradientStyle: string;
|
|
38
|
+
angle: string;
|
|
39
|
+
gradientColor: string;
|
|
40
|
+
gradientLocation: string;
|
|
41
|
+
firstColor: string;
|
|
42
|
+
secondColor: string;
|
|
43
|
+
firstColorLocation: string;
|
|
44
|
+
secondColorLocation: string;
|
|
45
|
+
leftTop: string;
|
|
46
|
+
leftCenter: string;
|
|
47
|
+
leftBottom: string;
|
|
48
|
+
rightTop: string;
|
|
49
|
+
rightCenter: string;
|
|
50
|
+
rightBottom: string;
|
|
51
|
+
centerTop: string;
|
|
52
|
+
centerCenter: string;
|
|
53
|
+
centerBottom: string;
|
|
54
|
+
position: string;
|
|
55
|
+
addColor: string;
|
|
56
|
+
ordinalText: {
|
|
57
|
+
first: string;
|
|
58
|
+
second: string;
|
|
59
|
+
third: string;
|
|
60
|
+
fourth: string;
|
|
61
|
+
fifth: string;
|
|
62
|
+
sixth: string;
|
|
63
|
+
seventh: string;
|
|
64
|
+
eighth: string;
|
|
65
|
+
ninth: string;
|
|
66
|
+
tenth: string;
|
|
67
|
+
};
|
|
35
68
|
}>, current?: string) => void;
|
|
36
69
|
export declare const t: (id: string, ...rest: any[]) => [string, ...any[]];
|
|
37
70
|
export declare const getTranslateMessage: (id: string, defaultMessage?: string, value?: Record<string, unknown>) => string;
|
|
@@ -29,5 +29,38 @@
|
|
|
29
29
|
"months": "Tháng",
|
|
30
30
|
"quarters": "Quý",
|
|
31
31
|
"years": "Năm"
|
|
32
|
+
},
|
|
33
|
+
"addColor": "Thêm màu",
|
|
34
|
+
"linear": "Linear",
|
|
35
|
+
"radial": "Radial",
|
|
36
|
+
"gradientStyle": "Kiểu chuyển màu",
|
|
37
|
+
"angle": "Góc",
|
|
38
|
+
"gradientColor": "Màu {{name}}",
|
|
39
|
+
"gradientLocation": "Vị trí màu {{name}}",
|
|
40
|
+
"firstColor": "Màu đầu tiên",
|
|
41
|
+
"secondColor": "Màu thứ hai",
|
|
42
|
+
"firstColorLocation": "Vị trí màu đầu tiên",
|
|
43
|
+
"secondColorLocation": "Vị trí màu thứ hai",
|
|
44
|
+
"leftTop": "Trái Trên",
|
|
45
|
+
"leftCenter": "Trái Giữa",
|
|
46
|
+
"leftBottom": "Trái Dưới",
|
|
47
|
+
"rightTop": "Phải Trên",
|
|
48
|
+
"rightCenter": "Phải Giữa",
|
|
49
|
+
"rightBottom": "Phải Dưới",
|
|
50
|
+
"centerTop": "Giữa Trên",
|
|
51
|
+
"centerCenter": "Giữa Giữa",
|
|
52
|
+
"centerBottom": "Giữa Dưới",
|
|
53
|
+
"position": "Vị trí",
|
|
54
|
+
"ordinalText": {
|
|
55
|
+
"first": "đầu tiên",
|
|
56
|
+
"second": "thứ hai",
|
|
57
|
+
"third": "thứ ba",
|
|
58
|
+
"fourth": "thứ tư",
|
|
59
|
+
"fifth": "thứ năm",
|
|
60
|
+
"sixth": "thứ sáu",
|
|
61
|
+
"seventh": "thứ bảy",
|
|
62
|
+
"eighth": "thứ tám",
|
|
63
|
+
"ninth": "thứ chín",
|
|
64
|
+
"tenth": "thứ mười"
|
|
32
65
|
}
|
|
33
66
|
}
|
package/es/test.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import ReactDOM from 'react-dom';
|
|
4
4
|
import '@antscorp/icons/main.css';
|
|
5
|
-
import { ColorSetting, ConfigProvider, EdgeSetting, IconSelection, PositionSetting, RadioGroup, SettingWrapper, SliderWithInputNumber, Space, UploadImage, } from './components';
|
|
5
|
+
import { ColorSetting, ConfigProvider, EdgeSetting, IconSelection, InputNumberWithUnit, PositionSetting, RadioGroup, SettingWrapper, SliderWithInputNumber, Space, UploadImage, } from './components';
|
|
6
6
|
// Constants
|
|
7
7
|
import { THEME } from './constants';
|
|
8
8
|
export const BACKGROUND_COLOR_STYLE = {
|
|
@@ -98,6 +98,12 @@ export const App = () => {
|
|
|
98
98
|
React.createElement(Space, { size: 20, direction: "vertical" },
|
|
99
99
|
React.createElement(SettingWrapper, { vertical: true, label: "Color Setting" },
|
|
100
100
|
React.createElement(ColorSetting, { label: "Background Color", labelStyling: { color: (_a = THEME.token) === null || _a === void 0 ? void 0 : _a.colorIcon }, color: colorSettingState.color, customColors: colorSettingState.customColors, callback: callbackColorSetting, onChange: handleChangeColorSetting })),
|
|
101
|
+
React.createElement(SettingWrapper, { vertical: true, label: "Input number with unit" },
|
|
102
|
+
React.createElement(InputNumberWithUnit, { unit: "px", min: 0, max: 2000, value: 700, onChange: value => {
|
|
103
|
+
console.log('onChange:: ', value);
|
|
104
|
+
}, onChangeUnit: unit => {
|
|
105
|
+
console.log('onChangeUnit:: ', unit);
|
|
106
|
+
} })),
|
|
101
107
|
React.createElement(SettingWrapper, { label: "Radio Group" },
|
|
102
108
|
React.createElement(RadioGroup, { options: Object.values(BACKGROUND_COLOR_STYLE), value: radioValue, onChange: e => handleChangeRadio(e) })),
|
|
103
109
|
React.createElement(SliderWithInputNumber, { label: "Size (px)", labelStyling: { marginTop: 10 }, min: 0, max: 100, value: sliderValue, onAfterChange: handleChangeSlider }),
|
package/es/utils/common.d.ts
CHANGED
|
@@ -45,3 +45,9 @@ export declare function getEntriesV2(res: any, def: any): {
|
|
|
45
45
|
messageAPI?: undefined;
|
|
46
46
|
};
|
|
47
47
|
export declare const getNumberFromString: (str: string) => number;
|
|
48
|
+
/**
|
|
49
|
+
* Maps a number to its corresponding ordinal text representation.
|
|
50
|
+
* @param {number} num - The number to be mapped.
|
|
51
|
+
* @return {string} The ordinal text representation of the number.
|
|
52
|
+
*/
|
|
53
|
+
export declare function mapNumberToOrdinalText(num: number): string;
|
package/es/utils/common.js
CHANGED
|
@@ -320,3 +320,36 @@ export const getNumberFromString = (str) => {
|
|
|
320
320
|
return 0;
|
|
321
321
|
}
|
|
322
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* Maps a number to its corresponding ordinal text representation.
|
|
325
|
+
* @param {number} num - The number to be mapped.
|
|
326
|
+
* @return {string} The ordinal text representation of the number.
|
|
327
|
+
*/
|
|
328
|
+
export function mapNumberToOrdinalText(num) {
|
|
329
|
+
switch (num) {
|
|
330
|
+
case 0:
|
|
331
|
+
return 'zeroth';
|
|
332
|
+
case 1:
|
|
333
|
+
return 'first';
|
|
334
|
+
case 2:
|
|
335
|
+
return 'second';
|
|
336
|
+
case 3:
|
|
337
|
+
return 'third';
|
|
338
|
+
case 4:
|
|
339
|
+
return 'fourth';
|
|
340
|
+
case 5:
|
|
341
|
+
return 'fifth';
|
|
342
|
+
case 6:
|
|
343
|
+
return 'sixth';
|
|
344
|
+
case 7:
|
|
345
|
+
return 'seventh';
|
|
346
|
+
case 8:
|
|
347
|
+
return 'eighth';
|
|
348
|
+
case 9:
|
|
349
|
+
return 'ninth';
|
|
350
|
+
case 10:
|
|
351
|
+
return 'tenth';
|
|
352
|
+
default:
|
|
353
|
+
return '';
|
|
354
|
+
}
|
|
355
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.2-beta.
|
|
3
|
+
"version": "1.3.2-beta.24",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -179,4 +179,4 @@
|
|
|
179
179
|
"react": ">=16.9.0",
|
|
180
180
|
"react-dom": ">=16.9.0"
|
|
181
181
|
}
|
|
182
|
-
}
|
|
182
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const InputNumberWrapper: import("styled-components").StyledComponent<(<T extends import("@rc-component/mini-decimal").ValueType = import("@rc-component/mini-decimal").ValueType>(props: import("antd").InputNumberProps<T> & {
|
|
3
|
-
children?: import("react").ReactNode;
|
|
4
|
-
} & {
|
|
5
|
-
ref?: import("react").Ref<HTMLInputElement> | undefined;
|
|
6
|
-
}) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>) & {
|
|
7
|
-
displayName?: string | undefined;
|
|
8
|
-
_InternalPanelDoNotUseOrYouWillBeFired: (props: import("antd").InputNumberProps<any>) => JSX.Element;
|
|
9
|
-
}, any, {}, never>;
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
2
|
-
// Libraries
|
|
3
|
-
import styled, { css } from 'styled-components';
|
|
4
|
-
// Components
|
|
5
|
-
import { InputNumber as AntdInputNumber } from 'antd';
|
|
6
|
-
// Constants
|
|
7
|
-
import { THEME } from '@antscorp/antsomi-ui/es/constants';
|
|
8
|
-
export const InputNumberWrapper = styled(AntdInputNumber) `
|
|
9
|
-
height: 30px;
|
|
10
|
-
border-style: none;
|
|
11
|
-
border-radius: none;
|
|
12
|
-
font-family: 'Roboto';
|
|
13
|
-
font-size: ${(_a = THEME.token) === null || _a === void 0 ? void 0 : _a.fontSize}px;
|
|
14
|
-
--tw-shadow: 0 1px 0 0 #e0e0e0;
|
|
15
|
-
--tw-shadow-colored: 0 1px 0 0 var(--tw-shadow-color);
|
|
16
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
|
|
17
|
-
var(--tw-shadow);
|
|
18
|
-
transition-property: all;
|
|
19
|
-
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
|
|
20
|
-
transition-duration: 150ms;
|
|
21
|
-
|
|
22
|
-
&::placeholder {
|
|
23
|
-
color: ${(_b = THEME.token) === null || _b === void 0 ? void 0 : _b.accent5};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
&:hover {
|
|
27
|
-
background-color: ${(_c = THEME.token) === null || _c === void 0 ? void 0 : _c.blue0};
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
${props => css `
|
|
31
|
-
height: ${props.height}${typeof props.height === 'number' ? 'px' : ''};
|
|
32
|
-
width: ${props.width}${typeof props.width === 'number' ? 'px' : ''};
|
|
33
|
-
`}
|
|
34
|
-
|
|
35
|
-
.antsomi-input-number-group {
|
|
36
|
-
min-width: 100px;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
&:active,
|
|
40
|
-
&:focus {
|
|
41
|
-
background-color: ${(_d = THEME.token) === null || _d === void 0 ? void 0 : _d.bw1_1};
|
|
42
|
-
--tw-shadow: 0 1px 0 0 #194e8d;
|
|
43
|
-
--tw-shadow-colored: 0 1px 0 0 var(--tw-shadow-color);
|
|
44
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
|
|
45
|
-
var(--tw-shadow);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&:disabled {
|
|
49
|
-
background-color: ${(_e = THEME.token) === null || _e === void 0 ? void 0 : _e.accent1};
|
|
50
|
-
color: ${(_f = THEME.token) === null || _f === void 0 ? void 0 : _f.accent5};
|
|
51
|
-
--tw-shadow: 0 1px 0 0 #e0e0e0;
|
|
52
|
-
--tw-shadow-colored: 0 1px 0 0 var(--tw-shadow-color);
|
|
53
|
-
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000),
|
|
54
|
-
var(--tw-shadow);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.antsomi-input-number-handler-wrap {
|
|
58
|
-
height: 100%;
|
|
59
|
-
opacity: 1;
|
|
60
|
-
|
|
61
|
-
&:hover {
|
|
62
|
-
.antsomi-input-number-handler {
|
|
63
|
-
height: 50%;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.antsomi-input-number-handler {
|
|
69
|
-
display: flex;
|
|
70
|
-
align-items: center;
|
|
71
|
-
justify-content: center;
|
|
72
|
-
border: none;
|
|
73
|
-
|
|
74
|
-
&:hover {
|
|
75
|
-
color: ${(_g = THEME.token) === null || _g === void 0 ? void 0 : _g.colorText};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.antsomi-input-number-input {
|
|
80
|
-
padding: 0px 4px !important;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
.antsomi-input-number-group-addon {
|
|
84
|
-
position: relative;
|
|
85
|
-
top: 1px;
|
|
86
|
-
padding: 0;
|
|
87
|
-
border: none;
|
|
88
|
-
--tw-bg-opacity: 1;
|
|
89
|
-
background-color: rgb(255 255 255 / var(--tw-bg-opacity));
|
|
90
|
-
padding-left: 10px;
|
|
91
|
-
font-size: 13px;
|
|
92
|
-
color: ${(_h = THEME.token) === null || _h === void 0 ? void 0 : _h.colorTextBase};
|
|
93
|
-
border-bottom-width: 1px;
|
|
94
|
-
}
|
|
95
|
-
`;
|