@antscorp/antsomi-ui 1.3.5-beta.482 → 1.3.5-beta.484
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.
|
@@ -18,16 +18,16 @@ import { Icon, Typography } from '@antscorp/antsomi-ui/es/components/atoms';
|
|
|
18
18
|
import { StyledFilterItem } from './styled';
|
|
19
19
|
// Constants
|
|
20
20
|
import { DATE_TIME_FORMAT, METRIC_TYPE, OPERATORS_CODE, OPERATORS_OPTION, } from '@antscorp/antsomi-ui/es/constants';
|
|
21
|
-
const { MATCHES_ANY, MATCHES, NOT_MATCHES, IS,
|
|
21
|
+
const { MATCHES_ANY, MATCHES, NOT_MATCHES, IS, AFTER, BEFORE, AFTER_DATE, BEFORE_DATE, ON } = OPERATORS_CODE;
|
|
22
22
|
const { DATE, DATE_TIME } = METRIC_TYPE;
|
|
23
23
|
const { Text } = Typography;
|
|
24
24
|
export const FilterItem = props => {
|
|
25
25
|
const { name, operator, datatype, value, onClickRemove } = props, restProps = __rest(props, ["name", "operator", "datatype", "value", "onClickRemove"]);
|
|
26
|
-
console.log('🚀 ~ datatype:', datatype);
|
|
27
26
|
// Memo
|
|
28
27
|
const serializeValue = useMemo(() => {
|
|
29
28
|
// Check type of value is valid date
|
|
30
|
-
if (dayjs(value).isValid() &&
|
|
29
|
+
if (dayjs(value).isValid() &&
|
|
30
|
+
[AFTER_DATE, BEFORE_DATE, ON, AFTER, BEFORE].includes(operator)) {
|
|
31
31
|
return dayjs(value).format(DATE_TIME_FORMAT.FILTER_CONDITION);
|
|
32
32
|
}
|
|
33
33
|
// Check value is an array
|
|
@@ -35,7 +35,7 @@ export const FilterItem = props => {
|
|
|
35
35
|
return value.map(item => item.title || item).join(', ');
|
|
36
36
|
}
|
|
37
37
|
return value;
|
|
38
|
-
}, [value,
|
|
38
|
+
}, [value, operator]);
|
|
39
39
|
const serializeOperator = useMemo(() => {
|
|
40
40
|
var _a;
|
|
41
41
|
const operatorLabel = ((_a = Object.values(OPERATORS_OPTION).find(({ value }) => value === operator)) === null || _a === void 0 ? void 0 : _a.label) || '';
|
|
@@ -57,7 +57,7 @@ export const FilterItem = props => {
|
|
|
57
57
|
serializeOperator && React.createElement(Text, null,
|
|
58
58
|
serializeOperator,
|
|
59
59
|
" \u00A0"),
|
|
60
|
-
React.createElement(Text, { strong: true, className: "filter-item__value" }, serializeValue)),
|
|
60
|
+
React.createElement(Text, { strong: true, className: "filter-item__value" }, `${serializeValue}`)),
|
|
61
61
|
React.createElement("div", { className: "filter-item__close-btn", onClick: e => {
|
|
62
62
|
e.stopPropagation();
|
|
63
63
|
if (onClickRemove) {
|
|
@@ -107,6 +107,17 @@ export const DataTableTest = () => {
|
|
|
107
107
|
},
|
|
108
108
|
},
|
|
109
109
|
},
|
|
110
|
+
formatFilterValue: {
|
|
111
|
+
matches(value) {
|
|
112
|
+
return Array.isArray(value) && value.map(item => item.key).join(',');
|
|
113
|
+
},
|
|
114
|
+
matches_any(value) {
|
|
115
|
+
return Array.isArray(value) && value.map(item => item.key).join(',');
|
|
116
|
+
},
|
|
117
|
+
not_matches(value) {
|
|
118
|
+
return Array.isArray(value) && value.map(item => item.key).join(',');
|
|
119
|
+
},
|
|
120
|
+
},
|
|
110
121
|
},
|
|
111
122
|
});
|
|
112
123
|
return (React.createElement(BrowserRouter, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antscorp/antsomi-ui",
|
|
3
|
-
"version": "1.3.5-beta.
|
|
3
|
+
"version": "1.3.5-beta.484",
|
|
4
4
|
"description": "An enterprise-class UI design language and React UI library.",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"dist/*",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"unpkg": "dist/index.js",
|
|
20
20
|
"types": "es/index.d.ts",
|
|
21
21
|
"scripts": {
|
|
22
|
-
"prepublishOnly": "yarn && yarn build:es && git commit -am \"chore: update antsomi-ui version\" && git push",
|
|
23
22
|
"build:es": "npm run clean && npm run copy-files && npm run ts-compile",
|
|
24
23
|
"clean": "rimraf dist lib es",
|
|
25
24
|
"dev": "vite",
|