@kingteza/crud-component 1.0.9 → 1.0.12
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.cjs +1 -1
- package/dist/util/index.cjs +1 -1
- package/package.json +18 -9
- package/dist/_virtual/FileSaver.min.cjs +0 -1
- package/dist/_virtual/FileSaver.min.js +0 -5
- package/dist/_virtual/FileSaver.min2.cjs +0 -1
- package/dist/_virtual/FileSaver.min2.js +0 -4
- package/dist/_virtual/ShowMoreText.cjs +0 -1
- package/dist/_virtual/ShowMoreText.js +0 -7
- package/dist/_virtual/ShowMoreText2.cjs +0 -1
- package/dist/_virtual/ShowMoreText2.js +0 -4
- package/dist/_virtual/Truncate.cjs +0 -1
- package/dist/_virtual/Truncate.js +0 -4
- package/dist/_virtual/_commonjsHelpers.cjs +0 -1
- package/dist/_virtual/_commonjsHelpers.js +0 -8
- package/dist/_virtual/advancedFormat.cjs +0 -1
- package/dist/_virtual/advancedFormat.js +0 -7
- package/dist/_virtual/advancedFormat2.cjs +0 -1
- package/dist/_virtual/advancedFormat2.js +0 -4
- package/dist/_virtual/customParseFormat.cjs +0 -1
- package/dist/_virtual/customParseFormat.js +0 -7
- package/dist/_virtual/customParseFormat2.cjs +0 -1
- package/dist/_virtual/customParseFormat2.js +0 -4
- package/dist/_virtual/dayjs.min.cjs +0 -1
- package/dist/_virtual/dayjs.min.js +0 -7
- package/dist/_virtual/dayjs.min2.cjs +0 -1
- package/dist/_virtual/dayjs.min2.js +0 -4
- package/dist/_virtual/index.cjs +0 -1
- package/dist/_virtual/index.js +0 -7
- package/dist/_virtual/index10.cjs +0 -1
- package/dist/_virtual/index10.js +0 -7
- package/dist/_virtual/index11.cjs +0 -1
- package/dist/_virtual/index11.js +0 -7
- package/dist/_virtual/index12.cjs +0 -1
- package/dist/_virtual/index12.js +0 -4
- package/dist/_virtual/index13.cjs +0 -1
- package/dist/_virtual/index13.js +0 -4
- package/dist/_virtual/index2.cjs +0 -1
- package/dist/_virtual/index2.js +0 -5
- package/dist/_virtual/index3.cjs +0 -1
- package/dist/_virtual/index3.js +0 -7
- package/dist/_virtual/index4.cjs +0 -1
- package/dist/_virtual/index4.js +0 -4
- package/dist/_virtual/index5.cjs +0 -1
- package/dist/_virtual/index5.js +0 -4
- package/dist/_virtual/index6.cjs +0 -1
- package/dist/_virtual/index6.js +0 -4
- package/dist/_virtual/index7.cjs +0 -1
- package/dist/_virtual/index7.js +0 -4
- package/dist/_virtual/index8.cjs +0 -1
- package/dist/_virtual/index8.js +0 -2
- package/dist/_virtual/index9.cjs +0 -1
- package/dist/_virtual/index9.js +0 -7
- package/dist/_virtual/jsx-runtime.cjs +0 -1
- package/dist/_virtual/jsx-runtime.js +0 -5
- package/dist/_virtual/jsx-runtime2.cjs +0 -1
- package/dist/_virtual/jsx-runtime2.js +0 -4
- package/dist/_virtual/localeData.cjs +0 -1
- package/dist/_virtual/localeData.js +0 -7
- package/dist/_virtual/localeData2.cjs +0 -1
- package/dist/_virtual/localeData2.js +0 -4
- package/dist/_virtual/main.cjs +0 -1
- package/dist/_virtual/main.js +0 -7
- package/dist/_virtual/main2.cjs +0 -1
- package/dist/_virtual/main2.js +0 -4
- package/dist/_virtual/papaparse.min.cjs +0 -1
- package/dist/_virtual/papaparse.min.js +0 -7
- package/dist/_virtual/papaparse.min2.cjs +0 -1
- package/dist/_virtual/papaparse.min2.js +0 -4
- package/dist/_virtual/react-is.development.cjs +0 -1
- package/dist/_virtual/react-is.development.js +0 -4
- package/dist/_virtual/react-is.development2.cjs +0 -1
- package/dist/_virtual/react-is.development2.js +0 -4
- package/dist/_virtual/react-is.production.min.cjs +0 -1
- package/dist/_virtual/react-is.production.min.js +0 -4
- package/dist/_virtual/react-is.production.min2.cjs +0 -1
- package/dist/_virtual/react-is.production.min2.js +0 -4
- package/dist/_virtual/react-jsx-runtime.development.cjs +0 -1
- package/dist/_virtual/react-jsx-runtime.development.js +0 -4
- package/dist/_virtual/react-jsx-runtime.production.min.cjs +0 -1
- package/dist/_virtual/react-jsx-runtime.production.min.js +0 -4
- package/dist/_virtual/weekOfYear.cjs +0 -1
- package/dist/_virtual/weekOfYear.js +0 -7
- package/dist/_virtual/weekOfYear2.cjs +0 -1
- package/dist/_virtual/weekOfYear2.js +0 -4
- package/dist/_virtual/weekYear.cjs +0 -1
- package/dist/_virtual/weekYear.js +0 -7
- package/dist/_virtual/weekYear2.cjs +0 -1
- package/dist/_virtual/weekYear2.js +0 -4
- package/dist/_virtual/weekday.cjs +0 -1
- package/dist/_virtual/weekday.js +0 -7
- package/dist/_virtual/weekday2.cjs +0 -1
- package/dist/_virtual/weekday2.js +0 -4
- package/dist/common/index.cjs +0 -1
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.js +0 -75
- package/dist/context/WindowDimension.d.ts +0 -4
- package/dist/crud-component.css +0 -9
- package/dist/src/components/common/DatePicker/DatePicker.cjs +0 -1
- package/dist/src/components/common/DatePicker/DatePicker.js +0 -89
- package/dist/src/components/common/DatePicker/TimePicker.cjs +0 -1
- package/dist/src/components/common/DatePicker/TimePicker.js +0 -79
- package/dist/src/components/common/appearance/Hider.cjs +0 -1
- package/dist/src/components/common/appearance/Hider.js +0 -5
- package/dist/src/components/common/button/Button.cjs +0 -1
- package/dist/src/components/common/button/Button.js +0 -65
- package/dist/src/components/common/button/CloneButtonTable.cjs +0 -1
- package/dist/src/components/common/button/CloneButtonTable.js +0 -20
- package/dist/src/components/common/button/DeleteButtonTable.cjs +0 -1
- package/dist/src/components/common/button/DeleteButtonTable.js +0 -68
- package/dist/src/components/common/button/ExportButton.cjs +0 -1
- package/dist/src/components/common/button/ExportButton.js +0 -27
- package/dist/src/components/common/button/HideButtonTable.cjs +0 -1
- package/dist/src/components/common/button/HideButtonTable.js +0 -68
- package/dist/src/components/common/button/ImportButton.cjs +0 -1
- package/dist/src/components/common/button/ImportButton.js +0 -56
- package/dist/src/components/common/button/NewButton.cjs +0 -1
- package/dist/src/components/common/button/NewButton.js +0 -24
- package/dist/src/components/common/button/PrintButton.cjs +0 -1
- package/dist/src/components/common/button/PrintButton.js +0 -26
- package/dist/src/components/common/button/RefreshButton.cjs +0 -1
- package/dist/src/components/common/button/RefreshButton.js +0 -24
- package/dist/src/components/common/button/UnHideButton.cjs +0 -1
- package/dist/src/components/common/button/UnHideButton.js +0 -70
- package/dist/src/components/common/button/UpdateButtonTable.cjs +0 -1
- package/dist/src/components/common/button/UpdateButtonTable.js +0 -20
- package/dist/src/components/common/button/ViewButtonTable.cjs +0 -1
- package/dist/src/components/common/button/ViewButtonTable.js +0 -20
- package/dist/src/components/common/check-box/CheckBox.cjs +0 -1
- package/dist/src/components/common/check-box/CheckBox.js +0 -42
- package/dist/src/components/common/description/DescList.cjs +0 -1
- package/dist/src/components/common/description/DescList.js +0 -16
- package/dist/src/components/common/layout/VerticalSpace.cjs +0 -1
- package/dist/src/components/common/layout/VerticalSpace.js +0 -6
- package/dist/src/components/common/loading/LoadingIndicator.cjs +0 -1
- package/dist/src/components/common/loading/LoadingIndicator.js +0 -25
- package/dist/src/components/common/picker/ImagePicker.cjs +0 -1
- package/dist/src/components/common/picker/ImagePicker.js +0 -287
- package/dist/src/components/common/radio/RadioGroupComponent.cjs +0 -1
- package/dist/src/components/common/radio/RadioGroupComponent.js +0 -20
- package/dist/src/components/common/report/SelectFieldInReport.cjs +0 -1
- package/dist/src/components/common/report/SelectFieldInReport.js +0 -31
- package/dist/src/components/common/select/CustomSelectOption.cjs +0 -1
- package/dist/src/components/common/select/CustomSelectOption.js +0 -13
- package/dist/src/components/common/select/SelectComponent.cjs +0 -1
- package/dist/src/components/common/select/SelectComponent.js +0 -92
- package/dist/src/components/common/show-more/index.cjs +0 -1
- package/dist/src/components/common/show-more/index.js +0 -8
- package/dist/src/components/common/tab/TabViewWithRoute.cjs +0 -1
- package/dist/src/components/common/tab/TabViewWithRoute.js +0 -38
- package/dist/src/components/common/table/table.cjs +0 -1
- package/dist/src/components/common/table/table.js +0 -40
- package/dist/src/components/common/tag/StatusTag.cjs +0 -1
- package/dist/src/components/common/tag/StatusTag.js +0 -30
- package/dist/src/components/common/text/index.cjs +0 -1
- package/dist/src/components/common/text/index.js +0 -5
- package/dist/src/components/common/text/title/index.cjs +0 -1
- package/dist/src/components/common/text/title/index.js +0 -5
- package/dist/src/components/common/text-field/NumberField.cjs +0 -1
- package/dist/src/components/common/text-field/NumberField.js +0 -84
- package/dist/src/components/common/text-field/PhoneNumberField.cjs +0 -1
- package/dist/src/components/common/text-field/PhoneNumberField.js +0 -18
- package/dist/src/components/common/text-field/TextArea.cjs +0 -1
- package/dist/src/components/common/text-field/TextArea.js +0 -48
- package/dist/src/components/common/text-field/TextField.cjs +0 -1
- package/dist/src/components/common/text-field/TextField.js +0 -74
- package/dist/src/components/common/tooltip/TooltipComponent.cjs +0 -1
- package/dist/src/components/common/tooltip/TooltipComponent.js +0 -9
- package/dist/src/components/common/wizard/WizardResult.cjs +0 -1
- package/dist/src/components/common/wizard/WizardResult.js +0 -61
- package/dist/src/components/common/wizard/WizardViewForm.cjs +0 -1
- package/dist/src/components/common/wizard/WizardViewForm.js +0 -74
- package/dist/src/components/crud/CrudComponent.cjs +0 -1
- package/dist/src/components/crud/CrudComponent.js +0 -213
- package/dist/src/components/crud/CrudField.cjs +0 -1
- package/dist/src/components/crud/CrudField.js +0 -462
- package/dist/src/components/crud/CrudForm.cjs +0 -1
- package/dist/src/components/crud/CrudForm.js +0 -94
- package/dist/src/components/crud/CrudFormWizard.cjs +0 -1
- package/dist/src/components/crud/CrudFormWizard.js +0 -145
- package/dist/src/components/crud/CrudReportComponent.cjs +0 -4
- package/dist/src/components/crud/CrudReportComponent.js +0 -259
- package/dist/src/components/crud/CrudSearchComponent.cjs +0 -1
- package/dist/src/components/crud/CrudSearchComponent.js +0 -97
- package/dist/src/components/crud/FileCrudField.cjs +0 -1
- package/dist/src/components/crud/FileCrudField.js +0 -229
- package/dist/src/components/crud/ImageCrudField.cjs +0 -1
- package/dist/src/components/crud/ImageCrudField.js +0 -116
- package/dist/src/components/crud/import/CrudImportButton.cjs +0 -1
- package/dist/src/components/crud/import/CrudImportButton.js +0 -31
- package/dist/src/components/crud/import/CrudImportComponent.cjs +0 -2
- package/dist/src/components/crud/import/CrudImportComponent.js +0 -226
- package/dist/src/components/crud/view/CrudDecListView.cjs +0 -1
- package/dist/src/components/crud/view/CrudDecListView.js +0 -42
- package/dist/src/components/crud/view/CrudViewer.cjs +0 -1
- package/dist/src/components/crud/view/CrudViewer.js +0 -217
- package/dist/src/components/crud/view/CrudViewerUtil.cjs +0 -1
- package/dist/src/components/crud/view/CrudViewerUtil.js +0 -59
- package/dist/src/context/WindowDimension.cjs +0 -1
- package/dist/src/context/WindowDimension.js +0 -8
- package/dist/src/locale/hooks/translation-constants.cjs +0 -1
- package/dist/src/locale/hooks/translation-constants.js +0 -4
- package/dist/src/locale/index.cjs +0 -1
- package/dist/src/locale/index.js +0 -33
- package/dist/src/locale/translations/en.cjs +0 -1
- package/dist/src/locale/translations/en.js +0 -60
- package/dist/src/util/DateUtil.cjs +0 -1
- package/dist/src/util/DateUtil.js +0 -6
- package/dist/src/util/ImageUtil.cjs +0 -1
- package/dist/src/util/ImageUtil.js +0 -63
- package/dist/src/util/NumberUtil.cjs +0 -1
- package/dist/src/util/NumberUtil.js +0 -60
- package/dist/src/util/ValidationUtil.cjs +0 -1
- package/dist/src/util/ValidationUtil.js +0 -60
- package/dist/types/DialogComponentProp.d.ts +0 -8
- package/dist/types/Id.d.ts +0 -10
- package/dist/vite.svg +0 -1
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { j as n } from "../../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import { forwardRef as E, useState as w, useEffect as H, useImperativeHandle as R, useCallback as v, useMemo as _ } from "react";
|
|
3
|
-
import $ from "../appearance/Hider.js";
|
|
4
|
-
import S from "../../../../node_modules/antd/es/steps/index.js";
|
|
5
|
-
const { Step: z } = S, V = E(
|
|
6
|
-
({
|
|
7
|
-
pages: a,
|
|
8
|
-
onSubmit: l,
|
|
9
|
-
initPosition: m = 0,
|
|
10
|
-
progressDot: g,
|
|
11
|
-
type: b,
|
|
12
|
-
labelPlacement: k,
|
|
13
|
-
className: F,
|
|
14
|
-
pageStyle: y
|
|
15
|
-
}, C) => {
|
|
16
|
-
const [e, i] = w(0), [r, p] = w(
|
|
17
|
-
[]
|
|
18
|
-
);
|
|
19
|
-
H(() => {
|
|
20
|
-
i(m);
|
|
21
|
-
}, [m]), R(
|
|
22
|
-
C,
|
|
23
|
-
() => ({
|
|
24
|
-
gotTo: (t) => i(t)
|
|
25
|
-
}),
|
|
26
|
-
[]
|
|
27
|
-
);
|
|
28
|
-
const d = v(
|
|
29
|
-
(t, c = !1, f = !1) => {
|
|
30
|
-
const s = [...r];
|
|
31
|
-
if (t !== void 0 && (s[e] = t, p(s)), f || i(e + 1), c && l) {
|
|
32
|
-
const o = {};
|
|
33
|
-
for (const j of s)
|
|
34
|
-
for (const x in j)
|
|
35
|
-
o[x] = j[x];
|
|
36
|
-
l(s, o);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
[e, r, l]
|
|
40
|
-
), u = v(() => {
|
|
41
|
-
const t = [...r];
|
|
42
|
-
t[e] = void 0, p(t), i(e - 1);
|
|
43
|
-
}, [e, r]), h = _(() => {
|
|
44
|
-
const t = [], c = [], f = a.filter((s) => !s.hidden);
|
|
45
|
-
for (let s = 0; s < f.length; s++) {
|
|
46
|
-
const o = f[s];
|
|
47
|
-
c.push(
|
|
48
|
-
/* @__PURE__ */ n.jsx($, { hide: e !== s, children: o.component({ forward: d, backward: u }, r, e === s) }, `${o.title}${s}`)
|
|
49
|
-
), t.push(/* @__PURE__ */ n.jsx(z, { icon: o.icon, title: o.title }, o.title));
|
|
50
|
-
}
|
|
51
|
-
return {
|
|
52
|
-
_pages: c,
|
|
53
|
-
steps: t
|
|
54
|
-
};
|
|
55
|
-
}, [u, e, r, d, a]);
|
|
56
|
-
return /* @__PURE__ */ n.jsxs(n.Fragment, { children: [
|
|
57
|
-
/* @__PURE__ */ n.jsx(
|
|
58
|
-
S,
|
|
59
|
-
{
|
|
60
|
-
labelPlacement: k,
|
|
61
|
-
progressDot: g,
|
|
62
|
-
className: [F, "pb-3"].join(" "),
|
|
63
|
-
current: e,
|
|
64
|
-
type: b,
|
|
65
|
-
children: h.steps
|
|
66
|
-
}
|
|
67
|
-
),
|
|
68
|
-
/* @__PURE__ */ n.jsx("div", { style: y, children: h._pages })
|
|
69
|
-
] });
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
export {
|
|
73
|
-
V as default
|
|
74
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("../../../_virtual/jsx-runtime.cjs"),ae=require("../../../_virtual/dayjs.min.cjs"),o=require("react"),ie=require("react-i18next"),le=require("../../locale/hooks/translation-constants.cjs"),re=require("./CrudForm.cjs"),ue=require("./CrudFormWizard.cjs"),ce=require("./import/CrudImportButton.cjs"),de=require("./view/CrudViewer.cjs"),fe=require("../common/button/NewButton.cjs"),xe=require("../common/button/PrintButton.cjs"),O=require("../../../node_modules/antd/es/space/index.cjs"),me=require("../../../node_modules/antd/es/modal/index.cjs"),pe=require("../../../node_modules/antd/es/spin/index.cjs"),je=require("../../../node_modules/antd/es/form/index.cjs"),{useForm:ye}=je.default;function Ce({idField:p="id",onCreate:C,onDelete:T,onHide:I,onUpdate:f,fields:i,data:M,grid:w,isHiding:D,isCreating:R,isDeleting:U,isUpdating:b,paginateProps:W,onPrint:q,printing:$,viewable:L,loadingData:H,formBuilder:G,extraAction:J,minusHeight:K,cloneable:Q,fullWidthModal:X=!0,wizard:l,extraView:Y,importable:S,onClickNew:h,...Z}){const{t:g}=ie.useTranslation(le.TRANSLATION_NAMESPACE),[F,j]=o.useState(!1),[x,v]=o.useState(),[z,E]=o.useState(),[r]=ye(),N=o.useCallback(async n=>{const c=l?n:await r.validateFields(),u=i.filter(e=>e.type==="color"),a={};u.forEach(e=>{var d;const t=r.getFieldValue(e.name);a[e.name]=typeof t=="string"?t:(d=t==null?void 0:t.toHexString())==null?void 0:d.toUpperCase()}),Object.assign(c,a),x&&f?(await f({...c,[p]:x[p]}),v(void 0)):!x&&C&&await C(c),E(void 0),r.resetFields(),j(!1)},[i,r,p,C,f,x,l]),[ee,P]=o.useState(!1),[te,k]=o.useState(!1);o.useEffect(()=>{F?(P(!1),k(!1)):y(void 0)},[F]);const V=o.useCallback(async n=>{P(n),k(!0)},[]),_=o.useCallback(async()=>{k(!0)},[]),[se,A]=o.useState(!1),B=o.useCallback(async(n,c=!0,u=!1)=>{try{A(!0),j(!0),c&&y("update");const a={};for(const e of i){const t=n[e.name];if(u&&e.type==="image"){const d=t;try{const oe=await e.provider.clone(d);a[e.name]=oe;continue}catch{continue}}e.type==="date"?t&&(a[e.name]=ae.default(t)):e.type==="select"?e.multiple&&Array.isArray(t)?a[e.name]=t.map(d=>d[e.innerFieldId??"id"]):t&&typeof t=="object"?a[e.name]=t[e.innerFieldId??"id"]:(t&&typeof t=="string"||typeof t=="number")&&(a[e.name]=t):a[e.name]=t}r.setFieldsValue(a),E(a),c&&v(n)}finally{A(!1)}},[i,r]),[m,y]=o.useState(),ne=o.useCallback(async n=>{y("clone"),B(n,!1,!0)},[B]);return s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsxs(O.default,{direction:"vertical",className:"w-100",children:[s.jsxRuntimeExports.jsxs("div",{className:"w-100 d-flex",children:[s.jsxRuntimeExports.jsx("div",{style:{flex:1},children:s.jsxRuntimeExports.jsx(fe.NewButton,{onClick:()=>{h?h():(j(n=>!n),y("new"))},className:"flex-1"})}),s.jsxRuntimeExports.jsxs(O.default,{children:[!!q&&s.jsxRuntimeExports.jsx(xe.PrintButton,{className:"float-right",loading:$,onClick:q}),!!S&&s.jsxRuntimeExports.jsx(ce.default,{fields:i,importProps:S})]})]}),s.jsxRuntimeExports.jsx(de.default,{...Z,minusHeight:K,data:M,fields:i,extraAction:J,idField:p,isDeleting:U,loadingData:H,onClickUpdate:f?B:void 0,onHide:I,isHiding:D,onDelete:T,onUpdate:f,onClickClone:Q?ne:void 0,paginateProps:W,viewable:L,extraView:Y})]}),s.jsxRuntimeExports.jsx(me.default,{width:X?"100%":void 0,title:g(m??"new"),open:F,confirmLoading:R||b,okText:g("str."+(m==="update"?"update":"save")),cancelText:g("str.cancel"),cancelButtonProps:{disabled:te,hidden:!!l},okButtonProps:{disabled:ee,hidden:!!l},onCancel:async()=>{try{if(m==="clone"){const n=l?x:r.getFieldsValue(),c=i.filter(u=>u.type==="image");for(const u of c)n[u.name]&&u.provider.delete(n[u.name])}}finally{}l||r.resetFields(),E(void 0),v(void 0),j(!1)},onOk:()=>N(),destroyOnClose:!0,children:s.jsxRuntimeExports.jsxs(pe.default,{spinning:se,children:[!l&&s.jsxRuntimeExports.jsx(re.CrudForm,{purpose:m,fields:i,form:r,formBuilder:G,grid:w,onDeleteFile:_,onUploadFile:V}),l&&s.jsxRuntimeExports.jsx(ue.default,{submitting:R||b,className:"mt-2",onSave:N,updatingValue:z,fields:i,onDeleteFile:_,onUploadFile:V,purpose:m,wizard:l})]})})]})}exports.default=Ce;
|
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
import { j as t } from "../../../_virtual/jsx-runtime.js";
|
|
2
|
-
import le from "../../../_virtual/dayjs.min.js";
|
|
3
|
-
import { useState as m, useCallback as y, useEffect as ae } from "react";
|
|
4
|
-
import { useTranslation as re } from "react-i18next";
|
|
5
|
-
import { TRANSLATION_NAMESPACE as ce } from "../../locale/hooks/translation-constants.js";
|
|
6
|
-
import { CrudForm as me } from "./CrudForm.js";
|
|
7
|
-
import fe from "./CrudFormWizard.js";
|
|
8
|
-
import de from "./import/CrudImportButton.js";
|
|
9
|
-
import pe from "./view/CrudViewer.js";
|
|
10
|
-
import { NewButton as ue } from "../common/button/NewButton.js";
|
|
11
|
-
import { PrintButton as ye } from "../common/button/PrintButton.js";
|
|
12
|
-
import _ from "../../../node_modules/antd/es/space/index.js";
|
|
13
|
-
import xe from "../../../node_modules/antd/es/modal/index.js";
|
|
14
|
-
import Fe from "../../../node_modules/antd/es/spin/index.js";
|
|
15
|
-
import ge from "../../../node_modules/antd/es/form/index.js";
|
|
16
|
-
const { useForm: je } = ge;
|
|
17
|
-
function Me({
|
|
18
|
-
idField: x = "id",
|
|
19
|
-
onCreate: j,
|
|
20
|
-
onDelete: D,
|
|
21
|
-
onHide: U,
|
|
22
|
-
onUpdate: d,
|
|
23
|
-
fields: i,
|
|
24
|
-
data: W,
|
|
25
|
-
grid: w,
|
|
26
|
-
isHiding: L,
|
|
27
|
-
isCreating: S,
|
|
28
|
-
isDeleting: R,
|
|
29
|
-
isUpdating: N,
|
|
30
|
-
paginateProps: H,
|
|
31
|
-
onPrint: V,
|
|
32
|
-
printing: q,
|
|
33
|
-
viewable: G,
|
|
34
|
-
loadingData: J,
|
|
35
|
-
formBuilder: K,
|
|
36
|
-
extraAction: Q,
|
|
37
|
-
minusHeight: X,
|
|
38
|
-
cloneable: Y,
|
|
39
|
-
fullWidthModal: Z = !0,
|
|
40
|
-
wizard: l,
|
|
41
|
-
extraView: $,
|
|
42
|
-
importable: P,
|
|
43
|
-
onClickNew: A,
|
|
44
|
-
...z
|
|
45
|
-
}) {
|
|
46
|
-
const { t: v } = re(ce), [C, F] = m(!1), [p, B] = m(), [ee, h] = m(), [a] = je(), E = y(
|
|
47
|
-
async (n) => {
|
|
48
|
-
const c = l ? n : await a.validateFields(), r = i.filter((e) => e.type === "color"), s = {};
|
|
49
|
-
r.forEach((e) => {
|
|
50
|
-
var f;
|
|
51
|
-
const o = a.getFieldValue(e.name);
|
|
52
|
-
s[e.name] = typeof o == "string" ? o : (f = o == null ? void 0 : o.toHexString()) == null ? void 0 : f.toUpperCase();
|
|
53
|
-
}), Object.assign(c, s), p && d ? (await d({
|
|
54
|
-
...c,
|
|
55
|
-
[x]: p[x]
|
|
56
|
-
}), B(void 0)) : !p && j && await j(c), h(void 0), a.resetFields(), F(!1);
|
|
57
|
-
},
|
|
58
|
-
[i, a, x, j, d, p, l]
|
|
59
|
-
), [oe, O] = m(!1), [te, k] = m(!1);
|
|
60
|
-
ae(() => {
|
|
61
|
-
C ? (O(!1), k(!1)) : g(void 0);
|
|
62
|
-
}, [C]);
|
|
63
|
-
const T = y(async (n) => {
|
|
64
|
-
O(n), k(!0);
|
|
65
|
-
}, []), I = y(async () => {
|
|
66
|
-
k(!0);
|
|
67
|
-
}, []), [ne, M] = m(!1), b = y(
|
|
68
|
-
async (n, c = !0, r = !1) => {
|
|
69
|
-
try {
|
|
70
|
-
M(!0), F(!0), c && g("update");
|
|
71
|
-
const s = {};
|
|
72
|
-
for (const e of i) {
|
|
73
|
-
const o = n[e.name];
|
|
74
|
-
if (r && e.type === "image") {
|
|
75
|
-
const f = o;
|
|
76
|
-
try {
|
|
77
|
-
const ie = await e.provider.clone(f);
|
|
78
|
-
s[e.name] = ie;
|
|
79
|
-
continue;
|
|
80
|
-
} catch {
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
e.type === "date" ? o && (s[e.name] = le(o)) : e.type === "select" ? e.multiple && Array.isArray(o) ? s[e.name] = o.map(
|
|
85
|
-
(f) => f[e.innerFieldId ?? "id"]
|
|
86
|
-
) : o && typeof o == "object" ? s[e.name] = o[e.innerFieldId ?? "id"] : (o && typeof o == "string" || typeof o == "number") && (s[e.name] = o) : s[e.name] = o;
|
|
87
|
-
}
|
|
88
|
-
a.setFieldsValue(s), h(s), c && B(n);
|
|
89
|
-
} finally {
|
|
90
|
-
M(!1);
|
|
91
|
-
}
|
|
92
|
-
},
|
|
93
|
-
[i, a]
|
|
94
|
-
), [u, g] = m(), se = y(
|
|
95
|
-
async (n) => {
|
|
96
|
-
g("clone"), b(n, !1, !0);
|
|
97
|
-
},
|
|
98
|
-
[b]
|
|
99
|
-
);
|
|
100
|
-
return /* @__PURE__ */ t.jsxs(t.Fragment, { children: [
|
|
101
|
-
/* @__PURE__ */ t.jsxs(_, { direction: "vertical", className: "w-100", children: [
|
|
102
|
-
/* @__PURE__ */ t.jsxs("div", { className: "w-100 d-flex", children: [
|
|
103
|
-
/* @__PURE__ */ t.jsx("div", { style: { flex: 1 }, children: /* @__PURE__ */ t.jsx(
|
|
104
|
-
ue,
|
|
105
|
-
{
|
|
106
|
-
onClick: () => {
|
|
107
|
-
A ? A() : (F((n) => !n), g("new"));
|
|
108
|
-
},
|
|
109
|
-
className: "flex-1"
|
|
110
|
-
}
|
|
111
|
-
) }),
|
|
112
|
-
/* @__PURE__ */ t.jsxs(_, { children: [
|
|
113
|
-
!!V && /* @__PURE__ */ t.jsx(
|
|
114
|
-
ye,
|
|
115
|
-
{
|
|
116
|
-
className: "float-right",
|
|
117
|
-
loading: q,
|
|
118
|
-
onClick: V
|
|
119
|
-
}
|
|
120
|
-
),
|
|
121
|
-
!!P && /* @__PURE__ */ t.jsx(de, { fields: i, importProps: P })
|
|
122
|
-
] })
|
|
123
|
-
] }),
|
|
124
|
-
/* @__PURE__ */ t.jsx(
|
|
125
|
-
pe,
|
|
126
|
-
{
|
|
127
|
-
...z,
|
|
128
|
-
minusHeight: X,
|
|
129
|
-
data: W,
|
|
130
|
-
fields: i,
|
|
131
|
-
extraAction: Q,
|
|
132
|
-
idField: x,
|
|
133
|
-
isDeleting: R,
|
|
134
|
-
loadingData: J,
|
|
135
|
-
onClickUpdate: d ? b : void 0,
|
|
136
|
-
onHide: U,
|
|
137
|
-
isHiding: L,
|
|
138
|
-
onDelete: D,
|
|
139
|
-
onUpdate: d,
|
|
140
|
-
onClickClone: Y ? se : void 0,
|
|
141
|
-
paginateProps: H,
|
|
142
|
-
viewable: G,
|
|
143
|
-
extraView: $
|
|
144
|
-
}
|
|
145
|
-
)
|
|
146
|
-
] }),
|
|
147
|
-
/* @__PURE__ */ t.jsx(
|
|
148
|
-
xe,
|
|
149
|
-
{
|
|
150
|
-
width: Z ? "100%" : void 0,
|
|
151
|
-
title: v(u ?? "new"),
|
|
152
|
-
open: C,
|
|
153
|
-
confirmLoading: S || N,
|
|
154
|
-
okText: v("str." + (u === "update" ? "update" : "save")),
|
|
155
|
-
cancelText: v("str.cancel"),
|
|
156
|
-
cancelButtonProps: {
|
|
157
|
-
disabled: te,
|
|
158
|
-
hidden: !!l
|
|
159
|
-
},
|
|
160
|
-
okButtonProps: {
|
|
161
|
-
disabled: oe,
|
|
162
|
-
hidden: !!l
|
|
163
|
-
},
|
|
164
|
-
onCancel: async () => {
|
|
165
|
-
try {
|
|
166
|
-
if (u === "clone") {
|
|
167
|
-
const n = l ? p : a.getFieldsValue(), c = i.filter((r) => r.type === "image");
|
|
168
|
-
for (const r of c)
|
|
169
|
-
n[r.name] && r.provider.delete(
|
|
170
|
-
n[r.name]
|
|
171
|
-
);
|
|
172
|
-
}
|
|
173
|
-
} finally {
|
|
174
|
-
}
|
|
175
|
-
l || a.resetFields(), h(void 0), B(void 0), F(!1);
|
|
176
|
-
},
|
|
177
|
-
onOk: () => E(),
|
|
178
|
-
destroyOnClose: !0,
|
|
179
|
-
children: /* @__PURE__ */ t.jsxs(Fe, { spinning: ne, children: [
|
|
180
|
-
!l && /* @__PURE__ */ t.jsx(
|
|
181
|
-
me,
|
|
182
|
-
{
|
|
183
|
-
purpose: u,
|
|
184
|
-
fields: i,
|
|
185
|
-
form: a,
|
|
186
|
-
formBuilder: K,
|
|
187
|
-
grid: w,
|
|
188
|
-
onDeleteFile: I,
|
|
189
|
-
onUploadFile: T
|
|
190
|
-
}
|
|
191
|
-
),
|
|
192
|
-
l && /* @__PURE__ */ t.jsx(
|
|
193
|
-
fe,
|
|
194
|
-
{
|
|
195
|
-
submitting: S || N,
|
|
196
|
-
className: "mt-2",
|
|
197
|
-
onSave: E,
|
|
198
|
-
updatingValue: ee,
|
|
199
|
-
fields: i,
|
|
200
|
-
onDeleteFile: I,
|
|
201
|
-
onUploadFile: T,
|
|
202
|
-
purpose: u,
|
|
203
|
-
wizard: l
|
|
204
|
-
}
|
|
205
|
-
)
|
|
206
|
-
] })
|
|
207
|
-
}
|
|
208
|
-
)
|
|
209
|
-
] });
|
|
210
|
-
}
|
|
211
|
-
export {
|
|
212
|
-
Me as default
|
|
213
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("../../../_virtual/jsx-runtime.cjs"),y=require("react"),W=require("../../../_virtual/main.cjs"),G=require("react-i18next"),z=require("../../locale/hooks/translation-constants.cjs"),J=require("./FileCrudField.cjs"),K=require("./ImageCrudField.cjs"),Q=require("../common/DatePicker/DatePicker.cjs"),X=require("../common/DatePicker/TimePicker.cjs"),Y=require("../common/check-box/CheckBox.cjs"),M=require("../common/select/SelectComponent.cjs"),Z=require("../common/text-field/NumberField.cjs"),V=require("../common/text-field/TextField.cjs"),ee=require("../common/text-field/TextArea.cjs"),te=require("../common/tooltip/TooltipComponent.cjs"),N=require("../../../node_modules/antd/es/form/index.cjs"),B=require("../../../node_modules/antd/es/radio/index.cjs"),w=require("../../../node_modules/antd/es/select/index.cjs"),se=require("../../../node_modules/antd/es/color-picker/ColorPicker.cjs");function re(E){const{label:l,name:d,type:g,required:o,hidden:q,rules:x=[],updatable:m=!0,readonly:F=!1,fieldClassName:h,customFormFieldRender:T,fieldTooltip:C,...e}=E,p=N.default.useFormInstance();y.useEffect(()=>{if(g==="select"){const{items:r=[],onSearch:i,searchOnType:n}=e;!(r!=null&&r.length)&&!n&&(i==null||i(void 0,p,e==null?void 0:e.updatingValue))}},[p,e,g,e==null?void 0:e.updatingValue]);const{t:v}=G.useTranslation(z.TRANSLATION_NAMESPACE);if(F||q)return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{});if(T)return T(p,E);switch(g){case"text":case"email":case"password":{const{onChange:r,placeholder:i}=e;return t.jsxRuntimeExports.jsx(V.default,{placeholder:i,disabled:!m,rules:x,required:o,onChange:r?n=>r(n,p):void 0,type:g,name:d,tooltip:C,label:l,className:h,autoComplete:"new-password"})}case"number":{const{onChange:r,placeholder:i,allowMinus:n}=e;return t.jsxRuntimeExports.jsx(Z.default,{placeholder:i,disabled:!m,moneyField:!!e.formatted,type:g,onChange:r?f=>r(f,p):void 0,rules:x,autoComplete:"false",required:o,tooltip:C,className:h,min:n?null:void 0,name:d,label:l})}case"date":{const{range:r,disableToday:i,disabledFutureDays:n,disabledPastDays:f,onChange:j,placeholder:c,format:b}=e;return t.jsxRuntimeExports.jsx(Q.default,{placeholder:c,required:o,disabled:!m,type:g,format:b,tooltip:C,range:r,name:d,label:l,onChange:j?a=>j(a,p):void 0,className:h,disableToday:i,disabledFutureDays:n,disabledPastDays:f})}case"time":{const{range:r=!1,disableCurrent:i,disabledFuture:n,disabledPast:f,onChange:j,use12Hours:c,format:b,placeholder:a}=e;return t.jsxRuntimeExports.jsx(X.default,{placeholder:a,required:o,format:b,disabled:!m,type:g,tooltip:C,range:r,use12Hours:c,name:d,label:l,onChange:j?R=>j(R,p):void 0,className:h,disableCurrent:i,disabledFuture:n,disabledPast:f})}case"textarea":{const{onChange:r,placeholder:i,rows:n,cols:f}=e;return t.jsxRuntimeExports.jsx(ee.default,{rules:x,placeholder:i,onChange:r?j=>{var c;return r((c=j==null?void 0:j.target)==null?void 0:c.value,p)}:void 0,tooltip:C,required:o,disabled:!m,name:d,label:l,className:h,rows:n,cols:f})}case"image":return t.jsxRuntimeExports.jsx(K.default,{...e,required:o,name:d,label:l,rules:x,fieldClassName:h,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"file":return t.jsxRuntimeExports.jsx(J.default,{...e,required:o,name:d,label:l,rules:x,fieldClassName:h,onRemoved:e.onRemoved,onUploading:e.onUploading,provider:e.provider});case"select":return t.jsxRuntimeExports.jsx(U,{...e,required:o,name:d,label:l,rules:x,fieldClassName:h,form:p,updatable:m,readonly:F,fieldTooltip:C});case"enum":{const{enum:r,radio:i=!1,translation:n,onChange:f,onSearch:j,multiple:c}=e,b=Array.isArray(r)?r:Object.keys(r);return i?t.jsxRuntimeExports.jsx(N.default.Item,{...e,name:d,required:o,tooltip:C,rules:x,label:l,className:["w-100",h].join(" "),children:t.jsxRuntimeExports.jsx(B.default.Group,{...e,onChange:f?a=>{var R;return f((R=a==null?void 0:a.target)==null?void 0:R.value,p)}:void 0,children:b.map(a=>t.jsxRuntimeExports.jsx(B.default,{disabled:!m,value:a,children:n?v(n[a]):a},a))})}):t.jsxRuntimeExports.jsx(M.default,{...e,onChange:f?a=>f(a,p):void 0,className:["w-100",h].join(" "),name:d,items:b,required:o,tooltip:C,rules:x,label:l,disabled:!m,onSearch:j?a=>j(a,p):void 0,allowClear:!0,mode:c?"multiple":void 0,itemBuilder:a=>t.jsxRuntimeExports.jsx(w.default.Option,{value:a,children:n?v(n[a]):a},a)})}case"checkbox":{const{onChange:r}=e;return t.jsxRuntimeExports.jsx(Y.default,{className:h,rules:x,onChange:r?i=>r(i,p):void 0,label:l,tooltip:C,disabled:!m,name:d})}case"color":return t.jsxRuntimeExports.jsx(_,{...e,type:"color",required:o,name:d,label:l,rules:x,fieldClassName:h,updatable:m,readonly:F,fieldTooltip:C});default:return t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:`${g} Not Implemented`})}}function U(E){const{items:l=[],loading:d,searchOnType:g,onSearch:o,multiple:q,onChange:x,highlightSearch:m,required:F,fieldClassName:h,rules:T,fieldTooltip:C,updatable:e,label:p,name:v,tagRender:r,updatingValue:i,onSet:n,placeholder:f,allowClear:j=!0}=E,c=E.form,[b,a]=y.useState(""),R=N.default.useWatch(v,c),[k,S]=y.useState(!0);y.useEffect(()=>{n&&k&&R&&(n==null||n(R,l,c),S(!1))},[k,c,l,v,n,R]),y.useEffect(()=>{R&&S(!0)},[R]);const D=y.useCallback(async s=>{a(s),g&&(o==null||o(s,c,i))},[c,o,g,i]);return t.jsxRuntimeExports.jsx(M.default,{...E,maxTagCount:"responsive",maxTagPlaceholder:s=>t.jsxRuntimeExports.jsxs(te.default,{title:t.jsxRuntimeExports.jsx(t.jsxRuntimeExports.Fragment,{children:s.map(u=>t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[u.label," ",t.jsxRuntimeExports.jsx("br",{})]}))}),children:["+",s==null?void 0:s.length]}),placeholder:f,onSelect:s=>{n==null||n(s==null?void 0:s.key,l,c)},onChange:x?s=>{a(""),x(s,c)}:void 0,mode:q?"multiple":void 0,className:["w-100",h].join(" "),name:v,items:l,required:F,tooltip:C,tagRender:r,rules:T,disabled:!e,label:p,allowClear:j,onSearch:D,loading:d,filterOption:m?(s,u)=>{var O,P,A;try{const I=s.toLowerCase().split(/\s+/),H=((typeof(u==null?void 0:u.children)=="string"?u==null?void 0:u.children:(P=(O=u==null?void 0:u.children)==null?void 0:O.props)==null?void 0:P.textToHighlight)??"").toLowerCase(),$=(((A=u==null?void 0:u.value)==null?void 0:A.toString())??"").toLowerCase();return I.every(L=>H.indexOf(L)>=0||$.indexOf(L)>=0)}catch{return!0}}:void 0,itemBuilder:m?s=>{const u=s.value?String(s.value):void 0;return t.jsxRuntimeExports.jsx(w.default.Option,{value:s.key,title:u,disabled:s.disabled,children:t.jsxRuntimeExports.jsx(W.default,{highlightClassName:"highlight-text",searchWords:(b??"").split(" "),autoEscape:!0,textToHighlight:u??""})},s.key)}:s=>t.jsxRuntimeExports.jsx(w.default.Option,{value:s.key,title:s.value,disabled:s.disabled,children:s.value},s.key)})}function _(E){const{required:l,fieldClassName:d,rules:g,fieldTooltip:o,updatable:q,label:x,name:m}=E;return t.jsxRuntimeExports.jsx(N.default.Item,{label:x,name:m,required:l,rules:g,tooltip:o,children:t.jsxRuntimeExports.jsx(se.default,{disabledAlpha:!0,format:"hex",defaultFormat:"hex",showText:!0,trigger:"click",className:d,disabled:!q,...E.innerProps})})}exports.ColorCrudFieldComponent=_;exports.SelectCrudFieldComponent=U;exports.default=re;
|