@kingteza/crud-component 1.27.3 → 1.29.1

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.
Files changed (36) hide show
  1. package/dist/common/rich/index.d.ts +2 -1
  2. package/dist/common/text-field/NumberField.cjs.js +1 -1
  3. package/dist/common/text-field/NumberField.es.js +17 -18
  4. package/dist/crud/CrudComponent.cjs.js +1 -1
  5. package/dist/crud/CrudComponent.d.ts +20 -9
  6. package/dist/crud/CrudComponent.es.js +73 -69
  7. package/dist/crud/CrudField.cjs.js +1 -1
  8. package/dist/crud/CrudField.es.js +302 -286
  9. package/dist/crud/CrudForm.d.ts +2 -2
  10. package/dist/crud/CrudFormWizard.cjs.js +1 -1
  11. package/dist/crud/CrudFormWizard.d.ts +2 -2
  12. package/dist/crud/CrudFormWizard.es.js +82 -78
  13. package/dist/crud/CrudReportComponent.d.ts +5 -5
  14. package/dist/crud/CrudSearchComponent.d.ts +2 -2
  15. package/dist/crud/actions/index.cjs.js +1 -1
  16. package/dist/crud/actions/index.d.ts +3 -1
  17. package/dist/crud/actions/index.es.js +63 -61
  18. package/dist/crud/import/CrudImportComponent.d.ts +2 -2
  19. package/dist/crud/index.d.ts +1 -1
  20. package/dist/crud/modal/index.cjs.js +1 -1
  21. package/dist/crud/modal/index.d.ts +2 -2
  22. package/dist/crud/modal/index.es.js +101 -96
  23. package/dist/crud/view/CrudDecListView.cjs.js +1 -1
  24. package/dist/crud/view/CrudDecListView.d.ts +2 -2
  25. package/dist/crud/view/CrudDecListView.es.js +31 -30
  26. package/dist/crud/view/CrudViewer.cjs.js +1 -1
  27. package/dist/crud/view/CrudViewer.d.ts +3 -3
  28. package/dist/crud/view/CrudViewer.es.js +190 -182
  29. package/dist/crud/view/CrudViewerUtil.cjs.js +1 -1
  30. package/dist/crud/view/CrudViewerUtil.es.js +39 -38
  31. package/dist/util/CrudUtil.d.ts +1 -1
  32. package/dist/util/ObjectUtil.cjs.js +1 -0
  33. package/dist/util/ObjectUtil.d.ts +2 -0
  34. package/dist/util/ObjectUtil.es.js +10 -0
  35. package/package.json +1 -1
  36. package/dist/locale/index.d.ts +0 -86
@@ -1,47 +1,48 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import { CheckOutlined as S, CloseOutlined as F } from "@ant-design/icons";
3
- import { Typography as d, Space as R, Tag as C, Tooltip as w, Avatar as I } from "antd";
4
- import { FileCrudCellValue as P } from "../FileCrudField.es.js";
5
- import { ImageCrudCellValue as V } from "../ImageCrudField.es.js";
3
+ import { Typography as h, Space as P, Tag as C, Tooltip as R, Avatar as V } from "antd";
4
+ import { FileCrudCellValue as w } from "../FileCrudField.es.js";
5
+ import { ImageCrudCellValue as I } from "../ImageCrudField.es.js";
6
6
  import T from "../../util/DateUtil.es.js";
7
7
  import j from "../../util/NumberUtil.es.js";
8
8
  import { tWithOrWithoutNS as A } from "../../locale/index.es.js";
9
9
  import k from "../../util/CrudUtil.es.js";
10
10
  import { ErrorBoundaryComponent as b } from "../../common/error/ErrorBoundaryComponent.es.js";
