@pnkx-lib/ui 1.9.491 → 1.9.494

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
1
  import { jsx, jsxs } from 'react/jsx-runtime';
2
- import { Modal, Spin } from 'antd';
2
+ import { Modal, Spin, Upload as Upload$2 } from 'antd';
3
3
  import * as React from 'react';
4
4
  import React__default, { isValidElement, version as version$1, useRef, useLayoutEffect, useEffect, forwardRef, useImperativeHandle, Component, useContext, useMemo as useMemo$1, useState, Children } from 'react';
5
- import { b as useMemo, i as isFragment$1, L as LocaleContext, l as localeValues, c as useLayoutUpdateEffect, d as Context, e as useLayoutEffect$1, _ as _toConsumableArray, t as toArray$2, u as unit, f as clearFix, h as textEllipsis, g as genStyleHooks, m as merge, r as resetComponent, j as defaultPrefixCls, k as genComponentStyleHook, w as warning$1, C as ConfigContext, n as useToken, S as SizeContext, p as devUseWarning, q as getAlphaColor, s as getLineHeight, v as genFocusStyle, x as resetIcon, y as genSubStyleComponent, a as useComponentConfig, D as DisabledContext, o as omit } from './toArray-2LkvUaha.js';
5
+ import { b as useMemo, i as isFragment$1, L as LocaleContext, l as localeValues, c as useLayoutUpdateEffect, d as Context, e as useLayoutEffect$1, _ as _toConsumableArray, t as toArray$2, u as unit, f as clearFix, h as textEllipsis, g as genStyleHooks, m as merge, r as resetComponent, j as defaultPrefixCls, k as genComponentStyleHook, w as warning$1, C as ConfigContext, n as useToken, S as SizeContext, p as devUseWarning, q as getAlphaColor, s as getLineHeight, v as genFocusStyle, x as resetIcon, y as genSubStyleComponent, a as useComponentConfig, D as DisabledContext, o as omit } from './toArray-Czwb0MFW.js';
6
6
  import * as ReactDOM from 'react-dom';
7
7
  import ReactDOM__default, { createPortal, flushSync } from 'react-dom';
8
8
  import { c as classNames } from './index-BLRvgOFN.js';
@@ -12,8 +12,7 @@ import { _ as _typeof, b as _defineProperty } from './defineProperty-CTLrw71t.js
12
12
  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
- import { C as Controller } from './index.esm-Dr5ZHcf7.js';
16
- import { toast } from '@pnkx-lib/core';
15
+ import { C as Controller } from './index.esm-AaUjBMaK.js';
17
16
  import { R as RefIcon$b } from './InboxOutlined-BBuIJe6u.js';
18
17
 
19
18
  // This icon file is generated automatically.
@@ -3627,6 +3626,8 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
3627
3626
  var doc = popupElement.ownerDocument;
3628
3627
  var win = getWin(popupElement);
3629
3628
  var _win$getComputedStyle = win.getComputedStyle(popupElement),
3629
+ width = _win$getComputedStyle.width,
3630
+ height = _win$getComputedStyle.height,
3630
3631
  popupPosition = _win$getComputedStyle.position;
3631
3632
  var originLeft = popupElement.style.left;
3632
3633
  var originTop = popupElement.style.top;
@@ -3675,9 +3676,6 @@ function useAlign(open, popupEle, target, placement, builtinPlacements, popupAli
3675
3676
  };
3676
3677
  }
3677
3678
  var popupRect = popupElement.getBoundingClientRect();
3678
- var _win$getComputedStyle2 = win.getComputedStyle(popupElement),
3679
- height = _win$getComputedStyle2.height,
3680
- width = _win$getComputedStyle2.width;
3681
3679
  popupRect.x = (_popupRect$x = popupRect.x) !== null && _popupRect$x !== void 0 ? _popupRect$x : popupRect.left;
3682
3680
  popupRect.y = (_popupRect$y = popupRect.y) !== null && _popupRect$y !== void 0 ? _popupRect$y : popupRect.top;
3683
3681
  var _doc$documentElement = doc.documentElement,
@@ -4551,10 +4549,6 @@ function generateTrigger() {
4551
4549
  cloneProps.className = classNames(originChildProps.className, className);
4552
4550
  }
4553
4551
 
