@pnkx-lib/ui 1.9.495 → 1.9.498

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.
@@ -13,6 +13,7 @@ import { R as RefIcon$7 } from './LoadingOutlined-DCtDXz9K.js';
13
13
  import { R as RefIcon$8, a as RefIcon$a } from './CloseCircleFilled-Bo29sDEQ.js';
14
14
  import { R as RefIcon$9 } from './CloseOutlined-CZUJ_3tW.js';
15
15
  import { C as Controller } from './index.esm-Dr5ZHcf7.js';
16
+ import { toast } from '@pnkx-lib/core';
16
17
  import { R as RefIcon$b } from './InboxOutlined-BBuIJe6u.js';
17
18
 
18
19
  // This icon file is generated automatically.
@@ -11481,7 +11482,9 @@ function GenericUploadModal({
11481
11482
  texts,
11482
11483
  setFileList,
11483
11484
  fileList,
11484
- trans
11485
+ trans,
11486
+ onDeleteFile,
11487
+ listType
11485
11488
  }) {
11486
11489
  const [displayFileList, setDisplayFileList] = useState(fileList);
11487
11490
  const [listFileId, setListFileId] = useState([]);
@@ -11503,6 +11506,13 @@ function GenericUploadModal({
11503
11506
  showUploadList: true,
11504
11507
  fileList: displayFileList,
11505
11508
  beforeUpload: (file) => {
11509
+ const MAX_FILE_SIZE = 5 * 1024 * 1024;
11510
+ if (file.size > MAX_FILE_SIZE && texts?.fileSizeError) {
11511
+ toast.warning(
11512
+ trans("categoryModernMedicine:fileError", { name: file.name })
11513
+ );
11514
+ return Upload$2.LIST_IGNORE;
11515
+ }
11506
11516
  const newFile = {
11507
11517
  uid: file.uid,
11508
11518
  name: file.name,
@@ -11543,6 +11553,14 @@ function GenericUploadModal({
11543
11553
  }
11544
11554
  });
11545
11555
  const handleSubmitDeleteFile = async () => {
11556
+ if (listFileId.length > 0) {
11557
+ try {
11558
+ onDeleteFile(listFileId);
11559
+ } catch (error) {
11560
+ onCancel();
11561
+ console.log("error", error);
11562
+ }
11563
+ }
11546
11564
  onCancel();
11547
11565
  };
11548
11566
  return /* @__PURE__ */ jsx(
@@ -11565,12 +11583,20 @@ function GenericUploadModal({
11565
11583
  render: ({ field }) => {
11566
11584
  const { onChange } = field;
11567
11585
  const props = createUploadProps(onChange);
11568
- return /* @__PURE__ */ jsx(Spin, { spinning: false, tip: texts?.uploading, children: /* @__PURE__ */ jsxs(Dragger, { ...props, accept: ".pdf,.doc,.docx,.jpg,.jpeg,.png", children: [
11569
- /* @__PURE__ */ jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsx(RefIcon$b, {}) }),
11570
- /* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText }),
11571
- /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 }),
11572
- /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint2 })
11573
- ] }) });
11586
+ return /* @__PURE__ */ jsx(Spin, { spinning: false, tip: texts?.uploading, children: /* @__PURE__ */ jsxs(
11587
+ Dragger,
11588
+ {
11589
+ ...props,
11590
+ listType,
11591
+ accept: ".pdf,.doc,.docx,.jpg,.jpeg,.png",
11592
+ children: [
11593
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsx(RefIcon$b, {}) }),
11594
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText }),
11595
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 }),
11596
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint2 })
11597
+ ]
11598
+ }
11599
+ ) });
11574
11600
  }
11575
11601
  }
11576
11602
  ) })
package/es/index.js CHANGED
@@ -65,7 +65,7 @@ export { ViewPdf } from './ui/ViewPdf.js';
65
65
  export { Sidebar } from './ui/Sidebar/index.js';
66
66
  export { SelectTable } from './ui/SelectTable.js';
67
67
  export { SelectSingleTable } from './ui/SelectSingleTable.js';
68
- export { G as GenericUploadModal } from './chunks/GenericUploadModal-DlXxiQ6N.js';
68
+ export { G as GenericUploadModal } from './chunks/GenericUploadModal-DxRzdkYF.js';
69
69
  export { Descriptions } from './ui/Descriptions.js';
70
70
  export { Input } from './fields/Input.js';
71
71
  export { PnkxField } from './fields/PnkxField.js';
@@ -1,6 +1,7 @@
1
1
  import 'react/jsx-runtime';
2
2
  import 'antd';
3
- export { G as GenericUploadModal } from '../chunks/GenericUploadModal-DlXxiQ6N.js';
3
+ export { G as GenericUploadModal } from '../chunks/GenericUploadModal-DxRzdkYF.js';
4
4
  import '../chunks/index.esm-Dr5ZHcf7.js';
5
5
  import 'react';
6
+ import '@pnkx-lib/core';
6
7
  import '../chunks/InboxOutlined-BBuIJe6u.js';
package/es/ui/Tabs.js CHANGED
@@ -23,7 +23,7 @@ const createStoreImpl = (createState) => {
23
23
  const initialState = state = createState(setState, getState, api);
24
24
  return api;
25
25
  };
26
- const createStore = (createState) => createState ? createStoreImpl(createState) : createStoreImpl;
26
+ const createStore = ((createState) => createState ? createStoreImpl(createState) : createStoreImpl);
27
27
 
28
28
  const identity = (arg) => arg;
