@kingteza/crud-component 1.0.31 → 1.0.33

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("antd"),g=require("../../context/WindowDimension.cjs"),i=require("react"),u=require("react-router"),q=require("react-router-dom"),{Content:T}=c.Layout,y=({positionOfRoute:n,initialKey:s="*",tabs:l,className:d="",mode:h="default"})=>{const[b,m]=i.useState(s),o=u.useNavigate(),p=e=>{o(e)},r=q.useLocation();i.useEffect(()=>{const e=r.pathname.split("/")[n];m(e??""),e||o(s,{replace:!0})},[s,r.pathname,o,n]);const{isDesktop:x}=g(),a=h==="side"&&x,f=a?"left":"top",j=a?"d-flex h-100":"";return t.jsxs("div",{className:`${d} ${j}`,children:[t.jsx(c.Tabs,{type:"card",tabPosition:f,activeKey:b,onChange:p,children:l.map(({key:e,label:v})=>t.jsx(c.Tabs.TabPane,{tab:v},e))}),t.jsx(T,{className:`max-height ${a?"overflow-auto":""}`,children:t.jsx(u.Outlet,{})})]})};exports.TabViewWithRoute=y;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),c=require("antd"),i=require("react"),u=require("react-router"),g=require("react-router-dom"),q=require("../../context/WindowDimension.cjs"),{Content:T}=c.Layout,y=({positionOfRoute:n,initialKey:s="*",tabs:l,className:d="",mode:h="default"})=>{const[b,m]=i.useState(s),o=u.useNavigate(),p=e=>{o(e)},r=g.useLocation();i.useEffect(()=>{const e=r.pathname.split("/")[n];m(e??""),e||o(s,{replace:!0})},[s,r.pathname,o,n]);const{isDesktop:x}=q(),a=h==="side"&&x,f=a?"left":"top",j=a?"d-flex h-100":"";return t.jsxs("div",{className:`${d} ${j}`,children:[t.jsx(c.Tabs,{type:"card",tabPosition:f,activeKey:b,onChange:p,children:l.map(({key:e,label:v})=>t.jsx(c.Tabs.TabPane,{tab:v},e))}),t.jsx(T,{className:`max-height ${a?"overflow-auto":""}`,children:t.jsx(u.Outlet,{})})]})};exports.TabViewWithRoute=y;
@@ -1,9 +1,9 @@
1
1
  import { jsxs as v, jsx as e } from "react/jsx-runtime";
2
2
  import { Tabs as r, Layout as x } from "antd";