4554
- // ============================ Perf ============================
4555
- var renderedRef = React.useRef(false);
4556
- renderedRef.current || (renderedRef.current = forceRender || mergedOpen || inMotion);
4557
-
4558
4552
  // =========================== Render ===========================
4559
4553
  var mergedChildrenProps = _objectSpread2(_objectSpread2({}, originChildProps), cloneProps);
4560
4554
 
@@ -4589,7 +4583,7 @@ function generateTrigger() {
4589
4583
  onResize: onTargetResize
4590
4584
  }, /*#__PURE__*/React.createElement(TriggerWrapper, {
4591
4585
  getTriggerDOMNode: getTriggerDOMNode
4592
- }, triggerNode)), renderedRef.current && /*#__PURE__*/React.createElement(TriggerContext.Provider, {
4586
+ }, triggerNode)), /*#__PURE__*/React.createElement(TriggerContext.Provider, {
4593
4587
  value: context
4594
4588
  }, /*#__PURE__*/React.createElement(Popup, {
4595
4589
  portal: PortalComponent,
@@ -4836,17 +4830,19 @@ function _regeneratorDefine(e, r, n, t) {
4836
4830
  i = 0;
4837
4831
  }
4838
4832
  _regeneratorDefine = function regeneratorDefine(e, r, n, t) {
4839
- function o(r, n) {
4840
- _regeneratorDefine(e, r, function (e) {
4841
- return this._invoke(r, n, e);
4842
- });
4843
- }
4844
- r ? i ? i(e, r, {
4833
+ if (r) i ? i(e, r, {
4845
4834
  value: n,
4846
4835
  enumerable: !t,
4847
4836
  configurable: !t,
4848
4837
  writable: !t
4849
- }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2));
4838
+ }) : e[r] = n;else {
4839
+ var o = function o(r, n) {
4840
+ _regeneratorDefine(e, r, function (e) {
4841
+ return this._invoke(r, n, e);
4842
+ });
4843
+ };
4844
+ o("next", 0), o("throw", 1), o("return", 2);
4845
+ }
4850
4846
  }, _regeneratorDefine(e, r, n, t);
4851
4847
  }
4852
4848
 
@@ -6881,7 +6877,7 @@ const genWaveStyle = token => {
6881
6877
  }
6882
6878
  };
6883
6879
  };
6884
- const useStyle$3 = genComponentStyleHook('Wave', genWaveStyle);
6880
+ const useStyle$3 = genComponentStyleHook('Wave', token => [genWaveStyle(token)]);
6885
6881
 
6886
6882
  const TARGET_CLS = `${defaultPrefixCls}-wave-target`;
6887
6883
 
@@ -7002,16 +6998,24 @@ function unstableSetRender(render) {
7002
6998
  function isValidWaveColor(color) {
7003
6999
  return color && color !== '#fff' && color !== '#ffffff' && color !== 'rgb(255, 255, 255)' && color !== 'rgba(255, 255, 255, 1)' && !/rgba\((?:\d*, ){3}0\)/.test(color) &&
7004
7000
  // any transparent rgba color
7005
- color !== 'transparent' && color !== 'canvastext';
7001
+ color !== 'transparent';
7006
7002
  }
7007
7003
  function getTargetWaveColor(node) {
7008
- var _a;
7009
7004
  const {
7010
7005
  borderTopColor,
7011
7006
  borderColor,
7012
7007
  backgroundColor
7013
7008
  } = getComputedStyle(node);
7014
- return (_a = [borderTopColor, borderColor, backgroundColor].find(isValidWaveColor)) !== null && _a !== void 0 ? _a : null;
7009
+ if (isValidWaveColor(borderTopColor)) {
7010
+ return borderTopColor;
7011
+ }
7012
+ if (isValidWaveColor(borderColor)) {
7013
+ return borderColor;
7014
+ }
7015
+ if (isValidWaveColor(backgroundColor)) {
7016
+ return backgroundColor;
7017
+ }
7018
+ return null;
7015
7019
  }
7016
7020
 
7017
7021
  function validateNum(value) {
@@ -7635,13 +7639,6 @@ let AggregationColor = /*#__PURE__*/function () {
7635
7639
  }]);
7636
7640
  }();
7637
7641
 
