@yusr_systems/ui 6.0.6 → 6.0.8

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.d.ts CHANGED
@@ -419,7 +419,19 @@ export declare function createGenericEntitySlice<T extends BaseEntity, CR extend
419
419
  isLoading: boolean;
420
420
  currentPage: number;
421
421
  rowsPerPage: number;
422
+ filterTypes?: number[] | undefined;
422
423
  }, action: PayloadAction<number>) => void;
424
+ setFilterTypes: (state: {
425
+ entities: {
426
+ data: Draft<T>[] | undefined;
427
+ count: number;
428
+ };
429
+ isLoaded: boolean;
430
+ isLoading: boolean;
431
+ currentPage: number;
432
+ rowsPerPage: number;
433
+ filterTypes?: number[] | undefined;
434
+ }, action: PayloadAction<number[]>) => void;
423
435
  refresh: (state: {
424
436
  entities: {
425
437
  data: Draft<T>[] | undefined;
@@ -429,6 +441,7 @@ export declare function createGenericEntitySlice<T extends BaseEntity, CR extend
429
441
  isLoading: boolean;
430
442
  currentPage: number;
431
443
  rowsPerPage: number;
444
+ filterTypes?: number[] | undefined;
432
445
  }, action: PayloadAction<{
433
446
  data?: T;
434
447
  deletedId?: number;
@@ -510,7 +523,7 @@ declare interface DateFieldProps extends DateInputProps {
510
523
  required?: boolean;
511
524
  }
512
525
 
513
- export declare function DateInput({ value, onChange, isInvalid, placeholder, locale }: DateInputProps): JSX.Element;
526
+ export declare function DateInput({ value, onChange, isInvalid, placeholder, locale, startYear, endYear, }: DateInputProps): JSX.Element;
514
527
 
515
528
  export declare interface DateInputProps {
516
529
  value?: Date;
@@ -518,6 +531,8 @@ export declare interface DateInputProps {
518
531
  isInvalid?: boolean;
519
532
  placeholder?: string;
520
533
  locale?: any;
534
+ startYear?: number;
535
+ endYear?: number;
521
536
  }
522
537
 
523
538
  export declare function DateTimeField({ label, error, isInvalid, required, ...props }: DateTimeFieldProps): JSX.Element;
@@ -706,7 +721,7 @@ declare const fieldVariants: (props?: ({
706
721
  orientation?: "horizontal" | "vertical" | "responsive" | null | undefined;
707
722
  } & ClassProp) | undefined) => string;
708
723
 
709
- declare type FilterMethodType<T> = (pageNumber: number, rowsPerPage: number, condition?: FilterCondition | undefined) => Promise<RequestResult<FilterResult<T>>> | undefined;
724
+ declare type FilterMethodType<T> = (pageNumber: number, rowsPerPage: number, condition?: FilterCondition | undefined, filterTypes?: number[]) => Promise<RequestResult<FilterResult<T>>> | undefined;
710
725
 
711
726
  export declare function FormField({ label, error, isInvalid, children, required }: FormFieldProps): JSX.Element;
712
727
 
@@ -736,6 +751,7 @@ export declare interface IEntityState<T> {
736
751
  isLoading: boolean;
737
752
  currentPage: number;
738
753
  rowsPerPage: number;
754
+ filterTypes?: number[];
739
755
  }
740
756
 
741
757
  export declare function Input({ className, type, ...props }: React_2.ComponentProps<"input">): JSX.Element;
package/dist/yusr-ui.js CHANGED
@@ -1100,23 +1100,34 @@ function Bt({ className: e, ...t }) {
1100
1100
  }
1101
1101
  //#endregion
1102
1102
  //#region src/components/custom/inputs/dateInput.tsx
1103
- function Vt({ value: e, onChange: t, isInvalid: n, placeholder: r = "اختر تاريخا", locale: i = jt }) {
1104
- return /* @__PURE__ */ o(Pt, { children: [/* @__PURE__ */ a(Ft, {
1105
- asChild: !0,
1106
- children: /* @__PURE__ */ o(F, {
1107
- variant: "outline",
1108
- className: P("w-full justify-between text-left font-normal", !e && "text-muted-foreground", n && "border-red-600 ring-red-600 text-red-900"),
1109
- children: [e ? Fe(e, "PPP", { locale: i }) : /* @__PURE__ */ a("span", { children: r }), /* @__PURE__ */ a(l, { className: "h-4 w-4 opacity-50" })]
1110
- })
1111
- }), /* @__PURE__ */ a(It, {
1112
- className: "w-auto p-0",
1113
- children: /* @__PURE__ */ a(Mt, {
1114
- mode: "single",
1115
- selected: e,
1116
- onSelect: t,
1117
- locale: i
1118
- })
1119
- })] });
1103
+ function Vt({ value: e, onChange: t, isInvalid: n, placeholder: r = "اختر تاريخا", locale: i = jt, startYear: s = (/* @__PURE__ */ new Date()).getFullYear() - 100, endYear: c = (/* @__PURE__ */ new Date()).getFullYear() + 10 }) {
1104
+ let [u, d] = x(!1);
1105
+ return /* @__PURE__ */ o(Pt, {
1106
+ open: u,
1107
+ onOpenChange: d,
1108
+ children: [/* @__PURE__ */ a(Ft, {
1109
+ asChild: !0,
1110
+ children: /* @__PURE__ */ o(F, {
1111
+ variant: "outline",
1112
+ className: P("w-full justify-between text-left font-normal", !e && "text-muted-foreground", n && "border-red-600 ring-red-600 text-red-900"),
1113
+ children: [e ? Fe(e, "PPP", { locale: i }) : /* @__PURE__ */ a("span", { children: r }), /* @__PURE__ */ a(l, { className: "h-4 w-4 opacity-50" })]
1114
+ })
1115
+ }), /* @__PURE__ */ a(It, {
1116
+ className: "w-auto p-0",
1117
+ align: "start",
1118
+ children: /* @__PURE__ */ a(Mt, {
1119
+ mode: "single",
1120
+ selected: e,
1121
+ onSelect: (e) => {
1122
+ t(e), d(!1);
1123
+ },
1124
+ locale: i,
1125
+ captionLayout: "dropdown",
1126
+ startMonth: new Date(s, 0),
1127
+ endMonth: new Date(c, 11)
1128
+ })
1129
+ })]
1130
+ });
1120
1131
  }
1121
1132
  //#endregion
1122
1133
  //#region src/components/pure/label.tsx
@@ -5283,19 +5294,25 @@ var Dc = (e) => e;
5283
5294
  //#endregion
5284
5295
  //#region src/state/generics/genericEntitySlice.ts
5285
5296
  function Oc(e, t, n, r) {
5286
- let i = it({
5287
- name: e,
5288
- initialState: {
5289
- entities: {
5290
- data: [],
5291
- count: 0
5292
- },
5293
- isLoaded: !1,
5294
- isLoading: !1,
5295
- currentPage: 1,
5296
- rowsPerPage: 100
5297
+ let i = {
5298
+ entities: {
5299
+ data: [],
5300
+ count: 0
5297
5301
  },
5302
+ isLoaded: !1,
5303
+ isLoading: !1,
5304
+ currentPage: 1,
5305
+ rowsPerPage: 100
5306
+ }, a = rt(`${e}/filter`, async (r, { getState: i }) => {
5307
+ let a = i()[e], o;
5308
+ return o = n ? await n(a.currentPage, a.rowsPerPage, r, a.filterTypes) : await t.Filter(a.currentPage, a.rowsPerPage, r), o?.data;
5309
+ }), o = it({
5310
+ name: e,
5311
+ initialState: i,
5298
5312
  reducers: {
5313
+ setFilterTypes: (e, t) => {
5314
+ e.filterTypes = t.payload;
5315
+ },
5299
5316
  setCurrentPage: (e, t) => {
5300
5317
  e.currentPage = t.payload;
5301
5318
  },
@@ -5318,14 +5335,11 @@ function Oc(e, t, n, r) {
5318
5335
  e.isLoading = !1;
5319
5336
  });
5320
5337
  }
5321
- }), a = rt(`${e}/filter`, async (r, { getState: i }) => {
5322
- let a = i()[e], o;
5323
- return o = n ? await n(a.currentPage, a.rowsPerPage, r) : await t.Filter(a.currentPage, a.rowsPerPage, r), o?.data;
5324
5338
  });
5325
5339
  return {
5326
- reducer: i.reducer,
5340
+ reducer: o.reducer,
5327
5341
  actions: {
5328
- ...i.actions,
5342
+ ...o.actions,
5329
5343
  filter: a
5330
5344
  }
5331
5345
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yusr_systems/ui",
3
- "version": "6.0.6",
3
+ "version": "6.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -41,7 +41,7 @@
41
41
  "@radix-ui/react-toggle-group": "^1.1.11",
42
42
  "@radix-ui/react-tooltip": "^1.2.8",
43
43
  "@reduxjs/toolkit": "^2.0.0",
44
- "@yusr_systems/core": "^6.0.6",
44
+ "@yusr_systems/core": "^6.0.8",
45
45
  "class-variance-authority": "^0.7.1",
46
46
  "clsx": "^2.1.1",
47
47
  "cmdk": "^1.1.1",