@stenajs-webui/filter 17.13.2 → 17.13.3
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.es.js
CHANGED
|
@@ -1,497 +1,493 @@
|
|
|
1
|
-
(function(){ try
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
(function(){"use strict";try{var e=document.createElement("style");e.appendChild(document.createTextNode("")),document.head.appendChild(e)}catch(t){console.error("vite-plugin-css-injected-by-js",t)}})();
|
|
2
|
+
import { createContext as b, useContext as E, useCallback as u, useState as R, useReducer as U, useMemo as v } from "react";
|
|
3
|
+
import { Drawer as X } from "@stenajs-webui/modal";
|
|
4
|
+
import { cssColor as H } from "@stenajs-webui/theme";
|
|
5
|
+
import { Row as M, Indent as Z, Heading as _, Column as T, SeparatorLine as N, truthyKeysAsList as j, Text as ee, Box as A } from "@stenajs-webui/core";
|
|
6
|
+
import { Icon as te, SecondaryButton as $, stenaTimes as ne, stenaSliders as z, Spinner as re, Banner as oe, FlatButton as D, Chip as q } from "@stenajs-webui/elements";
|
|
7
|
+
import { jsxs as L, jsx as c, Fragment as ce } from "react/jsx-runtime";
|
|
8
|
+
import { Collapsible as se, CollapsibleContent as P, CollapsibleClickableContent as ie } from "@stenajs-webui/panels";
|
|
9
|
+
import { upperFirst as le, lowerCase as ae } from "lodash";
|
|
10
|
+
import { combineReducers as de } from "redux";
|
|
11
|
+
import { reducerIdGate as k, createValueByIdReducer as ue, createEntityReducer as V, reducerIdGateAction as C, createEntityActions as g, createValueByIdActions as w } from "@stenajs-webui/redux";
|
|
12
|
+
import he from "@emotion/styled";
|
|
13
|
+
import { Checkbox as pe } from "@stenajs-webui/forms";
|
|
14
|
+
import { ChipMultiSelect as Ce } from "@stenajs-webui/select";
|
|
15
|
+
import { stringsToDateRange as Se, dateRangeToStrings as fe, DateRangeCalendar as me } from "@stenajs-webui/calendar";
|
|
16
|
+
const Fe = ({
|
|
17
|
+
onRequestClose: e,
|
|
18
|
+
header: t = "Filters",
|
|
19
|
+
headerIcon: n = z
|
|
20
|
+
}) => /* @__PURE__ */ L(M, {
|
|
21
|
+
height: "56px",
|
|
22
|
+
justifyContent: "space-between",
|
|
23
|
+
alignItems: "center",
|
|
24
|
+
indent: 2,
|
|
25
|
+
children: [/* @__PURE__ */ L(M, {
|
|
23
26
|
alignItems: "center",
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}), /* @__PURE__ */ jsx(Indent, {}), /* @__PURE__ */ jsx(Heading, {
|
|
32
|
-
variant: "h4",
|
|
33
|
-
children: header
|
|
34
|
-
})]
|
|
35
|
-
}), /* @__PURE__ */ jsx(SecondaryButton, {
|
|
36
|
-
leftIcon: stenaTimes,
|
|
37
|
-
onClick: onRequestClose
|
|
27
|
+
children: [/* @__PURE__ */ c(te, {
|
|
28
|
+
icon: n,
|
|
29
|
+
color: H("--lhds-color-ui-800"),
|
|
30
|
+
size: 24
|
|
31
|
+
}), /* @__PURE__ */ c(Z, {}), /* @__PURE__ */ c(_, {
|
|
32
|
+
variant: "h4",
|
|
33
|
+
children: t
|
|
38
34
|
})]
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
if (!
|
|
35
|
+
}), /* @__PURE__ */ c($, {
|
|
36
|
+
leftIcon: ne,
|
|
37
|
+
onClick: e
|
|
38
|
+
})]
|
|
39
|
+
}), G = b(null), I = () => {
|
|
40
|
+
const e = E(G);
|
|
41
|
+
if (!e)
|
|
42
|
+
throw new Error(
|
|
43
|
+
"Missing search filter context, wrap components with SearchFilterContext component."
|
|
44
|
+
);
|
|
45
|
+
return e;
|
|
46
|
+
}, K = b(null), f = () => {
|
|
47
|
+
const e = E(K);
|
|
48
|
+
if (!e)
|
|
53
49
|
throw new Error("Missing search filter dispatch context.");
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const useSearchFilterActions = () => {
|
|
59
|
-
const c = useContext(SearchFilterActionsContext);
|
|
60
|
-
if (!c) {
|
|
50
|
+
return e;
|
|
51
|
+
}, W = b(null), m = () => {
|
|
52
|
+
const e = E(W);
|
|
53
|
+
if (!e)
|
|
61
54
|
throw new Error("Missing search filter actions context.");
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
headerIcon,
|
|
69
|
-
...drawerProps
|
|
55
|
+
return e;
|
|
56
|
+
}, Ye = ({
|
|
57
|
+
children: e,
|
|
58
|
+
header: t,
|
|
59
|
+
headerIcon: n,
|
|
60
|
+
...r
|
|
70
61
|
}) => {
|
|
71
62
|
const {
|
|
72
63
|
settings: {
|
|
73
|
-
open
|
|
64
|
+
open: o
|
|
74
65
|
}
|
|
75
|
-
} =
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}, [actions, dispatch]);
|
|
81
|
-
return /* @__PURE__ */ jsx(Drawer, {
|
|
82
|
-
background: cssColor("--lhds-color-ui-50"),
|
|
66
|
+
} = I(), s = f(), i = m(), a = u(() => {
|
|
67
|
+
s(i.closeFilters());
|
|
68
|
+
}, [i, s]);
|
|
69
|
+
return /* @__PURE__ */ c(X, {
|
|
70
|
+
background: H("--lhds-color-ui-50"),
|
|
83
71
|
width: "370px",
|
|
84
|
-
isOpen:
|
|
85
|
-
onRequestClose:
|
|
86
|
-
...
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
-
children: [/* @__PURE__ */
|
|
89
|
-
onRequestClose:
|
|
90
|
-
header,
|
|
91
|
-
headerIcon
|
|
92
|
-
}), /* @__PURE__ */
|
|
72
|
+
isOpen: o,
|
|
73
|
+
onRequestClose: a,
|
|
74
|
+
...r,
|
|
75
|
+
children: /* @__PURE__ */ L(T, {
|
|
76
|
+
children: [/* @__PURE__ */ c(Fe, {
|
|
77
|
+
onRequestClose: a,
|
|
78
|
+
header: t,
|
|
79
|
+
headerIcon: n
|
|
80
|
+
}), /* @__PURE__ */ c(N, {}), e]
|
|
93
81
|
})
|
|
94
82
|
});
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
leftIcon = stenaSliders
|
|
83
|
+
}, Je = ({
|
|
84
|
+
label: e = "Filters",
|
|
85
|
+
leftIcon: t = z
|
|
99
86
|
}) => {
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
leftIcon,
|
|
108
|
-
onClick: onClickButton
|
|
87
|
+
const n = f(), r = m(), o = u(() => {
|
|
88
|
+
n(r.openFilters());
|
|
89
|
+
}, [r, n]);
|
|
90
|
+
return /* @__PURE__ */ c($, {
|
|
91
|
+
label: e,
|
|
92
|
+
leftIcon: t,
|
|
93
|
+
onClick: o
|
|
109
94
|
});
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
children
|
|
95
|
+
}, y = function({
|
|
96
|
+
sectionId: t,
|
|
97
|
+
label: n,
|
|
98
|
+
contentLeft: r,
|
|
99
|
+
contentRight: o,
|
|
100
|
+
loading: s,
|
|
101
|
+
error: i,
|
|
102
|
+
onRetry: a,
|
|
103
|
+
disableContentPadding: S,
|
|
104
|
+
children: h
|
|
121
105
|
}) {
|
|
122
|
-
var
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
contentLeft,
|
|
136
|
-
contentRight,
|
|
137
|
-
children: loading ? /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
138
|
-
children: /* @__PURE__ */ jsx(Row, {
|
|
139
|
-
spacing: true,
|
|
106
|
+
var O;
|
|
107
|
+
const l = I(), p = f(), F = m(), x = (O = l.expandedSections.values[t]) != null ? O : !1, J = u(() => {
|
|
108
|
+
p(F.setSectionExpanded(t, !x));
|
|
109
|
+
}, [F, p, x, t]), Q = n != null ? n : xe(t);
|
|
110
|
+
return /* @__PURE__ */ c(se, {
|
|
111
|
+
label: Q,
|
|
112
|
+
collapsed: !x,
|
|
113
|
+
onClick: J,
|
|
114
|
+
contentLeft: r,
|
|
115
|
+
contentRight: o,
|
|
116
|
+
children: s ? /* @__PURE__ */ c(P, {
|
|
117
|
+
children: /* @__PURE__ */ c(M, {
|
|
118
|
+
spacing: !0,
|
|
140
119
|
justifyContent: "center",
|
|
141
120
|
flex: 1,
|
|
142
|
-
children: /* @__PURE__ */
|
|
121
|
+
children: /* @__PURE__ */ c(re, {
|
|
143
122
|
size: "small"
|
|
144
123
|
})
|
|
145
124
|
})
|
|
146
|
-
}) :
|
|
125
|
+
}) : i ? /* @__PURE__ */ c(oe, {
|
|
147
126
|
variant: "error",
|
|
148
|
-
text:
|
|
149
|
-
contentRight:
|
|
127
|
+
text: i,
|
|
128
|
+
contentRight: a ? /* @__PURE__ */ c(D, {
|
|
150
129
|
label: "Retry",
|
|
151
|
-
onClick:
|
|
130
|
+
onClick: a
|
|
152
131
|
}) : null
|
|
153
|
-
}) :
|
|
154
|
-
children
|
|
132
|
+
}) : S ? h : /* @__PURE__ */ c(P, {
|
|
133
|
+
children: h
|
|
155
134
|
})
|
|
156
135
|
});
|
|
157
|
-
}
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
dispatch,
|
|
170
|
-
actions,
|
|
171
|
-
children
|
|
136
|
+
}, xe = (e) => le(ae(e)), Y = b(null), Qe = () => {
|
|
137
|
+
const e = E(Y);
|
|
138
|
+
if (!e)
|
|
139
|
+
throw new Error(
|
|
140
|
+
"Missing search filter context, wrap components with SearchFilterContext component."
|
|
141
|
+
);
|
|
142
|
+
return e;
|
|
143
|
+
}, ge = function({
|
|
144
|
+
state: t,
|
|
145
|
+
dispatch: n,
|
|
146
|
+
actions: r,
|
|
147
|
+
children: o
|
|
172
148
|
}) {
|
|
173
|
-
return /* @__PURE__ */
|
|
174
|
-
value:
|
|
175
|
-
children: /* @__PURE__ */
|
|
176
|
-
value:
|
|
177
|
-
children: /* @__PURE__ */
|
|
178
|
-
value:
|
|
179
|
-
children: /* @__PURE__ */
|
|
180
|
-
value:
|
|
181
|
-
children
|
|
149
|
+
return /* @__PURE__ */ c(K.Provider, {
|
|
150
|
+
value: n,
|
|
151
|
+
children: /* @__PURE__ */ c(W.Provider, {
|
|
152
|
+
value: r,
|
|
153
|
+
children: /* @__PURE__ */ c(G.Provider, {
|
|
154
|
+
value: t,
|
|
155
|
+
children: /* @__PURE__ */ c(Y.Provider, {
|
|
156
|
+
value: t.formModel,
|
|
157
|
+
children: o
|
|
182
158
|
})
|
|
183
159
|
})
|
|
184
160
|
})
|
|
185
161
|
});
|
|
186
|
-
}
|
|
187
|
-
const createSearchFilterInitialState = (initialFormModel) => ({
|
|
162
|
+
}, we = (e) => ({
|
|
188
163
|
settings: {
|
|
189
|
-
open:
|
|
164
|
+
open: !1
|
|
190
165
|
},
|
|
191
|
-
formModel:
|
|
166
|
+
formModel: e,
|
|
192
167
|
expandedSections: { values: {} }
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
168
|
+
}), Re = (e, t) => de({
|
|
169
|
+
expandedSections: k(
|
|
170
|
+
d(e, "expandedSections"),
|
|
171
|
+
ue(t.expandedSections)
|
|
172
|
+
),
|
|
173
|
+
formModel: k(
|
|
174
|
+
d(e, "formModel"),
|
|
175
|
+
V(t.formModel)
|
|
176
|
+
),
|
|
177
|
+
settings: k(
|
|
178
|
+
d(e, "settings"),
|
|
179
|
+
V(t.settings)
|
|
180
|
+
)
|
|
181
|
+
}), ve = (e, t) => ({
|
|
182
|
+
openFilters: () => C(
|
|
183
|
+
d(e, "settings"),
|
|
184
|
+
g().setEntityFields({
|
|
185
|
+
open: !0
|
|
186
|
+
})
|
|
187
|
+
),
|
|
188
|
+
closeFilters: () => C(
|
|
189
|
+
d(e, "settings"),
|
|
190
|
+
g().setEntityFields({
|
|
191
|
+
open: !1
|
|
192
|
+
})
|
|
193
|
+
),
|
|
194
|
+
setFormModelFields: (n) => C(
|
|
195
|
+
d(e, "formModel"),
|
|
196
|
+
g().setEntityFields(n)
|
|
197
|
+
),
|
|
198
|
+
clearFormModel: () => C(
|
|
199
|
+
d(e, "formModel"),
|
|
200
|
+
g().setEntity(t)
|
|
201
|
+
),
|
|
202
|
+
expandSection: (n) => C(
|
|
203
|
+
d(e, "expandedSections"),
|
|
204
|
+
w().setValue(n, !0)
|
|
205
|
+
),
|
|
206
|
+
collapseSection: (n) => C(
|
|
207
|
+
d(e, "expandedSections"),
|
|
208
|
+
w().setValue(n, !1)
|
|
209
|
+
),
|
|
210
|
+
setSectionExpanded: (n, r) => C(
|
|
211
|
+
d(e, "expandedSections"),
|
|
212
|
+
w().setValue(n, r)
|
|
213
|
+
),
|
|
214
|
+
clearExpandedSections: () => C(
|
|
215
|
+
d(e, "expandedSections"),
|
|
216
|
+
w().clearAllValues()
|
|
217
|
+
)
|
|
218
|
+
}), d = (e, t) => `${e}.${t}`, Me = (e) => {
|
|
219
|
+
const [t] = R(
|
|
220
|
+
() => Re("local", e)
|
|
221
|
+
), [n] = R(
|
|
222
|
+
() => ve(
|
|
223
|
+
"local",
|
|
224
|
+
e.formModel
|
|
225
|
+
)
|
|
226
|
+
), [r, o] = U(t, e);
|
|
218
227
|
return {
|
|
219
|
-
actions,
|
|
220
|
-
state,
|
|
221
|
-
dispatch
|
|
228
|
+
actions: n,
|
|
229
|
+
state: r,
|
|
230
|
+
dispatch: o
|
|
222
231
|
};
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
children
|
|
232
|
+
}, Ue = function({
|
|
233
|
+
initialFormModel: t,
|
|
234
|
+
children: n
|
|
227
235
|
}) {
|
|
228
236
|
const {
|
|
229
|
-
state,
|
|
230
|
-
actions,
|
|
231
|
-
dispatch
|
|
232
|
-
} =
|
|
233
|
-
return /* @__PURE__ */
|
|
234
|
-
state,
|
|
235
|
-
actions,
|
|
236
|
-
dispatch,
|
|
237
|
-
children
|
|
237
|
+
state: r,
|
|
238
|
+
actions: o,
|
|
239
|
+
dispatch: s
|
|
240
|
+
} = Me(we(t));
|
|
241
|
+
return /* @__PURE__ */ c(ge, {
|
|
242
|
+
state: r,
|
|
243
|
+
actions: o,
|
|
244
|
+
dispatch: s,
|
|
245
|
+
children: n
|
|
238
246
|
});
|
|
239
|
-
}
|
|
240
|
-
const ChipSpacer = styled.div`
|
|
247
|
+
}, B = he.div`
|
|
241
248
|
padding: calc(var(--swui-metrics-spacing) / 2)
|
|
242
249
|
calc(var(--swui-metrics-indent) / 2);
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
disableClearAllButton = false
|
|
250
|
+
`, Xe = ({
|
|
251
|
+
children: e,
|
|
252
|
+
disableClearAllButton: t = !1
|
|
247
253
|
}) => {
|
|
248
|
-
const
|
|
249
|
-
|
|
250
|
-
const onClickClearAll = useCallback(() => dispatch(actions.clearFormModel()), [actions, dispatch]);
|
|
251
|
-
return /* @__PURE__ */ jsxs(Row, {
|
|
254
|
+
const n = f(), r = m(), o = u(() => n(r.clearFormModel()), [r, n]);
|
|
255
|
+
return /* @__PURE__ */ L(M, {
|
|
252
256
|
flexWrap: "wrap",
|
|
253
|
-
children: [
|
|
254
|
-
children: /* @__PURE__ */
|
|
257
|
+
children: [e, !t && /* @__PURE__ */ c(B, {
|
|
258
|
+
children: /* @__PURE__ */ c(D, {
|
|
255
259
|
size: "small",
|
|
256
260
|
label: "Clear all",
|
|
257
|
-
onClick:
|
|
261
|
+
onClick: o
|
|
258
262
|
})
|
|
259
263
|
})]
|
|
260
264
|
});
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
sectionId
|
|
265
|
+
}, Le = function({
|
|
266
|
+
label: t,
|
|
267
|
+
sectionId: n
|
|
265
268
|
}) {
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}, [actions, dispatch, sectionId]);
|
|
273
|
-
return /* @__PURE__ */ jsx(ChipSpacer, {
|
|
274
|
-
children: /* @__PURE__ */ jsx(Chip, {
|
|
275
|
-
label,
|
|
269
|
+
const r = f(), o = m(), s = u(() => {
|
|
270
|
+
r(o.clearExpandedSections()), r(o.expandSection(n)), r(o.openFilters());
|
|
271
|
+
}, [o, r, n]);
|
|
272
|
+
return /* @__PURE__ */ c(B, {
|
|
273
|
+
children: /* @__PURE__ */ c(q, {
|
|
274
|
+
label: t,
|
|
276
275
|
variant: "secondary",
|
|
277
|
-
onClick:
|
|
276
|
+
onClick: s
|
|
278
277
|
})
|
|
279
278
|
});
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
onClickRemove
|
|
279
|
+
}, be = function({
|
|
280
|
+
sectionId: t,
|
|
281
|
+
label: n,
|
|
282
|
+
value: r,
|
|
283
|
+
onClickRemove: o
|
|
286
284
|
}) {
|
|
287
|
-
const
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
onClickRemove == null ? void 0 : onClickRemove({
|
|
292
|
-
value,
|
|
293
|
-
setFormModelFields
|
|
285
|
+
const s = f(), i = m(), a = u((l) => s(i.setFormModelFields(l)), [s, i]), S = u(() => {
|
|
286
|
+
o == null || o({
|
|
287
|
+
value: r,
|
|
288
|
+
setFormModelFields: a
|
|
294
289
|
});
|
|
295
|
-
}, [
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
label: label != null ? label : sectionId,
|
|
304
|
-
onClick: onClickLabel,
|
|
305
|
-
onClickRemove: onClickRemove ? onClickRemoveHandler : void 0
|
|
290
|
+
}, [o, a, r]), h = u(() => {
|
|
291
|
+
s(i.clearExpandedSections()), s(i.expandSection(t)), s(i.openFilters());
|
|
292
|
+
}, [i, s, t]);
|
|
293
|
+
return /* @__PURE__ */ c(B, {
|
|
294
|
+
children: /* @__PURE__ */ c(q, {
|
|
295
|
+
label: n != null ? n : t,
|
|
296
|
+
onClick: h,
|
|
297
|
+
onClickRemove: o ? S : void 0
|
|
306
298
|
})
|
|
307
299
|
});
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
onClickRemoveOnChip
|
|
300
|
+
}, Ze = function({
|
|
301
|
+
sectionId: t,
|
|
302
|
+
chips: n,
|
|
303
|
+
emptyChipLabel: r,
|
|
304
|
+
onClickRemoveOnChip: o
|
|
314
305
|
}) {
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
306
|
+
return n != null && n.length ? /* @__PURE__ */ c(ce, {
|
|
307
|
+
children: n.map(({
|
|
308
|
+
label: s,
|
|
309
|
+
value: i
|
|
310
|
+
}) => /* @__PURE__ */ c(be, {
|
|
311
|
+
label: s != null ? s : t,
|
|
312
|
+
sectionId: t,
|
|
313
|
+
onClickRemove: o,
|
|
314
|
+
value: i
|
|
315
|
+
}, i))
|
|
316
|
+
}) : r ? /* @__PURE__ */ c(Le, {
|
|
317
|
+
sectionId: t,
|
|
318
|
+
label: r
|
|
319
|
+
}) : null;
|
|
320
|
+
}, _e = (e, t, n) => ({
|
|
321
|
+
chips: Ee(
|
|
322
|
+
e[t],
|
|
323
|
+
n
|
|
324
|
+
),
|
|
325
|
+
onClickRemoveOnChip: ke(
|
|
326
|
+
e,
|
|
327
|
+
t
|
|
328
|
+
)
|
|
329
|
+
}), Ee = (e, t) => j(e).map((n) => {
|
|
330
|
+
var o;
|
|
331
|
+
const r = t == null ? void 0 : t.find((s) => s.value === n);
|
|
332
|
+
return { value: n, label: (o = r == null ? void 0 : r.label) != null ? o : n };
|
|
333
|
+
}), ke = (e, t) => ({ setFormModelFields: n, value: r }) => {
|
|
334
|
+
const o = { ...e[t] };
|
|
335
|
+
o[r] = !1, n({
|
|
336
|
+
[t]: o
|
|
334
337
|
});
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
const createOnClickRemoveOnChipForBooleanRecord = (formModel, fieldName) => {
|
|
346
|
-
return ({ setFormModelFields, value }) => {
|
|
347
|
-
const newRecord = { ...formModel[fieldName] };
|
|
348
|
-
newRecord[value] = false;
|
|
349
|
-
setFormModelFields({
|
|
350
|
-
[fieldName]: newRecord
|
|
351
|
-
});
|
|
352
|
-
};
|
|
353
|
-
};
|
|
354
|
-
const SimpleCheckboxListSection = ({
|
|
355
|
-
options,
|
|
356
|
-
value,
|
|
357
|
-
onValueChange,
|
|
358
|
-
...sectionProps
|
|
359
|
-
}) => /* @__PURE__ */ jsx(SearchFilterSection, {
|
|
360
|
-
disableContentPadding: true,
|
|
361
|
-
...sectionProps,
|
|
362
|
-
children: /* @__PURE__ */ jsx(Column, {
|
|
338
|
+
}, Ne = ({
|
|
339
|
+
options: e,
|
|
340
|
+
value: t,
|
|
341
|
+
onValueChange: n,
|
|
342
|
+
...r
|
|
343
|
+
}) => /* @__PURE__ */ c(y, {
|
|
344
|
+
disableContentPadding: !0,
|
|
345
|
+
...r,
|
|
346
|
+
children: /* @__PURE__ */ c(T, {
|
|
363
347
|
maxHeight: "400px",
|
|
364
348
|
overflowY: "auto",
|
|
365
349
|
flex: 1,
|
|
366
|
-
children:
|
|
350
|
+
children: e == null ? void 0 : e.map((o) => /* @__PURE__ */ c(ie, {
|
|
367
351
|
onClick: () => {
|
|
368
|
-
if (
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
...
|
|
372
|
-
[
|
|
352
|
+
if (t && n) {
|
|
353
|
+
const s = !t[o.value];
|
|
354
|
+
n({
|
|
355
|
+
...t,
|
|
356
|
+
[o.value]: s
|
|
373
357
|
});
|
|
374
358
|
}
|
|
375
359
|
},
|
|
376
|
-
contentLeft: /* @__PURE__ */
|
|
360
|
+
contentLeft: /* @__PURE__ */ c(pe, {
|
|
377
361
|
tabIndex: -1,
|
|
378
|
-
value:
|
|
362
|
+
value: t == null ? void 0 : t[o.value]
|
|
379
363
|
}),
|
|
380
|
-
children: /* @__PURE__ */
|
|
381
|
-
children:
|
|
364
|
+
children: /* @__PURE__ */ c(ee, {
|
|
365
|
+
children: o.label
|
|
382
366
|
})
|
|
383
|
-
},
|
|
367
|
+
}, o.value))
|
|
384
368
|
})
|
|
385
|
-
})
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
...sectionProps
|
|
369
|
+
}), et = ({
|
|
370
|
+
options: e,
|
|
371
|
+
value: t,
|
|
372
|
+
noneSelectedLabel: n,
|
|
373
|
+
onValueChange: r,
|
|
374
|
+
...o
|
|
392
375
|
}) => {
|
|
393
|
-
const [
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
const option = options == null ? void 0 : options.find((o) => o.value === key);
|
|
376
|
+
const [s, i] = R(""), a = v(() => t ? j(t).map((l) => {
|
|
377
|
+
var F;
|
|
378
|
+
const p = e == null ? void 0 : e.find((x) => x.value === l);
|
|
397
379
|
return {
|
|
398
|
-
value:
|
|
399
|
-
label: (
|
|
380
|
+
value: l,
|
|
381
|
+
label: (F = p == null ? void 0 : p.label) != null ? F : l
|
|
400
382
|
};
|
|
401
|
-
}) : [], [
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
inputValue: text,
|
|
415
|
-
noneSelectedLabel,
|
|
416
|
-
onInputChange: setText,
|
|
417
|
-
closeMenuOnSelect: false
|
|
383
|
+
}) : [], [e, t]), S = v(() => e == null ? void 0 : e.filter((l) => l.value.toLocaleLowerCase().indexOf(s.toLocaleLowerCase()) > -1 || l.label.toLocaleLowerCase().indexOf(s.toLocaleLowerCase()) > -1), [e, s]), h = u((l) => {
|
|
384
|
+
r == null || r(ye(l));
|
|
385
|
+
}, [r]);
|
|
386
|
+
return /* @__PURE__ */ c(y, {
|
|
387
|
+
...o,
|
|
388
|
+
children: /* @__PURE__ */ c(Ce, {
|
|
389
|
+
options: S,
|
|
390
|
+
value: a,
|
|
391
|
+
onValueChange: h,
|
|
392
|
+
inputValue: s,
|
|
393
|
+
noneSelectedLabel: n,
|
|
394
|
+
onInputChange: i,
|
|
395
|
+
closeMenuOnSelect: !1
|
|
418
396
|
})
|
|
419
397
|
});
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
];
|
|
438
|
-
};
|
|
439
|
-
const createOnClickRemoveOnChipForDateRange = (startDateFieldName, endDateFieldName) => {
|
|
440
|
-
return ({ setFormModelFields }) => {
|
|
441
|
-
setFormModelFields({
|
|
442
|
-
[startDateFieldName]: void 0,
|
|
443
|
-
[endDateFieldName]: void 0
|
|
444
|
-
});
|
|
445
|
-
};
|
|
446
|
-
};
|
|
447
|
-
const createDateRangeSectionProps = (formModel, startDateFieldName, endDateFieldName) => ({
|
|
398
|
+
}, ye = (e) => e.reduce((t, n) => (t[n.value] = !0, t), {}), tt = (e, t, n) => ({
|
|
399
|
+
chips: Be(
|
|
400
|
+
e[t],
|
|
401
|
+
e[n]
|
|
402
|
+
),
|
|
403
|
+
onClickRemoveOnChip: Oe(
|
|
404
|
+
t,
|
|
405
|
+
n
|
|
406
|
+
)
|
|
407
|
+
}), Be = (e, t) => !e && !t ? [] : [
|
|
408
|
+
{ value: "dateRange", label: `${e != null ? e : ""} - ${t != null ? t : ""}` }
|
|
409
|
+
], Oe = (e, t) => ({ setFormModelFields: n }) => {
|
|
410
|
+
n({
|
|
411
|
+
[e]: void 0,
|
|
412
|
+
[t]: void 0
|
|
413
|
+
});
|
|
414
|
+
}, nt = (e, t, n) => ({
|
|
448
415
|
value: {
|
|
449
|
-
startDate:
|
|
450
|
-
endDate:
|
|
416
|
+
startDate: e[t],
|
|
417
|
+
endDate: e[n]
|
|
451
418
|
},
|
|
452
|
-
onValueChange: (
|
|
453
|
-
const
|
|
454
|
-
[
|
|
455
|
-
[
|
|
419
|
+
onValueChange: (r, { dispatch: o, actions: s }) => {
|
|
420
|
+
const i = {
|
|
421
|
+
[t]: r.startDate,
|
|
422
|
+
[n]: r.endDate
|
|
456
423
|
};
|
|
457
|
-
|
|
424
|
+
o(s.setFormModelFields(i));
|
|
458
425
|
}
|
|
459
|
-
})
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
...dateRangeCalendarProps
|
|
426
|
+
}), rt = ({
|
|
427
|
+
value: e,
|
|
428
|
+
onValueChange: t,
|
|
429
|
+
sectionId: n,
|
|
430
|
+
...r
|
|
465
431
|
}) => {
|
|
466
|
-
const
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
onValueChange(dateRangeToStrings(value2), options);
|
|
476
|
-
}, [onValueChange, options]);
|
|
477
|
-
return /* @__PURE__ */ jsx(SearchFilterSection, {
|
|
478
|
-
sectionId,
|
|
479
|
-
children: /* @__PURE__ */ jsx(Box, {
|
|
432
|
+
const o = f(), s = m(), i = v(() => ({
|
|
433
|
+
dispatch: o,
|
|
434
|
+
actions: s
|
|
435
|
+
}), [s, o]), [a, S] = R("startDate"), h = v(() => Se(e), [e]), l = u((p) => {
|
|
436
|
+
t(fe(p), i);
|
|
437
|
+
}, [t, i]);
|
|
438
|
+
return /* @__PURE__ */ c(y, {
|
|
439
|
+
sectionId: n,
|
|
440
|
+
children: /* @__PURE__ */ c(A, {
|
|
480
441
|
flex: 1,
|
|
481
442
|
alignItems: "center",
|
|
482
|
-
children: /* @__PURE__ */
|
|
443
|
+
children: /* @__PURE__ */ c(A, {
|
|
483
444
|
background: "white",
|
|
484
|
-
indent:
|
|
485
|
-
children: /* @__PURE__ */
|
|
486
|
-
setFocusedInput,
|
|
487
|
-
focusedInput,
|
|
488
|
-
value:
|
|
489
|
-
onValueChange:
|
|
490
|
-
...
|
|
445
|
+
indent: !0,
|
|
446
|
+
children: /* @__PURE__ */ c(me, {
|
|
447
|
+
setFocusedInput: S,
|
|
448
|
+
focusedInput: a,
|
|
449
|
+
value: h,
|
|
450
|
+
onValueChange: l,
|
|
451
|
+
...r
|
|
491
452
|
})
|
|
492
453
|
})
|
|
493
454
|
})
|
|
494
455
|
});
|
|
495
456
|
};
|
|
496
|
-
export {
|
|
457
|
+
export {
|
|
458
|
+
et as ChipMultiSelectSection,
|
|
459
|
+
rt as DateRangeCalendarSection,
|
|
460
|
+
Le as EmptyChip,
|
|
461
|
+
W as SearchFilterActionsContext,
|
|
462
|
+
Je as SearchFilterButton,
|
|
463
|
+
be as SearchFilterChip,
|
|
464
|
+
Xe as SearchFilterChips,
|
|
465
|
+
ge as SearchFilterContext,
|
|
466
|
+
K as SearchFilterDispatchContext,
|
|
467
|
+
Ye as SearchFilterDrawer,
|
|
468
|
+
Ue as SearchFilterLocalStateContext,
|
|
469
|
+
Y as SearchFilterModelContext,
|
|
470
|
+
Fe as SearchFilterPanelHeader,
|
|
471
|
+
y as SearchFilterSection,
|
|
472
|
+
G as SearchFilterStateContext,
|
|
473
|
+
Ze as SectionChips,
|
|
474
|
+
Ne as SimpleCheckboxListSection,
|
|
475
|
+
Ee as createChipsForBooleanRecord,
|
|
476
|
+
Be as createChipsForDateRange,
|
|
477
|
+
_e as createChipsPropsForBooleanRecord,
|
|
478
|
+
tt as createChipsPropsForDateRange,
|
|
479
|
+
nt as createDateRangeSectionProps,
|
|
480
|
+
ke as createOnClickRemoveOnChipForBooleanRecord,
|
|
481
|
+
Oe as createOnClickRemoveOnChipForDateRange,
|
|
482
|
+
ve as createSearchFilterActions,
|
|
483
|
+
we as createSearchFilterInitialState,
|
|
484
|
+
Re as createSearchFilterReducer,
|
|
485
|
+
xe as formatColumnIdToHeaderCellLabel,
|
|
486
|
+
d as getReducerIdFor,
|
|
487
|
+
Me as useLocalSearchFilterState,
|
|
488
|
+
m as useSearchFilterActions,
|
|
489
|
+
f as useSearchFilterDispatch,
|
|
490
|
+
Qe as useSearchFilterModel,
|
|
491
|
+
I as useSearchFilterState
|
|
492
|
+
};
|
|
497
493
|
//# sourceMappingURL=index.es.js.map
|