7638
- const generateColor = color => {
7639
- if (color instanceof AggregationColor) {
7640
- return color;
7641
- }
7642
- return new AggregationColor(color);
7643
- };
7644
-
7645
7642
  const isBright = (value, bgColorToken) => {
7646
7643
  const {
7647
7644
  r,
@@ -7683,7 +7680,6 @@ const prepareComponentToken$2 = token => {
7683
7680
  }), {});
7684
7681
  return Object.assign(Object.assign({}, shadowColorTokens), {
7685
7682
  fontWeight: 400,
7686
- iconGap: token.marginXS,
7687
7683
  defaultShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlTmpOutline}`,
7688
7684
  primaryShadow: `0 ${token.controlOutlineWidth}px 0 ${token.controlOutline}`,
7689
7685
  dangerShadow: `0 ${token.controlOutlineWidth}px 0 ${token.colorErrorOutline}`,
@@ -7737,7 +7733,7 @@ const genSharedButtonStyle = token => {
7737
7733
  opacityLoading,
7738
7734
  motionDurationSlow,
7739
7735
  motionEaseInOut,
7740
- iconGap,
7736
+ marginXS,
7741
7737
  calc
7742
7738
  } = token;
7743
7739
  return {
@@ -7745,7 +7741,7 @@ const genSharedButtonStyle = token => {
7745
7741
  outline: 'none',
7746
7742
  position: 'relative',
7747
7743
  display: 'inline-flex',
7748
- gap: iconGap,
7744
+ gap: token.marginXS,
7749
7745
  alignItems: 'center',
7750
7746
  justifyContent: 'center',
7751
7747
  fontWeight,
@@ -7797,7 +7793,7 @@ const genSharedButtonStyle = token => {
7797
7793
  [`&:not(${componentCls}-icon-end)`]: {
7798
7794
  [`${componentCls}-loading-icon-motion`]: {
7799
7795
  '&-appear-start, &-enter-start': {
7800
- marginInlineEnd: calc(iconGap).mul(-1).equal()
7796
+ marginInlineEnd: calc(marginXS).mul(-1).equal()
7801
7797
  },
7802
7798
  '&-appear-active, &-enter-active': {
7803
7799
  marginInlineEnd: 0
@@ -7806,7 +7802,7 @@ const genSharedButtonStyle = token => {
7806
7802
  marginInlineEnd: 0
7807
7803
  },
7808
7804
  '&-leave-active': {
7809
- marginInlineEnd: calc(iconGap).mul(-1).equal()
7805
+ marginInlineEnd: calc(marginXS).mul(-1).equal()
7810
7806
  }
7811
7807
  }
7812
7808
  },
@@ -7814,7 +7810,7 @@ const genSharedButtonStyle = token => {
7814
7810
  flexDirection: 'row-reverse',
7815
7811
  [`${componentCls}-loading-icon-motion`]: {
7816
7812
  '&-appear-start, &-enter-start': {
7817
- marginInlineStart: calc(iconGap).mul(-1).equal()
7813
+ marginInlineStart: calc(marginXS).mul(-1).equal()
7818
7814
  },
7819
7815
  '&-appear-active, &-enter-active': {
7820
7816
  marginInlineStart: 0
@@ -7823,7 +7819,7 @@ const genSharedButtonStyle = token => {
7823
7819
  marginInlineStart: 0
7824
7820
  },
7825
7821
  '&-leave-active': {
7826
- marginInlineStart: calc(iconGap).mul(-1).equal()
7822
+ marginInlineStart: calc(marginXS).mul(-1).equal()
7827
7823
  }
7828
7824
  }
7829
7825
  }
@@ -7946,10 +7942,8 @@ const genPresetColorStyle = token => {
7946
7942
  borderColor: activeColor,
7947
7943
  background: token.colorBgContainer
7948
7944
  })), genDashedButtonStyle(token)), genFilledButtonStyle(token, lightColor, {
7949
- color: darkColor,
7950
7945
  background: lightHoverColor
7951
7946
  }, {
7952
- color: darkColor,
7953
7947
  background: lightBorderColor
7954
7948
  })), genTextLinkButtonStyle(token, darkColor, 'link', {
7955
7949
  color: hoverColor
@@ -7975,10 +7969,8 @@ const genDefaultButtonStyle = token => Object.assign(Object.assign(Object.assign
7975
7969
  color: token.solidTextColor,
7976
7970
  background: token.colorBgSolidActive
7977
7971
  })), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorFillTertiary, {
7978
- color: token.defaultColor,
7979
7972
  background: token.colorFillSecondary
7980
7973
  }, {
7981
- color: token.defaultColor,
7982
7974
  background: token.colorFill
7983
7975
  })), genGhostButtonStyle(token.componentCls, token.ghostBg, token.defaultGhostColor, token.defaultGhostBorderColor, token.colorTextDisabled, token.colorBorder)), genTextLinkButtonStyle(token, token.textTextColor, 'link', {
7984
7976
  color: token.colorLinkHover,
@@ -7998,10 +7990,8 @@ const genPrimaryButtonStyle = token => Object.assign(Object.assign(Object.assign
7998
7990
  borderColor: token.colorPrimaryActive,
7999
7991
  background: token.colorBgContainer
8000
7992
  })), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorPrimaryBg, {
8001
- color: token.colorPrimary,
8002
7993
  background: token.colorPrimaryBgHover
8003
7994
  }, {
8004
- color: token.colorPrimary,
8005
7995
  background: token.colorPrimaryBorder
8006
7996
  })), genTextLinkButtonStyle(token, token.colorPrimaryText, 'text', {
8007
7997
  color: token.colorPrimaryTextHover,
@@ -8035,10 +8025,8 @@ const genDangerousStyle = token => Object.assign(Object.assign(Object.assign(Obj
8035
8025
  color: token.colorErrorActive,
8036
8026
  borderColor: token.colorErrorActive
8037
8027
  })), genDashedButtonStyle(token)), genFilledButtonStyle(token, token.colorErrorBg, {
8038
- color: token.colorError,
8039
8028
  background: token.colorErrorBgFilledHover
8040
8029
  }, {
8041
- color: token.colorError,
8042
8030
  background: token.colorErrorBgActive
8043
8031
  })), genTextLinkButtonStyle(token, token.colorError, 'text', {
8044
8032
  color: token.colorErrorHover,
@@ -8206,7 +8194,7 @@ const useStyle$2 = genStyleHooks('Button', token => {
8206
8194
  });
8207
8195
 
8208
8196
  // handle border collapse
8209
- function compactItemBorder(token, parentCls, options, prefixCls) {
8197
+ function compactItemBorder(token, parentCls, options) {
8210
8198
  const {
8211
8199
  focusElCls,
8212
8200
  focus,
@@ -8218,16 +8206,13 @@ function compactItemBorder(token, parentCls, options, prefixCls) {
8218
8206
  [`&-item:not(${parentCls}-last-item)`]: {
8219
8207
  marginInlineEnd: token.calc(token.lineWidth).mul(-1).equal()
8220
8208
  },
8221
- [`&-item:not(${prefixCls}-status-success)`]: {
8222
- zIndex: 2
8223
- },
8224
8209
  '&-item': Object.assign(Object.assign({
8225
8210
  [hoverEffects]: {
8226
- zIndex: 3
8211
+ zIndex: 2
8227
8212
  }
8228
8213
  }, focusElCls ? {
8229
8214
  [`&${focusElCls}`]: {
8230
- zIndex: 3
8215
+ zIndex: 2
8231
8216
  }
8232
8217
  } : {}), {
8233
8218
  [`&[disabled] ${childCombinator}`]: {
@@ -8268,22 +8253,19 @@ function genCompactItemStyle(token, options = {
8268
8253
  } = token;
8269
8254
  const compactCls = `${componentCls}-compact`;
8270
8255
  return {
8271
- [compactCls]: Object.assign(Object.assign({}, compactItemBorder(token, compactCls, options, componentCls)), compactItemBorderRadius(componentCls, compactCls, options))
8256
+ [compactCls]: Object.assign(Object.assign({}, compactItemBorder(token, compactCls, options)), compactItemBorderRadius(componentCls, compactCls, options))
8272
8257
  };
8273
8258
  }
8274
8259
 
8275
- function compactItemVerticalBorder(token, parentCls, prefixCls) {
8260
+ function compactItemVerticalBorder(token, parentCls) {
8276
8261
  return {
8277
8262
  // border collapse
8278
8263
  [`&-item:not(${parentCls}-last-item)`]: {
8279
8264
  marginBottom: token.calc(token.lineWidth).mul(-1).equal()
8280
8265
  },
8281
- [`&-item:not(${prefixCls}-status-success)`]: {
8282
- zIndex: 2
8283
- },
8284
8266
  '&-item': {
8285
8267
  '&:hover,&:focus,&:active': {
8286
- zIndex: 3
8268
+ zIndex: 2
8287
8269
  },
8288
8270
  '&[disabled]': {
8289
8271
  zIndex: 0
@@ -8313,7 +8295,7 @@ function compactItemBorderVerticalRadius(prefixCls, parentCls) {
8313
8295
  function genCompactItemVerticalStyle(token) {
8314
8296
  const compactCls = `${token.componentCls}-compact-vertical`;
8315
8297
  return {
8316
- [compactCls]: Object.assign(Object.assign({}, compactItemVerticalBorder(token, compactCls, token.componentCls)), compactItemBorderVerticalRadius(token.componentCls, compactCls))
8298
+ [compactCls]: Object.assign(Object.assign({}, compactItemVerticalBorder(token, compactCls)), compactItemBorderVerticalRadius(token.componentCls, compactCls))
8317
8299
  };
8318
8300
  }
8319
8301
 
@@ -8389,7 +8371,7 @@ const InternalCompoundedButton = /*#__PURE__*/React__default.forwardRef((props,
8389
8371
  variant,
8390
8372
  type,
8391
8373
  danger = false,
8392
- shape: customizeShape,
8374
+ shape = 'default',
8393
8375
  size: customizeSize,
8394
8376
  styles,
8395
8377
  disabled: customDisabled,
@@ -8414,7 +8396,6 @@ const InternalCompoundedButton = /*#__PURE__*/React__default.forwardRef((props,
8414
8396
  const {
8415
8397
  button
8416
8398
  } = React__default.useContext(ConfigContext);
8417
- const shape = customizeShape || (button === null || button === void 0 ? void 0 : button.shape) || 'default';
8418
8399
  const [mergedColor, mergedVariant] = useMemo$1(() => {
8419
8400
  // >>>>> Local
8420
8401
  // Color & Variant
@@ -8471,7 +8452,7 @@ const InternalCompoundedButton = /*#__PURE__*/React__default.forwardRef((props,
8471
8452
  // ========================= Effect =========================
8472
8453
  // Loading. Should use `useLayoutEffect` to avoid low perf multiple click issue.
8473
8454
  // https://github.com/ant-design/ant-design/issues/51325
8474
- useLayoutEffect$1(() => {
8455
+ useLayoutEffect(() => {
8475
8456
  let delayTimer = null;
8476
8457
  if (loadingOrDelay.delay > 0) {
8477
8458
  delayTimer = setTimeout(() => {
@@ -9481,11 +9462,6 @@ function getPlacements(config) {
9481
9462
  borderRadius} = config;
9482
9463
  const halfArrowWidth = arrowWidth / 2;
9483
9464
  const placementMap = {};
9484
- // Dynamic offset
9485
- const arrowOffset = getArrowOffsetToken({
9486
- contentRadius: borderRadius,
9487
- limitVerticalRadius: true
9488
- });
9489
9465
  Object.keys(PlacementAlignMap).forEach(key => {
9490
9466
  const template = arrowPointAtCenter && ArrowCenterPlacementAlignMap[key] || PlacementAlignMap[key];
9491
9467
  const placementInfo = Object.assign(Object.assign({}, template), {
@@ -9520,6 +9496,11 @@ function getPlacements(config) {
9520
9496
  placementInfo.offset[0] = halfArrowWidth + offset;
9521
9497
  break;
9522
9498
  }
9499
+ // Dynamic offset
9500
+ const arrowOffset = getArrowOffsetToken({
9501
+ contentRadius: borderRadius,
9502
+ limitVerticalRadius: true
9503
+ });
9523
9504
  if (arrowPointAtCenter) {
9524
9505
  switch (key) {
9525
9506
  case 'topLeft':
@@ -9591,7 +9572,7 @@ const genTooltipStyle = token => {
9591
9572
  minWidth: centerAlignMinWidth,
9592
9573
  minHeight: controlHeight,
9593
9574
  padding: `${unit(token.calc(paddingSM).div(2).equal())} ${unit(paddingXS)}`,
9594
- color: `var(--ant-tooltip-color, ${tooltipColor})`,
9575
+ color: tooltipColor,
9595
9576
  textAlign: 'start',
9596
9577
  textDecoration: 'none',
9597
9578
  wordWrap: 'break-word',
@@ -9694,12 +9675,8 @@ function parseColor(prefixCls, color) {
9694
9675
  });
9695
9676
  const overlayStyle = {};
9696
9677
  const arrowStyle = {};
9697
- const rgb = generateColor(color).toRgb();
9698
- const luminance = (0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b) / 255;
9699
- const textColor = luminance < 0.5 ? '#FFF' : '#000';
9700
9678
  if (color && !isInternalColor) {
9701
9679
  overlayStyle.background = color;
9702
- overlayStyle['--ant-tooltip-color'] = textColor;
9703
9680
  // @ts-ignore
9704
9681
  arrowStyle['--antd-arrow-background-color'] = color;
9705
9682
  }
@@ -11068,7 +11045,6 @@ var __awaiter = undefined && undefined.__awaiter || function (thisArg, _argument
11068
11045
  };
11069
11046
  const LIST_IGNORE = `__LIST_IGNORE_${Date.now()}__`;
11070
11047
  const InternalUpload = (props, ref) => {
11071
- const config = useComponentConfig('upload');
11072
11048
  const {
11073
11049
  fileList,
11074
11050
  defaultFileList,
@@ -11103,7 +11079,6 @@ const InternalUpload = (props, ref) => {
11103
11079
  // ===================== Disabled =====================
11104
11080
  const disabled = React.useContext(DisabledContext);
11105
11081
  const mergedDisabled = customDisabled !== null && customDisabled !== void 0 ? customDisabled : disabled;
11106
- const customRequest = props.customRequest || config.customRequest;
11107
11082
  const [mergedFileList, setMergedFileList] = useMergedState(defaultFileList || [], {
11108
11083
  value: fileList,
11109
11084
  postState: list => list !== null && list !== void 0 ? list : []
@@ -11233,6 +11208,7 @@ const InternalUpload = (props, ref) => {
11233
11208
  const onSuccess = (response, file, xhr) => {
11234
11209
  try {
11235
11210
  if (typeof response === 'string') {
11211
+ // biome-ignore lint/style/noParameterAssign: we need to modify response
11236
11212
  response = JSON.parse(response);
11237
11213
  }
11238
11214
  } catch (_a) {
@@ -11325,7 +11301,6 @@ const InternalUpload = (props, ref) => {
11325
11301
  onProgress,
11326
11302
  onSuccess
11327
11303
  }, props), {
11328
- customRequest,
11329
11304
  data,
11330
11305
  multiple,
11331
11306
  action,
@@ -11478,39 +11453,32 @@ function GenericUploadModal({
11478
11453
  open,
11479
11454
  onCancel,
11480
11455
  control,
11481
- setFileList,
11482
11456
  record,
11483
- // allowedExtensions,
11484
- maxSize = 5,
11485
- texts
11457
+ texts,
11458
+ setFileList,
11459
+ fileList,
11460
+ trans
11486
11461
  }) {
11487
- const [displayFileList, setDisplayFileList] = useState([]);
11462
+ const [displayFileList, setDisplayFileList] = useState(fileList);
11463
+ const [listFileId, setListFileId] = useState([]);
11488
11464
  useEffect(() => {
11489
- if (open) {
11465
+ if (open && displayFileList.length === 0) {
11490
11466
  const recordFiles = record?.map((item) => ({
11491
- uid: item.uid,
11467
+ uid: item?.uid,
11492
11468
  name: item.fileName,
11493
11469
  url: item.filePath,
11494
- listFileId: item.fileManagerId,
11470
+ listFileId: item.fileMangerId,
11495
11471
  status: "done"
11496
11472
  })) ?? [];
11497
11473
  setDisplayFileList(recordFiles);
11498
- setFileList(recordFiles);
11499
11474
  }
11500
- }, [open, record, setFileList]);
11475
+ }, [open, record]);
11501
11476
  const createUploadProps = (onChange) => ({
11502
11477
  multiple: true,
11503
11478
  listType: "text",
11504
11479
  showUploadList: true,
11505
11480
  fileList: displayFileList,
11506
- beforeUpload: async (file) => {
11507
- const isLtMax = file.size / 1024 / 1024 <= maxSize;
11508
- if (!isLtMax) {
11509
- toast.warning(
11510
- texts?.fileSizeError ?? `File must be smaller than ${maxSize}MB`
11511
- );
11512
- return;
11513
- }
11481
+ beforeUpload: (file) => {
11514
11482
  const newFile = {
11515
11483
  uid: file.uid,
11516
11484
  name: file.name,
@@ -11520,13 +11488,12 @@ function GenericUploadModal({
11520
11488
  const newList = [...displayFileList, newFile];
11521
11489
  setDisplayFileList((prev) => {
11522
11490
  const newList2 = [...prev, newFile];
11523
- setFileList(newList2);
11524
11491
  onChange(newList2);
11492
+ setFileList(newList2);
11525
11493
  return newList2;
11526
11494
  });
11527
- setFileList(newList);
11528
11495
  onChange(newList);
11529
- return false;
11496
+ return Upload$2.LIST_IGNORE;
11530
11497
  },
11531
11498
  onPreview: (file) => {
11532
11499
  const fileUrl = file.url || (file.originFileObj ? URL.createObjectURL(file.originFileObj) : "");
@@ -11538,23 +11505,31 @@ function GenericUploadModal({
11538
11505
  link.click();
11539
11506
  document.body.removeChild(link);
11540
11507
  },
11541
- onRemove: (file) => {
11508
+ onRemove: async (file) => {
11509
+ const id = file.listFileId || file.uid;
11510
+ setListFileId((prev) => {
11511
+ const newList2 = [...prev, id];
11512
+ return Array.from(new Set(newList2));
11513
+ });
11542
11514
  const newList = displayFileList.filter((item) => item.uid !== file.uid);
11543
11515
  setDisplayFileList(newList);
11544
- setFileList(newList);
11545
11516
  onChange(newList);
11517
+ setFileList(newList);
11546
11518
  return true;
11547
11519
  }
11548
11520
  });
11521
+ const handleSubmitDeleteFile = async () => {
11522
+ onCancel();
11523
+ };
11549
11524
  return /* @__PURE__ */ jsx(
11550
11525
  Modal,
11551
11526
  {
11552
11527
  open,
11553
- title: texts?.title ?? "Upload Files",
11554
- okText: texts?.okText ?? "Confirm",
11555
- cancelText: texts?.cancelText ?? "Close",
11528
+ title: texts?.title,
11529
+ okText: texts?.okText,
11530
+ cancelText: texts?.cancelText,
11556
11531
  onCancel,
11557
- onOk: onCancel,
11532
+ onOk: handleSubmitDeleteFile,
11558
11533
  width: 800,
11559
11534
  centered: true,
11560
11535
  className: "pnkx-default-upload-modal",
@@ -11566,10 +11541,10 @@ function GenericUploadModal({
11566
11541
  render: ({ field }) => {
11567
11542
  const { onChange } = field;
11568
11543
  const props = createUploadProps(onChange);
11569
- return /* @__PURE__ */ jsx(Spin, { spinning: false, tip: texts?.uploading ?? "Uploading...", children: /* @__PURE__ */ jsxs(Dragger, { ...props, accept: ".pdf,.docx,image/*", children: [
11544
+ return /* @__PURE__ */ jsx(Spin, { spinning: false, tip: texts?.uploading, children: /* @__PURE__ */ jsxs(Dragger, { ...props, accept: ".pdf,.doc,.docx,.jpg,.jpeg,.png", children: [
11570
11545
  /* @__PURE__ */ jsx("p", { className: "ant-upload-drag-icon", children: /* @__PURE__ */ jsx(RefIcon$b, {}) }),
11571
- /* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText ?? "Click or drag files to this area to upload" }),
11572
- /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 ?? "Max size 5MB" }),
11546
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-text", children: texts?.dragText }),
11547
+ /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint1 }),
11573
11548
  /* @__PURE__ */ jsx("p", { className: "ant-upload-hint", children: texts?.hint2 })
11574
11549
  ] }) });
11575
11550
  }