@pnkx-lib/ui 1.9.7 → 1.9.9

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,4 +1,4 @@
1
- import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-DQm0didM.js';
1
+ import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-za5Skgtp.js';
2
2
  import { Select as Select$1, Radio } from 'antd';
3
3
 
4
4
  const Select = (props) => {
@@ -3495,6 +3495,8 @@ var getProxyFormState = (formState, control, localProxyFormState, isRoot = true)
3495
3495
  return result;
3496
3496
  };
3497
3497
 
3498
+ const useIsomorphicLayoutEffect$1 = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect;
3499
+
3498
3500
  /**
3499
3501
  * This custom hook allows you to subscribe to each form state, and isolate the re-render at the custom hook level. It has its scope in terms of form state subscription, so it would not affect other useFormState and useForm. Using this hook can reduce the re-render impact on large and complex form application.
3500
3502
  *
@@ -3539,10 +3541,8 @@ function useFormState(props) {
3539
3541
  isValid: false,
3540
3542
  errors: false,
3541
3543
  });
3542
- const _name = React__default.useRef(name);
3543
- _name.current = name;
3544
- React__default.useEffect(() => control._subscribe({
3545
- name: _name.current,
3544
+ useIsomorphicLayoutEffect$1(() => control._subscribe({
3545
+ name: name,
3546
3546
  formState: _localProxyFormState.current,
3547
3547
  exact,
3548
3548
  callback: (formState) => {
@@ -3552,7 +3552,7 @@ function useFormState(props) {
3552
3552
  ...formState,
3553
3553
  });
3554
3554
  },
3555
- }), [control, disabled, exact]);
3555
+ }), [name, disabled, exact]);
3556
3556
  React__default.useEffect(() => {
3557
3557
  _localProxyFormState.current.isValid && control._setValid(true);
3558
3558
  }, [control]);
@@ -3592,19 +3592,17 @@ var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) =>
3592
3592
  function useWatch(props) {
3593
3593
  const methods = useFormContext();
3594
3594
  const { control = methods.control, name, defaultValue, disabled, exact, } = props || {};
3595
- const _name = React__default.useRef(name);
3596
3595
  const _defaultValue = React__default.useRef(defaultValue);
3597
- _name.current = name;
3598
- React__default.useEffect(() => control._subscribe({
3599
- name: _name.current,
3596
+ const [value, updateValue] = React__default.useState(control._getWatch(name, _defaultValue.current));
3597
+ useIsomorphicLayoutEffect$1(() => control._subscribe({
3598
+ name: name,
3600
3599
  formState: {
3601
3600
  values: true,
3602
3601
  },
3603
3602
  exact,
3604
3603
  callback: (formState) => !disabled &&
3605
- updateValue(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, _defaultValue.current)),
3606
- }), [control, disabled, exact]);
3607
- const [value, updateValue] = React__default.useState(control._getWatch(name, defaultValue));
3604
+ updateValue(generateWatchOutput(name, control._names, formState.values || control._formValues, false, _defaultValue.current)),
3605
+ }), [name, control, disabled, exact]);
3608
3606
  React__default.useEffect(() => control._removeUnmounted());
3609
3607
  return value;
3610
3608
  }
@@ -4420,6 +4418,7 @@ function createFormControl(props = {}) {
4420
4418
  let _formState = {
4421
4419
  submitCount: 0,
4422
4420
  isDirty: false,
4421
+ isReady: false,
4423
4422
  isLoading: isFunction$1(_options.defaultValues),
4424
4423
  isValidating: false,
4425
4424
  isSubmitted: false,
@@ -4434,7 +4433,7 @@ function createFormControl(props = {}) {
4434
4433
  };
4435
4434
  const _fields = {};
4436
4435
  let _defaultValues = isObject(_options.defaultValues) || isObject(_options.values)
4437
- ? cloneObject(_options.values || _options.defaultValues) || {}
4436
+ ? cloneObject(_options.defaultValues || _options.values) || {}
4438
4437
  : {};
4439
4438
  let _formValues = _options.shouldUnregister
4440
4439
  ? {}
@@ -5485,6 +5484,7 @@ function useForm(props = {}) {
5485
5484
  validatingFields: {},
5486
5485
  errors: props.errors || {},
5487
5486
  disabled: props.disabled || false,
5487
+ isReady: false,
5488
5488
  defaultValues: isFunction$1(props.defaultValues)
5489
5489
  ? undefined
5490
5490
  : props.defaultValues,
@@ -5502,12 +5502,37 @@ function useForm(props = {}) {
5502
5502
  }
5503
5503
  const control = _formControl.current.control;
5504
5504
  control._options = props;
5505
- React__default.useLayoutEffect(() => control._subscribe({
5506
- formState: control._proxyFormState,
5507
- callback: () => updateFormState({ ...control._formState }),
5508
- reRenderRoot: true,
5509
- }), [control]);
5505
+ useIsomorphicLayoutEffect$1(() => {
5506
+ const sub = control._subscribe({
5507
+ formState: control._proxyFormState,
5508
+ callback: () => updateFormState({ ...control._formState }),
5509
+ reRenderRoot: true,
5510
+ });
5511
+ updateFormState((data) => ({
5512
+ ...data,
5513
+ isReady: true,
5514
+ }));
5515
+ control._formState.isReady = true;
5516
+ return sub;
5517
+ }, [control]);
5510
5518
  React__default.useEffect(() => control._disableForm(props.disabled), [control, props.disabled]);
5519
+ React__default.useEffect(() => {
5520
+ if (props.mode) {
5521
+ control._options.mode = props.mode;
5522
+ }
5523
+ if (props.reValidateMode) {
5524
+ control._options.reValidateMode = props.reValidateMode;
5525
+ }
5526
+ if (props.errors && !isEmptyObject(props.errors)) {
5527
+ control._setErrors(props.errors);
5528
+ }
5529
+ }, [control, props.errors, props.mode, props.reValidateMode]);
5530
+ React__default.useEffect(() => {
5531
+ props.shouldUnregister &&
5532
+ control._subjects.state.next({
5533
+ values: control._getWatch(),
5534
+ });
5535
+ }, [control, props.shouldUnregister]);
5511
5536
  React__default.useEffect(() => {
5512
5537
  if (control._proxyFormState.isDirty) {
5513
5538
  const isDirty = control._getDirty();
@@ -5527,12 +5552,7 @@ function useForm(props = {}) {
5527
5552
  else {
5528
5553
  control._resetDefaultValues();
5529
5554
  }
5530
- }, [props.values, control]);
5531
- React__default.useEffect(() => {
5532
- if (props.errors && !isEmptyObject(props.errors)) {
5533
- control._setErrors(props.errors);
5534
- }
5535
- }, [props.errors, control]);
5555
+ }, [control, props.values]);
5536
5556
  React__default.useEffect(() => {
5537
5557
  if (!control._state.mount) {
5538
5558
  control._setValid();
@@ -5544,12 +5564,6 @@ function useForm(props = {}) {
5544
5564
  }
5545
5565
  control._removeUnmounted();
5546
5566
  });
5547
- React__default.useEffect(() => {
5548
- props.shouldUnregister &&
5549
- control._subjects.state.next({
5550
- values: control._getWatch(),
5551
- });
5552
- }, [props.shouldUnregister, control]);
5553
5567
  _formControl.current.formState = getProxyFormState(formState, control);
5554
5568
  return _formControl.current;
5555
5569
  }
@@ -1,2 +1,2 @@
1
- export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, a as TinyMCE } from '../chunks/Switch-DQm0didM.js';
2
- export { R as RadioGroup, S as Select } from '../chunks/Radio-DA0U4ozV.js';
1
+ export { C as CheckboxField, D as DatePickerField, I as Input, P as PnkxField, R as RangePickerField, a as TinyMCE } from '../chunks/Switch-za5Skgtp.js';
2
+ export { R as RadioGroup, S as Select } from '../chunks/Radio-D2me1zZ-.js';
package/es/index.js CHANGED
@@ -1,5 +1,6 @@
1
- export { A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from './chunks/CategoryStatus-vAUuA6Yb.js';
2
- export { C as CheckboxField, D as DatePickerField, E as ErrorMessage, I as Input, L as Label, P as PnkxField, R as RangePickerField, a as TinyMCE, T as Typography } from './chunks/Switch-DQm0didM.js';
3
- export { R as RadioGroup, S as Select } from './chunks/Radio-DA0U4ozV.js';
1
+ export { A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from './chunks/CategoryStatus-CpeeXDTG.js';
2
+ export { C as CheckboxField, D as DatePickerField, E as ErrorMessage, I as Input, L as Label, P as PnkxField, R as RangePickerField, a as TinyMCE, T as Typography } from './chunks/Switch-za5Skgtp.js';
3
+ import 'react-router';
4
+ export { R as RadioGroup, S as Select } from './chunks/Radio-D2me1zZ-.js';
4
5
  export { u as useToast } from './chunks/cloneDeep-BLYi2V0G.js';
5
6
  export { u as useFiltersHandler, a as useMessage } from './chunks/useMessage-D_-VT5B4.js';
package/es/ui/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export { A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from '../chunks/CategoryStatus-vAUuA6Yb.js';
2
- export { E as ErrorMessage, L as Label, T as Typography } from '../chunks/Switch-DQm0didM.js';
1
+ export { A as Alert, E as Anchor, G as Appfix, I as AutoComplete, e as Badge, g as Breadcrumb, U as BulkAction, B as Button, C as CascaderField, f as Col, V as ConfirmModal, d as Container, o as Divider, q as Drawer, D as Dropdown, N as Empty, X as ErrorBoundary, F as Flex, H as Heading, O as Image, L as Layout, j as Menu, M as Modal, k as Pagination, J as PnkxCollapse, K as PnkxColorPicker, r as Popconfirm, P as Popover, Q as QRCode, u as Rate, s as Result, R as Row, c as SearchFiltersForm, v as Segmented, m as Sidebar, S as Skeleton, h as Space, p as Spin, i as Splitter, w as Statistic, l as Steps, T as Table, b as Tabs, n as Tag, x as Timeline, a as Tooltip, y as Tour, z as Tree, W as Watermark, t as typeColorMap } from '../chunks/CategoryStatus-CpeeXDTG.js';
2
+ export { E as ErrorMessage, L as Label, T as Typography } from '../chunks/Switch-za5Skgtp.js';
3
+ import 'react-router';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pnkx-lib/ui",
3
3
  "private": false,
4
- "version": "1.9.7",
4
+ "version": "1.9.9",
5
5
  "type": "module",
6
6
  "main": "./es/index.js",
7
7
  "module": "./es/index.js",
@@ -85,7 +85,8 @@
85
85
  "antd": "^5.24.4",
86
86
  "react": "^18.3.1",
87
87
  "react-dom": "^18.3.1",
88
- "tailwindcss": "^4.0.17"
88
+ "tailwindcss": "^4.0.17",
89
+ "react-router": "^7.6.0"
89
90
  },
90
91
  "dependencies": {
91
92
  "@ant-design/icons": "^5.6.1",
@@ -106,9 +107,8 @@
106
107
  "react-datepicker": "^4.16.0",
107
108
  "react-hook-form": "^7.54.2",
108
109
  "react-number-format": "^5.4.3",
109
- "react-router": "^7.6.0",
110
110
  "tailwind-merge": "^3.3.0",
111
111
  "yup": "^1.6.1",
112
112
  "zustand": "^5.0.3"
113
113
  }
114
- }
114
+ }
package/types/index.d.ts CHANGED
@@ -666,9 +666,9 @@ declare type TabItem = {
666
666
  disabled?: boolean;
667
667
  };
668
668
 
669
- export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, className, editable, onSave, ...rest }: TableCommonProps<T>) => JSX.Element;
669
+ export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, className, editable, onSave, titleSettingTableModal, showSetting, setColumns, ...rest }: TableCommonProps<T>) => JSX.Element;
670
670
 
671
- export declare type TableColumnsType<T> = TableColumnsType_2<T>;
671
+ export declare type TableColumnsType<T> = TableColumnsType_2<T> & TableColumnsTypeEditable<T>;
672
672
 
673
673
  export declare type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {
674
674
  editable?: boolean;
@@ -676,7 +676,7 @@ export declare type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {
676
676
 
677
677
  export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
678
678
  dataSource: T[];
679
- columns: TableColumnsType<T> | TableColumnsTypeEditable<T>;
679
+ columns: TableColumnsType<T>;
680
680
  loading?: boolean;
681
681
  totalItems: number;
682
682
  filters: any;
@@ -690,6 +690,9 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
690
690
  className?: string;
691
691
  editable?: boolean;
692
692
  onSave?: (data: T) => void;
693
+ titleSettingTableModal?: string;
694
+ showSetting?: boolean;
695
+ setColumns?: (newColumns: TableColumnsType<T>) => void;
693
696
  }
694
697
 
695
698
  export declare const Tabs: default_3.FC<TabsProps>;
package/types/ui.d.ts CHANGED
@@ -511,9 +511,9 @@ declare type TabItem = {
511
511
  disabled?: boolean;
512
512
  };
513
513
 
514
- export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, className, editable, onSave, ...rest }: TableCommonProps<T>) => JSX.Element;
514
+ export declare const Table: <T extends RowCommon>({ dataSource, columns, loading, totalItems, filters, onChangePage, onChangePageSize, onSort, rowsSelected, onSelect, onRowClick, rowKey, className, editable, onSave, titleSettingTableModal, showSetting, setColumns, ...rest }: TableCommonProps<T>) => JSX.Element;
515
515
 
516
- export declare type TableColumnsType<T> = TableColumnsType_2<T>;
516
+ export declare type TableColumnsType<T> = TableColumnsType_2<T> & TableColumnsTypeEditable<T>;
517
517
 
518
518
  export declare type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {
519
519
  editable?: boolean;
@@ -521,7 +521,7 @@ export declare type TableColumnsTypeEditable<T> = (ColumnTypes<T>[number] & {
521
521
 
522
522
  export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "columns"> {
523
523
  dataSource: T[];
524
- columns: TableColumnsType<T> | TableColumnsTypeEditable<T>;
524
+ columns: TableColumnsType<T>;
525
525
  loading?: boolean;
526
526
  totalItems: number;
527
527
  filters: any;
@@ -535,6 +535,9 @@ export declare interface TableCommonProps<T> extends Omit<TableProps<T>, "column
535
535
  className?: string;
536
536
  editable?: boolean;
537
537
  onSave?: (data: T) => void;
538
+ titleSettingTableModal?: string;
539
+ showSetting?: boolean;
540
+ setColumns?: (newColumns: TableColumnsType<T>) => void;
538
541
  }
539
542
 
540
543
  export declare const Tabs: default_3.FC<TabsProps>;