@fctc/widget-logic 1.1.2 → 1.1.4

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.mts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { useClickOutside, useDebounce } from './hooks.mjs';
2
2
  export { CloseIcon, EyeIcon, LoadingIcon } from './icons.mjs';
3
- import { ValuePropsType, WidgetPropsType, ColorWrapperControllerProps, ColorType, IInputFieldProps } from './types.mjs';
4
- export { GoogleLoginType } from './types.mjs';
3
+ import { ValuePropsType, WidgetPropsType, ColorWrapperControllerProps, IInputFieldProps } from './types.mjs';
4
+ export { ColorType, GoogleLoginType } from './types.mjs';
5
5
  import * as react from 'react';
6
- import react__default, { ChangeEvent } from 'react';
6
+ import { ChangeEvent } from 'react';
7
7
  import * as _tanstack_query_core from '@tanstack/query-core';
8
8
  import * as _fctc_interface_logic from '@fctc/interface-logic';
9
9
  import { BaseModelInit } from '@fctc/interface-logic';
@@ -48,6 +48,7 @@ interface Many2OneProps {
48
48
  showDetail: any;
49
49
  actionData: any;
50
50
  }
51
+
51
52
  declare const many2oneFieldController: (props: Many2OneProps) => {
52
53
  allowShowDetail: any;
53
54
  handleClose: () => void;
@@ -98,6 +99,7 @@ interface Many2ManyControllerProps {
98
99
  options: any;
99
100
  sessionStorageUtils: any;
100
101
  }
102
+
101
103
  declare const many2manyFieldController: (props: Many2ManyControllerProps) => {
102
104
  rows: any[];
103
105
  columns: any;
@@ -182,6 +184,7 @@ interface PriorityFieldProps {
182
184
  viewData: any;
183
185
  context: any;
184
186
  }
187
+
185
188
  declare const priorityFieldController: (props: PriorityFieldProps) => {
186
189
  selection: any;
187
190
  isForm: boolean;
@@ -235,6 +238,7 @@ type TDownLoadBinaryProps = {
235
238
  defaultValue: any;
236
239
  formValues: any;
237
240
  };
241
+
238
242
  declare const downLoadBinaryController: (props: TDownLoadBinaryProps) => {
239
243
  handleFileDownload: (e: any) => Promise<void>;
240
244
  };
@@ -261,9 +265,9 @@ declare const copyLinkButtonController: (props: any) => {
261
265
  };
262
266
 
263
267
  declare const colorWrapperController: (props: ColorWrapperControllerProps) => {
264
- selectedColor: ColorType;
268
+ selectedColor: any;
265
269
  showFullColors: boolean;
266
- setSelectedColor: react.Dispatch<react.SetStateAction<ColorType>>;
270
+ setSelectedColor: react.Dispatch<any>;
267
271
  handleShowFullColors: () => void;
268
272
  pickColorsRef: react.RefObject<HTMLDivElement>;
269
273
  savePickColor: any;
@@ -277,6 +281,7 @@ interface ColorFieldProps extends IInputFieldProps {
277
281
  onChange?: (name: string, value: any) => void;
278
282
  [key: string]: any;
279
283
  }
284
+
280
285
  declare const colorFieldController: (props: ColorFieldProps) => {
281
286
  savePickColor: (colorObject: any) => Promise<void>;
282
287
  };
@@ -293,29 +298,6 @@ declare const binaryFieldController: (props: IInputFieldProps) => {
293
298
  getImageBase64WithMimeType: (base64: any) => string | null;
294
299
  };
295
300
 
296
- declare const ModalConfirm: ({ name, isShowModal, onClick, onClose, title, content, isLoading, }: {
297
- name: "delete" | "duplicate" | "archive" | "unarchive";
298
- isShowModal: boolean;
299
- isLoading?: boolean;
300
- onClick: () => void;
301
- onClose: () => void;
302
- title?: string;
303
- content?: React.ReactNode;
304
- }) => JSX.Element;
305
-
306
- declare const ModalDetail: ({ idToolTip, title, model, idForm, aid, place, renderDetail, context, }: any) => react.ReactPortal;
307
-
308
- declare const ModalLayer: ({ isOpen, onClose, title, children, }: {
309
- isOpen: boolean;
310
- onClose: () => void;
311
- title?: string;
312
- children: react__default.ReactNode;
313
- }) => JSX.Element;
314
-
315
- declare const LayerLoading: () => JSX.Element;
316
-
317
- declare const LoadingSmall: () => JSX.Element;
318
-
319
301
  interface UseTableProps {
320
302
  data: {
321
303
  fields: any[];
@@ -330,6 +312,7 @@ interface UseTableProps {
330
312
  typeTable?: 'list' | 'group' | 'calendar';
331
313
  };
332
314
  }
315
+
333
316
  declare const useTableHandler: ({ data }: UseTableProps) => {
334
317
  rows: any[];
335
318
  columns: any;
@@ -337,4 +320,4 @@ declare const useTableHandler: ({ data }: UseTableProps) => {
337
320
  typeTable: "list" | "group" | "calendar" | undefined;
338
321
  };
339
322
 
340
- export { ColorType, ColorWrapperControllerProps, IInputFieldProps, LayerLoading, LoadingSmall, ModalConfirm, ModalDetail, ModalLayer, ValuePropsType, WidgetPropsType, binaryFieldController, colorFieldController, colorWrapperController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, useTableHandler };
323
+ export { ColorWrapperControllerProps, IInputFieldProps, ValuePropsType, WidgetPropsType, binaryFieldController, colorFieldController, colorWrapperController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, useTableHandler };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  export { useClickOutside, useDebounce } from './hooks.js';
2
2
  export { CloseIcon, EyeIcon, LoadingIcon } from './icons.js';
3
- import { ValuePropsType, WidgetPropsType, ColorWrapperControllerProps, ColorType, IInputFieldProps } from './types.js';
4
- export { GoogleLoginType } from './types.js';
3
+ import { ValuePropsType, WidgetPropsType, ColorWrapperControllerProps, IInputFieldProps } from './types.js';
4
+ export { ColorType, GoogleLoginType } from './types.js';
5
5
  import * as react from 'react';
6
- import react__default, { ChangeEvent } from 'react';
6
+ import { ChangeEvent } from 'react';
7
7
  import * as _tanstack_query_core from '@tanstack/query-core';
8
8
  import * as _fctc_interface_logic from '@fctc/interface-logic';
9
9
  import { BaseModelInit } from '@fctc/interface-logic';
@@ -48,6 +48,7 @@ interface Many2OneProps {
48
48
  showDetail: any;
49
49
  actionData: any;
50
50
  }
51
+
51
52
  declare const many2oneFieldController: (props: Many2OneProps) => {
52
53
  allowShowDetail: any;
53
54
  handleClose: () => void;
@@ -98,6 +99,7 @@ interface Many2ManyControllerProps {
98
99
  options: any;
99
100
  sessionStorageUtils: any;
100
101
  }
102
+
101
103
  declare const many2manyFieldController: (props: Many2ManyControllerProps) => {
102
104
  rows: any[];
103
105
  columns: any;
@@ -182,6 +184,7 @@ interface PriorityFieldProps {
182
184
  viewData: any;
183
185
  context: any;
184
186
  }
187
+
185
188
  declare const priorityFieldController: (props: PriorityFieldProps) => {
186
189
  selection: any;
187
190
  isForm: boolean;
@@ -235,6 +238,7 @@ type TDownLoadBinaryProps = {
235
238
  defaultValue: any;
236
239
  formValues: any;
237
240
  };
241
+
238
242
  declare const downLoadBinaryController: (props: TDownLoadBinaryProps) => {
239
243
  handleFileDownload: (e: any) => Promise<void>;
240
244
  };
@@ -261,9 +265,9 @@ declare const copyLinkButtonController: (props: any) => {
261
265
  };
262
266
 
263
267
  declare const colorWrapperController: (props: ColorWrapperControllerProps) => {
264
- selectedColor: ColorType;
268
+ selectedColor: any;
265
269
  showFullColors: boolean;
266
- setSelectedColor: react.Dispatch<react.SetStateAction<ColorType>>;
270
+ setSelectedColor: react.Dispatch<any>;
267
271
  handleShowFullColors: () => void;
268
272
  pickColorsRef: react.RefObject<HTMLDivElement>;
269
273
  savePickColor: any;
@@ -277,6 +281,7 @@ interface ColorFieldProps extends IInputFieldProps {
277
281
  onChange?: (name: string, value: any) => void;
278
282
  [key: string]: any;
279
283
  }
284
+
280
285
  declare const colorFieldController: (props: ColorFieldProps) => {
281
286
  savePickColor: (colorObject: any) => Promise<void>;
282
287
  };
@@ -293,29 +298,6 @@ declare const binaryFieldController: (props: IInputFieldProps) => {
293
298
  getImageBase64WithMimeType: (base64: any) => string | null;
294
299
  };
295
300
 
296
- declare const ModalConfirm: ({ name, isShowModal, onClick, onClose, title, content, isLoading, }: {
297
- name: "delete" | "duplicate" | "archive" | "unarchive";
298
- isShowModal: boolean;
299
- isLoading?: boolean;
300
- onClick: () => void;
301
- onClose: () => void;
302
- title?: string;
303
- content?: React.ReactNode;
304
- }) => JSX.Element;
305
-
306
- declare const ModalDetail: ({ idToolTip, title, model, idForm, aid, place, renderDetail, context, }: any) => react.ReactPortal;
307
-
308
- declare const ModalLayer: ({ isOpen, onClose, title, children, }: {
309
- isOpen: boolean;
310
- onClose: () => void;
311
- title?: string;
312
- children: react__default.ReactNode;
313
- }) => JSX.Element;
314
-
315
- declare const LayerLoading: () => JSX.Element;
316
-
317
- declare const LoadingSmall: () => JSX.Element;
318
-
319
301
  interface UseTableProps {
320
302
  data: {
321
303
  fields: any[];
@@ -330,6 +312,7 @@ interface UseTableProps {
330
312
  typeTable?: 'list' | 'group' | 'calendar';
331
313
  };
332
314
  }
315
+
333
316
  declare const useTableHandler: ({ data }: UseTableProps) => {
334
317
  rows: any[];
335
318
  columns: any;
@@ -337,4 +320,4 @@ declare const useTableHandler: ({ data }: UseTableProps) => {
337
320
  typeTable: "list" | "group" | "calendar" | undefined;
338
321
  };
339
322
 
340
- export { ColorType, ColorWrapperControllerProps, IInputFieldProps, LayerLoading, LoadingSmall, ModalConfirm, ModalDetail, ModalLayer, ValuePropsType, WidgetPropsType, binaryFieldController, colorFieldController, colorWrapperController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, useTableHandler };
323
+ export { ColorWrapperControllerProps, IInputFieldProps, ValuePropsType, WidgetPropsType, binaryFieldController, colorFieldController, colorWrapperController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, useTableHandler };
package/dist/index.js CHANGED
@@ -4036,12 +4036,7 @@ var index_exports = {};
4036
4036
  __export(index_exports, {
4037
4037
  CloseIcon: () => CloseIcon,
4038
4038
  EyeIcon: () => EyeIcon,
4039
- LayerLoading: () => LayerLoading,
4040
4039
  LoadingIcon: () => LoadingIcon,
4041
- LoadingSmall: () => LoadingSmall,
4042
- ModalConfirm: () => ModalConfirm,
4043
- ModalDetail: () => ModalDetail,
4044
- ModalLayer: () => ModalLayer,
4045
4040
  binaryFieldController: () => binaryFieldController,
4046
4041
  colorFieldController: () => colorFieldController,
4047
4042
  colorWrapperController: () => colorWrapperController,
@@ -5313,7 +5308,7 @@ var dateFieldController = (props) => {
5313
5308
  };
5314
5309
  };
5315
5310
 
5316
- // src/widget/basic/copy-link-buttton/controller.ts
5311
+ // src/widget/basic/copy-link-button/controller.ts
5317
5312
  var import_react12 = require("react");
5318
5313
  var import_interface_logic10 = require("@fctc/interface-logic");
5319
5314
  var copyLinkButtonController = (props) => {
@@ -5495,277 +5490,11 @@ var binaryFieldController = (props) => {
5495
5490
  getImageBase64WithMimeType
5496
5491
  };
5497
5492
  };
5498
-
5499
- // src/widget/common/modal-layer.tsx
5500
- var import_react15 = require("react");
5501
- var import_react16 = require("@headlessui/react");
5502
- var import_jsx_runtime4 = require("react/jsx-runtime");
5503
- var ModalLayer = ({
5504
- isOpen,
5505
- onClose,
5506
- title,
5507
- children
5508
- }) => {
5509
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5510
- import_react16.Transition,
5511
- {
5512
- show: isOpen,
5513
- enter: "transition duration-100 ease-out",
5514
- enterFrom: "transform scale-95 opacity-0",
5515
- enterTo: "transform scale-100 opacity-100",
5516
- leave: "transition duration-75 ease-out",
5517
- leaveFrom: "transform scale-100 opacity-100",
5518
- leaveTo: "transform scale-95 opacity-0",
5519
- as: import_react15.Fragment,
5520
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react16.Dialog, { onClose, "aria-labelledby": "modal-title", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react16.DialogPanel, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[500]", children: [
5521
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
5522
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex items-center justify-center mx-4 absolute inset-0 overflow-auto", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: " relative z-[1] mx-auto my-[88px] p-4 flex flex-col gap-2 max-w-[1000px] transform rounded-xl bg-[#FFF]", children: [
5523
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
5524
- "div",
5525
- {
5526
- className: `flex justify-between items-center border-[rgba(0,0,0,0.1)] pb-2`,
5527
- children: [
5528
- title && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { id: "modal-title", className: "text-[20px] font-semibold", children: title }),
5529
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
5530
- "button",
5531
- {
5532
- onClick: onClose,
5533
- "aria-label": "Close",
5534
- className: "ml-auto absolute top-[16px] right-[16px] !cursor-pointer",
5535
- children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(CloseIcon, {})
5536
- }
5537
- )
5538
- ]
5539
- }
5540
- ),
5541
- children
5542
- ] }) })
5543
- ] }) }) })
5544
- }
5545
- );
5546
- };
5547
-
5548
- // src/widget/common/modal-confirm.tsx
5549
- var import_jsx_runtime5 = require("react/jsx-runtime");
5550
- var ModalConfirm = ({
5551
- name,
5552
- isShowModal,
5553
- onClick,
5554
- onClose,
5555
- title,
5556
- content,
5557
- isLoading
5558
- }) => {
5559
- const renderButtonAction = (name2) => {
5560
- switch (name2) {
5561
- case "duplicate":
5562
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5563
- "button",
5564
- {
5565
- type: "button",
5566
- onClick,
5567
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5568
- disabled: isLoading,
5569
- children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingIcon, {})
5570
- }
5571
- );
5572
- case "archive":
5573
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5574
- "button",
5575
- {
5576
- type: "button",
5577
- onClick,
5578
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5579
- disabled: isLoading,
5580
- children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingIcon, {})
5581
- }
5582
- );
5583
- case "unarchive":
5584
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5585
- "button",
5586
- {
5587
- type: "button",
5588
- onClick,
5589
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5590
- disabled: isLoading,
5591
- children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingIcon, {})
5592
- }
5593
- );
5594
- case "delete":
5595
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5596
- "button",
5597
- {
5598
- type: "button",
5599
- onClick,
5600
- className: "button-primary flex-1 flex items-center justify-center gap-2",
5601
- disabled: isLoading,
5602
- children: isLoading && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(LoadingIcon, {})
5603
- }
5604
- );
5605
- default:
5606
- break;
5607
- }
5608
- };
5609
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ModalLayer, { isOpen: isShowModal, onClose, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "mx-auto flex flex-col items-center justify-center gap-4", children: [
5610
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex flex-col gap-[4px] items-center", children: [
5611
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "text-[18px] font-bold", children: title }),
5612
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "text-[16px]", children: content })
5613
- ] }),
5614
- /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex justify-center items-center gap-2 w-full", children: [
5615
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
5616
- "button",
5617
- {
5618
- type: "button",
5619
- onClick: onClose,
5620
- className: "button-secondary flex-1 cursor-pointer"
5621
- }
5622
- ),
5623
- renderButtonAction(name)
5624
- ] })
5625
- ] }) });
5626
- };
5627
-
5628
- // src/widget/common/modal-detail.tsx
5629
- var import_react17 = require("react");
5630
- var import_react_dom = require("react-dom");
5631
- var import_react_tooltip = require("react-tooltip");
5632
- var import_interface_logic13 = require("@fctc/interface-logic");
5633
- var import_jsx_runtime6 = require("react/jsx-runtime");
5634
- var ModalDetail = ({
5635
- idToolTip,
5636
- title,
5637
- model,
5638
- idForm,
5639
- aid,
5640
- place,
5641
- renderDetail,
5642
- context
5643
- }) => {
5644
- const [showModalDetail, setShowModalDetail] = (0, import_react17.useState)(false);
5645
- const [actionData, setActionData] = (0, import_react17.useState)();
5646
- const { isShowingModalDetail } = (0, import_interface_logic13.useAppSelector)(import_interface_logic13.selectForm);
5647
- const appDispatch = (0, import_interface_logic13.useAppDispatch)();
5648
- const handleToggleModal = (e) => {
5649
- e.stopPropagation();
5650
- setShowModalDetail(!showModalDetail);
5651
- appDispatch((0, import_interface_logic13.setIsShowingModalDetail)(!isShowingModalDetail));
5652
- };
5653
- const handleNavigateDetail = () => {
5654
- sessionStorage.setItem("actionData", JSON.stringify(actionData));
5655
- (0, import_interface_logic13.setIsShowingModalDetail)(!isShowingModalDetail);
5656
- window.location.href = `/form/menu?model=${model}&id=${idForm}`;
5657
- };
5658
- return (0, import_react_dom.createPortal)(
5659
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
5660
- !isShowingModalDetail && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5661
- import_react_tooltip.Tooltip,
5662
- {
5663
- opacity: 1,
5664
- className: "z-[99999] ",
5665
- place,
5666
- id: idToolTip,
5667
- clickable: true,
5668
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
5669
- "button",
5670
- {
5671
- className: "flex gap-2 cursor-pointer items-center justify-center rounded-lg",
5672
- type: "button",
5673
- onClick: handleToggleModal,
5674
- children: [
5675
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(EyeIcon, {}),
5676
- title
5677
- ]
5678
- }
5679
- )
5680
- }
5681
- ),
5682
- showModalDetail && /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[100]", children: [
5683
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
5684
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "absolute inset-0 overflow-auto flex flex-col justify-center items-center px-5", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "relative z-[1] max-w-full p-4 flex flex-col gap-4 w-[1000px] transform rounded-3xl bg-[#FFF] h-[90%]", children: [
5685
- /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
5686
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5687
- "div",
5688
- {
5689
- id: "modal-detail",
5690
- className: "text-[20px] cursor-pointer font-semibold flex items-stretch gap-2",
5691
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
5692
- "button",
5693
- {
5694
- onClick: handleNavigateDetail,
5695
- className: "text-sm italic text-primary underline cursor-pointer",
5696
- children: title
5697
- }
5698
- )
5699
- }
5700
- ),
5701
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("button", { onClick: handleToggleModal, className: "cursor-pointer", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CloseIcon, { className: "h-5 w-5" }) })
5702
- ] }),
5703
- /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "flex-1 overflow-auto", children: typeof renderDetail === "function" && renderDetail({
5704
- id: idForm,
5705
- aid,
5706
- model,
5707
- setActionData,
5708
- context
5709
- }) })
5710
- ] }) })
5711
- ] })
5712
- ] }),
5713
- document.body
5714
- );
5715
- };
5716
-
5717
- // src/widget/common/loading-normal.tsx
5718
- var import_react18 = require("react");
5719
- var import_jsx_runtime7 = require("react/jsx-runtime");
5720
- var LayerLoading = () => {
5721
- const [activeIndex, setActiveIndex] = (0, import_react18.useState)(0);
5722
- (0, import_react18.useEffect)(() => {
5723
- const interval = setInterval(() => {
5724
- setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
5725
- }, 200);
5726
- return () => clearInterval(interval);
5727
- }, []);
5728
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "my-auto flex-1 h-full flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex justify-center flex-col items-center gap-12", children: [
5729
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "loading-container", children: [...Array(6)].map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
5730
- "div",
5731
- {
5732
- className: `loading-item ${index === activeIndex ? "active" : ""}`
5733
- },
5734
- index
5735
- )) }),
5736
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-[rgba(45,45,45,1)] text-xl font-semibold tracking-[-1%]" })
5737
- ] }) }) });
5738
- };
5739
-
5740
- // src/widget/common/loading-small.tsx
5741
- var import_react19 = require("react");
5742
- var import_jsx_runtime8 = require("react/jsx-runtime");
5743
- var LoadingSmall = () => {
5744
- const [activeIndex, setActiveIndex] = (0, import_react19.useState)(0);
5745
- (0, import_react19.useEffect)(() => {
5746
- const interval = setInterval(() => {
5747
- setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
5748
- }, 200);
5749
- return () => clearInterval(interval);
5750
- }, []);
5751
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "my-auto flex-1 h-full flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex justify-center flex-col items-center gap-12", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "loading-container-small", children: [...Array(4)].map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
5752
- "div",
5753
- {
5754
- className: `loading-item-small ${index === activeIndex ? "active" : ""}`
5755
- },
5756
- index
5757
- )) }) }) }) });
5758
- };
5759
5493
  // Annotate the CommonJS export names for ESM import in node:
