@react-fabric/searchbar 1.0.0-beta.60 → 1.0.0-beta.61
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/cjs/filterbar/FilterBar.js +7 -7
- package/dist/cjs/filterbar/FilterForm.js +3 -2
- package/dist/cjs/filterbar/FilterMenu.js +3 -3
- package/dist/cjs/filterbar/FilterTag.js +2 -2
- package/dist/cjs/filterbar/QueryForm.js +2 -1
- package/dist/esm/filterbar/FilterBar.js +8 -8
- package/dist/esm/filterbar/FilterForm.js +3 -2
- package/dist/esm/filterbar/FilterMenu.js +4 -4
- package/dist/esm/filterbar/FilterTag.js +3 -3
- package/dist/esm/filterbar/QueryForm.js +2 -1
- package/package.json +8 -7
- package/src/filterbar/FilterBar.tsx +7 -8
- package/src/filterbar/FilterForm.tsx +3 -2
- package/src/filterbar/FilterMenu.tsx +4 -4
- package/src/filterbar/FilterTag.tsx +5 -3
- package/src/filterbar/QueryForm.tsx +2 -1
|
@@ -4,12 +4,12 @@ var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
|
4
4
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
5
5
|
var core = require('@react-fabric/core');
|
|
6
6
|
var utilities = require('@react-fabric/utilities');
|
|
7
|
+
var classNames = require('classnames');
|
|
7
8
|
var react = require('react');
|
|
8
9
|
var reactI18next = require('react-i18next');
|
|
10
|
+
var Context = require('./Context.js');
|
|
9
11
|
var FilterEdit = require('./FilterEdit.js');
|
|
10
12
|
var FilterTag = require('./FilterTag.js');
|
|
11
|
-
var classNames = require('classnames');
|
|
12
|
-
var Context = require('./Context.js');
|
|
13
13
|
var jsxRuntime = require('react/jsx-runtime');
|
|
14
14
|
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -88,7 +88,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
88
88
|
showArrow: true,
|
|
89
89
|
disabled: utilities.isEmpty(filters),
|
|
90
90
|
children: [/*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
91
|
-
icon:
|
|
91
|
+
icon: "icon-[mdi--cog-outline]",
|
|
92
92
|
className: classNames(utilities.isEmpty(filters) && "pointer-events-none opacity-30"),
|
|
93
93
|
color: !utilities.isEmpty(filters) ? "primary" : undefined
|
|
94
94
|
}), /*#__PURE__*/jsxRuntime.jsxs(core.Menu, {
|
|
@@ -101,7 +101,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
101
101
|
id: "disableAll",
|
|
102
102
|
label: t("label.disableAll")
|
|
103
103
|
}), /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
104
|
-
icon:
|
|
104
|
+
icon: "icon-[mdi--checkbox-intermediate-variant]",
|
|
105
105
|
id: "toggleDisable",
|
|
106
106
|
label: t("label.toggleDisable")
|
|
107
107
|
}), /*#__PURE__*/jsxRuntime.jsx(core.Divider, {}), menuItems.someExcluded && /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
@@ -112,12 +112,12 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
112
112
|
label: t("label.excludeAll")
|
|
113
113
|
}), /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
114
114
|
id: "invertAll",
|
|
115
|
-
icon:
|
|
115
|
+
icon: "icon-[mdi--set-left]",
|
|
116
116
|
label: t("label.invertAll")
|
|
117
117
|
}), /*#__PURE__*/jsxRuntime.jsx(core.Divider, {}), /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
118
118
|
id: "removeAll",
|
|
119
119
|
color: "danger",
|
|
120
|
-
icon:
|
|
120
|
+
icon: "icon-[mdi--minus-circle-outline]",
|
|
121
121
|
label: t("label.removeAll"),
|
|
122
122
|
disabled: !menuItems.canRemoveAll
|
|
123
123
|
})]
|
|
@@ -140,7 +140,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
140
140
|
children: [/*#__PURE__*/jsxRuntime.jsx(core.Chip, {
|
|
141
141
|
size: "sm",
|
|
142
142
|
className: "outline-dashed! outline-tint-400!",
|
|
143
|
-
icon:
|
|
143
|
+
icon: "icon-[mdi--plus-circle-outline]",
|
|
144
144
|
children: t("label.add")
|
|
145
145
|
}), /*#__PURE__*/jsxRuntime.jsx(FilterEdit.FilterEdit, {
|
|
146
146
|
onChange: handleChange
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
|
|
4
4
|
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
|
|
5
5
|
var react = require('@floating-ui/react');
|
|
6
|
+
var yup = require('@hookform/resolvers/yup');
|
|
6
7
|
var core = require('@react-fabric/core');
|
|
7
8
|
var form = require('@react-fabric/form');
|
|
8
9
|
var utilities = require('@react-fabric/utilities');
|
|
@@ -17,7 +18,7 @@ var FilterSchema = new utilities.yup.ObjectSchema({
|
|
|
17
18
|
field: utilities.yup.string().required(),
|
|
18
19
|
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
19
20
|
operator: utilities.yup.string().required().oneOf(Object.values(index.OPERATOR)),
|
|
20
|
-
negate: utilities.yup["boolean"](),
|
|
21
|
+
negate: utilities.yup["boolean"]().optional(),
|
|
21
22
|
label: utilities.yup.string(),
|
|
22
23
|
value: utilities.yup.mixed().when("operator", {
|
|
23
24
|
is: index.OPERATOR.EXISTS,
|
|
@@ -299,7 +300,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
299
300
|
}, [field, onChange]);
|
|
300
301
|
return /*#__PURE__*/jsxRuntime.jsx(form.Form, {
|
|
301
302
|
formRef: formRef,
|
|
302
|
-
|
|
303
|
+
resolver: yup.yupResolver(FilterSchema),
|
|
303
304
|
defaultValues: values,
|
|
304
305
|
onChange: setValues,
|
|
305
306
|
onSubmit: handleSubmit,
|
|
@@ -36,14 +36,14 @@ var FilterMenu = function FilterMenu(_ref) {
|
|
|
36
36
|
}) : /*#__PURE__*/jsxRuntime.jsxs(core.Menu, {
|
|
37
37
|
className: "text-sm",
|
|
38
38
|
children: [editable && filter.canEdit !== false ? /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
39
|
-
icon:
|
|
39
|
+
icon: "icon-[mdi--lead-pencil]",
|
|
40
40
|
label: t("label.edit"),
|
|
41
41
|
"data-dropdown-dismiss": "false",
|
|
42
42
|
onClick: function onClick() {
|
|
43
43
|
setView("edit");
|
|
44
44
|
}
|
|
45
45
|
}) : /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
46
|
-
icon:
|
|
46
|
+
icon: "icon-[mdi--eye]",
|
|
47
47
|
label: t("label.view"),
|
|
48
48
|
"data-dropdown-dismiss": "false",
|
|
49
49
|
onClick: function onClick() {
|
|
@@ -80,7 +80,7 @@ var FilterMenu = function FilterMenu(_ref) {
|
|
|
80
80
|
}
|
|
81
81
|
}), !filter.required && /*#__PURE__*/jsxRuntime.jsx(core.Divider, {}), !filter.required && /*#__PURE__*/jsxRuntime.jsx(core.MenuItem, {
|
|
82
82
|
color: "danger",
|
|
83
|
-
icon:
|
|
83
|
+
icon: "icon-[mdi--minus-circle-outline]",
|
|
84
84
|
label: t("label.remove"),
|
|
85
85
|
onClick: function onClick() {
|
|
86
86
|
return onRemove();
|
|
@@ -57,7 +57,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
57
57
|
}, [filter, includedColor, excludedColor]);
|
|
58
58
|
var icon = react.useMemo(function () {
|
|
59
59
|
if (filter.canDisable === false) return undefined;
|
|
60
|
-
return filter.disabled ?
|
|
60
|
+
return filter.disabled ? "icon-[mdi--checkbox-blank-outline]" : "icon-[mdi--checkbox-marked]";
|
|
61
61
|
}, [filter]);
|
|
62
62
|
return /*#__PURE__*/jsxRuntime.jsxs(core.Dropdown, {
|
|
63
63
|
showArrow: true,
|
|
@@ -85,7 +85,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
85
85
|
className: classNames("flex gap-1 items-center", filter.disabled && "line-through opacity-65"),
|
|
86
86
|
children: [filter.pinned && /*#__PURE__*/jsxRuntime.jsx(core.Icon, {
|
|
87
87
|
className: "flex-content",
|
|
88
|
-
icon: (_filter$icon = filter.icon) !== null && _filter$icon !== void 0 ? _filter$icon :
|
|
88
|
+
icon: (_filter$icon = filter.icon) !== null && _filter$icon !== void 0 ? _filter$icon : "icon-[mdi--pin]"
|
|
89
89
|
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
90
90
|
className: "truncate flex gap-x-0.5 flex-nowrap",
|
|
91
91
|
children: label
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var _defineProperty = require('@babel/runtime/helpers/defineProperty');
|
|
4
4
|
var _objectWithoutProperties = require('@babel/runtime/helpers/objectWithoutProperties');
|
|
5
5
|
var react = require('@floating-ui/react');
|
|
6
|
+
var yup = require('@hookform/resolvers/yup');
|
|
6
7
|
var core = require('@react-fabric/core');
|
|
7
8
|
var form = require('@react-fabric/form');
|
|
8
9
|
var monaco = require('@react-fabric/monaco');
|
|
@@ -69,7 +70,7 @@ var QueryForm = function QueryForm(_ref) {
|
|
|
69
70
|
tree === null || tree === void 0 || tree.events.emit("close");
|
|
70
71
|
}, [onChange]);
|
|
71
72
|
return /*#__PURE__*/jsxRuntime.jsxs(form.Form, {
|
|
72
|
-
|
|
73
|
+
resolver: yup.yupResolver(QuerySchema),
|
|
73
74
|
defaultValues: filterValue,
|
|
74
75
|
onSubmit: handleSubmit,
|
|
75
76
|
children: [/*#__PURE__*/jsxRuntime.jsx(core.Callout, {
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
5
|
-
import { Dropdown, Icon,
|
|
5
|
+
import { Dropdown, Icon, Menu, MenuItem, Divider, Chip } from '@react-fabric/core';
|
|
6
6
|
import { isNil, isEmpty } from '@react-fabric/utilities';
|
|
7
|
+
import classNames from 'classnames';
|
|
7
8
|
import { useCallback, useMemo } from 'react';
|
|
8
9
|
import { useTranslation } from 'react-i18next';
|
|
10
|
+
import { FilterContext } from './Context.js';
|
|
9
11
|
import { FilterEdit } from './FilterEdit.js';
|
|
10
12
|
import { FilterTag } from './FilterTag.js';
|
|
11
|
-
import classNames from 'classnames';
|
|
12
|
-
import { FilterContext } from './Context.js';
|
|
13
13
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
14
14
|
|
|
15
15
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
@@ -88,7 +88,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
88
88
|
showArrow: true,
|
|
89
89
|
disabled: isEmpty(filters),
|
|
90
90
|
children: [/*#__PURE__*/jsx(Icon, {
|
|
91
|
-
icon:
|
|
91
|
+
icon: "icon-[mdi--cog-outline]",
|
|
92
92
|
className: classNames(isEmpty(filters) && "pointer-events-none opacity-30"),
|
|
93
93
|
color: !isEmpty(filters) ? "primary" : undefined
|
|
94
94
|
}), /*#__PURE__*/jsxs(Menu, {
|
|
@@ -101,7 +101,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
101
101
|
id: "disableAll",
|
|
102
102
|
label: t("label.disableAll")
|
|
103
103
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
104
|
-
icon:
|
|
104
|
+
icon: "icon-[mdi--checkbox-intermediate-variant]",
|
|
105
105
|
id: "toggleDisable",
|
|
106
106
|
label: t("label.toggleDisable")
|
|
107
107
|
}), /*#__PURE__*/jsx(Divider, {}), menuItems.someExcluded && /*#__PURE__*/jsx(MenuItem, {
|
|
@@ -112,12 +112,12 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
112
112
|
label: t("label.excludeAll")
|
|
113
113
|
}), /*#__PURE__*/jsx(MenuItem, {
|
|
114
114
|
id: "invertAll",
|
|
115
|
-
icon:
|
|
115
|
+
icon: "icon-[mdi--set-left]",
|
|
116
116
|
label: t("label.invertAll")
|
|
117
117
|
}), /*#__PURE__*/jsx(Divider, {}), /*#__PURE__*/jsx(MenuItem, {
|
|
118
118
|
id: "removeAll",
|
|
119
119
|
color: "danger",
|
|
120
|
-
icon:
|
|
120
|
+
icon: "icon-[mdi--minus-circle-outline]",
|
|
121
121
|
label: t("label.removeAll"),
|
|
122
122
|
disabled: !menuItems.canRemoveAll
|
|
123
123
|
})]
|
|
@@ -140,7 +140,7 @@ var FilterBar = function FilterBar(_ref) {
|
|
|
140
140
|
children: [/*#__PURE__*/jsx(Chip, {
|
|
141
141
|
size: "sm",
|
|
142
142
|
className: "outline-dashed! outline-tint-400!",
|
|
143
|
-
icon:
|
|
143
|
+
icon: "icon-[mdi--plus-circle-outline]",
|
|
144
144
|
children: t("label.add")
|
|
145
145
|
}), /*#__PURE__*/jsx(FilterEdit, {
|
|
146
146
|
onChange: handleChange
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
5
|
import { useFloatingTree } from '@floating-ui/react';
|
|
6
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
7
|
import { Row, Col, Button } from '@react-fabric/core';
|
|
7
8
|
import { Field, Controller, Switch, Select, Input, Textarea, Number, DateInput, Form } from '@react-fabric/form';
|
|
8
9
|
import { yup, shortHash, isArray } from '@react-fabric/utilities';
|
|
@@ -17,7 +18,7 @@ var FilterSchema = new yup.ObjectSchema({
|
|
|
17
18
|
field: yup.string().required(),
|
|
18
19
|
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
19
20
|
operator: yup.string().required().oneOf(Object.values(OPERATOR)),
|
|
20
|
-
negate: yup["boolean"](),
|
|
21
|
+
negate: yup["boolean"]().optional(),
|
|
21
22
|
label: yup.string(),
|
|
22
23
|
value: yup.mixed().when("operator", {
|
|
23
24
|
is: OPERATOR.EXISTS,
|
|
@@ -299,7 +300,7 @@ var FilterForm = function FilterForm(_ref) {
|
|
|
299
300
|
}, [field, onChange]);
|
|
300
301
|
return /*#__PURE__*/jsx(Form, {
|
|
301
302
|
formRef: formRef,
|
|
302
|
-
|
|
303
|
+
resolver: yupResolver(FilterSchema),
|
|
303
304
|
defaultValues: values,
|
|
304
305
|
onChange: setValues,
|
|
305
306
|
onSubmit: handleSubmit,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
5
|
-
import { Menu, MenuItem,
|
|
5
|
+
import { Menu, MenuItem, Divider } from '@react-fabric/core';
|
|
6
6
|
import { useState } from 'react';
|
|
7
7
|
import { useTranslation } from 'react-i18next';
|
|
8
8
|
import { OPERATOR } from '../types/index.js';
|
|
@@ -36,14 +36,14 @@ var FilterMenu = function FilterMenu(_ref) {
|
|
|
36
36
|
}) : /*#__PURE__*/jsxs(Menu, {
|
|
37
37
|
className: "text-sm",
|
|
38
38
|
children: [editable && filter.canEdit !== false ? /*#__PURE__*/jsx(MenuItem, {
|
|
39
|
-
icon:
|
|
39
|
+
icon: "icon-[mdi--lead-pencil]",
|
|
40
40
|
label: t("label.edit"),
|
|
41
41
|
"data-dropdown-dismiss": "false",
|
|
42
42
|
onClick: function onClick() {
|
|
43
43
|
setView("edit");
|
|
44
44
|
}
|
|
45
45
|
}) : /*#__PURE__*/jsx(MenuItem, {
|
|
46
|
-
icon:
|
|
46
|
+
icon: "icon-[mdi--eye]",
|
|
47
47
|
label: t("label.view"),
|
|
48
48
|
"data-dropdown-dismiss": "false",
|
|
49
49
|
onClick: function onClick() {
|
|
@@ -80,7 +80,7 @@ var FilterMenu = function FilterMenu(_ref) {
|
|
|
80
80
|
}
|
|
81
81
|
}), !filter.required && /*#__PURE__*/jsx(Divider, {}), !filter.required && /*#__PURE__*/jsx(MenuItem, {
|
|
82
82
|
color: "danger",
|
|
83
|
-
icon:
|
|
83
|
+
icon: "icon-[mdi--minus-circle-outline]",
|
|
84
84
|
label: t("label.remove"),
|
|
85
85
|
onClick: function onClick() {
|
|
86
86
|
return onRemove();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
|
-
import {
|
|
4
|
+
import { Dropdown, Chip, Icon } from '@react-fabric/core';
|
|
5
5
|
import { isNil } from '@react-fabric/utilities';
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { useMemo, Fragment } from 'react';
|
|
@@ -57,7 +57,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
57
57
|
}, [filter, includedColor, excludedColor]);
|
|
58
58
|
var icon = useMemo(function () {
|
|
59
59
|
if (filter.canDisable === false) return undefined;
|
|
60
|
-
return filter.disabled ?
|
|
60
|
+
return filter.disabled ? "icon-[mdi--checkbox-blank-outline]" : "icon-[mdi--checkbox-marked]";
|
|
61
61
|
}, [filter]);
|
|
62
62
|
return /*#__PURE__*/jsxs(Dropdown, {
|
|
63
63
|
showArrow: true,
|
|
@@ -85,7 +85,7 @@ var FilterTag = function FilterTag(_ref) {
|
|
|
85
85
|
className: classNames("flex gap-1 items-center", filter.disabled && "line-through opacity-65"),
|
|
86
86
|
children: [filter.pinned && /*#__PURE__*/jsx(Icon, {
|
|
87
87
|
className: "flex-content",
|
|
88
|
-
icon: (_filter$icon = filter.icon) !== null && _filter$icon !== void 0 ? _filter$icon :
|
|
88
|
+
icon: (_filter$icon = filter.icon) !== null && _filter$icon !== void 0 ? _filter$icon : "icon-[mdi--pin]"
|
|
89
89
|
}), /*#__PURE__*/jsx("div", {
|
|
90
90
|
className: "truncate flex gap-x-0.5 flex-nowrap",
|
|
91
91
|
children: label
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
4
4
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
5
5
|
import { useFloatingTree } from '@floating-ui/react';
|
|
6
|
+
import { yupResolver } from '@hookform/resolvers/yup';
|
|
6
7
|
import { Callout, Button } from '@react-fabric/core';
|
|
7
8
|
import { Form, Controller, Input } from '@react-fabric/form';
|
|
8
9
|
import { CodeEditor } from '@react-fabric/monaco';
|
|
@@ -69,7 +70,7 @@ var QueryForm = function QueryForm(_ref) {
|
|
|
69
70
|
tree === null || tree === void 0 || tree.events.emit("close");
|
|
70
71
|
}, [onChange]);
|
|
71
72
|
return /*#__PURE__*/jsxs(Form, {
|
|
72
|
-
|
|
73
|
+
resolver: yupResolver(QuerySchema),
|
|
73
74
|
defaultValues: filterValue,
|
|
74
75
|
onSubmit: handleSubmit,
|
|
75
76
|
children: [/*#__PURE__*/jsx(Callout, {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-fabric/searchbar",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.61",
|
|
4
4
|
"description": "RUF: Searchbar with filters package",
|
|
5
5
|
"author": "Adarsh Pastakia <adarshpastakia@outlook.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,10 +34,11 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@floating-ui/react": "~0.27.16",
|
|
37
|
-
"@
|
|
38
|
-
"@react-fabric/
|
|
39
|
-
"@react-fabric/
|
|
40
|
-
"@react-fabric/
|
|
37
|
+
"@hookform/resolvers": "~5.2.2",
|
|
38
|
+
"@react-fabric/core": "^1.0.0-beta.61",
|
|
39
|
+
"@react-fabric/form": "^1.0.0-beta.61",
|
|
40
|
+
"@react-fabric/monaco": "^1.0.0-beta.61",
|
|
41
|
+
"@react-fabric/utilities": "^1.0.0-beta.61",
|
|
41
42
|
"classnames": "~2.5.1",
|
|
42
43
|
"react-hook-form": "~7.65.0"
|
|
43
44
|
},
|
|
@@ -48,11 +49,11 @@
|
|
|
48
49
|
"react-i18next": "~16.2.1"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
|
-
"@react-fabric/superdate": "^1.0.0-beta.
|
|
52
|
+
"@react-fabric/superdate": "^1.0.0-beta.61"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
|
54
55
|
"node": ">=18.12.0",
|
|
55
56
|
"npm": ">=8.19.0"
|
|
56
57
|
},
|
|
57
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "a0b0c571bf9c189fa3355bbc3b896ecc4b9d6a04"
|
|
58
59
|
}
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
|
|
24
24
|
import {
|
|
25
25
|
Chip,
|
|
26
|
-
CoreIcons,
|
|
27
26
|
Divider,
|
|
28
27
|
Dropdown,
|
|
29
28
|
Icon,
|
|
@@ -31,13 +30,13 @@ import {
|
|
|
31
30
|
MenuItem,
|
|
32
31
|
} from "@react-fabric/core";
|
|
33
32
|
import { isEmpty, isNil } from "@react-fabric/utilities";
|
|
33
|
+
import classNames from "classnames";
|
|
34
34
|
import { useCallback, useMemo } from "react";
|
|
35
35
|
import { useTranslation } from "react-i18next";
|
|
36
36
|
import { type FilterBarProps, type FilterObject } from "../types";
|
|
37
|
+
import { FilterContext } from "./Context";
|
|
37
38
|
import { FilterEdit } from "./FilterEdit";
|
|
38
39
|
import { FilterTag } from "./FilterTag";
|
|
39
|
-
import classNames from "classnames";
|
|
40
|
-
import { FilterContext } from "./Context";
|
|
41
40
|
|
|
42
41
|
/**
|
|
43
42
|
* FilterBar component allows users to manage a list of filters.
|
|
@@ -168,7 +167,7 @@ export const FilterBar = ({
|
|
|
168
167
|
<div className="flex flex-wrap gap-1 items-center">
|
|
169
168
|
<Dropdown showArrow disabled={isEmpty(filters)}>
|
|
170
169
|
<Icon
|
|
171
|
-
icon=
|
|
170
|
+
icon="icon-[mdi--cog-outline]"
|
|
172
171
|
className={classNames(
|
|
173
172
|
isEmpty(filters) && "pointer-events-none opacity-30",
|
|
174
173
|
)}
|
|
@@ -182,7 +181,7 @@ export const FilterBar = ({
|
|
|
182
181
|
<MenuItem id="disableAll" label={t("label.disableAll")} />
|
|
183
182
|
)}
|
|
184
183
|
<MenuItem
|
|
185
|
-
icon=
|
|
184
|
+
icon="icon-[mdi--checkbox-intermediate-variant]"
|
|
186
185
|
id="toggleDisable"
|
|
187
186
|
label={t("label.toggleDisable")}
|
|
188
187
|
/>
|
|
@@ -195,14 +194,14 @@ export const FilterBar = ({
|
|
|
195
194
|
)}
|
|
196
195
|
<MenuItem
|
|
197
196
|
id="invertAll"
|
|
198
|
-
icon=
|
|
197
|
+
icon="icon-[mdi--set-left]"
|
|
199
198
|
label={t("label.invertAll")}
|
|
200
199
|
/>
|
|
201
200
|
<Divider />
|
|
202
201
|
<MenuItem
|
|
203
202
|
id="removeAll"
|
|
204
203
|
color="danger"
|
|
205
|
-
icon=
|
|
204
|
+
icon="icon-[mdi--minus-circle-outline]"
|
|
206
205
|
label={t("label.removeAll")}
|
|
207
206
|
disabled={!menuItems.canRemoveAll}
|
|
208
207
|
/>
|
|
@@ -224,7 +223,7 @@ export const FilterBar = ({
|
|
|
224
223
|
<Chip
|
|
225
224
|
size="sm"
|
|
226
225
|
className="outline-dashed! outline-tint-400!"
|
|
227
|
-
icon=
|
|
226
|
+
icon="icon-[mdi--plus-circle-outline]"
|
|
228
227
|
>
|
|
229
228
|
{t("label.add")}
|
|
230
229
|
</Chip>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
25
26
|
import { Button, Col, Row } from "@react-fabric/core";
|
|
26
27
|
import {
|
|
27
28
|
Controller,
|
|
@@ -52,7 +53,7 @@ const FilterSchema = new yup.ObjectSchema({
|
|
|
52
53
|
field: yup.string().required(),
|
|
53
54
|
// type: yup.string().oneOf(Object.values(FIELD_TYPE)),
|
|
54
55
|
operator: yup.string().required().oneOf(Object.values(OPERATOR)),
|
|
55
|
-
negate: yup.boolean(),
|
|
56
|
+
negate: yup.boolean().optional(),
|
|
56
57
|
label: yup.string(),
|
|
57
58
|
value: yup
|
|
58
59
|
.mixed()
|
|
@@ -307,7 +308,7 @@ export const FilterForm = ({
|
|
|
307
308
|
return (
|
|
308
309
|
<Form<FilterSchemaType>
|
|
309
310
|
formRef={formRef}
|
|
310
|
-
|
|
311
|
+
resolver={yupResolver(FilterSchema) as any}
|
|
311
312
|
defaultValues={values}
|
|
312
313
|
onChange={setValues}
|
|
313
314
|
onSubmit={handleSubmit}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import {
|
|
24
|
+
import { Divider, Menu, MenuItem } from "@react-fabric/core";
|
|
25
25
|
import { useState } from "react";
|
|
26
26
|
import { useTranslation } from "react-i18next";
|
|
27
27
|
import { OPERATOR, type FilterField, type FilterObject } from "../types";
|
|
@@ -57,7 +57,7 @@ export const FilterMenu = ({
|
|
|
57
57
|
<Menu className="text-sm">
|
|
58
58
|
{editable && filter.canEdit !== false ? (
|
|
59
59
|
<MenuItem
|
|
60
|
-
icon=
|
|
60
|
+
icon="icon-[mdi--lead-pencil]"
|
|
61
61
|
label={t("label.edit")}
|
|
62
62
|
data-dropdown-dismiss="false"
|
|
63
63
|
onClick={() => {
|
|
@@ -66,7 +66,7 @@ export const FilterMenu = ({
|
|
|
66
66
|
/>
|
|
67
67
|
) : (
|
|
68
68
|
<MenuItem
|
|
69
|
-
icon=
|
|
69
|
+
icon="icon-[mdi--eye]"
|
|
70
70
|
label={t("label.view")}
|
|
71
71
|
data-dropdown-dismiss="false"
|
|
72
72
|
onClick={() => {
|
|
@@ -117,7 +117,7 @@ export const FilterMenu = ({
|
|
|
117
117
|
{!filter.required && (
|
|
118
118
|
<MenuItem
|
|
119
119
|
color="danger"
|
|
120
|
-
icon=
|
|
120
|
+
icon="icon-[mdi--minus-circle-outline]"
|
|
121
121
|
label={t("label.remove")}
|
|
122
122
|
onClick={() => onRemove()}
|
|
123
123
|
/>
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
|
-
import { Chip,
|
|
24
|
+
import { Chip, Dropdown, Icon } from "@react-fabric/core";
|
|
25
25
|
import { isNil } from "@react-fabric/utilities";
|
|
26
26
|
import classNames from "classnames";
|
|
27
27
|
import { Fragment, useMemo } from "react";
|
|
@@ -82,7 +82,9 @@ export const FilterTag = ({
|
|
|
82
82
|
|
|
83
83
|
const icon = useMemo(() => {
|
|
84
84
|
if (filter.canDisable === false) return undefined;
|
|
85
|
-
return filter.disabled
|
|
85
|
+
return filter.disabled
|
|
86
|
+
? "icon-[mdi--checkbox-blank-outline]"
|
|
87
|
+
: "icon-[mdi--checkbox-marked]";
|
|
86
88
|
}, [filter]);
|
|
87
89
|
|
|
88
90
|
return (
|
|
@@ -114,7 +116,7 @@ export const FilterTag = ({
|
|
|
114
116
|
{filter.pinned && (
|
|
115
117
|
<Icon
|
|
116
118
|
className="flex-content"
|
|
117
|
-
icon={filter.icon ??
|
|
119
|
+
icon={filter.icon ?? "icon-[mdi--pin]"}
|
|
118
120
|
/>
|
|
119
121
|
)}
|
|
120
122
|
<div className="truncate flex gap-x-0.5 flex-nowrap">{label}</div>
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
|
|
24
24
|
import { useFloatingTree } from "@floating-ui/react";
|
|
25
|
+
import { yupResolver } from "@hookform/resolvers/yup";
|
|
25
26
|
import { Button, Callout } from "@react-fabric/core";
|
|
26
27
|
import { Controller, Form, Input } from "@react-fabric/form";
|
|
27
28
|
import { CodeEditor } from "@react-fabric/monaco";
|
|
@@ -98,7 +99,7 @@ export const QueryForm = ({
|
|
|
98
99
|
|
|
99
100
|
return (
|
|
100
101
|
<Form<QuerySchemaType>
|
|
101
|
-
|
|
102
|
+
resolver={yupResolver(QuerySchema)}
|
|
102
103
|
defaultValues={filterValue}
|
|
103
104
|
onSubmit={handleSubmit}
|
|
104
105
|
>
|