@pnkx-lib/ui 1.9.2 → 1.9.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/style.css +1 -1
- package/es/chunks/{ErrorBoundary-13MGAHnq.js → ErrorBoundary-CB-74GLK.js} +70 -2025
- package/es/chunks/{Radio-DA0U4ozV.js → Radio-D2me1zZ-.js} +1 -1
- package/es/chunks/{Switch-DQm0didM.js → Switch-za5Skgtp.js} +44 -30
- package/es/fields/index.js +2 -2
- package/es/index.js +4 -3
- package/es/ui/index.js +3 -2
- package/package.json +4 -4
- package/types/index.d.ts +10 -13
- package/types/ui.d.ts +10 -13
@@ -1,4 +1,4 @@
|
|
1
|
-
import { g as get, j as jsxRuntimeExports, L as Label, E as ErrorMessage, T as Typography } from './Switch-
|
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
|
-
|
3543
|
-
|
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
|
-
}), [
|
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
|
-
|
3598
|
-
|
3599
|
-
name:
|
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(
|
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.
|
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
|
-
|
5506
|
-
|
5507
|
-
|
5508
|
-
|
5509
|
-
|
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
|
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
|
}
|
package/es/fields/index.js
CHANGED
@@ -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-
|
2
|
-
export { R as RadioGroup, S as Select } from '../chunks/Radio-
|
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/ErrorBoundary-
|
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-
|
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/ErrorBoundary-CB-74GLK.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/ErrorBoundary-
|
2
|
-
export { E as ErrorMessage, L as Label, T as Typography } from '../chunks/Switch-
|
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/ErrorBoundary-CB-74GLK.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.
|
4
|
+
"version": "1.9.4",
|
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
@@ -202,20 +202,19 @@ export declare type BreadcrumbPropsUnion = BaseProps_6 & BreadcrumbProps;
|
|
202
202
|
|
203
203
|
export declare type BreadcrumbSeparatorType = BreadcrumbSeparatorType_2;
|
204
204
|
|
205
|
-
export declare const BulkAction: ({ quantity,
|
205
|
+
export declare const BulkAction: ({ quantity, handleRefresh, handleSend, handleSlash, handleProhibit, handleCheck, handleClose, handleDelete, handleUnLock, handleLock, }: BulkActionProps) => JSX.Element;
|
206
206
|
|
207
207
|
export declare interface BulkActionProps {
|
208
208
|
quantity: number;
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
209
|
+
handleRefresh?: () => void;
|
210
|
+
handleSend?: () => void;
|
211
|
+
handleSlash?: () => void;
|
212
|
+
handleProhibit?: () => void;
|
213
|
+
handleCheck?: () => void;
|
214
|
+
handleClose?: () => void;
|
215
215
|
handleDelete?: () => void;
|
216
|
-
|
217
|
-
|
218
|
-
status?: number;
|
216
|
+
handleUnLock?: () => void;
|
217
|
+
handleLock?: () => void;
|
219
218
|
}
|
220
219
|
|
221
220
|
export declare const Button: default_3.FC<ButtonProps>;
|
@@ -265,13 +264,11 @@ export declare interface ConfirmModalProps extends ModalProps {
|
|
265
264
|
content: string;
|
266
265
|
titleCancelBtn?: string;
|
267
266
|
titleSubmitBtn?: string;
|
268
|
-
typeIcon:
|
267
|
+
typeIcon: "success" | "error" | "warning" | "info";
|
269
268
|
handleCancel?: () => void;
|
270
269
|
handleSubmit?: () => void;
|
271
270
|
}
|
272
271
|
|
273
|
-
export declare type ConfirmModalType = "success" | "error" | "warning" | "info";
|
274
|
-
|
275
272
|
export declare const Container: default_3.FC<ContainerProps>;
|
276
273
|
|
277
274
|
export declare interface ContainerProps {
|
package/types/ui.d.ts
CHANGED
@@ -183,20 +183,19 @@ export declare type BreadcrumbPropsUnion = BaseProps_6 & BreadcrumbProps;
|
|
183
183
|
|
184
184
|
export declare type BreadcrumbSeparatorType = BreadcrumbSeparatorType_2;
|
185
185
|
|
186
|
-
export declare const BulkAction: ({ quantity,
|
186
|
+
export declare const BulkAction: ({ quantity, handleRefresh, handleSend, handleSlash, handleProhibit, handleCheck, handleClose, handleDelete, handleUnLock, handleLock, }: BulkActionProps) => JSX.Element;
|
187
187
|
|
188
188
|
export declare interface BulkActionProps {
|
189
189
|
quantity: number;
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
190
|
+
handleRefresh?: () => void;
|
191
|
+
handleSend?: () => void;
|
192
|
+
handleSlash?: () => void;
|
193
|
+
handleProhibit?: () => void;
|
194
|
+
handleCheck?: () => void;
|
195
|
+
handleClose?: () => void;
|
196
196
|
handleDelete?: () => void;
|
197
|
-
|
198
|
-
|
199
|
-
status?: number;
|
197
|
+
handleUnLock?: () => void;
|
198
|
+
handleLock?: () => void;
|
200
199
|
}
|
201
200
|
|
202
201
|
export declare const Button: default_3.FC<ButtonProps>;
|
@@ -232,13 +231,11 @@ export declare interface ConfirmModalProps extends ModalProps {
|
|
232
231
|
content: string;
|
233
232
|
titleCancelBtn?: string;
|
234
233
|
titleSubmitBtn?: string;
|
235
|
-
typeIcon:
|
234
|
+
typeIcon: "success" | "error" | "warning" | "info";
|
236
235
|
handleCancel?: () => void;
|
237
236
|
handleSubmit?: () => void;
|
238
237
|
}
|
239
238
|
|
240
|
-
export declare type ConfirmModalType = "success" | "error" | "warning" | "info";
|
241
|
-
|
242
239
|
export declare const Container: default_3.FC<ContainerProps>;
|
243
240
|
|
244
241
|
export declare interface ContainerProps {
|