3
- import g from "../../context/WindowDimension.js";
4
- import { useState as y, useEffect as S } from "react";
5
- import { useNavigate as w, Outlet as N } from "react-router";
6
- import { useLocation as P } from "react-router-dom";
3
+ import { useState as g, useEffect as y } from "react";
4
+ import { useNavigate as S, Outlet as w } from "react-router";
5
+ import { useLocation as N } from "react-router-dom";
6
+ import P from "../../context/WindowDimension.js";
7
7
  const { Content: T } = x, A = ({
8
8
  positionOfRoute: c,
9
9
  initialKey: o = "*",
@@ -11,14 +11,14 @@ const { Content: T } = x, A = ({
11
11
  className: m = "",
12
12
  mode: l = "default"
13
13
  }) => {
14
- const [p, u] = y(o), s = w(), f = (t) => {
14
+ const [p, u] = g(o), s = S(), f = (t) => {
15
15
  s(t);
16
- }, n = P();
17
- S(() => {
16
+ }, n = N();
17
+ y(() => {
18
18
  const t = n.pathname.split("/")[c];
19
19
  u(t ?? ""), t || s(o, { replace: !0 });
20
20
  }, [o, n.pathname, s, c]);
21
- const { isDesktop: d } = g(), a = l === "side" && d, h = a ? "left" : "top";
21
+ const { isDesktop: d } = P(), a = l === "side" && d, h = a ? "left" : "top";
22
22
  return /* @__PURE__ */ v("div", { className: `${m} ${a ? "d-flex h-100" : ""}`, children: [
23
23
  /* @__PURE__ */ e(
24
24
  r,
@@ -30,7 +30,7 @@ const { Content: T } = x, A = ({
30
30
  children: i.map(({ key: t, label: b }) => /* @__PURE__ */ e(r.TabPane, { tab: b }, t))
31
31
  }
32
32
  ),
33
- /* @__PURE__ */ e(T, { className: `max-height ${a ? "overflow-auto" : ""}`, children: /* @__PURE__ */ e(N, {}) })
33
+ /* @__PURE__ */ e(T, { className: `max-height ${a ? "overflow-auto" : ""}`, children: /* @__PURE__ */ e(w, {}) })
34
34
  ] });
35
35
  };
36
36
  export {
@@ -3,12 +3,12 @@ import { Rule } from 'antd/es/form';
3
3
  import { FormInstance } from 'antd/lib';
4
4
  import { Dayjs } from 'dayjs';
5
5
  import { default as React, ReactElement } from 'react';
6
- import { default as IdProps } from 'types/Id';
7
6
  import { CrudSearchComponentProps } from './CrudSearchComponent';
8
7
  import { FileCrudField } from './FileCrudField';
9
8
  import { ImageCrudField } from './ImageCrudField';
10
9
  import { CrudImportProps } from './import/CrudImportComponent';
11
- import { SelectTagRenderProps } from 'common/select/SelectComponent';
10
+ import { SelectTagRenderProps } from '../common/select/SelectComponent';
11
+ import { default as IdProps } from '../types/Id';
12
12
  export type SelectFieldItem = {
13
13
  key?: string | number;
14
14
  value: string | number;
@@ -1,5 +1,5 @@
1
1
  import { CrudFieldProps } from '../CrudComponent';
2
- import { DialogProps } from 'types/DialogComponentProp';
2
+ import { DialogProps } from '../../types/DialogComponentProp';
3
3
  export interface CrudImportComponentProps<T> {
4
4
  fields: CrudFieldProps<T>[];
5
5
  importProps: CrudImportProps<T>;
@@ -2,7 +2,7 @@ import { SizeType } from 'antd/es/config-provider/SizeContext';
2
2
  import { ExpandableConfig } from 'antd/es/table/interface';
3
3
  import { TableProps } from 'antd/lib';
4
4
  import { default as React, ReactElement } from 'react';
5
- import { default as IdProps } from 'types/Id';
5
+ import { default as IdProps } from '../../types/Id';
6
6
  import { CrudFieldProps, CrudPaginateProps } from '../CrudComponent';
7
7
  import { CrudSearchComponentProps } from '../CrudSearchComponent';
8
8
  import { DescListColumn } from './CrudDecListView';
@@ -1,2 +1,2 @@
1
- import { CrudFieldProps } from 'crud/CrudComponent';
1
+ import { CrudFieldProps } from '../CrudComponent';
2
2
  export declare function getRendererValueCrudViewer<T>({ type, render, ...props }: CrudFieldProps<T>): (value: any, obj: T, index: number) => any;
package/locale/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { TRANSLATION_NAMESPACE } from 'locale/hooks/translation-constants';
1
+ import { TRANSLATION_NAMESPACE } from '../locale/hooks/translation-constants';
2
2
  import { default as en } from './translations/en';
3
3
  import { default as i18n } from 'i18next';
4
4
  export declare const defaultTranslations: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.0.31",
4
+ "version": "1.0.33",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -24,6 +24,7 @@
24
24
  "/*.d.ts",
25
25
  "/crud/",
26
26
  "/common/",
27
+ "/types/",
27
28
  "/util/",
28
29
  "/locale/",
29
30
  "/README.md"
@@ -0,0 +1,8 @@
1
+ /**
2
+ * This is the common type for dialog props
3
+ */
4
+ export interface DialogProps<U = {}, CLOSE = boolean | undefined, OPEN = CLOSE> {
5
+ open: OPEN | undefined;
6
+ onCloseMethod: (val: CLOSE) => void;
7
+ updatingItem?: U;
8
+ }
package/types/Id.d.ts ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * We can use this interface to indicate the id like
3
+ * { id: string }
4
+ */
5
+ export default interface IdProps {
6
+ id: string;
7
+ }
8
+ export interface IdPropsOp {
9
+ id?: string;
10
+ }