@shefing/quickfilter 1.0.32 → 1.0.34
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 +62 -4
- package/dist/QuickFilter.d.ts.map +1 -1
- package/dist/QuickFilter.js +2 -172
- package/dist/QuickFilter.js.map +1 -1
- package/dist/filters/constants/date-filter-options.d.ts +2 -2
- package/dist/filters/constants/date-filter-options.d.ts.map +1 -1
- package/dist/filters/constants/date-filter-options.js +4 -1
- package/dist/filters/constants/date-filter-options.js.map +1 -1
- package/dist/filters/utils/date-helpers.d.ts.map +1 -1
- package/dist/filters/utils/date-helpers.js +26 -0
- package/dist/filters/utils/date-helpers.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/labels.d.ts +38 -2
- package/dist/labels.d.ts.map +1 -1
- package/dist/labels.js +19 -1
- package/dist/labels.js.map +1 -1
- package/dist/lib/utils.d.ts +4 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +186 -0
- package/dist/lib/utils.js.map +1 -1
- package/dist/nav/NavHamburger/index.d.ts +5 -0
- package/dist/nav/NavHamburger/index.d.ts.map +1 -0
- package/dist/nav/NavHamburger/index.js +20 -0
- package/dist/nav/NavHamburger/index.js.map +1 -0
- package/dist/nav/NavWrapper/index.d.ts +7 -0
- package/dist/nav/NavWrapper/index.d.ts.map +1 -0
- package/dist/nav/NavWrapper/index.js +25 -0
- package/dist/nav/NavWrapper/index.js.map +1 -0
- package/dist/nav/NavWrapper/index.scss +27 -0
- package/dist/nav/getNavPrefs.d.ts +3 -0
- package/dist/nav/getNavPrefs.d.ts.map +1 -0
- package/dist/nav/getNavPrefs.js +31 -0
- package/dist/nav/getNavPrefs.js.map +1 -0
- package/dist/nav/index.client.d.ts +8 -0
- package/dist/nav/index.client.d.ts.map +1 -0
- package/dist/nav/index.client.js +93 -0
- package/dist/nav/index.client.js.map +1 -0
- package/dist/nav/index.d.ts +8 -0
- package/dist/nav/index.d.ts.map +1 -0
- package/dist/nav/index.js +208 -0
- package/dist/nav/index.js.map +1 -0
- package/dist/nav/index.scss +163 -0
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/command.d.ts +7 -7
- package/package.json +6 -1
package/dist/index.js
CHANGED
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionSlug, Config } from 'payload';\n\nexport type CollectionFilterPluginConfig = {\n /**\n * List of collections to add filters to\n */\n disabled?: boolean;\n excludedCollections?: CollectionSlug[];\n includedCollections?: CollectionSlug[];\n};\n\nexport const CollectionQuickFilterPlugin =\n (pluginOptions: CollectionFilterPluginConfig = {}) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = [];\n }\n\n // Process each collection to add the QuickFilter component\n config.collections = config.collections.map((collection) => {\n // Check if this collection should be processed based on includedCollections/excludedCollections\n const shouldProcessCollection = pluginOptions.includedCollections \n ? pluginOptions.includedCollections.includes(collection.slug)
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import type { CollectionSlug, Config } from 'payload';\n\nexport * from './nav/index';\n\nexport type CollectionFilterPluginConfig = {\n /**\n * List of collections to add filters to\n */\n disabled?: boolean;\n excludedCollections?: CollectionSlug[];\n includedCollections?: CollectionSlug[];\n};\n\nexport const CollectionQuickFilterPlugin =\n (pluginOptions: CollectionFilterPluginConfig = {}) =>\n (config: Config): Config => {\n if (!config.collections) {\n config.collections = [];\n }\n\n // Process each collection to add the QuickFilter component\n config.collections = config.collections.map((collection) => {\n // Check if this collection should be processed based on includedCollections/excludedCollections\n const shouldProcessCollection = pluginOptions.includedCollections \n ? pluginOptions.includedCollections.includes(collection.slug as CollectionSlug)\n : pluginOptions.excludedCollections \n ? !pluginOptions.excludedCollections.includes(collection.slug as CollectionSlug)\n : true;\n\n // Check if the collection has a filterList configuration\n // or if it's specified in the plugin options\n if (shouldProcessCollection && collection.custom?.filterList && Array.isArray(collection.custom.filterList)) {\n // Clone the collection to avoid mutating the original\n const newCollection = { ...collection };\n\n // Initialize components if not exists\n if (!newCollection.admin) {\n newCollection.admin = {};\n }\n\n if (!newCollection.admin.components) {\n newCollection.admin.components = {};\n }\n\n if (!newCollection.admin.components.beforeListTable) {\n newCollection.admin.components.beforeListTable = [];\n } else if (!Array.isArray(newCollection.admin.components.beforeListTable)) {\n // If it's not an array, convert it to an array\n newCollection.admin.components.beforeListTable = [\n newCollection.admin.components.beforeListTable,\n ];\n }\n\n // Add the QuickFilter component\n newCollection.admin.components.beforeListTable.push({\n path: '@shefing/quickfilter/QuickFilter',\n clientProps: {\n filterList: collection.custom.filterList,\n slug: collection.slug,\n },\n });\n\n return newCollection;\n }\n\n return collection;\n });\n\n /**\n * If the plugin is disabled, we still want to keep added collections/fields so the database schema is consistent which is important for migrations.\n * If your plugin heavily modifies the database schema, you may want to remove this property.\n */\n if (pluginOptions.disabled) {\n return config;\n }\n\n return config;\n };\n\nexport default CollectionQuickFilterPlugin;\n"],"names":["CollectionQuickFilterPlugin","pluginOptions","config","collections","map","collection","shouldProcessCollection","includedCollections","includes","slug","excludedCollections","custom","filterList","Array","isArray","newCollection","admin","components","beforeListTable","push","path","clientProps","disabled"],"mappings":"AAEA,cAAc,cAAc;AAW5B,OAAO,MAAMA,8BACX,CAACC,gBAA8C,CAAC,CAAC,GACjD,CAACC;QACC,IAAI,CAACA,OAAOC,WAAW,EAAE;YACvBD,OAAOC,WAAW,GAAG,EAAE;QACzB;QAEA,2DAA2D;QAC3DD,OAAOC,WAAW,GAAGD,OAAOC,WAAW,CAACC,GAAG,CAAC,CAACC;YAC3C,gGAAgG;YAChG,MAAMC,0BAA0BL,cAAcM,mBAAmB,GAC7DN,cAAcM,mBAAmB,CAACC,QAAQ,CAACH,WAAWI,IAAI,IAC1DR,cAAcS,mBAAmB,GAC/B,CAACT,cAAcS,mBAAm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25
25
|
readonly last7Days: "Last 7 Days";
|
|
26
26
|
readonly last30Days: "Last 30 Days";
|
|
27
|
+
readonly lastYear: "Last Year";
|
|
28
|
+
readonly last2Years: "Last 2 Years";
|
|
27
29
|
readonly allPast: "All Past";
|
|
28
30
|
readonly today: "Today";
|
|
29
31
|
readonly thisWeek: "This Week";
|
|
30
32
|
readonly thisMonth: "This Month";
|
|
31
33
|
readonly next7Days: "Next 7 Days";
|
|
32
34
|
readonly next30Days: "Next 30 Days";
|
|
35
|
+
readonly todayAndFuture: "Today & Future";
|
|
33
36
|
readonly allFuture: "All Future";
|
|
34
37
|
};
|
|
35
38
|
readonly ar: {
|
|
@@ -56,12 +59,15 @@ export declare const PLUGIN_LABELS: {
|
|
|
56
59
|
readonly lastMonth: "الشهر الماضي";
|
|
57
60
|
readonly last7Days: "آخر 7 أيام";
|
|
58
61
|
readonly last30Days: "آخر 30 يومًا";
|
|
62
|
+
readonly lastYear: "العام الماضي";
|
|
63
|
+
readonly last2Years: "العامين الماضيين";
|
|
59
64
|
readonly allPast: "كل الماضي";
|
|
60
65
|
readonly today: "اليوم";
|
|
61
66
|
readonly thisWeek: "هذا الأسبوع";
|
|
62
67
|
readonly thisMonth: "هذا الشهر";
|
|
63
68
|
readonly next7Days: "الـ 7 أيام القادمة";
|
|
64
69
|
readonly next30Days: "الـ 30 يومًا القادمة";
|
|
70
|
+
readonly todayAndFuture: "اليوم والمستقبل";
|
|
65
71
|
readonly allFuture: "كل المستقبل";
|
|
66
72
|
};
|
|
67
73
|
readonly fr: {
|
|
@@ -88,12 +94,15 @@ export declare const PLUGIN_LABELS: {
|
|
|
88
94
|
readonly lastMonth: "Mois dernier";
|
|
89
95
|
readonly last7Days: "7 derniers jours";
|
|
90
96
|
readonly last30Days: "30 derniers jours";
|
|
97
|
+
readonly lastYear: "Année dernière";
|
|
98
|
+
readonly last2Years: "2 dernières années";
|
|
91
99
|
readonly allPast: "Tout le passé";
|
|
92
|
-
readonly today: "Aujourd
|
|
100
|
+
readonly today: "Aujourd'hui";
|
|
93
101
|
readonly thisWeek: "Cette semaine";
|
|
94
102
|
readonly thisMonth: "Ce mois";
|
|
95
103
|
readonly next7Days: "7 prochains jours";
|
|
96
104
|
readonly next30Days: "30 prochains jours";
|
|
105
|
+
readonly todayAndFuture: "Aujourd'hui & Futur";
|
|
97
106
|
readonly allFuture: "Tout le futur";
|
|
98
107
|
};
|
|
99
108
|
readonly es: {
|
|
@@ -120,12 +129,15 @@ export declare const PLUGIN_LABELS: {
|
|
|
120
129
|
readonly lastMonth: "Mes pasado";
|
|
121
130
|
readonly last7Days: "Últimos 7 días";
|
|
122
131
|
readonly last30Days: "Últimos 30 días";
|
|
132
|
+
readonly lastYear: "Último año";
|
|
133
|
+
readonly last2Years: "Últimos 2 años";
|
|
123
134
|
readonly allPast: "Todo el pasado";
|
|
124
135
|
readonly today: "Hoy";
|
|
125
136
|
readonly thisWeek: "Esta semana";
|
|
126
137
|
readonly thisMonth: "Este mes";
|
|
127
138
|
readonly next7Days: "Próximos 7 días";
|
|
128
139
|
readonly next30Days: "Próximos 30 días";
|
|
140
|
+
readonly todayAndFuture: "Hoy y futuro";
|
|
129
141
|
readonly allFuture: "Todo el futuro";
|
|
130
142
|
};
|
|
131
143
|
readonly zh: {
|
|
@@ -152,12 +164,15 @@ export declare const PLUGIN_LABELS: {
|
|
|
152
164
|
readonly lastMonth: "上个月";
|
|
153
165
|
readonly last7Days: "过去7天";
|
|
154
166
|
readonly last30Days: "过去30天";
|
|
167
|
+
readonly lastYear: "去年";
|
|
168
|
+
readonly last2Years: "过去2年";
|
|
155
169
|
readonly allPast: "所有过去";
|
|
156
170
|
readonly today: "今天";
|
|
157
171
|
readonly thisWeek: "本周";
|
|
158
172
|
readonly thisMonth: "本月";
|
|
159
173
|
readonly next7Days: "未来7天";
|
|
160
174
|
readonly next30Days: "未来30天";
|
|
175
|
+
readonly todayAndFuture: "今天和未来";
|
|
161
176
|
readonly allFuture: "所有未来";
|
|
162
177
|
};
|
|
163
178
|
readonly he: {
|
|
@@ -184,12 +199,15 @@ export declare const PLUGIN_LABELS: {
|
|
|
184
199
|
readonly lastMonth: "חודש שעבר";
|
|
185
200
|
readonly last7Days: "7 ימים אחרונים";
|
|
186
201
|
readonly last30Days: "30 ימים אחרונים";
|
|
202
|
+
readonly lastYear: "שנה שעברה";
|
|
203
|
+
readonly last2Years: "שנתיים אחרונות";
|
|
187
204
|
readonly allPast: "בעבר";
|
|
188
205
|
readonly today: "היום";
|
|
189
206
|
readonly thisWeek: "השבוע";
|
|
190
207
|
readonly thisMonth: "החודש";
|
|
191
208
|
readonly next7Days: "7 ימים הבאים";
|
|
192
209
|
readonly next30Days: "30 ימים הבאים";
|
|
210
|
+
readonly todayAndFuture: "היום והעתיד";
|
|
193
211
|
readonly allFuture: "בעתיד";
|
|
194
212
|
};
|
|
195
213
|
};
|
|
@@ -219,12 +237,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
219
237
|
readonly lastMonth: "Last Month";
|
|
220
238
|
readonly last7Days: "Last 7 Days";
|
|
221
239
|
readonly last30Days: "Last 30 Days";
|
|
240
|
+
readonly lastYear: "Last Year";
|
|
241
|
+
readonly last2Years: "Last 2 Years";
|
|
222
242
|
readonly allPast: "All Past";
|
|
223
243
|
readonly today: "Today";
|
|
224
244
|
readonly thisWeek: "This Week";
|
|
225
245
|
readonly thisMonth: "This Month";
|
|
226
246
|
readonly next7Days: "Next 7 Days";
|
|
227
247
|
readonly next30Days: "Next 30 Days";
|
|
248
|
+
readonly todayAndFuture: "Today & Future";
|
|
228
249
|
readonly allFuture: "All Future";
|
|
229
250
|
} | {
|
|
230
251
|
readonly quickFilters: "فلاتر سريعة";
|
|
@@ -250,12 +271,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
250
271
|
readonly lastMonth: "الشهر الماضي";
|
|
251
272
|
readonly last7Days: "آخر 7 أيام";
|
|
252
273
|
readonly last30Days: "آخر 30 يومًا";
|
|
274
|
+
readonly lastYear: "العام الماضي";
|
|
275
|
+
readonly last2Years: "العامين الماضيين";
|
|
253
276
|
readonly allPast: "كل الماضي";
|
|
254
277
|
readonly today: "اليوم";
|
|
255
278
|
readonly thisWeek: "هذا الأسبوع";
|
|
256
279
|
readonly thisMonth: "هذا الشهر";
|
|
257
280
|
readonly next7Days: "الـ 7 أيام القادمة";
|
|
258
281
|
readonly next30Days: "الـ 30 يومًا القادمة";
|
|
282
|
+
readonly todayAndFuture: "اليوم والمستقبل";
|
|
259
283
|
readonly allFuture: "كل المستقبل";
|
|
260
284
|
} | {
|
|
261
285
|
readonly quickFilters: "Filtres rapides";
|
|
@@ -281,12 +305,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
281
305
|
readonly lastMonth: "Mois dernier";
|
|
282
306
|
readonly last7Days: "7 derniers jours";
|
|
283
307
|
readonly last30Days: "30 derniers jours";
|
|
308
|
+
readonly lastYear: "Année dernière";
|
|
309
|
+
readonly last2Years: "2 dernières années";
|
|
284
310
|
readonly allPast: "Tout le passé";
|
|
285
|
-
readonly today: "Aujourd
|
|
311
|
+
readonly today: "Aujourd'hui";
|
|
286
312
|
readonly thisWeek: "Cette semaine";
|
|
287
313
|
readonly thisMonth: "Ce mois";
|
|
288
314
|
readonly next7Days: "7 prochains jours";
|
|
289
315
|
readonly next30Days: "30 prochains jours";
|
|
316
|
+
readonly todayAndFuture: "Aujourd'hui & Futur";
|
|
290
317
|
readonly allFuture: "Tout le futur";
|
|
291
318
|
} | {
|
|
292
319
|
readonly quickFilters: "Filtros rápidos";
|
|
@@ -312,12 +339,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
312
339
|
readonly lastMonth: "Mes pasado";
|
|
313
340
|
readonly last7Days: "Últimos 7 días";
|
|
314
341
|
readonly last30Days: "Últimos 30 días";
|
|
342
|
+
readonly lastYear: "Último año";
|
|
343
|
+
readonly last2Years: "Últimos 2 años";
|
|
315
344
|
readonly allPast: "Todo el pasado";
|
|
316
345
|
readonly today: "Hoy";
|
|
317
346
|
readonly thisWeek: "Esta semana";
|
|
318
347
|
readonly thisMonth: "Este mes";
|
|
319
348
|
readonly next7Days: "Próximos 7 días";
|
|
320
349
|
readonly next30Days: "Próximos 30 días";
|
|
350
|
+
readonly todayAndFuture: "Hoy y futuro";
|
|
321
351
|
readonly allFuture: "Todo el futuro";
|
|
322
352
|
} | {
|
|
323
353
|
readonly quickFilters: "快速筛选";
|
|
@@ -343,12 +373,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
343
373
|
readonly lastMonth: "上个月";
|
|
344
374
|
readonly last7Days: "过去7天";
|
|
345
375
|
readonly last30Days: "过去30天";
|
|
376
|
+
readonly lastYear: "去年";
|
|
377
|
+
readonly last2Years: "过去2年";
|
|
346
378
|
readonly allPast: "所有过去";
|
|
347
379
|
readonly today: "今天";
|
|
348
380
|
readonly thisWeek: "本周";
|
|
349
381
|
readonly thisMonth: "本月";
|
|
350
382
|
readonly next7Days: "未来7天";
|
|
351
383
|
readonly next30Days: "未来30天";
|
|
384
|
+
readonly todayAndFuture: "今天和未来";
|
|
352
385
|
readonly allFuture: "所有未来";
|
|
353
386
|
} | {
|
|
354
387
|
readonly quickFilters: "סינון מהיר";
|
|
@@ -374,12 +407,15 @@ export declare const getLabels: (locale?: SupportedLocale) => {
|
|
|
374
407
|
readonly lastMonth: "חודש שעבר";
|
|
375
408
|
readonly last7Days: "7 ימים אחרונים";
|
|
376
409
|
readonly last30Days: "30 ימים אחרונים";
|
|
410
|
+
readonly lastYear: "שנה שעברה";
|
|
411
|
+
readonly last2Years: "שנתיים אחרונות";
|
|
377
412
|
readonly allPast: "בעבר";
|
|
378
413
|
readonly today: "היום";
|
|
379
414
|
readonly thisWeek: "השבוע";
|
|
380
415
|
readonly thisMonth: "החודש";
|
|
381
416
|
readonly next7Days: "7 ימים הבאים";
|
|
382
417
|
readonly next30Days: "30 ימים הבאים";
|
|
418
|
+
readonly todayAndFuture: "היום והעתיד";
|
|
383
419
|
readonly allFuture: "בעתיד";
|
|
384
420
|
};
|
|
385
421
|
export declare const getLabel: (key: LabelKey, locale?: SupportedLocale) => string;
|
package/dist/labels.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,UAAuC,CAAC;AAEtE,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../src/labels.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,UAAuC,CAAC;AAEtE,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqNhB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,MAAM,OAAO,aAAa,CAAC;AACzD,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,aAAa,CAAC,EAAE,CAAC;AAGrD,eAAO,MAAM,SAAS,YAAY,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAEhD,CAAC;AAGF,eAAO,MAAM,QAAQ,QAAS,QAAQ,WAAU,eAAe,KAAU,MAaxE,CAAC"}
|
package/dist/labels.js
CHANGED
|
@@ -33,12 +33,15 @@ export const PLUGIN_LABELS = {
|
|
|
33
33
|
lastMonth: 'Last Month',
|
|
34
34
|
last7Days: 'Last 7 Days',
|
|
35
35
|
last30Days: 'Last 30 Days',
|
|
36
|
+
lastYear: 'Last Year',
|
|
37
|
+
last2Years: 'Last 2 Years',
|
|
36
38
|
allPast: 'All Past',
|
|
37
39
|
today: 'Today',
|
|
38
40
|
thisWeek: 'This Week',
|
|
39
41
|
thisMonth: 'This Month',
|
|
40
42
|
next7Days: 'Next 7 Days',
|
|
41
43
|
next30Days: 'Next 30 Days',
|
|
44
|
+
todayAndFuture: 'Today & Future',
|
|
42
45
|
allFuture: 'All Future'
|
|
43
46
|
},
|
|
44
47
|
ar: {
|
|
@@ -65,12 +68,15 @@ export const PLUGIN_LABELS = {
|
|
|
65
68
|
lastMonth: 'الشهر الماضي',
|
|
66
69
|
last7Days: 'آخر 7 أيام',
|
|
67
70
|
last30Days: 'آخر 30 يومًا',
|
|
71
|
+
lastYear: 'العام الماضي',
|
|
72
|
+
last2Years: 'العامين الماضيين',
|
|
68
73
|
allPast: 'كل الماضي',
|
|
69
74
|
today: 'اليوم',
|
|
70
75
|
thisWeek: 'هذا الأسبوع',
|
|
71
76
|
thisMonth: 'هذا الشهر',
|
|
72
77
|
next7Days: 'الـ 7 أيام القادمة',
|
|
73
78
|
next30Days: 'الـ 30 يومًا القادمة',
|
|
79
|
+
todayAndFuture: 'اليوم والمستقبل',
|
|
74
80
|
allFuture: 'كل المستقبل'
|
|
75
81
|
},
|
|
76
82
|
fr: {
|
|
@@ -97,12 +103,15 @@ export const PLUGIN_LABELS = {
|
|
|
97
103
|
lastMonth: 'Mois dernier',
|
|
98
104
|
last7Days: '7 derniers jours',
|
|
99
105
|
last30Days: '30 derniers jours',
|
|
106
|
+
lastYear: 'Année dernière',
|
|
107
|
+
last2Years: '2 dernières années',
|
|
100
108
|
allPast: 'Tout le passé',
|
|
101
|
-
today: '
|
|
109
|
+
today: "Aujourd'hui",
|
|
102
110
|
thisWeek: 'Cette semaine',
|
|
103
111
|
thisMonth: 'Ce mois',
|
|
104
112
|
next7Days: '7 prochains jours',
|
|
105
113
|
next30Days: '30 prochains jours',
|
|
114
|
+
todayAndFuture: "Aujourd'hui & Futur",
|
|
106
115
|
allFuture: 'Tout le futur'
|
|
107
116
|
},
|
|
108
117
|
es: {
|
|
@@ -129,12 +138,15 @@ export const PLUGIN_LABELS = {
|
|
|
129
138
|
lastMonth: 'Mes pasado',
|
|
130
139
|
last7Days: 'Últimos 7 días',
|
|
131
140
|
last30Days: 'Últimos 30 días',
|
|
141
|
+
lastYear: 'Último año',
|
|
142
|
+
last2Years: 'Últimos 2 años',
|
|
132
143
|
allPast: 'Todo el pasado',
|
|
133
144
|
today: 'Hoy',
|
|
134
145
|
thisWeek: 'Esta semana',
|
|
135
146
|
thisMonth: 'Este mes',
|
|
136
147
|
next7Days: 'Próximos 7 días',
|
|
137
148
|
next30Days: 'Próximos 30 días',
|
|
149
|
+
todayAndFuture: 'Hoy y futuro',
|
|
138
150
|
allFuture: 'Todo el futuro'
|
|
139
151
|
},
|
|
140
152
|
zh: {
|
|
@@ -161,12 +173,15 @@ export const PLUGIN_LABELS = {
|
|
|
161
173
|
lastMonth: '上个月',
|
|
162
174
|
last7Days: '过去7天',
|
|
163
175
|
last30Days: '过去30天',
|
|
176
|
+
lastYear: '去年',
|
|
177
|
+
last2Years: '过去2年',
|
|
164
178
|
allPast: '所有过去',
|
|
165
179
|
today: '今天',
|
|
166
180
|
thisWeek: '本周',
|
|
167
181
|
thisMonth: '本月',
|
|
168
182
|
next7Days: '未来7天',
|
|
169
183
|
next30Days: '未来30天',
|
|
184
|
+
todayAndFuture: '今天和未来',
|
|
170
185
|
allFuture: '所有未来'
|
|
171
186
|
},
|
|
172
187
|
he: {
|
|
@@ -193,12 +208,15 @@ export const PLUGIN_LABELS = {
|
|
|
193
208
|
lastMonth: 'חודש שעבר',
|
|
194
209
|
last7Days: '7 ימים אחרונים',
|
|
195
210
|
last30Days: '30 ימים אחרונים',
|
|
211
|
+
lastYear: 'שנה שעברה',
|
|
212
|
+
last2Years: 'שנתיים אחרונות',
|
|
196
213
|
allPast: 'בעבר',
|
|
197
214
|
today: 'היום',
|
|
198
215
|
thisWeek: 'השבוע',
|
|
199
216
|
thisMonth: 'החודש',
|
|
200
217
|
next7Days: '7 ימים הבאים',
|
|
201
218
|
next30Days: '30 ימים הבאים',
|
|
219
|
+
todayAndFuture: 'היום והעתיד',
|
|
202
220
|
allFuture: 'בעתיד'
|
|
203
221
|
}
|
|
204
222
|
};
|
package/dist/labels.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/labels.ts"],"sourcesContent":["// Centralized labels for the quickfilter plugin\n\n// List of all accepted languages in the system - only those defined in PLUGIN_LABELS\nexport const acceptedLanguages = ['ar', 'en', 'es', 'fr', 'he', 'zh'];\n\nexport const PLUGIN_LABELS = {\n en: {\n quickFilters: 'Quick Filters',\n clearFilters: 'Clear Filters',\n activeFilterSingular: 'Active filter on column',\n activeFilterPlural: 'Active filters on columns',\n custom: 'Custom',\n all: 'All',\n yes: 'Yes',\n no: 'No',\n selectOption: 'Select Option',\n from: 'From',\n to: 'To',\n selectDate: 'Select Date',\n past: 'Past',\n future: 'Future',\n presentFuture: 'Present & Future',\n customRange: 'Custom Range',\n apply: 'Apply',\n cancel: 'Cancel',\n yesterday: 'Yesterday',\n lastWeek: 'Last Week',\n lastMonth: 'Last Month',\n last7Days: 'Last 7 Days',\n last30Days: 'Last 30 Days',\n allPast: 'All Past',\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n next7Days: 'Next 7 Days',\n next30Days: 'Next 30 Days',\n allFuture: 'All Future',\n },\n ar: {\n quickFilters: 'فلاتر سريعة',\n clearFilters: 'مسح الفلاتر',\n activeFilterSingular: 'فلتر نشط على العمود',\n activeFilterPlural: 'فلاتر نشطة على الأعمدة',\n custom: 'مخصص',\n all: 'الكل',\n yes: 'نعم',\n no: 'لا',\n selectOption: 'اختر خيارًا',\n from: 'من',\n to: 'إلى',\n selectDate: 'اختر التاريخ',\n past: 'الماضي',\n future: 'المستقبل',\n presentFuture: 'الحاضر والمستقبل',\n customRange: 'نطاق مخصص',\n apply: 'تطبيق',\n cancel: 'إلغاء',\n yesterday: 'أمس',\n lastWeek: 'الأسبوع الماضي',\n lastMonth: 'الشهر الماضي',\n last7Days: 'آخر 7 أيام',\n last30Days: 'آخر 30 يومًا',\n allPast: 'كل الماضي',\n today: 'اليوم',\n thisWeek: 'هذا الأسبوع',\n thisMonth: 'هذا الشهر',\n next7Days: 'الـ 7 أيام القادمة',\n next30Days: 'الـ 30 يومًا القادمة',\n allFuture: 'كل المستقبل',\n },\n fr: {\n quickFilters: 'Filtres rapides',\n clearFilters: 'Effacer les filtres',\n activeFilterSingular: 'Filtre actif sur la colonne',\n activeFilterPlural: 'Filtres actifs sur les colonnes',\n custom: 'Personnalisé',\n all: 'Tous',\n yes: 'Oui',\n no: 'Non',\n selectOption: 'Sélectionner une option',\n from: 'De',\n to: 'À',\n selectDate: 'Sélectionner une date',\n past: 'Passé',\n future: 'Futur',\n presentFuture: 'Présent & Futur',\n customRange: 'Plage personnalisée',\n apply: 'Appliquer',\n cancel: 'Annuler',\n yesterday: 'Hier',\n lastWeek: 'Semaine dernière',\n lastMonth: 'Mois dernier',\n last7Days: '7 derniers jours',\n last30Days: '30 derniers jours',\n allPast: 'Tout le passé',\n today: 'Aujourd’hui',\n thisWeek: 'Cette semaine',\n thisMonth: 'Ce mois',\n next7Days: '7 prochains jours',\n next30Days: '30 prochains jours',\n allFuture: 'Tout le futur',\n },\n es: {\n quickFilters: 'Filtros rápidos',\n clearFilters: 'Borrar filtros',\n activeFilterSingular: 'Filtro activo en la columna',\n activeFilterPlural: 'Filtros activos en las columnas',\n custom: 'Personalizado',\n all: 'Todos',\n yes: 'Sí',\n no: 'No',\n selectOption: 'Seleccionar opción',\n from: 'Desde',\n to: 'Hasta',\n selectDate: 'Seleccionar fecha',\n past: 'Pasado',\n future: 'Futuro',\n presentFuture: 'Presente & Futuro',\n customRange: 'Rango personalizado',\n apply: 'Aplicar',\n cancel: 'Cancelar',\n yesterday: 'Ayer',\n lastWeek: 'Semana pasada',\n lastMonth: 'Mes pasado',\n last7Days: 'Últimos 7 días',\n last30Days: 'Últimos 30 días',\n allPast: 'Todo el pasado',\n today: 'Hoy',\n thisWeek: 'Esta semana',\n thisMonth: 'Este mes',\n next7Days: 'Próximos 7 días',\n next30Days: 'Próximos 30 días',\n allFuture: 'Todo el futuro',\n },\n zh: {\n quickFilters: '快速筛选',\n clearFilters: '清除筛选',\n activeFilterSingular: '列上激活的筛选',\n activeFilterPlural: '多列上激活的筛选',\n custom: '自定义',\n all: '全部',\n yes: '是',\n no: '否',\n selectOption: '选择选项',\n from: '从',\n to: '到',\n selectDate: '选择日期',\n past: '过去',\n future: '未来',\n presentFuture: '现在和未来',\n customRange: '自定义范围',\n apply: '应用',\n cancel: '取消',\n yesterday: '昨天',\n lastWeek: '上周',\n lastMonth: '上个月',\n last7Days: '过去7天',\n last30Days: '过去30天',\n allPast: '所有过去',\n today: '今天',\n thisWeek: '本周',\n thisMonth: '本月',\n next7Days: '未来7天',\n next30Days: '未来30天',\n allFuture: '所有未来',\n },\n he: {\n quickFilters: 'סינון מהיר',\n clearFilters: 'נקה סינון',\n activeFilterSingular: 'סינון פעיל בעמודה',\n activeFilterPlural: 'סינון פעיל בעמודות',\n custom: 'מותאם אישית',\n all: 'הכל',\n yes: 'כן',\n no: 'לא',\n selectOption: 'בחר אפשרות',\n from: 'מתאריך',\n to: 'עד תאריך',\n selectDate: 'בחר תאריך',\n past: 'עבר',\n future: 'עתיד',\n presentFuture: 'הווה ועתיד',\n customRange: 'טווח מותאם אישית',\n apply: 'החל',\n cancel: 'ביטול',\n yesterday: 'אתמול',\n lastWeek: 'שבוע שעבר',\n lastMonth: 'חודש שעבר',\n last7Days: '7 ימים אחרונים',\n last30Days: '30 ימים אחרונים',\n allPast: 'בעבר',\n today: 'היום',\n thisWeek: 'השבוע',\n thisMonth: 'החודש',\n next7Days: '7 ימים הבאים',\n next30Days: '30 ימים הבאים',\n allFuture: 'בעתיד',\n },\n // Placeholder for other languages (az, bg, bn-BD, etc.)\n // These can be structured similarly with proper translations\n} as const;\nexport type SupportedLocale = keyof typeof PLUGIN_LABELS;\nexport type LabelKey = keyof typeof PLUGIN_LABELS.en;\n\n// Helper function to get labels for a specific locale\nexport const getLabels = (locale: SupportedLocale = 'en') => {\n return PLUGIN_LABELS[locale] || PLUGIN_LABELS.en;\n};\n\n// Helper function to get a specific label\nexport const getLabel = (key: LabelKey, locale: SupportedLocale = 'en'): string => {\n const labels = getLabels(locale);\n const value = labels[key as keyof typeof labels];\n\n if (typeof value === 'string') {\n return value;\n }\n\n // Fallback to English if not found\n const fallbackLabels = getLabels('en');\n const fallbackValue = fallbackLabels[key];\n\n return typeof fallbackValue === 'string' ? fallbackValue : String(key);\n};\n"],"names":["acceptedLanguages","PLUGIN_LABELS","en","quickFilters","clearFilters","activeFilterSingular","activeFilterPlural","custom","all","yes","no","selectOption","from","to","selectDate","past","future","presentFuture","customRange","apply","cancel","yesterday","lastWeek","lastMonth","last7Days","last30Days","allPast","today","thisWeek","thisMonth","next7Days","next30Days","allFuture","ar","fr","es","zh","he","getLabels","locale","getLabel","key","labels","value","fallbackLabels","fallbackValue","String"],"mappings":"AAAA,gDAAgD;AAEhD,qFAAqF;AACrF,OAAO,MAAMA,oBAAoB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;CAAK,CAAC;AAEtE,OAAO,MAAMC,gBAAgB;IAC3BC,IAAI;QACFC,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;QACNC,IAAI;QACJC,YAAY;QACZC,MAAM;QACNC,QAAQ;QACRC,eAAe;QACfC,aAAa;QACbC,OAAO;QACPC,QAAQ;QACRC,WAAW;QACXC,UAAU;QACV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Ac,CAACH,IAAI;IAEzC,OAAO,OAAOI,kBAAkB,WAAWA,gBAAgBC,OAAOL;AACpE,EAAE"}
|
|
1
|
+
{"version":3,"sources":["../src/labels.ts"],"sourcesContent":["// Centralized labels for the quickfilter plugin\n\n// List of all accepted languages in the system - only those defined in PLUGIN_LABELS\nexport const acceptedLanguages = ['ar', 'en', 'es', 'fr', 'he', 'zh'];\n\nexport const PLUGIN_LABELS = {\n en: {\n quickFilters: 'Quick Filters',\n clearFilters: 'Clear Filters',\n activeFilterSingular: 'Active filter on column',\n activeFilterPlural: 'Active filters on columns',\n custom: 'Custom',\n all: 'All',\n yes: 'Yes',\n no: 'No',\n selectOption: 'Select Option',\n from: 'From',\n to: 'To',\n selectDate: 'Select Date',\n past: 'Past',\n future: 'Future',\n presentFuture: 'Present & Future',\n customRange: 'Custom Range',\n apply: 'Apply',\n cancel: 'Cancel',\n yesterday: 'Yesterday',\n lastWeek: 'Last Week',\n lastMonth: 'Last Month',\n last7Days: 'Last 7 Days',\n last30Days: 'Last 30 Days',\n lastYear: 'Last Year',\n last2Years: 'Last 2 Years',\n allPast: 'All Past',\n today: 'Today',\n thisWeek: 'This Week',\n thisMonth: 'This Month',\n next7Days: 'Next 7 Days',\n next30Days: 'Next 30 Days',\n todayAndFuture: 'Today & Future',\n allFuture: 'All Future',\n },\n ar: {\n quickFilters: 'فلاتر سريعة',\n clearFilters: 'مسح الفلاتر',\n activeFilterSingular: 'فلتر نشط على العمود',\n activeFilterPlural: 'فلاتر نشطة على الأعمدة',\n custom: 'مخصص',\n all: 'الكل',\n yes: 'نعم',\n no: 'لا',\n selectOption: 'اختر خيارًا',\n from: 'من',\n to: 'إلى',\n selectDate: 'اختر التاريخ',\n past: 'الماضي',\n future: 'المستقبل',\n presentFuture: 'الحاضر والمستقبل',\n customRange: 'نطاق مخصص',\n apply: 'تطبيق',\n cancel: 'إلغاء',\n yesterday: 'أمس',\n lastWeek: 'الأسبوع الماضي',\n lastMonth: 'الشهر الماضي',\n last7Days: 'آخر 7 أيام',\n last30Days: 'آخر 30 يومًا',\n lastYear: 'العام الماضي',\n last2Years: 'العامين الماضيين',\n allPast: 'كل الماضي',\n today: 'اليوم',\n thisWeek: 'هذا الأسبوع',\n thisMonth: 'هذا الشهر',\n next7Days: 'الـ 7 أيام القادمة',\n next30Days: 'الـ 30 يومًا القادمة',\n todayAndFuture: 'اليوم والمستقبل',\n allFuture: 'كل المستقبل',\n },\n fr: {\n quickFilters: 'Filtres rapides',\n clearFilters: 'Effacer les filtres',\n activeFilterSingular: 'Filtre actif sur la colonne',\n activeFilterPlural: 'Filtres actifs sur les colonnes',\n custom: 'Personnalisé',\n all: 'Tous',\n yes: 'Oui',\n no: 'Non',\n selectOption: 'Sélectionner une option',\n from: 'De',\n to: 'À',\n selectDate: 'Sélectionner une date',\n past: 'Passé',\n future: 'Futur',\n presentFuture: 'Présent & Futur',\n customRange: 'Plage personnalisée',\n apply: 'Appliquer',\n cancel: 'Annuler',\n yesterday: 'Hier',\n lastWeek: 'Semaine dernière',\n lastMonth: 'Mois dernier',\n last7Days: '7 derniers jours',\n last30Days: '30 derniers jours',\n lastYear: 'Année dernière',\n last2Years: '2 dernières années',\n allPast: 'Tout le passé',\n today: \"Aujourd'hui\",\n thisWeek: 'Cette semaine',\n thisMonth: 'Ce mois',\n next7Days: '7 prochains jours',\n next30Days: '30 prochains jours',\n todayAndFuture: \"Aujourd'hui & Futur\",\n allFuture: 'Tout le futur',\n },\n es: {\n quickFilters: 'Filtros rápidos',\n clearFilters: 'Borrar filtros',\n activeFilterSingular: 'Filtro activo en la columna',\n activeFilterPlural: 'Filtros activos en las columnas',\n custom: 'Personalizado',\n all: 'Todos',\n yes: 'Sí',\n no: 'No',\n selectOption: 'Seleccionar opción',\n from: 'Desde',\n to: 'Hasta',\n selectDate: 'Seleccionar fecha',\n past: 'Pasado',\n future: 'Futuro',\n presentFuture: 'Presente & Futuro',\n customRange: 'Rango personalizado',\n apply: 'Aplicar',\n cancel: 'Cancelar',\n yesterday: 'Ayer',\n lastWeek: 'Semana pasada',\n lastMonth: 'Mes pasado',\n last7Days: 'Últimos 7 días',\n last30Days: 'Últimos 30 días',\n lastYear: 'Último año',\n last2Years: 'Últimos 2 años',\n allPast: 'Todo el pasado',\n today: 'Hoy',\n thisWeek: 'Esta semana',\n thisMonth: 'Este mes',\n next7Days: 'Próximos 7 días',\n next30Days: 'Próximos 30 días',\n todayAndFuture: 'Hoy y futuro',\n allFuture: 'Todo el futuro',\n },\n zh: {\n quickFilters: '快速筛选',\n clearFilters: '清除筛选',\n activeFilterSingular: '列上激活的筛选',\n activeFilterPlural: '多列上激活的筛选',\n custom: '自定义',\n all: '全部',\n yes: '是',\n no: '否',\n selectOption: '选择选项',\n from: '从',\n to: '到',\n selectDate: '选择日期',\n past: '过去',\n future: '未来',\n presentFuture: '现在和未来',\n customRange: '自定义范围',\n apply: '应用',\n cancel: '取消',\n yesterday: '昨天',\n lastWeek: '上周',\n lastMonth: '上个月',\n last7Days: '过去7天',\n last30Days: '过去30天',\n lastYear: '去年',\n last2Years: '过去2年',\n allPast: '所有过去',\n today: '今天',\n thisWeek: '本周',\n thisMonth: '本月',\n next7Days: '未来7天',\n next30Days: '未来30天',\n todayAndFuture: '今天和未来',\n allFuture: '所有未来',\n },\n he: {\n quickFilters: 'סינון מהיר',\n clearFilters: 'נקה סינון',\n activeFilterSingular: 'סינון פעיל בעמודה',\n activeFilterPlural: 'סינון פעיל בעמודות',\n custom: 'מותאם אישית',\n all: 'הכל',\n yes: 'כן',\n no: 'לא',\n selectOption: 'בחר אפשרות',\n from: 'מתאריך',\n to: 'עד תאריך',\n selectDate: 'בחר תאריך',\n past: 'עבר',\n future: 'עתיד',\n presentFuture: 'הווה ועתיד',\n customRange: 'טווח מותאם אישית',\n apply: 'החל',\n cancel: 'ביטול',\n yesterday: 'אתמול',\n lastWeek: 'שבוע שעבר',\n lastMonth: 'חודש שעבר',\n last7Days: '7 ימים אחרונים',\n last30Days: '30 ימים אחרונים',\n lastYear: 'שנה שעברה',\n last2Years: 'שנתיים אחרונות',\n allPast: 'בעבר',\n today: 'היום',\n thisWeek: 'השבוע',\n thisMonth: 'החודש',\n next7Days: '7 ימים הבאים',\n next30Days: '30 ימים הבאים',\n todayAndFuture: 'היום והעתיד',\n allFuture: 'בעתיד',\n },\n // Placeholder for other languages (az, bg, bn-BD, etc.)\n // These can be structured similarly with proper translations\n} as const;\nexport type SupportedLocale = keyof typeof PLUGIN_LABELS;\nexport type LabelKey = keyof typeof PLUGIN_LABELS.en;\n\n// Helper function to get labels for a specific locale\nexport const getLabels = (locale: SupportedLocale = 'en') => {\n return PLUGIN_LABELS[locale] || PLUGIN_LABELS.en;\n};\n\n// Helper function to get a specific label\nexport const getLabel = (key: LabelKey, locale: SupportedLocale = 'en'): string => {\n const labels = getLabels(locale);\n const value = labels[key as keyof typeof labels];\n\n if (typeof value === 'string') {\n return value;\n }\n\n // Fallback to English if not found\n const fallbackLabels = getLabels('en');\n const fallbackValue = fallbackLabels[key];\n\n return typeof fallbackValue === 'string' ? fallbackValue : String(key);\n};\n"],"names":["acceptedLanguages","PLUGIN_LABELS","en","quickFilters","clearFilters","activeFilterSingular","activeFilterPlural","custom","all","yes","no","selectOption","from","to","selectDate","past","future","presentFuture","customRange","apply","cancel","yesterday","lastWeek","lastMonth","last7Days","last30Days","lastYear","last2Years","allPast","today","thisWeek","thisMonth","next7Days","next30Days","todayAndFuture","allFuture","ar","fr","es","zh","he","getLabels","locale","getLabel","key","labels","value","fallbackLabels","fallbackValue","String"],"mappings":"AAAA,gDAAgD;AAEhD,qFAAqF;AACrF,OAAO,MAAMA,oBAAoB;IAAC;IAAM;IAAM;IAAM;IAAM;IAAM;CAAK,CAAC;AAEtE,OAAO,MAAMC,gBAAgB;IAC3BC,IAAI;QACFC,cAAc;QACdC,cAAc;QACdC,sBAAsB;QACtBC,oBAAoB;QACpBC,QAAQ;QACRC,KAAK;QACLC,KAAK;QACLC,IAAI;QACJC,cAAc;QACdC,MAAM;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tD,OAAO,MAAMM,YAAY,CAACC,SAA0B,IAAI;IACtD,OAAOzC,aAAa,CAACyC,OAAO,IAAIzC,cAAcC,EAAE;AAClD,EAAE;AAEF,0CAA0C;AAC1C,OAAO,MAAMyC,WAAW,CAACC,KAAeF,SAA0B,IAAI;IACpE,MAAMG,SAASJ,UAAUC;IACzB,MAAMI,QAAQD,MAAM,CAACD,IAA2B;IAEhD,IAAI,OAAOE,UAAU,UAAU;QAC7B,OAAOA;IACT;IAEA,mCAAmC;IACnC,MAAMC,iBAAiBN,UAAU;IACjC,MAAMO,gBAAgBD,cAAc,CAACH,IAAI;IAEzC,OAAO,OAAOI,kBAAkB,WAAWA,gBAAgBC,OAAOL;AACpE,EAAE"}
|
package/dist/lib/utils.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type ClassValue } from 'clsx';
|
|
2
2
|
import { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
3
|
+
import type { FilterDetaild } from '../filters/types/filters-type';
|
|
4
|
+
import { SupportedLocale } from '../labels';
|
|
3
5
|
export declare function cn(...inputs: ClassValue[]): string;
|
|
4
6
|
export declare function handleNavigation(href: string, e: React.MouseEvent, pathname: string, router: AppRouterInstance): void;
|
|
7
|
+
export declare const parseWhereClauseToFilterValues: (where: any, fields: FilterDetaild[], locale: SupportedLocale) => Record<string, any>;
|
|
8
|
+
export declare const buildQuickFilterConditions: (values: Record<string, any>, fieldDefs: FilterDetaild[], locale: SupportedLocale) => Record<string, any>[];
|
|
5
9
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/lib/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAQ,MAAM,MAAM,CAAA;AAE5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,wDAAwD,CAAA;AAC1F,OAAO,KAAK,EAGV,aAAa,EAEd,MAAM,+BAA+B,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AAO3C,wBAAgB,EAAE,CAAC,GAAG,MAAM,EAAE,UAAU,EAAE,UAEzC;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,CAAC,EAAE,KAAK,CAAC,UAAU,EACnB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,iBAAiB,QAmB1B;AAGD,eAAO,MAAM,8BAA8B,UAClC,GAAG,UACF,aAAa,EAAE,UACf,eAAe,KACtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAqGpB,CAAA;AAED,eAAO,MAAM,0BAA0B,WAC7B,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,aAChB,aAAa,EAAE,UAClB,eAAe,KACtB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EA6DrB,CAAA"}
|
package/dist/lib/utils.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { clsx } from 'clsx';
|
|
2
2
|
import { twMerge } from 'tailwind-merge';
|
|
3
|
+
import { futureOptionKeys, pastOptionKeys } from '../filters/constants/date-filter-options';
|
|
4
|
+
import { getDateRangeForOption } from '../filters/utils/date-helpers';
|
|
3
5
|
export function cn(...inputs) {
|
|
4
6
|
return twMerge(clsx(inputs));
|
|
5
7
|
}
|
|
@@ -14,5 +16,189 @@ export function handleNavigation(href, e, pathname, router) {
|
|
|
14
16
|
}
|
|
15
17
|
router.push(href);
|
|
16
18
|
}
|
|
19
|
+
// Translates URL query conditions to the quick filter's internal state
|
|
20
|
+
export const parseWhereClauseToFilterValues = (where, fields, locale)=>{
|
|
21
|
+
const values = {};
|
|
22
|
+
const fieldNames = new Set(fields.map((f)=>f.name));
|
|
23
|
+
const recursiveParse = (clause)=>{
|
|
24
|
+
if (!clause || typeof clause !== 'object') return;
|
|
25
|
+
if (clause.and) {
|
|
26
|
+
clause.and.forEach(recursiveParse);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (clause.or) {
|
|
30
|
+
if (clause.or.length > 1) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
clause.or.forEach(recursiveParse);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
for(const fieldName in clause){
|
|
37
|
+
if (fieldNames.has(fieldName)) {
|
|
38
|
+
const fieldDef = fields.find((f)=>f.name === fieldName);
|
|
39
|
+
const condition = clause[fieldName];
|
|
40
|
+
// Handle string values for date fields (e.g., 'todayAndFuture')
|
|
41
|
+
if (fieldDef && fieldDef.type === 'date' && typeof condition === 'string') {
|
|
42
|
+
const predefinedValue = condition;
|
|
43
|
+
if ([
|
|
44
|
+
...pastOptionKeys,
|
|
45
|
+
...futureOptionKeys
|
|
46
|
+
].includes(predefinedValue)) {
|
|
47
|
+
values[fieldName] = {
|
|
48
|
+
type: 'predefined',
|
|
49
|
+
predefinedValue
|
|
50
|
+
};
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (fieldDef && condition && typeof condition === 'object') {
|
|
55
|
+
if ('equals' in condition) {
|
|
56
|
+
if (fieldDef.type === 'checkbox') {
|
|
57
|
+
values[fieldName] = condition.equals == 'true' ? 'checked' : 'unchecked';
|
|
58
|
+
} else if (fieldDef.type === 'select') {
|
|
59
|
+
values[fieldName] = {
|
|
60
|
+
selectedValues: [
|
|
61
|
+
condition.equals
|
|
62
|
+
]
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
} else if ('in' in condition && Array.isArray(condition.in)) {
|
|
66
|
+
if (fieldDef.type === 'select') {
|
|
67
|
+
values[fieldName] = {
|
|
68
|
+
selectedValues: condition.in
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
} else if ('greater_than_equal' in condition || 'less_than_equal' in condition) {
|
|
72
|
+
if (fieldDef.type === 'date') {
|
|
73
|
+
const fromDate = condition.greater_than_equal ? new Date(condition.greater_than_equal) : null;
|
|
74
|
+
const toDate = condition.less_than_equal ? new Date(condition.less_than_equal) : null;
|
|
75
|
+
const allDateOptions = [
|
|
76
|
+
...pastOptionKeys,
|
|
77
|
+
...futureOptionKeys
|
|
78
|
+
];
|
|
79
|
+
let matchedOption = null;
|
|
80
|
+
for (const option of allDateOptions){
|
|
81
|
+
const range = getDateRangeForOption(option, locale);
|
|
82
|
+
let isFromMatch;
|
|
83
|
+
if (fromDate) {
|
|
84
|
+
isFromMatch = range.from?.toDateString() === fromDate.toDateString();
|
|
85
|
+
} else if (fromDate == null && range.to == undefined) {
|
|
86
|
+
// all future: fromDate == null & range.to == undefined
|
|
87
|
+
isFromMatch = true;
|
|
88
|
+
}
|
|
89
|
+
let isToMatch;
|
|
90
|
+
if (toDate) {
|
|
91
|
+
isToMatch = range.to?.toDateString() === toDate.toDateString();
|
|
92
|
+
} else if (toDate == null && range.to == undefined) {
|
|
93
|
+
// all future: fromDate == null & range.to == undefined
|
|
94
|
+
isToMatch = true;
|
|
95
|
+
}
|
|
96
|
+
if (isFromMatch && isToMatch) {
|
|
97
|
+
matchedOption = option;
|
|
98
|
+
break;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (matchedOption) {
|
|
102
|
+
values[fieldName] = {
|
|
103
|
+
type: 'predefined',
|
|
104
|
+
predefinedValue: matchedOption
|
|
105
|
+
};
|
|
106
|
+
} else {
|
|
107
|
+
values[fieldName] = {
|
|
108
|
+
type: 'custom',
|
|
109
|
+
customRange: {
|
|
110
|
+
from: fromDate,
|
|
111
|
+
to: toDate
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
recursiveParse(where);
|
|
122
|
+
return values;
|
|
123
|
+
};
|
|
124
|
+
// Builds an array of condition objects from the quick filter values
|
|
125
|
+
export const buildQuickFilterConditions = (values, fieldDefs, locale)=>{
|
|
126
|
+
const conditions = [];
|
|
127
|
+
Object.entries(values).forEach(([fieldName, value])=>{
|
|
128
|
+
if (!value) return;
|
|
129
|
+
const fieldDef = fieldDefs.find((f)=>f.name === fieldName);
|
|
130
|
+
if (!fieldDef) return;
|
|
131
|
+
let condition = null;
|
|
132
|
+
switch(fieldDef.type){
|
|
133
|
+
case 'date':
|
|
134
|
+
{
|
|
135
|
+
const dateValue = value;
|
|
136
|
+
let from;
|
|
137
|
+
let to;
|
|
138
|
+
if (dateValue.predefinedValue) {
|
|
139
|
+
const range = getDateRangeForOption(dateValue.predefinedValue, locale);
|
|
140
|
+
from = range.from;
|
|
141
|
+
to = range.to;
|
|
142
|
+
} else if (dateValue.customRange) {
|
|
143
|
+
if (dateValue.customRange.from) from = new Date(dateValue.customRange.from);
|
|
144
|
+
if (dateValue.customRange.to) to = new Date(dateValue.customRange.to);
|
|
145
|
+
}
|
|
146
|
+
if (from || to) {
|
|
147
|
+
const dateQuery = {};
|
|
148
|
+
if (from) dateQuery.greater_than_equal = from;
|
|
149
|
+
if (to) dateQuery.less_than_equal = to;
|
|
150
|
+
if (Object.keys(dateQuery).length > 0) {
|
|
151
|
+
condition = {
|
|
152
|
+
[fieldName]: dateQuery
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
break;
|
|
157
|
+
}
|
|
158
|
+
case 'select':
|
|
159
|
+
{
|
|
160
|
+
const selectValue = value;
|
|
161
|
+
if (selectValue.selectedValues && selectValue.selectedValues.length > 0) {
|
|
162
|
+
if (selectValue.selectedValues.length === 1) {
|
|
163
|
+
condition = {
|
|
164
|
+
[fieldName]: {
|
|
165
|
+
equals: selectValue.selectedValues[0]
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
} else {
|
|
169
|
+
condition = {
|
|
170
|
+
[fieldName]: {
|
|
171
|
+
in: selectValue.selectedValues
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
break;
|
|
177
|
+
}
|
|
178
|
+
case 'checkbox':
|
|
179
|
+
{
|
|
180
|
+
const checkboxState = value;
|
|
181
|
+
if (checkboxState === 'checked') {
|
|
182
|
+
condition = {
|
|
183
|
+
[fieldName]: {
|
|
184
|
+
equals: 'true'
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
} else if (checkboxState === 'unchecked') {
|
|
188
|
+
condition = {
|
|
189
|
+
[fieldName]: {
|
|
190
|
+
equals: 'false'
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (condition) {
|
|
198
|
+
conditions.push(condition);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
return conditions;
|
|
202
|
+
};
|
|
17
203
|
|
|
18
204
|
//# sourceMappingURL=utils.js.map
|
package/dist/lib/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/utils.ts"],"sourcesContent":["import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\nimport { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n\nexport function handleNavigation(\n href: string,\n e: React.MouseEvent,\n pathname: string,\n router: AppRouterInstance,\n) {\n // Check if we're on holdings page and there's a navigation handler\n if (\n pathname === '/holdings' &&\n typeof window !== 'undefined' &&\n (window as unknown as Record<string, unknown>).holdingsNavigationHandler\n ) {\n const canNavigate = (\n (window as unknown as Record<string, unknown>).holdingsNavigationHandler as (\n href: string,\n ) => boolean\n )(href);\n if (!canNavigate) {\n e.preventDefault();\n return;\n }\n }\n router.push(href);\n}\n"],"names":["clsx","twMerge","cn","inputs","handleNavigation","href","e","pathname","router","window","holdingsNavigationHandler","canNavigate","preventDefault","push"],"mappings":"AAAA,SAASA,IAAI,QAAyB,OAAO;AAC7C,SAASC,OAAO,QAAQ,iBAAiB;AAGzC,OAAO,SAASC,GAAG,GAAGC,MAAoB;IACxC,OAAOF,QAAQD,KAAKG;AACtB;AAEA,OAAO,SAASC,iBACdC,IAAY,EACZC,CAAmB,EACnBC,QAAgB,EAChBC,MAAyB;IAEzB,mEAAmE;IACnE,IACED,aAAa,eACb,OAAOE,WAAW,eAClB,AAACA,OAA8CC,yBAAyB,EACxE;QACA,MAAMC,cAAc,AAClB,AAACF,OAA8CC,yBAAyB,CAGxEL;QACF,IAAI,CAACM,aAAa;YAChBL,EAAEM,cAAc;YAChB;QACF;IACF;IACAJ,OAAOK,IAAI,CAACR;AACd"}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/utils.ts"],"sourcesContent":["import { type ClassValue, clsx } from 'clsx'\nimport { twMerge } from 'tailwind-merge'\nimport { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime'\nimport type {\n CheckboxFilterState,\n DateFilterValue,\n FilterDetaild,\n SelectFilterValue,\n} from '../filters/types/filters-type'\nimport { SupportedLocale } from '../labels'\nimport {\n futureOptionKeys,\n pastOptionKeys,\n} from '../filters/constants/date-filter-options'\nimport { getDateRangeForOption } from '../filters/utils/date-helpers'\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function handleNavigation(\n href: string,\n e: React.MouseEvent,\n pathname: string,\n router: AppRouterInstance,\n) {\n // Check if we're on holdings page and there's a navigation handler\n if (\n pathname === '/holdings' &&\n typeof window !== 'undefined' &&\n (window as unknown as Record<string, unknown>).holdingsNavigationHandler\n ) {\n const canNavigate = (\n (window as unknown as Record<string, unknown>).holdingsNavigationHandler as (\n href: string,\n ) => boolean\n )(href)\n if (!canNavigate) {\n e.preventDefault()\n return\n }\n }\n router.push(href)\n}\n\n// Translates URL query conditions to the quick filter's internal state\nexport const parseWhereClauseToFilterValues = (\n where: any,\n fields: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any> => {\n const values: Record<string, any> = {}\n const fieldNames = new Set(fields.map((f) => f.name))\n\n const recursiveParse = (clause: any) => {\n if (!clause || typeof clause !== 'object') return\n\n if (clause.and) {\n clause.and.forEach(recursiveParse)\n return\n }\n if (clause.or) {\n if (clause.or.length > 1) {\n return\n }\n clause.or.forEach(recursiveParse)\n return\n }\n for (const fieldName in clause) {\n if (fieldNames.has(fieldName)) {\n const fieldDef = fields.find((f) => f.name === fieldName)\n const condition = clause[fieldName]\n\n // Handle string values for date fields (e.g., 'todayAndFuture')\n if (fieldDef && fieldDef.type === 'date' && typeof condition === 'string') {\n const predefinedValue = condition\n if ([...pastOptionKeys, ...futureOptionKeys].includes(predefinedValue as any)) {\n values[fieldName] = {\n type: 'predefined',\n predefinedValue,\n }\n continue\n }\n }\n\n if (fieldDef && condition && typeof condition === 'object') {\n if ('equals' in condition) {\n if (fieldDef.type === 'checkbox') {\n values[fieldName] = condition.equals == 'true' ? 'checked' : 'unchecked'\n } else if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: [condition.equals] }\n }\n } else if ('in' in condition && Array.isArray(condition.in)) {\n if (fieldDef.type === 'select') {\n values[fieldName] = { selectedValues: condition.in }\n }\n } else if ('greater_than_equal' in condition || 'less_than_equal' in condition) {\n if (fieldDef.type === 'date') {\n const fromDate = condition.greater_than_equal\n ? new Date(condition.greater_than_equal)\n : null\n const toDate = condition.less_than_equal ? new Date(condition.less_than_equal) : null\n const allDateOptions = [...pastOptionKeys, ...futureOptionKeys]\n let matchedOption = null\n\n for (const option of allDateOptions) {\n const range = getDateRangeForOption(option, locale)\n let isFromMatch\n if (fromDate) {\n isFromMatch = range.from?.toDateString() === fromDate.toDateString()\n } else if (fromDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isFromMatch = true\n }\n let isToMatch\n if (toDate) {\n isToMatch = range.to?.toDateString() === toDate.toDateString()\n } else if (toDate == null && range.to == undefined) {\n // all future: fromDate == null & range.to == undefined\n isToMatch = true\n }\n\n if (isFromMatch && isToMatch) {\n matchedOption = option\n break\n }\n }\n\n if (matchedOption) {\n values[fieldName] = {\n type: 'predefined',\n predefinedValue: matchedOption,\n }\n } else {\n values[fieldName] = {\n type: 'custom',\n customRange: {\n from: fromDate,\n to: toDate,\n },\n }\n }\n }\n }\n }\n }\n }\n }\n\n recursiveParse(where)\n return values\n}\n// Builds an array of condition objects from the quick filter values\nexport const buildQuickFilterConditions = (\n values: Record<string, any>,\n fieldDefs: FilterDetaild[],\n locale: SupportedLocale,\n): Record<string, any>[] => {\n const conditions: Record<string, any>[] = []\n\n Object.entries(values).forEach(([fieldName, value]) => {\n if (!value) return\n const fieldDef = fieldDefs.find((f) => f.name === fieldName)\n if (!fieldDef) return\n\n let condition: Record<string, any> | null = null\n\n switch (fieldDef.type) {\n case 'date': {\n const dateValue = value as DateFilterValue\n let from: Date | undefined\n let to: Date | undefined\n\n if (dateValue.predefinedValue) {\n const range = getDateRangeForOption(dateValue.predefinedValue, locale)\n from = range.from\n to = range.to\n } else if (dateValue.customRange) {\n if (dateValue.customRange.from) from = new Date(dateValue.customRange.from)\n if (dateValue.customRange.to) to = new Date(dateValue.customRange.to)\n }\n\n if (from || to) {\n const dateQuery: any = {}\n if (from) dateQuery.greater_than_equal = from\n if (to) dateQuery.less_than_equal = to\n if (Object.keys(dateQuery).length > 0) {\n condition = { [fieldName]: dateQuery }\n }\n }\n break\n }\n case 'select': {\n const selectValue = value as SelectFilterValue\n if (selectValue.selectedValues && selectValue.selectedValues.length > 0) {\n if (selectValue.selectedValues.length === 1) {\n condition = { [fieldName]: { equals: selectValue.selectedValues[0] } }\n } else {\n condition = { [fieldName]: { in: selectValue.selectedValues } }\n }\n }\n break\n }\n case 'checkbox': {\n const checkboxState = value as CheckboxFilterState\n if (checkboxState === 'checked') {\n condition = { [fieldName]: { equals: 'true' } }\n } else if (checkboxState === 'unchecked') {\n condition = { [fieldName]: { equals: 'false' } }\n }\n break\n }\n }\n if (condition) {\n conditions.push(condition)\n }\n })\n return conditions\n}"],"names":["clsx","twMerge","futureOptionKeys","pastOptionKeys","getDateRangeForOption","cn","inputs","handleNavigation","href","e","pathname","router","window","holdingsNavigationHandler","canNavigate","preventDefault","push","parseWhereClauseToFilterValues","where","fields","locale","values","fieldNames","Set","map","f","name","recursiveParse","clause","and","forEach","or","length","fieldName","has","fieldDef","find","condition","type","predefinedValue","includes","equals","selectedValues","Array","isArray","in","fromDate","greater_than_equal","Date","toDate","less_than_equal","allDateOptions","matchedOption","option","range","isFromMatch","from","toDateString","to","undefined","isToMatch","customRange","buildQuickFilterConditions","fieldDefs","conditions","Object","entries","value","dateValue","dateQuery","keys","selectValue","checkboxState"],"mappings":"AAAA,SAA0BA,IAAI,QAAQ,OAAM;AAC5C,SAASC,OAAO,QAAQ,iBAAgB;AASxC,SACEC,gBAAgB,EAChBC,cAAc,QACT,2CAA0C;AACjD,SAASC,qBAAqB,QAAQ,gCAA+B;AAErE,OAAO,SAASC,GAAG,GAAGC,MAAoB;IACxC,OAAOL,QAAQD,KAAKM;AACtB;AAEA,OAAO,SAASC,iBACdC,IAAY,EACZC,CAAmB,EACnBC,QAAgB,EAChBC,MAAyB;IAEzB,mEAAmE;IACnE,IACED,aAAa,eACb,OAAOE,WAAW,eAClB,AAACA,OAA8CC,yBAAyB,EACxE;QACA,MAAMC,cAAc,AAClB,AAACF,OAA8CC,yBAAyB,CAGxEL;QACF,IAAI,CAACM,aAAa;YAChBL,EAAEM,cAAc;YAChB;QACF;IACF;IACAJ,OAAOK,IAAI,CAACR;AACd;AAEA,uEAAuE;AACvE,OAAO,MAAMS,iCAAiC,CAC5CC,OACAC,QACAC;IAEA,MAAMC,SAA8B,CAAC;IACrC,MAAMC,aAAa,IAAIC,IAAIJ,OAAOK,GAAG,CAAC,CAACC,IAAMA,EAAEC,IAAI;IAEnD,MAAMC,iBAAiB,CAACC;QACtB,IA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