29
29
  function useStore(api, selector = identity) {
@@ -41,7 +41,7 @@ const createImpl = (createState) => {
41
41
  Object.assign(useBoundStore, api);
42
42
  return useBoundStore;
43
43
  };
44
- const create = (createState) => createState ? createImpl(createState) : createImpl;
44
+ const create = ((createState) => createState ? createImpl(createState) : createImpl);
45
45
 
46
46
  const useTabStore = create((set) => ({
47
47
  activeTabKey: void 0,
package/es/ui/index.js CHANGED
@@ -64,8 +64,8 @@ import { r as requireClassnames, c as classNames } from '../chunks/index-BLRvgOF
64
64
  import { F as FastColor, m as blue, n as blueDark, o as cyan, q as cyanDark, s as geekblue, t as geekblueDark, i as generate, v as gold, x as goldDark, y as gray, z as green, A as greenDark, B as grey, C as greyDark, D as lime, E as limeDark, G as magenta, H as magentaDark, J as orange, K as orangeDark, L as presetDarkPalettes, j as presetPalettes, p as presetPrimaryColors, M as purple, N as purpleDark, O as red, P as redDark, Q as volcano, R as volcanoDark, S as yellow, T as yellowDark, c as _slicedToArray, b as _objectSpread2, w as warningOnce, a as _objectWithoutProperties, _ as _extends$1 } from '../chunks/AntdIcon-Bve8mGNz.js';
65
65
  import { b as _defineProperty, _ as _typeof$1 } from '../chunks/defineProperty-CTLrw71t.js';
66
66
  import { z as lintWarning, A as toStyleStr, B as ATTR_CACHE_MAP, E as serialize, F as extract, G as CSS_VAR_PREFIX, H as STYLE_PREFIX, I as extract$1, T as TOKEN_PREFIX, J as extract$2, K as unitlessKeys, M as supportWhere, N as supportLogicProps, O as StyleContext, P as StyleProvider, Q as Theme, R as createCache, U as createTheme, V as getComputedToken, W as token2CSSVar, u as unit$1, X as useCSSVarRegister, Y as useCacheToken, Z as useStyleRegister, $ as genCalc$1, a0 as genStyleUtils$1, m as merge, a1 as statistic, a2 as statisticToken, a3 as MotionProvider, _ as _toConsumableArray, a4 as merge$1, a5 as get$1, a6 as set$1, a7 as isEqual$1, t as toArray$3 } from '../chunks/toArray-2LkvUaha.js';
67
- import { K as Keyframe, C as CSSMotion, a as CSSMotionList, T as Tooltip, P as Popup, _ as _asyncToGenerator, b as _regeneratorRuntime, c as Color, u as useEvent$2, d as useMergedState$1, r as requireReactIs, p as pickAttrs } from '../chunks/GenericUploadModal-DlXxiQ6N.js';
68
- export { G as GenericUploadModal } from '../chunks/GenericUploadModal-DlXxiQ6N.js';
67
+ import { K as Keyframe, C as CSSMotion, a as CSSMotionList, T as Tooltip, P as Popup, _ as _asyncToGenerator, b as _regeneratorRuntime, c as Color, u as useEvent$2, d as useMergedState$1, r as requireReactIs, p as pickAttrs } from '../chunks/GenericUploadModal-DxRzdkYF.js';
68
+ export { G as GenericUploadModal } from '../chunks/GenericUploadModal-DxRzdkYF.js';
69
69
  import { _ as _createClass, a as _classCallCheck, b as _inherits, c as _createSuper, d as _assertThisInitialized, e as _isNativeReflectConstruct, f as _setPrototypeOf, g as _getPrototypeOf } from '../chunks/createSuper-C9_dQ5Zr.js';
70
70
  import ReactDOM__default, { unstable_batchedUpdates, createPortal } from 'react-dom';
71
71
  import { isEmpty, isBoolean } from 'lodash';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.495",
4
+ "version": "1.9.498",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -1,4 +1,5 @@
1
1
  import { Control } from 'react-hook-form';
2
+ import { UploadListType } from 'antd/es/upload/interface';
2
3
  export interface GenericUploadModalProps {
3
4
  open: boolean;
4
5
  onCancel: () => void;
@@ -10,10 +11,12 @@ export interface GenericUploadModalProps {
10
11
  uid: string;
11
12
  fileName: string;
12
13
  }>;
14
+ onDeleteFile: (values: string[]) => void;
13
15
  setFileList: (value: any) => void;
14
16
  allowedExtensions: string[];
15
17
  maxSize?: number;
16
18
  trans: any;
19
+ listType?: UploadListType;
17
20
  texts?: {
18
21
  title?: string;
19
22
  okText?: string;
@@ -26,4 +29,4 @@ export interface GenericUploadModalProps {
26
29
  uploading?: string;
27
30
  };
28
31
  }
29
- export declare function GenericUploadModal({ open, onCancel, control, record, texts, setFileList, fileList, trans, }: GenericUploadModalProps): import("react/jsx-runtime").JSX.Element;
32
+ export declare function GenericUploadModal({ open, onCancel, control, record, texts, setFileList, fileList, trans, onDeleteFile, listType, }: GenericUploadModalProps): import("react/jsx-runtime").JSX.Element;
@@ -31,7 +31,7 @@ export interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
31
31
  size?: SizeType;
32
32
  defaultEllipsis?: boolean;
33
33
  handleSubmit?: FormEventHandler<any>;
34
- noPagination?: boolean;
34
+ noPagination: boolean;
35
35
  customPagination?: React.ReactNode;
36
36
  }
37
37
  export declare const Table: <T>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, showIndexColumn, size, defaultEllipsis, onDoubleClickRow, handleSubmit, customPagination, noPagination, ...rest }: TableCommonProps<T>) => import("react/jsx-runtime").JSX.Element;