11
- import { CopyToClipboardButtonWrapper as m, copyableFn as h } from "../../util/CopyUtilComponent.es.js";
12
- function z({
11
+ import { CopyToClipboardButtonWrapper as m, copyableFn as d } from "../../util/CopyUtilComponent.es.js";
12
+ import { getValueByPath as D } from "../../util/ObjectUtil.es.js";
13
+ function J({
13
14
  type: y,
14
- render: n,
15
+ render: e,
15
16
  ...u
16
17
  }) {
17
18
  try {
18
- return y === "object" ? (t, l, e) => /* @__PURE__ */ r(
19
+ return y === "object" ? (t, l, n) => /* @__PURE__ */ r(
19
20
  m,
20
21
  {
21
22
  copyable: u.copyable,
22
23
  value: t,
23
- children: typeof n == "function" ? n(t, l, e) : ""
24
+ children: typeof e == "function" ? e(t, l, n) : ""
24
25
  }
25
- ) : y === "select" ? (t, l, e) => {
26
+ ) : y === "select" ? (t, l, n) => {
26
27
  if (!t) return "-";
27
28
  const o = u, a = t || (o.items ?? []).find(
28
- (f) => f[o.innerFieldId ?? "key"] === l[k.getRealName(u.name, "upsertFieldName")]
29
+ (f) => f[o.innerFieldId ?? "key"] === D(l, k.getRealName(u.name, "upsertFieldName"))
29
30
  ), c = o.multiple ? Array.isArray(a) ? a.map((f) => f == null ? void 0 : f[o.innerFieldLabel ?? "name"]) : void 0 : a == null ? void 0 : a[o.innerFieldLabel ?? "value"];
30
- return /* @__PURE__ */ r(d.Text, { copyable: h(o.copyable, c), children: typeof n == "function" ? n(c, l, e) : Array.isArray(c) ? c.join(", ") : c });
31
- } : y === "number" ? (t, l, e) => {
31
+ return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: typeof e == "function" ? e(c, l, n) : Array.isArray(c) ? c.join(", ") : c });
32
+ } : y === "number" ? (t, l, n) => {
32
33
  const o = u;
33
- return /* @__PURE__ */ r(d.Text, { copyable: h(o.copyable, t), children: typeof n == "function" ? n(t, l, e) : o.int ? j.toInt(t, o.formatted) : j.toMoney(t) });
34
- } : y === "enum" ? (t, l, e) => {
34
+ return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: typeof e == "function" ? e(t, l, n) : o.int ? j.toInt(t, o.formatted) : j.toMoney(t) });
35
+ } : y === "enum" ? (t, l, n) => {
35
36
  var f;
36
37
  if (!t) return "-";
37
38
  const o = u;
38
- if (typeof n == "function")
39
+ if (typeof e == "function")
39
40
  return /* @__PURE__ */ r(
40
41
  m,
41
42
  {
42
43
  copyable: o.copyable,
43
44
  value: t,
44
- children: n(t, l, e)
45
+ children: e(t, l, n)
45
46
  }
46
47
  );
47
48
  if (o.multiple) {
@@ -66,7 +67,7 @@ function z({
66
67
  value: () => s.map(
67
68
  ({ translatedValue: i, item: p }) => i ?? p
68
69
  ).join(", "),
69
- children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(R, { wrap: !0, children: s.map(({ tagProps: i, translatedValue: p, item: v }, g) => i ? /* @__PURE__ */ r(C, { color: i.color, children: p }, g + v) : p) }) })
70
+ children: /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(P, { wrap: !0, children: s.map(({ tagProps: i, translatedValue: p, item: v }, g) => i ? /* @__PURE__ */ r(C, { color: i.color, children: p }, g + v) : p) }) })
70
71
  }
71
72
  );
72
73
  if (o != null && o.translation)