5760
5494
  0 && (module.exports = {
5761
5495
  CloseIcon,
5762
5496
  EyeIcon,
5763
- LayerLoading,
5764
5497
  LoadingIcon,
5765
- LoadingSmall,
5766
- ModalConfirm,
5767
- ModalDetail,
5768
- ModalLayer,
5769
5498
  binaryFieldController,
5770
5499
  colorFieldController,
5771
5500
  colorWrapperController,
package/dist/index.mjs CHANGED
@@ -5321,7 +5321,7 @@ var dateFieldController = (props) => {
5321
5321
  };
5322
5322
  };
5323
5323
 
5324
- // src/widget/basic/copy-link-buttton/controller.ts
5324
+ // src/widget/basic/copy-link-button/controller.ts
5325
5325
  import { useState as useState10 } from "react";
5326
5326
  import { copyTextToClipboard } from "@fctc/interface-logic";
5327
5327
  var copyLinkButtonController = (props) => {
@@ -5503,281 +5503,10 @@ var binaryFieldController = (props) => {
5503
5503
  getImageBase64WithMimeType
5504
5504
  };
5505
5505
  };
5506
-
5507
- // src/widget/common/modal-layer.tsx
5508
- import { Fragment } from "react";
5509
- import { Dialog, DialogPanel, Transition } from "@headlessui/react";
5510
- import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
5511
- var ModalLayer = ({
5512
- isOpen,
5513
- onClose,
5514
- title,
5515
- children
5516
- }) => {
5517
- return /* @__PURE__ */ jsx4(
5518
- Transition,
5519
- {
5520
- show: isOpen,
5521
- enter: "transition duration-100 ease-out",
5522
- enterFrom: "transform scale-95 opacity-0",
5523
- enterTo: "transform scale-100 opacity-100",
5524
- leave: "transition duration-75 ease-out",
5525
- leaveFrom: "transform scale-100 opacity-100",
5526
- leaveTo: "transform scale-95 opacity-0",
5527
- as: Fragment,
5528
- children: /* @__PURE__ */ jsx4(Dialog, { onClose, "aria-labelledby": "modal-title", children: /* @__PURE__ */ jsx4(DialogPanel, { children: /* @__PURE__ */ jsxs3("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[500]", children: [
5529
- /* @__PURE__ */ jsx4("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
5530
- /* @__PURE__ */ jsx4("div", { className: "flex items-center justify-center mx-4 absolute inset-0 overflow-auto", children: /* @__PURE__ */ jsxs3("div", { className: " relative z-[1] mx-auto my-[88px] p-4 flex flex-col gap-2 max-w-[1000px] transform rounded-xl bg-[#FFF]", children: [
5531
- /* @__PURE__ */ jsxs3(
5532
- "div",
5533
- {
5534
- className: `flex justify-between items-center border-[rgba(0,0,0,0.1)] pb-2`,
5535
- children: [
5536
- title && /* @__PURE__ */ jsx4("div", { id: "modal-title", className: "text-[20px] font-semibold", children: title }),
5537
- /* @__PURE__ */ jsx4(
5538
- "button",
5539
- {
5540
- onClick: onClose,
5541
- "aria-label": "Close",
5542
- className: "ml-auto absolute top-[16px] right-[16px] !cursor-pointer",
5543
- children: /* @__PURE__ */ jsx4(CloseIcon, {})
5544
- }
5545
- )
5546
- ]
5547
- }
5548
- ),
5549
- children
5550
- ] }) })
5551
- ] }) }) })
5552
- }
5553
- );
5554
- };
5555
-
5556
- // src/widget/common/modal-confirm.tsx
5557
- import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
5558
- var ModalConfirm = ({
5559
- name,
5560
- isShowModal,
5561
- onClick,
5562
- onClose,
5563
- title,
5564
- content,
5565
- isLoading
5566
- }) => {
5567
- const renderButtonAction = (name2) => {
5568
- switch (name2) {
5569
- case "duplicate":
5570
- return /* @__PURE__ */ jsx5(
5571
- "button",
5572
- {
5573
- type: "button",
5574
- onClick,
5575
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5576
- disabled: isLoading,
5577
- children: isLoading && /* @__PURE__ */ jsx5(LoadingIcon, {})
5578
- }
5579
- );
5580
- case "archive":
5581
- return /* @__PURE__ */ jsx5(
5582
- "button",
5583
- {
5584
- type: "button",
5585
- onClick,
5586
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5587
- disabled: isLoading,
5588
- children: isLoading && /* @__PURE__ */ jsx5(LoadingIcon, {})
5589
- }
5590
- );
5591
- case "unarchive":
5592
- return /* @__PURE__ */ jsx5(
5593
- "button",
5594
- {
5595
- type: "button",
5596
- onClick,
5597
- className: "button-primary flex-1 cursor-pointer flex items-center justify-center gap-2",
5598
- disabled: isLoading,
5599
- children: isLoading && /* @__PURE__ */ jsx5(LoadingIcon, {})
5600
- }
5601
- );
5602
- case "delete":
5603
- return /* @__PURE__ */ jsx5(
5604
- "button",
5605
- {
5606
- type: "button",
5607
- onClick,
5608
- className: "button-primary flex-1 flex items-center justify-center gap-2",
5609
- disabled: isLoading,
5610
- children: isLoading && /* @__PURE__ */ jsx5(LoadingIcon, {})
5611
- }
5612
- );
5613
- default:
5614
- break;
5615
- }
5616
- };
5617
- return /* @__PURE__ */ jsx5(ModalLayer, { isOpen: isShowModal, onClose, children: /* @__PURE__ */ jsxs4("div", { className: "mx-auto flex flex-col items-center justify-center gap-4", children: [
5618
- /* @__PURE__ */ jsxs4("div", { className: "flex flex-col gap-[4px] items-center", children: [
5619
- /* @__PURE__ */ jsx5("div", { className: "text-[18px] font-bold", children: title }),
5620
- /* @__PURE__ */ jsx5("p", { className: "text-[16px]", children: content })
5621
- ] }),
5622
- /* @__PURE__ */ jsxs4("div", { className: "flex justify-center items-center gap-2 w-full", children: [
5623
- /* @__PURE__ */ jsx5(
5624
- "button",
5625
- {
5626
- type: "button",
5627
- onClick: onClose,
5628
- className: "button-secondary flex-1 cursor-pointer"
5629
- }
5630
- ),
5631
- renderButtonAction(name)
5632
- ] })
5633
- ] }) });
5634
- };
5635
-
5636
- // src/widget/common/modal-detail.tsx
5637
- import { useState as useState13 } from "react";
5638
- import { createPortal } from "react-dom";
5639
- import { Tooltip } from "react-tooltip";
5640
- import {
5641
- selectForm,
5642
- setIsShowingModalDetail,
5643
- useAppDispatch as useAppDispatch2,
5644
- useAppSelector as useAppSelector4
5645
- } from "@fctc/interface-logic";
5646
- import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
5647
- var ModalDetail = ({
5648
- idToolTip,
5649
- title,
5650
- model,
5651
- idForm,
5652
- aid,
5653
- place,
5654
- renderDetail,
5655
- context
5656
- }) => {
5657
- const [showModalDetail, setShowModalDetail] = useState13(false);
5658
- const [actionData, setActionData] = useState13();
5659
- const { isShowingModalDetail } = useAppSelector4(selectForm);
5660
- const appDispatch = useAppDispatch2();
5661
- const handleToggleModal = (e) => {
5662
- e.stopPropagation();
5663
- setShowModalDetail(!showModalDetail);
5664
- appDispatch(setIsShowingModalDetail(!isShowingModalDetail));
5665
- };
5666
- const handleNavigateDetail = () => {
5667
- sessionStorage.setItem("actionData", JSON.stringify(actionData));
5668
- setIsShowingModalDetail(!isShowingModalDetail);
5669
- window.location.href = `/form/menu?model=${model}&id=${idForm}`;
5670
- };
5671
- return createPortal(
5672
- /* @__PURE__ */ jsxs5(Fragment2, { children: [
5673
- !isShowingModalDetail && /* @__PURE__ */ jsx6(
5674
- Tooltip,
5675
- {
5676
- opacity: 1,
5677
- className: "z-[99999] ",
5678
- place,
5679
- id: idToolTip,
5680
- clickable: true,
5681
- children: /* @__PURE__ */ jsxs5(
5682
- "button",
5683
- {
5684
- className: "flex gap-2 cursor-pointer items-center justify-center rounded-lg",
5685
- type: "button",
5686
- onClick: handleToggleModal,
5687
- children: [
5688
- /* @__PURE__ */ jsx6(EyeIcon, {}),
5689
- title
5690
- ]
5691
- }
5692
- )
5693
- }
5694
- ),
5695
- showModalDetail && /* @__PURE__ */ jsxs5("div", { className: "fixed bottom-0 left-0 right-0 top-0 z-[100]", children: [
5696
- /* @__PURE__ */ jsx6("div", { className: "absolute inset-0 bg-[rgba(27,27,27,0.48)]" }),
5697
- /* @__PURE__ */ jsx6("div", { className: "absolute inset-0 overflow-auto flex flex-col justify-center items-center px-5", children: /* @__PURE__ */ jsxs5("div", { className: "relative z-[1] max-w-full p-4 flex flex-col gap-4 w-[1000px] transform rounded-3xl bg-[#FFF] h-[90%]", children: [
5698
- /* @__PURE__ */ jsxs5("div", { className: "flex justify-between items-center border-b border-[rgba(0,0,0,0.1)] pb-2", children: [
5699
- /* @__PURE__ */ jsx6(
5700
- "div",
5701
- {
5702
- id: "modal-detail",
5703
- className: "text-[20px] cursor-pointer font-semibold flex items-stretch gap-2",
5704
- children: /* @__PURE__ */ jsx6(
5705
- "button",
5706
- {
5707
- onClick: handleNavigateDetail,
5708
- className: "text-sm italic text-primary underline cursor-pointer",
5709
- children: title
5710
- }
5711
- )
5712
- }
5713
- ),
5714
- /* @__PURE__ */ jsx6("button", { onClick: handleToggleModal, className: "cursor-pointer", children: /* @__PURE__ */ jsx6(CloseIcon, { className: "h-5 w-5" }) })
5715
- ] }),
5716
- /* @__PURE__ */ jsx6("div", { className: "flex-1 overflow-auto", children: typeof renderDetail === "function" && renderDetail({
5717
- id: idForm,
5718
- aid,
5719
- model,
5720
- setActionData,
5721
- context
5722
- }) })
5723
- ] }) })
5724
- ] })
5725
- ] }),
5726
- document.body
5727
- );
5728
- };
5729
-
5730
- // src/widget/common/loading-normal.tsx
5731
- import { useEffect as useEffect10, useState as useState14 } from "react";
5732
- import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
5733
- var LayerLoading = () => {
5734
- const [activeIndex, setActiveIndex] = useState14(0);
5735
- useEffect10(() => {
5736
- const interval = setInterval(() => {
5737
- setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
5738
- }, 200);
5739
- return () => clearInterval(interval);
5740
- }, []);
5741
- return /* @__PURE__ */ jsx7("div", { className: "my-auto flex-1 h-full flex justify-center items-center", children: /* @__PURE__ */ jsx7("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsxs6("div", { className: "flex justify-center flex-col items-center gap-12", children: [
5742
- /* @__PURE__ */ jsx7("div", { className: "loading-container", children: [...Array(6)].map((_, index) => /* @__PURE__ */ jsx7(
5743
- "div",
5744
- {
5745
- className: `loading-item ${index === activeIndex ? "active" : ""}`
5746
- },
5747
- index
5748
- )) }),
5749
- /* @__PURE__ */ jsx7("div", { className: "text-[rgba(45,45,45,1)] text-xl font-semibold tracking-[-1%]" })
5750
- ] }) }) });
5751
- };
5752
-
5753
- // src/widget/common/loading-small.tsx
5754
- import { useEffect as useEffect11, useState as useState15 } from "react";
5755
- import { jsx as jsx8 } from "react/jsx-runtime";
5756
- var LoadingSmall = () => {
5757
- const [activeIndex, setActiveIndex] = useState15(0);
5758
- useEffect11(() => {
5759
- const interval = setInterval(() => {
5760
- setActiveIndex((prevIndex) => (prevIndex + 1) % 6);
5761
- }, 200);
5762
- return () => clearInterval(interval);
5763
- }, []);
5764
- return /* @__PURE__ */ jsx8("div", { className: "my-auto flex-1 h-full flex justify-center items-center", children: /* @__PURE__ */ jsx8("div", { className: "flex justify-center items-center", children: /* @__PURE__ */ jsx8("div", { className: "flex justify-center flex-col items-center gap-12", children: /* @__PURE__ */ jsx8("div", { className: "loading-container-small", children: [...Array(4)].map((_, index) => /* @__PURE__ */ jsx8(
5765
- "div",
5766
- {
5767
- className: `loading-item-small ${index === activeIndex ? "active" : ""}`
5768
- },
5769
- index
5770
- )) }) }) }) });
5771
- };
5772
5506
  export {
5773
5507
  CloseIcon,
5774
5508
  EyeIcon,
5775
- LayerLoading,
5776
5509
  LoadingIcon,
5777
- LoadingSmall,
5778
- ModalConfirm,
5779
- ModalDetail,
5780
- ModalLayer,
5781
5510
  binaryFieldController,
5782
5511
  colorFieldController,
5783
5512
  colorWrapperController,
package/dist/types.d.mts CHANGED
@@ -116,8 +116,8 @@ interface ColorType {
116
116
  }
117
117
  interface ColorWrapperControllerProps {
118
118
  savePickColor: any;
119
- defaultColor: number;
120
- colors: ColorType[];
119
+ defaultColor: any;
120
+ colors: any;
121
121
  }
122
122
 
123
123
  export type { ColorType, ColorWrapperControllerProps, GoogleLoginType, IInputFieldProps, ValuePropsType, WidgetPropsType };
package/dist/types.d.ts CHANGED
@@ -116,8 +116,8 @@ interface ColorType {
116
116
  }
117
117
  interface ColorWrapperControllerProps {
118
118
  savePickColor: any;
119
- defaultColor: number;
120
- colors: ColorType[];
119
+ defaultColor: any;
120
+ colors: any;
121
121
  }
122
122
 
123
123
  export type { ColorType, ColorWrapperControllerProps, GoogleLoginType, IInputFieldProps, ValuePropsType, WidgetPropsType };
package/package.json CHANGED
@@ -1,52 +1,57 @@
1
- {
2
- "name": "@fctc/widget-logic",
3
- "version": "1.1.2",
4
- "types": "dist/index.d.ts",
5
- "main": "dist/index.cjs",
6
- "module": "dist/index.mjs",
7
- "exports": {
8
- ".": {
9
- "types": "./dist/index.d.ts",
10
- "import": "./dist/index.mjs",
11
- "require": "./dist/index.cjs"
12
- },
13
- "./hooks": {
14
- "types": "./dist/hooks.d.ts",
15
- "import": "./dist/hooks.mjs",
16
- "require": "./dist/hooks.cjs"
17
- },
18
- "./types": {
19
- "types": "./dist/types.d.ts",
20
- "import": "./dist/types.mjs",
21
- "require": "./dist/types.cjs"
22
- },
23
- "./widget": {
24
- "types": "./dist/widget.d.ts",
25
- "import": "./dist/widget.mjs",
26
- "require": "./dist/widget.cjs"
27
- }
28
- },
29
- "files": [
30
- "dist"
31
- ],
32
- "scripts": {
33
- "build": "tsup",
34
- "test": "jest"
35
- },
36
- "dependencies": {
37
- "@fctc/interface-logic": "^1.0.4",
38
- "@headlessui/react": "^2.2.6",
39
- "@types/react-dom": "^19.1.7",
40
- "react-datepicker": "^8.4.0",
41
- "react-dom": "^19.1.1",
42
- "react-tooltip": "^5.29.1"
43
- },
44
- "devDependencies": {
45
- "@types/react": "18.0.0",
46
- "jest": "^29.7.0",
47
- "react": "18.0.0",
48
- "tsup": "^8.0.0",
49
- "typescript": "^5.8.2"
50
- },
51
- "packageManager": "yarn@1.22.0"
52
- }
1
+ {
2
+ "name": "@fctc/widget-logic",
3
+ "version": "1.1.4",
4
+ "types": "dist/index.d.ts",
5
+ "main": "dist/index.cjs",
6
+ "module": "dist/index.mjs",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
+ },
13
+ "./hooks": {
14
+ "types": "./dist/hooks.d.ts",
15
+ "import": "./dist/hooks.mjs",
16
+ "require": "./dist/hooks.cjs"
17
+ },
18
+ "./types": {
19
+ "types": "./dist/types.d.ts",
20
+ "import": "./dist/types.mjs",
21
+ "require": "./dist/types.cjs"
22
+ },
23
+ "./widget": {
24
+ "types": "./dist/widget.d.ts",
25
+ "import": "./dist/widget.mjs",
26
+ "require": "./dist/widget.cjs"
27
+ },
28
+ "./icons": {
29
+ "types": "./dist/icons.d.ts",
30
+ "import": "./dist/icons.mjs",
31
+ "require": "./dist/icons.cjs"
32
+ }
33
+ },
34
+ "files": [
35
+ "dist"
36
+ ],
37
+ "scripts": {
38
+ "build": "tsup",
39
+ "test": "jest"
40
+ },
41
+ "dependencies": {
42
+ "@fctc/interface-logic": "^1.0.4",
43
+ "@headlessui/react": "^2.2.6",
44
+ "@types/react-dom": "^19.1.7",
45
+ "react-datepicker": "^8.4.0",
46
+ "react-dom": "^19.1.1",
47
+ "react-tooltip": "^5.29.1"
48
+ },
49
+ "devDependencies": {
50
+ "@types/react": "18.0.0",
51
+ "jest": "^29.7.0",
52
+ "react": "18.0.0",
53
+ "tsup": "^8.0.0",
54
+ "typescript": "^5.8.2"
55
+ },
56
+ "packageManager": "yarn@1.22.0"
57
+ }