@@ -85,9 +86,9 @@ function z({
85
86
  {
86
87
  const i = s.map(({ translatedValue: p, item: v }) => p ?? v).join(", ");
87
88
  return /* @__PURE__ */ r(
88
- d.Text,
89
+ h.Text,
89
90
  {
90
- copyable: h(o.copyable, i),
91
+ copyable: d(o.copyable, i),
91
92
  children: i
92
93
  }
93
94
  );
@@ -106,8 +107,8 @@ function z({
106
107
  }
107
108
  );
108
109
  }
109
- return /* @__PURE__ */ r(d.Text, { copyable: h(o.copyable, c), children: c });
110
- } : y === "date" ? (t, l, e) => {
110
+ return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, c), children: c });
111
+ } : y === "date" ? (t, l, n) => {
111
112
  if (!t) return "-";
112
113
  const o = u, a = o.formatTime ? T.formatDateTime(t) : T.formatDate(t);
113
114
  return /* @__PURE__ */ r(
@@ -115,22 +116,22 @@ function z({
115
116
  {
116
117
  copyable: o.copyable,
117
118
  value: a,
118
- children: /* @__PURE__ */ r(b, { children: typeof n == "function" ? n(t, l, e) : a })
119
+ children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : a })
119
120
  }
120
121
  );
121
- } : y === "checkbox" ? (t, l, e) => typeof n == "function" ? n(t, l, e) : t ? /* @__PURE__ */ r(S, {}) : /* @__PURE__ */ r(F, {}) : y === "image" ? (t, l, e) => t ? /* @__PURE__ */ r(b, { children: typeof n == "function" ? n(t, l, e) : /* @__PURE__ */ r(
122
- V,
122
+ } : y === "checkbox" ? (t, l, n) => typeof e == "function" ? e(t, l, n) : t ? /* @__PURE__ */ r(S, {}) : /* @__PURE__ */ r(F, {}) : y === "image" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
123
+ I,
123
124
  {
124
125
  value: t,
125
126
  provider: u.provider
126
127
  }
127
- ) }) : "-" : y === "file" ? (t, l, e) => t ? /* @__PURE__ */ r(b, { children: typeof n == "function" ? n(t, l, e) : /* @__PURE__ */ r(
128
- P,
128
+ ) }) : "-" : y === "file" ? (t, l, n) => t ? /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : /* @__PURE__ */ r(
129
+ w,
129
130
  {
130
131
  value: t,
131
132
  provider: u.provider
132
133
  }
133
- ) }) : "" : y === "time" ? (t, l, e) => {
134
+ ) }) : "" : y === "time" ? (t, l, n) => {
134
135
  if (!t) return "-";
135
136
  const o = u, a = o.format, c = o.use12Hours, f = T.formatTime(
136
137
  t,
@@ -141,30 +142,30 @@ function z({
141
142
  {
142
143
  copyable: o.copyable,
143
144
  value: f,
144
- children: /* @__PURE__ */ r(b, { children: typeof n == "function" ? n(t, l, e) : f })
145
+ children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : f })
145
146
  }
146
147
  );
147
- } : y === "color" ? (t, l, e) => {
148
+ } : y === "color" ? (t, l, n) => {
148
149
  const o = u;
149
- return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(b, { children: typeof n == "function" ? n(t, l, e) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(w, { title: t, children: /* @__PURE__ */ r(I, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
150
- } : y === "textarea" ? (t, l, e) => {
150
+ return t ? /* @__PURE__ */ r(m, { copyable: o.copyable, value: t, children: /* @__PURE__ */ r(b, { children: typeof e == "function" ? e(t, l, n) : typeof t == "string" && t.startsWith("#") ? /* @__PURE__ */ r(R, { title: t, children: /* @__PURE__ */ r(V, { style: { backgroundColor: t } }) }) : String(t) }) }) : "-";
151
+ } : y === "textarea" ? (t, l, n) => {
151
152
  if (!t) return "-";
152
153
  const o = u, a = o.truncated ?? 1, c = typeof t == "string" && t.split(" ").length < 10;
153
- return typeof n == "function" ? /* @__PURE__ */ r(
154
+ return typeof e == "function" ? /* @__PURE__ */ r(
154
155
  m,
155
156
  {
156
157
  copyable: o.copyable,
157
158
  value: t,
158
- children: n(t, l, e)
159
+ children: e(t, l, n)
159
160
  }
160
161
  ) : a ? /* @__PURE__ */ r(b, { children: /* @__PURE__ */ r(
161
- d.Paragraph,
162
+ h.Paragraph,
162
163
  {
163
164
  ellipsis: !c && {
164
165
  rows: a === !0 ? 1 : a,
165
166
  expandable: "collapsible"
166
167
  },
167
- copyable: h(o.copyable, t),
168
+ copyable: d(o.copyable, t),
168
169
  children: o.rich ? /* @__PURE__ */ r(
169
170
  "div",
170
171
  {
@@ -194,9 +195,9 @@ function z({
194
195
  children: t
195
196
  }
196
197
  );
197
- } : typeof n == "function" ? n : (t, l, e) => {
198
+ } : typeof e == "function" ? e : (t, l, n) => {
198
199
  const o = u;
199
- return /* @__PURE__ */ r(d.Text, { copyable: h(o.copyable, t), children: t });
200
+ return /* @__PURE__ */ r(h.Text, { copyable: d(o.copyable, t), children: t });
200
201
  };
201
202
  } catch (t) {
202
203
  return console.warn(
@@ -206,5 +207,5 @@ function z({
206
207
  }
207
208
  }
208
209
  export {
209
- z as getRendererValueCrudViewer
210
+ J as getRendererValueCrudViewer
210
211
  };
@@ -1,4 +1,4 @@
1
- import { InitialCrudField, SelectCrudField } from 'src/crud';
1
+ import { InitialCrudField, SelectCrudField } from '../crud/CrudComponent';
2
2
  declare class CrudUtil {
3
3
  static getRealName<T>(name: InitialCrudField<T>["name"] | SelectCrudField<T>["name"], extract?: "name" | "upsertFieldName"): (string | number)[] | keyof T;
4
4
  }
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function y(e,r){return typeof e!="object"||e===null?e:Array.isArray(r)?r.reduce((t,u)=>t[u],e):e[r]}function i(e,r,t){return typeof e!="object"||e===null?e:Array.isArray(r)?r.reduce((u,n)=>u[n],e):(e[r]=t,e)}exports.getValueByPath=y;exports.setValueByPath=i;
@@ -0,0 +1,2 @@
1
+ export declare function getValueByPath<T = any>(obj: T, path: (string | number)[] | keyof T): T[keyof T] | any;
2
+ export declare function setValueByPath<T = any>(obj: T, path: (string | number)[] | keyof T, value: any): T;
@@ -0,0 +1,10 @@
1
+ function f(r, e) {
2
+ return typeof r != "object" || r === null ? r : Array.isArray(e) ? e.reduce((u, t) => u[t], r) : r[e];
3
+ }
4
+ function i(r, e, u) {
5
+ return typeof r != "object" || r === null ? r : Array.isArray(e) ? e.reduce((t, n) => t[n], r) : (r[e] = u, r);
6
+ }
7
+ export {
8
+ f as getValueByPath,
9
+ i as setValueByPath
10
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kingteza/crud-component",
3
3
  "private": false,
4
- "version": "1.27.3",
4
+ "version": "1.29.1",
5
5
  "description": "React CRUD component library with Ant Design",
6
6
  "keywords": [
7
7
  "react",
@@ -1,86 +0,0 @@
1
- import { TRANSLATION_NAMESPACE } from '../locale/hooks/translation-constants';
2
- import { default as en } from './translations/en';
3
- import { i18n as i18nType } from 'i18next';
4
- import { UseTranslationOptions } from 'react-i18next';
5
- export declare const defaultTranslations: {
6
- en: {
7
- "crud-component": {
8
- str: {
9
- delete: string;
10
- clone: string;
11
- update: string;
12
- new: string;
13
- back: string;
14
- next: string;
15
- save: string;
16
- import: string;
17
- cancel: string;
18
- print: string;
19
- hide: string;
20
- no: string;
21
- action: string;
22
- remove: string;
23
- view: string;
24
- ok: string;
25
- yes: string;
26
- warning: string;
27
- success: string;
28
- error: string;
29
- retry: string;
30
- previous: string;
31
- unhide: string;
32
- downloadCsvTemplate: string;
33
- importCsvFile: string;
34
- export: string;
35
- goBack: string;
36
- refresh: string;
37
- fileUploadMessage1: string;
38
- fileUploadMessage2: string;
39
- rotateLeft: string;
40
- rotateRight: string;
41
- flipHorizontal: string;
42
- flipVertical: string;
43
- skipCrop: string;
44
- };
45
- err: {
46
- save: string;
47
- validation: {
48
- required: string;
49
- minLength8: string;
50
- percentage: string;
51
- maximumValueExceeded: string;
52
- invalidNic: string;
53
- invalid: string;
54
- };
55
- notFound: string;
56
- };
57
- message: {
58
- loading: {
59
- saving: string;
60
- };
61
- uploadButtonText: string;
62
- };
63
- qus: {
64
- importWithIssues: string;
65
- doYouWantToDelete: string;
66
- doYouWantToHide: string;
67
- doYouWantToUnhide: string;
68
- };
69
- };
70
- };
71
- };
72
- export type LibTranslations = typeof en;
73
- export interface SetupI18nOptions {
74
- translations?: Record<string, {
75
- [TRANSLATION_NAMESPACE]: LibTranslations;
76
- }>;
77
- language?: string;
78
- i18nInstance?: i18nType;
79
- }
80
- export declare let i18nInstance: i18nType;
81
- export declare const setupI18n: (options?: SetupI18nOptions) => i18nType;
82
- export declare const updateTranslations: (language: string, translations: Record<string, any>, i18nInstance?: i18nType) => void;
83
- export declare const useTranslationLib: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"crud-component", string>;
84
- export declare const useTranslationLibNoNS: (options?: Omit<UseTranslationOptions<string>, "i18n">) => import('react-i18next').UseTranslationResponse<"translation", string>;
85
- export declare const t: (key: string, options?: any) => string | import('node_modules/i18next/typescript/helpers').$SpecialObject | import('i18next').TFunctionDetailedResult<string | import('node_modules/i18next/typescript/helpers').$SpecialObject, any>;
86
- export declare const tWithOrWithoutNS: (key: string, options?: any, fallback?: string) => string | object;