react-table-edit 1.2.21 → 1.2.22

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.js CHANGED
@@ -1444,14 +1444,14 @@ var require_shims = __commonJS({
1444
1444
  exports2.dontSetMe = dontSetMe;
1445
1445
  exports2.findInArray = findInArray;
1446
1446
  exports2.int = int;
1447
- exports2.isFunction = isFunction5;
1447
+ exports2.isFunction = isFunction4;
1448
1448
  exports2.isNum = isNum;
1449
1449
  function findInArray(array, callback) {
1450
1450
  for (let i2 = 0, length = array.length; i2 < length; i2++) {
1451
1451
  if (callback.apply(callback, [array[i2], i2, array])) return array[i2];
1452
1452
  }
1453
1453
  }
1454
- function isFunction5(func) {
1454
+ function isFunction4(func) {
1455
1455
  return typeof func === "function" || Object.prototype.toString.call(func) === "[object Function]";
1456
1456
  }
1457
1457
  function isNum(num) {
@@ -1894,7 +1894,7 @@ var require_DraggableCore = __commonJS({
1894
1894
  value: true
1895
1895
  });
1896
1896
  exports2.default = void 0;
1897
- var React17 = _interopRequireWildcard(require("react"));
1897
+ var React16 = _interopRequireWildcard(require("react"));
1898
1898
  var _propTypes = _interopRequireDefault(require_prop_types());
1899
1899
  var _reactDom = _interopRequireDefault(require("react-dom"));
1900
1900
  var _domFns = require_domFns();
@@ -1977,7 +1977,7 @@ var require_DraggableCore = __commonJS({
1977
1977
  }
1978
1978
  };
1979
1979
  var dragEventFor = eventsFor.mouse;
1980
- var DraggableCore = class extends React17.Component {
1980
+ var DraggableCore = class extends React16.Component {
1981
1981
  constructor() {
1982
1982
  super(...arguments);
1983
1983
  _defineProperty4(this, "dragging", false);
@@ -2129,7 +2129,7 @@ var require_DraggableCore = __commonJS({
2129
2129
  return (_this$props = this.props) !== null && _this$props !== void 0 && _this$props.nodeRef ? (_this$props2 = this.props) === null || _this$props2 === void 0 || (_this$props2 = _this$props2.nodeRef) === null || _this$props2 === void 0 ? void 0 : _this$props2.current : _reactDom.default.findDOMNode(this);
2130
2130
  }
2131
2131
  render() {
2132
- return /* @__PURE__ */ React17.cloneElement(React17.Children.only(this.props.children), {
2132
+ return /* @__PURE__ */ React16.cloneElement(React16.Children.only(this.props.children), {
2133
2133
  // Note: mouseMove handler is attached to document so it will still function
2134
2134
  // when the user drags quickly and leaves the bounds of the element.
2135
2135
  onMouseDown: this.onMouseDown,
@@ -2299,7 +2299,7 @@ var require_Draggable = __commonJS({
2299
2299
  }
2300
2300
  });
2301
2301
  exports2.default = void 0;
2302
- var React17 = _interopRequireWildcard(require("react"));
2302
+ var React16 = _interopRequireWildcard(require("react"));
2303
2303
  var _propTypes = _interopRequireDefault(require_prop_types());
2304
2304
  var _reactDom = _interopRequireDefault(require("react-dom"));
2305
2305
  var _clsx = _interopRequireDefault((init_clsx_m(), __toCommonJS(clsx_m_exports)));
@@ -2385,7 +2385,7 @@ var require_Draggable = __commonJS({
2385
2385
  }
2386
2386
  return (hint === "string" ? String : Number)(input);
2387
2387
  }
2388
- var Draggable = class extends React17.Component {
2388
+ var Draggable = class extends React16.Component {
2389
2389
  // React 16.3+
2390
2390
  // Arity (props, state)
2391
2391
  static getDerivedStateFromProps(_ref, _ref2) {
@@ -2546,11 +2546,11 @@ var require_Draggable = __commonJS({
2546
2546
  [defaultClassNameDragging]: this.state.dragging,
2547
2547
  [defaultClassNameDragged]: this.state.dragged
2548
2548
  });
2549
- return /* @__PURE__ */ React17.createElement(_DraggableCore.default, _extends6({}, draggableCoreProps, {
2549
+ return /* @__PURE__ */ React16.createElement(_DraggableCore.default, _extends6({}, draggableCoreProps, {
2550
2550
  onStart: this.onDragStart,
2551
2551
  onDrag: this.onDrag,
2552
2552
  onStop: this.onDragStop
2553
- }), /* @__PURE__ */ React17.cloneElement(React17.Children.only(children), {
2553
+ }), /* @__PURE__ */ React16.cloneElement(React16.Children.only(children), {
2554
2554
  className,
2555
2555
  style: {
2556
2556
  ...children.props.style,
@@ -2894,7 +2894,7 @@ var require_Resizable = __commonJS({
2894
2894
  "use strict";
2895
2895
  exports2.__esModule = true;
2896
2896
  exports2.default = void 0;
2897
- var React17 = _interopRequireWildcard(require("react"));
2897
+ var React16 = _interopRequireWildcard(require("react"));
2898
2898
  var _reactDraggable = require_cjs();
2899
2899
  var _utils = require_utils();
2900
2900
  var _propTypes = require_propTypes();
@@ -3115,7 +3115,7 @@ var require_Resizable = __commonJS({
3115
3115
  _proto.renderResizeHandle = function renderResizeHandle(handleAxis, ref) {
3116
3116
  var handle = this.props.handle;
3117
3117
  if (!handle) {
3118
- return /* @__PURE__ */ React17.createElement("span", {
3118
+ return /* @__PURE__ */ React16.createElement("span", {
3119
3119
  className: "react-resizable-handle react-resizable-handle-" + handleAxis,
3120
3120
  ref
3121
3121
  });
@@ -3129,7 +3129,7 @@ var require_Resizable = __commonJS({
3129
3129
  }, isDOMElement ? {} : {
3130
3130
  handleAxis
3131
3131
  });
3132
- return /* @__PURE__ */ React17.cloneElement(handle, props);
3132
+ return /* @__PURE__ */ React16.cloneElement(handle, props);
3133
3133
  };
3134
3134
  _proto.render = function render2() {
3135
3135
  var _this3 = this;
@@ -3138,8 +3138,8 @@ var require_Resizable = __commonJS({
3138
3138
  className: (className ? className + " " : "") + "react-resizable",
3139
3139
  children: [].concat(children.props.children, resizeHandles.map(function(handleAxis) {
3140
3140
  var _this3$handleRefs$han;
3141
- var ref = (_this3$handleRefs$han = _this3.handleRefs[handleAxis]) != null ? _this3$handleRefs$han : _this3.handleRefs[handleAxis] = /* @__PURE__ */ React17.createRef();
3142
- return /* @__PURE__ */ React17.createElement(_reactDraggable.DraggableCore, _extends6({}, draggableOpts, {
3141
+ var ref = (_this3$handleRefs$han = _this3.handleRefs[handleAxis]) != null ? _this3$handleRefs$han : _this3.handleRefs[handleAxis] = /* @__PURE__ */ React16.createRef();
3142
+ return /* @__PURE__ */ React16.createElement(_reactDraggable.DraggableCore, _extends6({}, draggableOpts, {
3143
3143
  nodeRef: ref,
3144
3144
  key: "resizableHandle-" + handleAxis,
3145
3145
  onStop: _this3.resizeHandler("onResizeStop", handleAxis),
@@ -3150,7 +3150,7 @@ var require_Resizable = __commonJS({
3150
3150
  }));
3151
3151
  };
3152
3152
  return Resizable3;
3153
- }(React17.Component);
3153
+ }(React16.Component);
3154
3154
  exports2.default = Resizable2;
3155
3155
  Resizable2.propTypes = _propTypes.resizableProps;
3156
3156
  Resizable2.defaultProps = {
@@ -3171,7 +3171,7 @@ var require_ResizableBox = __commonJS({
3171
3171
  "use strict";
3172
3172
  exports2.__esModule = true;
3173
3173
  exports2.default = void 0;
3174
- var React17 = _interopRequireWildcard(require("react"));
3174
+ var React16 = _interopRequireWildcard(require("react"));
3175
3175
  var _propTypes = _interopRequireDefault(require_prop_types());
3176
3176
  var _Resizable = _interopRequireDefault(require_Resizable());
3177
3177
  var _propTypes2 = require_propTypes();
@@ -3339,7 +3339,7 @@ var require_ResizableBox = __commonJS({
3339
3339
  var _proto = ResizableBox2.prototype;
3340
3340
  _proto.render = function render2() {
3341
3341
  var _this$props = this.props, handle = _this$props.handle, handleSize = _this$props.handleSize, onResize = _this$props.onResize, onResizeStart = _this$props.onResizeStart, onResizeStop = _this$props.onResizeStop, draggableOpts = _this$props.draggableOpts, minConstraints = _this$props.minConstraints, maxConstraints = _this$props.maxConstraints, lockAspectRatio = _this$props.lockAspectRatio, axis = _this$props.axis, width = _this$props.width, height = _this$props.height, resizeHandles = _this$props.resizeHandles, style = _this$props.style, transformScale = _this$props.transformScale, props = _objectWithoutPropertiesLoose4(_this$props, _excluded4);
3342
- return /* @__PURE__ */ React17.createElement(_Resizable.default, {
3342
+ return /* @__PURE__ */ React16.createElement(_Resizable.default, {
3343
3343
  axis,
3344
3344
  draggableOpts,
3345
3345
  handle,
@@ -3354,7 +3354,7 @@ var require_ResizableBox = __commonJS({
3354
3354
  resizeHandles,
3355
3355
  transformScale,
3356
3356
  width: this.state.width
3357
- }, /* @__PURE__ */ React17.createElement("div", _extends6({}, props, {
3357
+ }, /* @__PURE__ */ React16.createElement("div", _extends6({}, props, {
3358
3358
  style: _objectSpread3(_objectSpread3({}, style), {}, {
3359
3359
  width: this.state.width + "px",
3360
3360
  height: this.state.height + "px"
@@ -3362,7 +3362,7 @@ var require_ResizableBox = __commonJS({
3362
3362
  })));
3363
3363
  };
3364
3364
  return ResizableBox2;
3365
- }(React17.Component);
3365
+ }(React16.Component);
3366
3366
  exports2.default = ResizableBox;
3367
3367
  ResizableBox.propTypes = _objectSpread3(_objectSpread3({}, _propTypes2.resizableProps), {}, {
3368
3368
  children: _propTypes.default.element
@@ -3410,7 +3410,7 @@ __export(src_exports, {
3410
3410
  module.exports = __toCommonJS(src_exports);
3411
3411
 
3412
3412
  // src/component/table/index.tsx
3413
- var import_react25 = require("react");
3413
+ var import_react24 = require("react");
3414
3414
 
3415
3415
  // node_modules/reactstrap/dist/reactstrap.modern.js
3416
3416
  var import_react3 = __toESM(require("react"), 1);
@@ -4807,15 +4807,15 @@ function popperGenerator(generatorOptions) {
4807
4807
  if (generatorOptions === void 0) {
4808
4808
  generatorOptions = {};
4809
4809
  }
4810
- var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions3 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
4810
+ var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions2 = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
4811
4811
  return function createPopper2(reference2, popper2, options) {
4812
4812
  if (options === void 0) {
4813
- options = defaultOptions3;
4813
+ options = defaultOptions2;
4814
4814
  }
4815
4815
  var state = {
4816
4816
  placement: "bottom",
4817
4817
  orderedModifiers: [],
4818
- options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions3),
4818
+ options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions2),
4819
4819
  modifiersData: {},
4820
4820
  elements: {
4821
4821
  reference: reference2,
@@ -4831,7 +4831,7 @@ function popperGenerator(generatorOptions) {
4831
4831
  setOptions: function setOptions(setOptionsAction) {
4832
4832
  var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
4833
4833
  cleanupModifierEffects();
4834
- state.options = Object.assign({}, defaultOptions3, state.options, options2);
4834
+ state.options = Object.assign({}, defaultOptions2, state.options, options2);
4835
4835
  state.scrollParents = {
4836
4836
  reference: isElement(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
4837
4837
  popper: listScrollParents(popper2)
@@ -22497,1499 +22497,21 @@ var formatDateTime = (data, format2 = "dd/MM/yyyy") => {
22497
22497
  };
22498
22498
 
22499
22499
  // src/component/edit-form/index.tsx
22500
- var import_react16 = require("react");
22501
-
22502
- // node_modules/react-hook-form/dist/index.esm.mjs
22503
- var import_react11 = __toESM(require("react"), 1);
22504
- var isCheckBoxInput = (element) => element.type === "checkbox";
22505
- var isDateObject = (value) => value instanceof Date;
22506
- var isNullOrUndefined2 = (value) => value == null;
22507
- var isObjectType = (value) => typeof value === "object";
22508
- var isObject2 = (value) => !isNullOrUndefined2(value) && !Array.isArray(value) && isObjectType(value) && !isDateObject(value);
22509
- var getEventValue = (event) => isObject2(event) && event.target ? isCheckBoxInput(event.target) ? event.target.checked : event.target.value : event;
22510
- var getNodeParentName = (name) => name.substring(0, name.search(/\.\d+(\.|$)/)) || name;
22511
- var isNameInFieldArray = (names, name) => names.has(getNodeParentName(name));
22512
- var isPlainObject = (tempObject) => {
22513
- const prototypeCopy = tempObject.constructor && tempObject.constructor.prototype;
22514
- return isObject2(prototypeCopy) && prototypeCopy.hasOwnProperty("isPrototypeOf");
22515
- };
22516
- var isWeb = typeof window !== "undefined" && typeof window.HTMLElement !== "undefined" && typeof document !== "undefined";
22517
- function cloneObject(data) {
22518
- let copy;
22519
- const isArray = Array.isArray(data);
22520
- if (data instanceof Date) {
22521
- copy = new Date(data);
22522
- } else if (data instanceof Set) {
22523
- copy = new Set(data);
22524
- } else if (!(isWeb && (data instanceof Blob || data instanceof FileList)) && (isArray || isObject2(data))) {
22525
- copy = isArray ? [] : {};
22526
- if (!Array.isArray(data) && !isPlainObject(data)) {
22527
- copy = data;
22528
- } else {
22529
- for (const key in data) {
22530
- copy[key] = cloneObject(data[key]);
22531
- }
22532
- }
22533
- } else {
22534
- return data;
22535
- }
22536
- return copy;
22537
- }
22538
- var compact = (value) => Array.isArray(value) ? value.filter(Boolean) : [];
22539
- var isUndefined = (val) => val === void 0;
22540
- var get = (obj, path, defaultValue) => {
22541
- if (!path || !isObject2(obj)) {
22542
- return defaultValue;
22543
- }
22544
- const result = compact(path.split(/[,[\].]+?/)).reduce((result2, key) => isNullOrUndefined2(result2) ? result2 : result2[key], obj);
22545
- return isUndefined(result) || result === obj ? isUndefined(obj[path]) ? defaultValue : obj[path] : result;
22546
- };
22547
- var EVENTS = {
22548
- BLUR: "blur",
22549
- FOCUS_OUT: "focusout",
22550
- CHANGE: "change"
22551
- };
22552
- var VALIDATION_MODE = {
22553
- onBlur: "onBlur",
22554
- onChange: "onChange",
22555
- onSubmit: "onSubmit",
22556
- onTouched: "onTouched",
22557
- all: "all"
22558
- };
22559
- var INPUT_VALIDATION_RULES = {
22560
- max: "max",
22561
- min: "min",
22562
- maxLength: "maxLength",
22563
- minLength: "minLength",
22564
- pattern: "pattern",
22565
- required: "required",
22566
- validate: "validate"
22567
- };
22568
- var HookFormContext = import_react11.default.createContext(null);
22569
- var useFormContext = () => import_react11.default.useContext(HookFormContext);
22570
- var getProxyFormState = (formState, control, localProxyFormState, isRoot = true) => {
22571
- const result = {
22572
- defaultValues: control._defaultValues
22573
- };
22574
- for (const key in formState) {
22575
- Object.defineProperty(result, key, {
22576
- get: () => {
22577
- const _key = key;
22578
- if (control._proxyFormState[_key] !== VALIDATION_MODE.all) {
22579
- control._proxyFormState[_key] = !isRoot || VALIDATION_MODE.all;
22580
- }
22581
- localProxyFormState && (localProxyFormState[_key] = true);
22582
- return formState[_key];
22583
- }
22584
- });
22585
- }
22586
- return result;
22587
- };
22588
- var isEmptyObject = (value) => isObject2(value) && !Object.keys(value).length;
22589
- var shouldRenderFormState = (formStateData, _proxyFormState, updateFormState, isRoot) => {
22590
- updateFormState(formStateData);
22591
- const { name, ...formState } = formStateData;
22592
- return isEmptyObject(formState) || Object.keys(formState).length >= Object.keys(_proxyFormState).length || Object.keys(formState).find((key) => _proxyFormState[key] === (!isRoot || VALIDATION_MODE.all));
22593
- };
22594
- var convertToArrayPayload = (value) => Array.isArray(value) ? value : [value];
22595
- var shouldSubscribeByName = (name, signalName, exact) => exact && signalName ? name === signalName : !name || !signalName || name === signalName || convertToArrayPayload(name).some((currentName) => currentName && (currentName.startsWith(signalName) || signalName.startsWith(currentName)));
22596
- function useSubscribe(props) {
22597
- const _props = import_react11.default.useRef(props);
22598
- _props.current = props;
22599
- import_react11.default.useEffect(() => {
22600
- const subscription = !props.disabled && _props.current.subject && _props.current.subject.subscribe({
22601
- next: _props.current.next
22602
- });
22603
- return () => {
22604
- subscription && subscription.unsubscribe();
22605
- };
22606
- }, [props.disabled]);
22607
- }
22608
- function useFormState(props) {
22609
- const methods = useFormContext();
22610
- const { control = methods.control, disabled, name, exact } = props || {};
22611
- const [formState, updateFormState] = import_react11.default.useState(control._formState);
22612
- const _mounted = import_react11.default.useRef(true);
22613
- const _localProxyFormState = import_react11.default.useRef({
22614
- isDirty: false,
22615
- isLoading: false,
22616
- dirtyFields: false,
22617
- touchedFields: false,
22618
- isValidating: false,
22619
- isValid: false,
22620
- errors: false
22621
- });
22622
- const _name = import_react11.default.useRef(name);
22623
- _name.current = name;
22624
- useSubscribe({
22625
- disabled,
22626
- next: (value) => _mounted.current && shouldSubscribeByName(_name.current, value.name, exact) && shouldRenderFormState(value, _localProxyFormState.current, control._updateFormState) && updateFormState({
22627
- ...control._formState,
22628
- ...value
22629
- }),
22630
- subject: control._subjects.state
22631
- });
22632
- import_react11.default.useEffect(() => {
22633
- _mounted.current = true;
22634
- _localProxyFormState.current.isValid && control._updateValid(true);
22635
- return () => {
22636
- _mounted.current = false;
22637
- };
22638
- }, [control]);
22639
- return getProxyFormState(formState, control, _localProxyFormState.current, false);
22640
- }
22641
- var isString = (value) => typeof value === "string";
22642
- var generateWatchOutput = (names, _names, formValues, isGlobal, defaultValue) => {
22643
- if (isString(names)) {
22644
- isGlobal && _names.watch.add(names);
22645
- return get(formValues, names, defaultValue);
22646
- }
22647
- if (Array.isArray(names)) {
22648
- return names.map((fieldName) => (isGlobal && _names.watch.add(fieldName), get(formValues, fieldName)));
22649
- }
22650
- isGlobal && (_names.watchAll = true);
22651
- return formValues;
22652
- };
22653
- function useWatch(props) {
22654
- const methods = useFormContext();
22655
- const { control = methods.control, name, defaultValue, disabled, exact } = props || {};
22656
- const _name = import_react11.default.useRef(name);
22657
- _name.current = name;
22658
- useSubscribe({
22659
- disabled,
22660
- subject: control._subjects.values,
22661
- next: (formState) => {
22662
- if (shouldSubscribeByName(_name.current, formState.name, exact)) {
22663
- updateValue(cloneObject(generateWatchOutput(_name.current, control._names, formState.values || control._formValues, false, defaultValue)));
22664
- }
22665
- }
22666
- });
22667
- const [value, updateValue] = import_react11.default.useState(control._getWatch(name, defaultValue));
22668
- import_react11.default.useEffect(() => control._removeUnmounted());
22669
- return value;
22670
- }
22671
- var isKey = (value) => /^\w*$/.test(value);
22672
- var stringToPath = (input) => compact(input.replace(/["|']|\]/g, "").split(/\.|\[/));
22673
- function set(object, path, value) {
22674
- let index = -1;
22675
- const tempPath = isKey(path) ? [path] : stringToPath(path);
22676
- const length = tempPath.length;
22677
- const lastIndex = length - 1;
22678
- while (++index < length) {
22679
- const key = tempPath[index];
22680
- let newValue = value;
22681
- if (index !== lastIndex) {
22682
- const objValue = object[key];
22683
- newValue = isObject2(objValue) || Array.isArray(objValue) ? objValue : !isNaN(+tempPath[index + 1]) ? [] : {};
22684
- }
22685
- object[key] = newValue;
22686
- object = object[key];
22687
- }
22688
- return object;
22689
- }
22690
- function useController(props) {
22691
- const methods = useFormContext();
22692
- const { name, control = methods.control, shouldUnregister } = props;
22693
- const isArrayField = isNameInFieldArray(control._names.array, name);
22694
- const value = useWatch({
22695
- control,
22696
- name,
22697
- defaultValue: get(control._formValues, name, get(control._defaultValues, name, props.defaultValue)),
22698
- exact: true
22699
- });
22700
- const formState = useFormState({
22701
- control,
22702
- name
22703
- });
22704
- const _registerProps = import_react11.default.useRef(control.register(name, {
22705
- ...props.rules,
22706
- value
22707
- }));
22708
- import_react11.default.useEffect(() => {
22709
- const _shouldUnregisterField = control._options.shouldUnregister || shouldUnregister;
22710
- const updateMounted = (name2, value2) => {
22711
- const field = get(control._fields, name2);
22712
- if (field) {
22713
- field._f.mount = value2;
22714
- }
22715
- };
22716
- updateMounted(name, true);
22717
- if (_shouldUnregisterField) {
22718
- const value2 = cloneObject(get(control._options.defaultValues, name));
22719
- set(control._defaultValues, name, value2);
22720
- if (isUndefined(get(control._formValues, name))) {
22721
- set(control._formValues, name, value2);
22722
- }
22723
- }
22724
- return () => {
22725
- (isArrayField ? _shouldUnregisterField && !control._state.action : _shouldUnregisterField) ? control.unregister(name) : updateMounted(name, false);
22726
- };
22727
- }, [name, control, isArrayField, shouldUnregister]);
22728
- return {
22729
- field: {
22730
- name,
22731
- value,
22732
- onChange: import_react11.default.useCallback((event) => _registerProps.current.onChange({
22733
- target: {
22734
- value: getEventValue(event),
22735
- name
22736
- },
22737
- type: EVENTS.CHANGE
22738
- }), [name]),
22739
- onBlur: import_react11.default.useCallback(() => _registerProps.current.onBlur({
22740
- target: {
22741
- value: get(control._formValues, name),
22742
- name
22743
- },
22744
- type: EVENTS.BLUR
22745
- }), [name, control]),
22746
- ref: (elm) => {
22747
- const field = get(control._fields, name);
22748
- if (field && elm) {
22749
- field._f.ref = {
22750
- focus: () => elm.focus(),
22751
- select: () => elm.select(),
22752
- setCustomValidity: (message) => elm.setCustomValidity(message),
22753
- reportValidity: () => elm.reportValidity()
22754
- };
22755
- }
22756
- }
22757
- },
22758
- formState,
22759
- fieldState: Object.defineProperties({}, {
22760
- invalid: {
22761
- enumerable: true,
22762
- get: () => !!get(formState.errors, name)
22763
- },
22764
- isDirty: {
22765
- enumerable: true,
22766
- get: () => !!get(formState.dirtyFields, name)
22767
- },
22768
- isTouched: {
22769
- enumerable: true,
22770
- get: () => !!get(formState.touchedFields, name)
22771
- },
22772
- error: {
22773
- enumerable: true,
22774
- get: () => get(formState.errors, name)
22775
- }
22776
- })
22777
- };
22778
- }
22779
- var Controller = (props) => props.render(useController(props));
22780
- var appendErrors = (name, validateAllFieldCriteria, errors, type, message) => validateAllFieldCriteria ? {
22781
- ...errors[name],
22782
- types: {
22783
- ...errors[name] && errors[name].types ? errors[name].types : {},
22784
- [type]: message || true
22785
- }
22786
- } : {};
22787
- var focusFieldBy = (fields, callback, fieldsNames) => {
22788
- for (const key of fieldsNames || Object.keys(fields)) {
22789
- const field = get(fields, key);
22790
- if (field) {
22791
- const { _f, ...currentField } = field;
22792
- if (_f && callback(_f.name)) {
22793
- if (_f.ref.focus) {
22794
- _f.ref.focus();
22795
- break;
22796
- } else if (_f.refs && _f.refs[0].focus) {
22797
- _f.refs[0].focus();
22798
- break;
22799
- }
22800
- } else if (isObject2(currentField)) {
22801
- focusFieldBy(currentField, callback);
22802
- }
22803
- }
22804
- }
22805
- };
22806
- var getValidationModes = (mode) => ({
22807
- isOnSubmit: !mode || mode === VALIDATION_MODE.onSubmit,
22808
- isOnBlur: mode === VALIDATION_MODE.onBlur,
22809
- isOnChange: mode === VALIDATION_MODE.onChange,
22810
- isOnAll: mode === VALIDATION_MODE.all,
22811
- isOnTouch: mode === VALIDATION_MODE.onTouched
22812
- });
22813
- var isWatched = (name, _names, isBlurEvent) => !isBlurEvent && (_names.watchAll || _names.watch.has(name) || [..._names.watch].some((watchName) => name.startsWith(watchName) && /^\.\w+/.test(name.slice(watchName.length))));
22814
- var updateFieldArrayRootError = (errors, error2, name) => {
22815
- const fieldArrayErrors = compact(get(errors, name));
22816
- set(fieldArrayErrors, "root", error2[name]);
22817
- set(errors, name, fieldArrayErrors);
22818
- return errors;
22819
- };
22820
- var isBoolean = (value) => typeof value === "boolean";
22821
- var isFileInput = (element) => element.type === "file";
22822
- var isFunction4 = (value) => typeof value === "function";
22823
- var isHTMLElement2 = (value) => {
22824
- if (!isWeb) {
22825
- return false;
22826
- }
22827
- const owner = value ? value.ownerDocument : 0;
22828
- return value instanceof (owner && owner.defaultView ? owner.defaultView.HTMLElement : HTMLElement);
22829
- };
22830
- var isMessage = (value) => isString(value);
22831
- var isRadioInput = (element) => element.type === "radio";
22832
- var isRegex = (value) => value instanceof RegExp;
22833
- var defaultResult = {
22834
- value: false,
22835
- isValid: false
22836
- };
22837
- var validResult = { value: true, isValid: true };
22838
- var getCheckboxValue2 = (options) => {
22839
- if (Array.isArray(options)) {
22840
- if (options.length > 1) {
22841
- const values = options.filter((option) => option && option.checked && !option.disabled).map((option) => option.value);
22842
- return { value: values, isValid: !!values.length };
22843
- }
22844
- return options[0].checked && !options[0].disabled ? (
22845
- // @ts-expect-error expected to work in the browser
22846
- options[0].attributes && !isUndefined(options[0].attributes.value) ? isUndefined(options[0].value) || options[0].value === "" ? validResult : { value: options[0].value, isValid: true } : validResult
22847
- ) : defaultResult;
22848
- }
22849
- return defaultResult;
22850
- };
22851
- var defaultReturn = {
22852
- isValid: false,
22853
- value: null
22854
- };
22855
- var getRadioValue2 = (options) => Array.isArray(options) ? options.reduce((previous, option) => option && option.checked && !option.disabled ? {
22856
- isValid: true,
22857
- value: option.value
22858
- } : previous, defaultReturn) : defaultReturn;
22859
- function getValidateError(result, ref, type = "validate") {
22860
- if (isMessage(result) || Array.isArray(result) && result.every(isMessage) || isBoolean(result) && !result) {
22861
- return {
22862
- type,
22863
- message: isMessage(result) ? result : "",
22864
- ref
22865
- };
22866
- }
22867
- }
22868
- var getValueAndMessage = (validationData) => isObject2(validationData) && !isRegex(validationData) ? validationData : {
22869
- value: validationData,
22870
- message: ""
22871
- };
22872
- var validateField = async (field, formValues, validateAllFieldCriteria, shouldUseNativeValidation, isFieldArray) => {
22873
- const { ref, refs, required, maxLength, minLength, min: min2, max: max2, pattern, validate, name, valueAsNumber, mount, disabled } = field._f;
22874
- const inputValue = get(formValues, name);
22875
- if (!mount || disabled) {
22876
- return {};
22877
- }
22878
- const inputRef = refs ? refs[0] : ref;
22879
- const setCustomValidity = (message) => {
22880
- if (shouldUseNativeValidation && inputRef.reportValidity) {
22881
- inputRef.setCustomValidity(isBoolean(message) ? "" : message || "");
22882
- inputRef.reportValidity();
22883
- }
22884
- };
22885
- const error2 = {};
22886
- const isRadio = isRadioInput(ref);
22887
- const isCheckBox = isCheckBoxInput(ref);
22888
- const isRadioOrCheckbox2 = isRadio || isCheckBox;
22889
- const isEmpty = (valueAsNumber || isFileInput(ref)) && isUndefined(ref.value) && isUndefined(inputValue) || isHTMLElement2(ref) && ref.value === "" || inputValue === "" || Array.isArray(inputValue) && !inputValue.length;
22890
- const appendErrorsCurry = appendErrors.bind(null, name, validateAllFieldCriteria, error2);
22891
- const getMinMaxMessage = (exceedMax, maxLengthMessage, minLengthMessage, maxType = INPUT_VALIDATION_RULES.maxLength, minType = INPUT_VALIDATION_RULES.minLength) => {
22892
- const message = exceedMax ? maxLengthMessage : minLengthMessage;
22893
- error2[name] = {
22894
- type: exceedMax ? maxType : minType,
22895
- message,
22896
- ref,
22897
- ...appendErrorsCurry(exceedMax ? maxType : minType, message)
22898
- };
22899
- };
22900
- if (isFieldArray ? !Array.isArray(inputValue) || !inputValue.length : required && (!isRadioOrCheckbox2 && (isEmpty || isNullOrUndefined2(inputValue)) || isBoolean(inputValue) && !inputValue || isCheckBox && !getCheckboxValue2(refs).isValid || isRadio && !getRadioValue2(refs).isValid)) {
22901
- const { value, message } = isMessage(required) ? { value: !!required, message: required } : getValueAndMessage(required);
22902
- if (value) {
22903
- error2[name] = {
22904
- type: INPUT_VALIDATION_RULES.required,
22905
- message,
22906
- ref: inputRef,
22907
- ...appendErrorsCurry(INPUT_VALIDATION_RULES.required, message)
22908
- };
22909
- if (!validateAllFieldCriteria) {
22910
- setCustomValidity(message);
22911
- return error2;
22912
- }
22913
- }
22914
- }
22915
- if (!isEmpty && (!isNullOrUndefined2(min2) || !isNullOrUndefined2(max2))) {
22916
- let exceedMax;
22917
- let exceedMin;
22918
- const maxOutput = getValueAndMessage(max2);
22919
- const minOutput = getValueAndMessage(min2);
22920
- if (!isNullOrUndefined2(inputValue) && !isNaN(inputValue)) {
22921
- const valueNumber = ref.valueAsNumber || (inputValue ? +inputValue : inputValue);
22922
- if (!isNullOrUndefined2(maxOutput.value)) {
22923
- exceedMax = valueNumber > maxOutput.value;
22924
- }
22925
- if (!isNullOrUndefined2(minOutput.value)) {
22926
- exceedMin = valueNumber < minOutput.value;
22927
- }
22928
- } else {
22929
- const valueDate = ref.valueAsDate || new Date(inputValue);
22930
- const convertTimeToDate = (time) => /* @__PURE__ */ new Date((/* @__PURE__ */ new Date()).toDateString() + " " + time);
22931
- const isTime = ref.type == "time";
22932
- const isWeek = ref.type == "week";
22933
- if (isString(maxOutput.value) && inputValue) {
22934
- exceedMax = isTime ? convertTimeToDate(inputValue) > convertTimeToDate(maxOutput.value) : isWeek ? inputValue > maxOutput.value : valueDate > new Date(maxOutput.value);
22935
- }
22936
- if (isString(minOutput.value) && inputValue) {
22937
- exceedMin = isTime ? convertTimeToDate(inputValue) < convertTimeToDate(minOutput.value) : isWeek ? inputValue < minOutput.value : valueDate < new Date(minOutput.value);
22938
- }
22939
- }
22940
- if (exceedMax || exceedMin) {
22941
- getMinMaxMessage(!!exceedMax, maxOutput.message, minOutput.message, INPUT_VALIDATION_RULES.max, INPUT_VALIDATION_RULES.min);
22942
- if (!validateAllFieldCriteria) {
22943
- setCustomValidity(error2[name].message);
22944
- return error2;
22945
- }
22946
- }
22947
- }
22948
- if ((maxLength || minLength) && !isEmpty && (isString(inputValue) || isFieldArray && Array.isArray(inputValue))) {
22949
- const maxLengthOutput = getValueAndMessage(maxLength);
22950
- const minLengthOutput = getValueAndMessage(minLength);
22951
- const exceedMax = !isNullOrUndefined2(maxLengthOutput.value) && inputValue.length > +maxLengthOutput.value;
22952
- const exceedMin = !isNullOrUndefined2(minLengthOutput.value) && inputValue.length < +minLengthOutput.value;
22953
- if (exceedMax || exceedMin) {
22954
- getMinMaxMessage(exceedMax, maxLengthOutput.message, minLengthOutput.message);
22955
- if (!validateAllFieldCriteria) {
22956
- setCustomValidity(error2[name].message);
22957
- return error2;
22958
- }
22959
- }
22960
- }
22961
- if (pattern && !isEmpty && isString(inputValue)) {
22962
- const { value: patternValue, message } = getValueAndMessage(pattern);
22963
- if (isRegex(patternValue) && !inputValue.match(patternValue)) {
22964
- error2[name] = {
22965
- type: INPUT_VALIDATION_RULES.pattern,
22966
- message,
22967
- ref,
22968
- ...appendErrorsCurry(INPUT_VALIDATION_RULES.pattern, message)
22969
- };
22970
- if (!validateAllFieldCriteria) {
22971
- setCustomValidity(message);
22972
- return error2;
22973
- }
22974
- }
22975
- }
22976
- if (validate) {
22977
- if (isFunction4(validate)) {
22978
- const result = await validate(inputValue, formValues);
22979
- const validateError = getValidateError(result, inputRef);
22980
- if (validateError) {
22981
- error2[name] = {
22982
- ...validateError,
22983
- ...appendErrorsCurry(INPUT_VALIDATION_RULES.validate, validateError.message)
22984
- };
22985
- if (!validateAllFieldCriteria) {
22986
- setCustomValidity(validateError.message);
22987
- return error2;
22988
- }
22989
- }
22990
- } else if (isObject2(validate)) {
22991
- let validationResult = {};
22992
- for (const key in validate) {
22993
- if (!isEmptyObject(validationResult) && !validateAllFieldCriteria) {
22994
- break;
22995
- }
22996
- const validateError = getValidateError(await validate[key](inputValue, formValues), inputRef, key);
22997
- if (validateError) {
22998
- validationResult = {
22999
- ...validateError,
23000
- ...appendErrorsCurry(key, validateError.message)
23001
- };
23002
- setCustomValidity(validateError.message);
23003
- if (validateAllFieldCriteria) {
23004
- error2[name] = validationResult;
23005
- }
23006
- }
23007
- }
23008
- if (!isEmptyObject(validationResult)) {
23009
- error2[name] = {
23010
- ref: inputRef,
23011
- ...validationResult
23012
- };
23013
- if (!validateAllFieldCriteria) {
23014
- return error2;
23015
- }
23016
- }
23017
- }
23018
- }
23019
- setCustomValidity(true);
23020
- return error2;
23021
- };
23022
- function baseGet(object, updatePath) {
23023
- const length = updatePath.slice(0, -1).length;
23024
- let index = 0;
23025
- while (index < length) {
23026
- object = isUndefined(object) ? index++ : object[updatePath[index++]];
23027
- }
23028
- return object;
23029
- }
23030
- function isEmptyArray(obj) {
23031
- for (const key in obj) {
23032
- if (!isUndefined(obj[key])) {
23033
- return false;
23034
- }
23035
- }
23036
- return true;
23037
- }
23038
- function unset(object, path) {
23039
- const paths = Array.isArray(path) ? path : isKey(path) ? [path] : stringToPath(path);
23040
- const childObject = paths.length === 1 ? object : baseGet(object, paths);
23041
- const index = paths.length - 1;
23042
- const key = paths[index];
23043
- if (childObject) {
23044
- delete childObject[key];
23045
- }
23046
- if (index !== 0 && (isObject2(childObject) && isEmptyObject(childObject) || Array.isArray(childObject) && isEmptyArray(childObject))) {
23047
- unset(object, paths.slice(0, -1));
23048
- }
23049
- return object;
23050
- }
23051
- function createSubject() {
23052
- let _observers = [];
23053
- const next = (value) => {
23054
- for (const observer of _observers) {
23055
- observer.next && observer.next(value);
23056
- }
23057
- };
23058
- const subscribe = (observer) => {
23059
- _observers.push(observer);
23060
- return {
23061
- unsubscribe: () => {
23062
- _observers = _observers.filter((o2) => o2 !== observer);
23063
- }
23064
- };
23065
- };
23066
- const unsubscribe = () => {
23067
- _observers = [];
23068
- };
23069
- return {
23070
- get observers() {
23071
- return _observers;
23072
- },
23073
- next,
23074
- subscribe,
23075
- unsubscribe
23076
- };
23077
- }
23078
- var isPrimitive = (value) => isNullOrUndefined2(value) || !isObjectType(value);
23079
- function deepEqual(object1, object2) {
23080
- if (isPrimitive(object1) || isPrimitive(object2)) {
23081
- return object1 === object2;
23082
- }
23083
- if (isDateObject(object1) && isDateObject(object2)) {
23084
- return object1.getTime() === object2.getTime();
23085
- }
23086
- const keys1 = Object.keys(object1);
23087
- const keys2 = Object.keys(object2);
23088
- if (keys1.length !== keys2.length) {
23089
- return false;
23090
- }
23091
- for (const key of keys1) {
23092
- const val1 = object1[key];
23093
- if (!keys2.includes(key)) {
23094
- return false;
23095
- }
23096
- if (key !== "ref") {
23097
- const val2 = object2[key];
23098
- if (isDateObject(val1) && isDateObject(val2) || isObject2(val1) && isObject2(val2) || Array.isArray(val1) && Array.isArray(val2) ? !deepEqual(val1, val2) : val1 !== val2) {
23099
- return false;
23100
- }
23101
- }
23102
- }
23103
- return true;
23104
- }
23105
- var isMultipleSelect = (element) => element.type === `select-multiple`;
23106
- var isRadioOrCheckbox = (ref) => isRadioInput(ref) || isCheckBoxInput(ref);
23107
- var live = (ref) => isHTMLElement2(ref) && ref.isConnected;
23108
- var objectHasFunction = (data) => {
23109
- for (const key in data) {
23110
- if (isFunction4(data[key])) {
23111
- return true;
23112
- }
23113
- }
23114
- return false;
23115
- };
23116
- function markFieldsDirty(data, fields = {}) {
23117
- const isParentNodeArray = Array.isArray(data);
23118
- if (isObject2(data) || isParentNodeArray) {
23119
- for (const key in data) {
23120
- if (Array.isArray(data[key]) || isObject2(data[key]) && !objectHasFunction(data[key])) {
23121
- fields[key] = Array.isArray(data[key]) ? [] : {};
23122
- markFieldsDirty(data[key], fields[key]);
23123
- } else if (!isNullOrUndefined2(data[key])) {
23124
- fields[key] = true;
23125
- }
23126
- }
23127
- }
23128
- return fields;
23129
- }
23130
- function getDirtyFieldsFromDefaultValues(data, formValues, dirtyFieldsFromValues) {
23131
- const isParentNodeArray = Array.isArray(data);
23132
- if (isObject2(data) || isParentNodeArray) {
23133
- for (const key in data) {
23134
- if (Array.isArray(data[key]) || isObject2(data[key]) && !objectHasFunction(data[key])) {
23135
- if (isUndefined(formValues) || isPrimitive(dirtyFieldsFromValues[key])) {
23136
- dirtyFieldsFromValues[key] = Array.isArray(data[key]) ? markFieldsDirty(data[key], []) : { ...markFieldsDirty(data[key]) };
23137
- } else {
23138
- getDirtyFieldsFromDefaultValues(data[key], isNullOrUndefined2(formValues) ? {} : formValues[key], dirtyFieldsFromValues[key]);
23139
- }
23140
- } else {
23141
- dirtyFieldsFromValues[key] = !deepEqual(data[key], formValues[key]);
23142
- }
23143
- }
23144
- }
23145
- return dirtyFieldsFromValues;
23146
- }
23147
- var getDirtyFields = (defaultValues, formValues) => getDirtyFieldsFromDefaultValues(defaultValues, formValues, markFieldsDirty(formValues));
23148
- var getFieldValueAs = (value, { valueAsNumber, valueAsDate, setValueAs }) => isUndefined(value) ? value : valueAsNumber ? value === "" ? NaN : value ? +value : value : valueAsDate && isString(value) ? new Date(value) : setValueAs ? setValueAs(value) : value;
23149
- function getFieldValue(_f) {
23150
- const ref = _f.ref;
23151
- if (_f.refs ? _f.refs.every((ref2) => ref2.disabled) : ref.disabled) {
23152
- return;
23153
- }
23154
- if (isFileInput(ref)) {
23155
- return ref.files;
23156
- }
23157
- if (isRadioInput(ref)) {
23158
- return getRadioValue2(_f.refs).value;
23159
- }
23160
- if (isMultipleSelect(ref)) {
23161
- return [...ref.selectedOptions].map(({ value }) => value);
23162
- }
23163
- if (isCheckBoxInput(ref)) {
23164
- return getCheckboxValue2(_f.refs).value;
23165
- }
23166
- return getFieldValueAs(isUndefined(ref.value) ? _f.ref.value : ref.value, _f);
23167
- }
23168
- var getResolverOptions = (fieldsNames, _fields, criteriaMode, shouldUseNativeValidation) => {
23169
- const fields = {};
23170
- for (const name of fieldsNames) {
23171
- const field = get(_fields, name);
23172
- field && set(fields, name, field._f);
23173
- }
23174
- return {
23175
- criteriaMode,
23176
- names: [...fieldsNames],
23177
- fields,
23178
- shouldUseNativeValidation
23179
- };
23180
- };
23181
- var getRuleValue = (rule) => isUndefined(rule) ? rule : isRegex(rule) ? rule.source : isObject2(rule) ? isRegex(rule.value) ? rule.value.source : rule.value : rule;
23182
- var hasValidation = (options) => options.mount && (options.required || options.min || options.max || options.maxLength || options.minLength || options.pattern || options.validate);
23183
- function schemaErrorLookup(errors, _fields, name) {
23184
- const error2 = get(errors, name);
23185
- if (error2 || isKey(name)) {
23186
- return {
23187
- error: error2,
23188
- name
23189
- };
23190
- }
23191
- const names = name.split(".");
23192
- while (names.length) {
23193
- const fieldName = names.join(".");
23194
- const field = get(_fields, fieldName);
23195
- const foundError = get(errors, fieldName);
23196
- if (field && !Array.isArray(field) && name !== fieldName) {
23197
- return { name };
23198
- }
23199
- if (foundError && foundError.type) {
23200
- return {
23201
- name: fieldName,
23202
- error: foundError
23203
- };
23204
- }
23205
- names.pop();
23206
- }
23207
- return {
23208
- name
23209
- };
23210
- }
23211
- var skipValidation = (isBlurEvent, isTouched, isSubmitted, reValidateMode, mode) => {
23212
- if (mode.isOnAll) {
23213
- return false;
23214
- } else if (!isSubmitted && mode.isOnTouch) {
23215
- return !(isTouched || isBlurEvent);
23216
- } else if (isSubmitted ? reValidateMode.isOnBlur : mode.isOnBlur) {
23217
- return !isBlurEvent;
23218
- } else if (isSubmitted ? reValidateMode.isOnChange : mode.isOnChange) {
23219
- return isBlurEvent;
23220
- }
23221
- return true;
23222
- };
23223
- var unsetEmptyArray = (ref, name) => !compact(get(ref, name)).length && unset(ref, name);
23224
- var defaultOptions2 = {
23225
- mode: VALIDATION_MODE.onSubmit,
23226
- reValidateMode: VALIDATION_MODE.onChange,
23227
- shouldFocusError: true
23228
- };
23229
- function createFormControl(props = {}, flushRootRender) {
23230
- let _options = {
23231
- ...defaultOptions2,
23232
- ...props
23233
- };
23234
- let _formState = {
23235
- submitCount: 0,
23236
- isDirty: false,
23237
- isLoading: isFunction4(_options.defaultValues),
23238
- isValidating: false,
23239
- isSubmitted: false,
23240
- isSubmitting: false,
23241
- isSubmitSuccessful: false,
23242
- isValid: false,
23243
- touchedFields: {},
23244
- dirtyFields: {},
23245
- errors: {}
23246
- };
23247
- let _fields = {};
23248
- let _defaultValues = isObject2(_options.defaultValues) || isObject2(_options.values) ? cloneObject(_options.defaultValues || _options.values) || {} : {};
23249
- let _formValues = _options.shouldUnregister ? {} : cloneObject(_defaultValues);
23250
- let _state = {
23251
- action: false,
23252
- mount: false,
23253
- watch: false
23254
- };
23255
- let _names = {
23256
- mount: /* @__PURE__ */ new Set(),
23257
- unMount: /* @__PURE__ */ new Set(),
23258
- array: /* @__PURE__ */ new Set(),
23259
- watch: /* @__PURE__ */ new Set()
23260
- };
23261
- let delayErrorCallback;
23262
- let timer = 0;
23263
- const _proxyFormState = {
23264
- isDirty: false,
23265
- dirtyFields: false,
23266
- touchedFields: false,
23267
- isValidating: false,
23268
- isValid: false,
23269
- errors: false
23270
- };
23271
- const _subjects = {
23272
- values: createSubject(),
23273
- array: createSubject(),
23274
- state: createSubject()
23275
- };
23276
- const shouldCaptureDirtyFields = props.resetOptions && props.resetOptions.keepDirtyValues;
23277
- const validationModeBeforeSubmit = getValidationModes(_options.mode);
23278
- const validationModeAfterSubmit = getValidationModes(_options.reValidateMode);
23279
- const shouldDisplayAllAssociatedErrors = _options.criteriaMode === VALIDATION_MODE.all;
23280
- const debounce2 = (callback) => (wait) => {
23281
- clearTimeout(timer);
23282
- timer = setTimeout(callback, wait);
23283
- };
23284
- const _updateValid = async (shouldUpdateValid) => {
23285
- if (_proxyFormState.isValid || shouldUpdateValid) {
23286
- const isValid = _options.resolver ? isEmptyObject((await _executeSchema()).errors) : await executeBuiltInValidation(_fields, true);
23287
- if (isValid !== _formState.isValid) {
23288
- _subjects.state.next({
23289
- isValid
23290
- });
23291
- }
23292
- }
23293
- };
23294
- const _updateIsValidating = (value) => _proxyFormState.isValidating && _subjects.state.next({
23295
- isValidating: value
23296
- });
23297
- const _updateFieldArray = (name, values = [], method, args, shouldSetValues = true, shouldUpdateFieldsAndState = true) => {
23298
- if (args && method) {
23299
- _state.action = true;
23300
- if (shouldUpdateFieldsAndState && Array.isArray(get(_fields, name))) {
23301
- const fieldValues = method(get(_fields, name), args.argA, args.argB);
23302
- shouldSetValues && set(_fields, name, fieldValues);
23303
- }
23304
- if (shouldUpdateFieldsAndState && Array.isArray(get(_formState.errors, name))) {
23305
- const errors = method(get(_formState.errors, name), args.argA, args.argB);
23306
- shouldSetValues && set(_formState.errors, name, errors);
23307
- unsetEmptyArray(_formState.errors, name);
23308
- }
23309
- if (_proxyFormState.touchedFields && shouldUpdateFieldsAndState && Array.isArray(get(_formState.touchedFields, name))) {
23310
- const touchedFields = method(get(_formState.touchedFields, name), args.argA, args.argB);
23311
- shouldSetValues && set(_formState.touchedFields, name, touchedFields);
23312
- }
23313
- if (_proxyFormState.dirtyFields) {
23314
- _formState.dirtyFields = getDirtyFields(_defaultValues, _formValues);
23315
- }
23316
- _subjects.state.next({
23317
- name,
23318
- isDirty: _getDirty(name, values),
23319
- dirtyFields: _formState.dirtyFields,
23320
- errors: _formState.errors,
23321
- isValid: _formState.isValid
23322
- });
23323
- } else {
23324
- set(_formValues, name, values);
23325
- }
23326
- };
23327
- const updateErrors = (name, error2) => {
23328
- set(_formState.errors, name, error2);
23329
- _subjects.state.next({
23330
- errors: _formState.errors
23331
- });
23332
- };
23333
- const updateValidAndValue = (name, shouldSkipSetValueAs, value, ref) => {
23334
- const field = get(_fields, name);
23335
- if (field) {
23336
- const defaultValue = get(_formValues, name, isUndefined(value) ? get(_defaultValues, name) : value);
23337
- isUndefined(defaultValue) || ref && ref.defaultChecked || shouldSkipSetValueAs ? set(_formValues, name, shouldSkipSetValueAs ? defaultValue : getFieldValue(field._f)) : setFieldValue(name, defaultValue);
23338
- _state.mount && _updateValid();
23339
- }
23340
- };
23341
- const updateTouchAndDirty = (name, fieldValue, isBlurEvent, shouldDirty, shouldRender) => {
23342
- let shouldUpdateField = false;
23343
- let isPreviousDirty = false;
23344
- const output = {
23345
- name
23346
- };
23347
- if (!isBlurEvent || shouldDirty) {
23348
- if (_proxyFormState.isDirty) {
23349
- isPreviousDirty = _formState.isDirty;
23350
- _formState.isDirty = output.isDirty = _getDirty();
23351
- shouldUpdateField = isPreviousDirty !== output.isDirty;
23352
- }
23353
- const isCurrentFieldPristine = deepEqual(get(_defaultValues, name), fieldValue);
23354
- isPreviousDirty = get(_formState.dirtyFields, name);
23355
- isCurrentFieldPristine ? unset(_formState.dirtyFields, name) : set(_formState.dirtyFields, name, true);
23356
- output.dirtyFields = _formState.dirtyFields;
23357
- shouldUpdateField = shouldUpdateField || _proxyFormState.dirtyFields && isPreviousDirty !== !isCurrentFieldPristine;
23358
- }
23359
- if (isBlurEvent) {
23360
- const isPreviousFieldTouched = get(_formState.touchedFields, name);
23361
- if (!isPreviousFieldTouched) {
23362
- set(_formState.touchedFields, name, isBlurEvent);
23363
- output.touchedFields = _formState.touchedFields;
23364
- shouldUpdateField = shouldUpdateField || _proxyFormState.touchedFields && isPreviousFieldTouched !== isBlurEvent;
23365
- }
23366
- }
23367
- shouldUpdateField && shouldRender && _subjects.state.next(output);
23368
- return shouldUpdateField ? output : {};
23369
- };
23370
- const shouldRenderByError = (name, isValid, error2, fieldState) => {
23371
- const previousFieldError = get(_formState.errors, name);
23372
- const shouldUpdateValid = _proxyFormState.isValid && isBoolean(isValid) && _formState.isValid !== isValid;
23373
- if (props.delayError && error2) {
23374
- delayErrorCallback = debounce2(() => updateErrors(name, error2));
23375
- delayErrorCallback(props.delayError);
23376
- } else {
23377
- clearTimeout(timer);
23378
- delayErrorCallback = null;
23379
- error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
23380
- }
23381
- if ((error2 ? !deepEqual(previousFieldError, error2) : previousFieldError) || !isEmptyObject(fieldState) || shouldUpdateValid) {
23382
- const updatedFormState = {
23383
- ...fieldState,
23384
- ...shouldUpdateValid && isBoolean(isValid) ? { isValid } : {},
23385
- errors: _formState.errors,
23386
- name
23387
- };
23388
- _formState = {
23389
- ..._formState,
23390
- ...updatedFormState
23391
- };
23392
- _subjects.state.next(updatedFormState);
23393
- }
23394
- _updateIsValidating(false);
23395
- };
23396
- const _executeSchema = async (name) => _options.resolver(_formValues, _options.context, getResolverOptions(name || _names.mount, _fields, _options.criteriaMode, _options.shouldUseNativeValidation));
23397
- const executeSchemaAndUpdateState = async (names) => {
23398
- const { errors } = await _executeSchema();
23399
- if (names) {
23400
- for (const name of names) {
23401
- const error2 = get(errors, name);
23402
- error2 ? set(_formState.errors, name, error2) : unset(_formState.errors, name);
23403
- }
23404
- } else {
23405
- _formState.errors = errors;
23406
- }
23407
- return errors;
23408
- };
23409
- const executeBuiltInValidation = async (fields, shouldOnlyCheckValid, context = {
23410
- valid: true
23411
- }) => {
23412
- for (const name in fields) {
23413
- const field = fields[name];
23414
- if (field) {
23415
- const { _f, ...fieldValue } = field;
23416
- if (_f) {
23417
- const isFieldArrayRoot = _names.array.has(_f.name);
23418
- const fieldError = await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation && !shouldOnlyCheckValid, isFieldArrayRoot);
23419
- if (fieldError[_f.name]) {
23420
- context.valid = false;
23421
- if (shouldOnlyCheckValid) {
23422
- break;
23423
- }
23424
- }
23425
- !shouldOnlyCheckValid && (get(fieldError, _f.name) ? isFieldArrayRoot ? updateFieldArrayRootError(_formState.errors, fieldError, _f.name) : set(_formState.errors, _f.name, fieldError[_f.name]) : unset(_formState.errors, _f.name));
23426
- }
23427
- fieldValue && await executeBuiltInValidation(fieldValue, shouldOnlyCheckValid, context);
23428
- }
23429
- }
23430
- return context.valid;
23431
- };
23432
- const _removeUnmounted = () => {
23433
- for (const name of _names.unMount) {
23434
- const field = get(_fields, name);
23435
- field && (field._f.refs ? field._f.refs.every((ref) => !live(ref)) : !live(field._f.ref)) && unregister(name);
23436
- }
23437
- _names.unMount = /* @__PURE__ */ new Set();
23438
- };
23439
- const _getDirty = (name, data) => (name && data && set(_formValues, name, data), !deepEqual(getValues(), _defaultValues));
23440
- const _getWatch = (names, defaultValue, isGlobal) => generateWatchOutput(names, _names, {
23441
- ..._state.mount ? _formValues : isUndefined(defaultValue) ? _defaultValues : isString(names) ? { [names]: defaultValue } : defaultValue
23442
- }, isGlobal, defaultValue);
23443
- const _getFieldArray = (name) => compact(get(_state.mount ? _formValues : _defaultValues, name, props.shouldUnregister ? get(_defaultValues, name, []) : []));
23444
- const setFieldValue = (name, value, options = {}) => {
23445
- const field = get(_fields, name);
23446
- let fieldValue = value;
23447
- if (field) {
23448
- const fieldReference = field._f;
23449
- if (fieldReference) {
23450
- !fieldReference.disabled && set(_formValues, name, getFieldValueAs(value, fieldReference));
23451
- fieldValue = isHTMLElement2(fieldReference.ref) && isNullOrUndefined2(value) ? "" : value;
23452
- if (isMultipleSelect(fieldReference.ref)) {
23453
- [...fieldReference.ref.options].forEach((optionRef) => optionRef.selected = fieldValue.includes(optionRef.value));
23454
- } else if (fieldReference.refs) {
23455
- if (isCheckBoxInput(fieldReference.ref)) {
23456
- fieldReference.refs.length > 1 ? fieldReference.refs.forEach((checkboxRef) => (!checkboxRef.defaultChecked || !checkboxRef.disabled) && (checkboxRef.checked = Array.isArray(fieldValue) ? !!fieldValue.find((data) => data === checkboxRef.value) : fieldValue === checkboxRef.value)) : fieldReference.refs[0] && (fieldReference.refs[0].checked = !!fieldValue);
23457
- } else {
23458
- fieldReference.refs.forEach((radioRef) => radioRef.checked = radioRef.value === fieldValue);
23459
- }
23460
- } else if (isFileInput(fieldReference.ref)) {
23461
- fieldReference.ref.value = "";
23462
- } else {
23463
- fieldReference.ref.value = fieldValue;
23464
- if (!fieldReference.ref.type) {
23465
- _subjects.values.next({
23466
- name,
23467
- values: { ..._formValues }
23468
- });
23469
- }
23470
- }
23471
- }
23472
- }
23473
- (options.shouldDirty || options.shouldTouch) && updateTouchAndDirty(name, fieldValue, options.shouldTouch, options.shouldDirty, true);
23474
- options.shouldValidate && trigger(name);
23475
- };
23476
- const setValues = (name, value, options) => {
23477
- for (const fieldKey in value) {
23478
- const fieldValue = value[fieldKey];
23479
- const fieldName = `${name}.${fieldKey}`;
23480
- const field = get(_fields, fieldName);
23481
- (_names.array.has(name) || !isPrimitive(fieldValue) || field && !field._f) && !isDateObject(fieldValue) ? setValues(fieldName, fieldValue, options) : setFieldValue(fieldName, fieldValue, options);
23482
- }
23483
- };
23484
- const setValue = (name, value, options = {}) => {
23485
- const field = get(_fields, name);
23486
- const isFieldArray = _names.array.has(name);
23487
- const cloneValue = cloneObject(value);
23488
- set(_formValues, name, cloneValue);
23489
- if (isFieldArray) {
23490
- _subjects.array.next({
23491
- name,
23492
- values: { ..._formValues }
23493
- });
23494
- if ((_proxyFormState.isDirty || _proxyFormState.dirtyFields) && options.shouldDirty) {
23495
- _subjects.state.next({
23496
- name,
23497
- dirtyFields: getDirtyFields(_defaultValues, _formValues),
23498
- isDirty: _getDirty(name, cloneValue)
23499
- });
23500
- }
23501
- } else {
23502
- field && !field._f && !isNullOrUndefined2(cloneValue) ? setValues(name, cloneValue, options) : setFieldValue(name, cloneValue, options);
23503
- }
23504
- isWatched(name, _names) && _subjects.state.next({ ..._formState });
23505
- _subjects.values.next({
23506
- name,
23507
- values: { ..._formValues }
23508
- });
23509
- !_state.mount && flushRootRender();
23510
- };
23511
- const onChange = async (event) => {
23512
- const target = event.target;
23513
- let name = target.name;
23514
- let isFieldValueUpdated = true;
23515
- const field = get(_fields, name);
23516
- const getCurrentFieldValue = () => target.type ? getFieldValue(field._f) : getEventValue(event);
23517
- if (field) {
23518
- let error2;
23519
- let isValid;
23520
- const fieldValue = getCurrentFieldValue();
23521
- const isBlurEvent = event.type === EVENTS.BLUR || event.type === EVENTS.FOCUS_OUT;
23522
- const shouldSkipValidation = !hasValidation(field._f) && !_options.resolver && !get(_formState.errors, name) && !field._f.deps || skipValidation(isBlurEvent, get(_formState.touchedFields, name), _formState.isSubmitted, validationModeAfterSubmit, validationModeBeforeSubmit);
23523
- const watched = isWatched(name, _names, isBlurEvent);
23524
- set(_formValues, name, fieldValue);
23525
- if (isBlurEvent) {
23526
- field._f.onBlur && field._f.onBlur(event);
23527
- delayErrorCallback && delayErrorCallback(0);
23528
- } else if (field._f.onChange) {
23529
- field._f.onChange(event);
23530
- }
23531
- const fieldState = updateTouchAndDirty(name, fieldValue, isBlurEvent, false);
23532
- const shouldRender = !isEmptyObject(fieldState) || watched;
23533
- !isBlurEvent && _subjects.values.next({
23534
- name,
23535
- type: event.type,
23536
- values: { ..._formValues }
23537
- });
23538
- if (shouldSkipValidation) {
23539
- _proxyFormState.isValid && _updateValid();
23540
- return shouldRender && _subjects.state.next({ name, ...watched ? {} : fieldState });
23541
- }
23542
- !isBlurEvent && watched && _subjects.state.next({ ..._formState });
23543
- _updateIsValidating(true);
23544
- if (_options.resolver) {
23545
- const { errors } = await _executeSchema([name]);
23546
- const previousErrorLookupResult = schemaErrorLookup(_formState.errors, _fields, name);
23547
- const errorLookupResult = schemaErrorLookup(errors, _fields, previousErrorLookupResult.name || name);
23548
- error2 = errorLookupResult.error;
23549
- name = errorLookupResult.name;
23550
- isValid = isEmptyObject(errors);
23551
- } else {
23552
- error2 = (await validateField(field, _formValues, shouldDisplayAllAssociatedErrors, _options.shouldUseNativeValidation))[name];
23553
- isFieldValueUpdated = isNaN(fieldValue) || fieldValue === get(_formValues, name, fieldValue);
23554
- if (isFieldValueUpdated) {
23555
- if (error2) {
23556
- isValid = false;
23557
- } else if (_proxyFormState.isValid) {
23558
- isValid = await executeBuiltInValidation(_fields, true);
23559
- }
23560
- }
23561
- }
23562
- if (isFieldValueUpdated) {
23563
- field._f.deps && trigger(field._f.deps);
23564
- shouldRenderByError(name, isValid, error2, fieldState);
23565
- }
23566
- }
23567
- };
23568
- const trigger = async (name, options = {}) => {
23569
- let isValid;
23570
- let validationResult;
23571
- const fieldNames = convertToArrayPayload(name);
23572
- _updateIsValidating(true);
23573
- if (_options.resolver) {
23574
- const errors = await executeSchemaAndUpdateState(isUndefined(name) ? name : fieldNames);
23575
- isValid = isEmptyObject(errors);
23576
- validationResult = name ? !fieldNames.some((name2) => get(errors, name2)) : isValid;
23577
- } else if (name) {
23578
- validationResult = (await Promise.all(fieldNames.map(async (fieldName) => {
23579
- const field = get(_fields, fieldName);
23580
- return await executeBuiltInValidation(field && field._f ? { [fieldName]: field } : field);
23581
- }))).every(Boolean);
23582
- !(!validationResult && !_formState.isValid) && _updateValid();
23583
- } else {
23584
- validationResult = isValid = await executeBuiltInValidation(_fields);
23585
- }
23586
- _subjects.state.next({
23587
- ...!isString(name) || _proxyFormState.isValid && isValid !== _formState.isValid ? {} : { name },
23588
- ..._options.resolver || !name ? { isValid } : {},
23589
- errors: _formState.errors,
23590
- isValidating: false
23591
- });
23592
- options.shouldFocus && !validationResult && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), name ? fieldNames : _names.mount);
23593
- return validationResult;
23594
- };
23595
- const getValues = (fieldNames) => {
23596
- const values = {
23597
- ..._defaultValues,
23598
- ..._state.mount ? _formValues : {}
23599
- };
23600
- return isUndefined(fieldNames) ? values : isString(fieldNames) ? get(values, fieldNames) : fieldNames.map((name) => get(values, name));
23601
- };
23602
- const getFieldState = (name, formState) => ({
23603
- invalid: !!get((formState || _formState).errors, name),
23604
- isDirty: !!get((formState || _formState).dirtyFields, name),
23605
- isTouched: !!get((formState || _formState).touchedFields, name),
23606
- error: get((formState || _formState).errors, name)
23607
- });
23608
- const clearErrors = (name) => {
23609
- name && convertToArrayPayload(name).forEach((inputName) => unset(_formState.errors, inputName));
23610
- _subjects.state.next({
23611
- errors: name ? _formState.errors : {}
23612
- });
23613
- };
23614
- const setError = (name, error2, options) => {
23615
- const ref = (get(_fields, name, { _f: {} })._f || {}).ref;
23616
- set(_formState.errors, name, {
23617
- ...error2,
23618
- ref
23619
- });
23620
- _subjects.state.next({
23621
- name,
23622
- errors: _formState.errors,
23623
- isValid: false
23624
- });
23625
- options && options.shouldFocus && ref && ref.focus && ref.focus();
23626
- };
23627
- const watch = (name, defaultValue) => isFunction4(name) ? _subjects.values.subscribe({
23628
- next: (payload) => name(_getWatch(void 0, defaultValue), payload)
23629
- }) : _getWatch(name, defaultValue, true);
23630
- const unregister = (name, options = {}) => {
23631
- for (const fieldName of name ? convertToArrayPayload(name) : _names.mount) {
23632
- _names.mount.delete(fieldName);
23633
- _names.array.delete(fieldName);
23634
- if (!options.keepValue) {
23635
- unset(_fields, fieldName);
23636
- unset(_formValues, fieldName);
23637
- }
23638
- !options.keepError && unset(_formState.errors, fieldName);
23639
- !options.keepDirty && unset(_formState.dirtyFields, fieldName);
23640
- !options.keepTouched && unset(_formState.touchedFields, fieldName);
23641
- !_options.shouldUnregister && !options.keepDefaultValue && unset(_defaultValues, fieldName);
23642
- }
23643
- _subjects.values.next({
23644
- values: { ..._formValues }
23645
- });
23646
- _subjects.state.next({
23647
- ..._formState,
23648
- ...!options.keepDirty ? {} : { isDirty: _getDirty() }
23649
- });
23650
- !options.keepIsValid && _updateValid();
23651
- };
23652
- const register = (name, options = {}) => {
23653
- let field = get(_fields, name);
23654
- const disabledIsDefined = isBoolean(options.disabled);
23655
- set(_fields, name, {
23656
- ...field || {},
23657
- _f: {
23658
- ...field && field._f ? field._f : { ref: { name } },
23659
- name,
23660
- mount: true,
23661
- ...options
23662
- }
23663
- });
23664
- _names.mount.add(name);
23665
- field ? disabledIsDefined && set(_formValues, name, options.disabled ? void 0 : get(_formValues, name, getFieldValue(field._f))) : updateValidAndValue(name, true, options.value);
23666
- return {
23667
- ...disabledIsDefined ? { disabled: options.disabled } : {},
23668
- ..._options.shouldUseNativeValidation ? {
23669
- required: !!options.required,
23670
- min: getRuleValue(options.min),
23671
- max: getRuleValue(options.max),
23672
- minLength: getRuleValue(options.minLength),
23673
- maxLength: getRuleValue(options.maxLength),
23674
- pattern: getRuleValue(options.pattern)
23675
- } : {},
23676
- name,
23677
- onChange,
23678
- onBlur: onChange,
23679
- ref: (ref) => {
23680
- if (ref) {
23681
- register(name, options);
23682
- field = get(_fields, name);
23683
- const fieldRef = isUndefined(ref.value) ? ref.querySelectorAll ? ref.querySelectorAll("input,select,textarea")[0] || ref : ref : ref;
23684
- const radioOrCheckbox = isRadioOrCheckbox(fieldRef);
23685
- const refs = field._f.refs || [];
23686
- if (radioOrCheckbox ? refs.find((option) => option === fieldRef) : fieldRef === field._f.ref) {
23687
- return;
23688
- }
23689
- set(_fields, name, {
23690
- _f: {
23691
- ...field._f,
23692
- ...radioOrCheckbox ? {
23693
- refs: [
23694
- ...refs.filter(live),
23695
- fieldRef,
23696
- ...Array.isArray(get(_defaultValues, name)) ? [{}] : []
23697
- ],
23698
- ref: { type: fieldRef.type, name }
23699
- } : { ref: fieldRef }
23700
- }
23701
- });
23702
- updateValidAndValue(name, false, void 0, fieldRef);
23703
- } else {
23704
- field = get(_fields, name, {});
23705
- if (field._f) {
23706
- field._f.mount = false;
23707
- }
23708
- (_options.shouldUnregister || options.shouldUnregister) && !(isNameInFieldArray(_names.array, name) && _state.action) && _names.unMount.add(name);
23709
- }
23710
- }
23711
- };
23712
- };
23713
- const _focusError = () => _options.shouldFocusError && focusFieldBy(_fields, (key) => key && get(_formState.errors, key), _names.mount);
23714
- const handleSubmit = (onValid, onInvalid) => async (e2) => {
23715
- if (e2) {
23716
- e2.preventDefault && e2.preventDefault();
23717
- e2.persist && e2.persist();
23718
- }
23719
- let fieldValues = cloneObject(_formValues);
23720
- _subjects.state.next({
23721
- isSubmitting: true
23722
- });
23723
- if (_options.resolver) {
23724
- const { errors, values } = await _executeSchema();
23725
- _formState.errors = errors;
23726
- fieldValues = values;
23727
- } else {
23728
- await executeBuiltInValidation(_fields);
23729
- }
23730
- unset(_formState.errors, "root");
23731
- if (isEmptyObject(_formState.errors)) {
23732
- _subjects.state.next({
23733
- errors: {}
23734
- });
23735
- await onValid(fieldValues, e2);
23736
- } else {
23737
- if (onInvalid) {
23738
- await onInvalid({ ..._formState.errors }, e2);
23739
- }
23740
- _focusError();
23741
- setTimeout(_focusError);
23742
- }
23743
- _subjects.state.next({
23744
- isSubmitted: true,
23745
- isSubmitting: false,
23746
- isSubmitSuccessful: isEmptyObject(_formState.errors),
23747
- submitCount: _formState.submitCount + 1,
23748
- errors: _formState.errors
23749
- });
23750
- };
23751
- const resetField = (name, options = {}) => {
23752
- if (get(_fields, name)) {
23753
- if (isUndefined(options.defaultValue)) {
23754
- setValue(name, get(_defaultValues, name));
23755
- } else {
23756
- setValue(name, options.defaultValue);
23757
- set(_defaultValues, name, options.defaultValue);
23758
- }
23759
- if (!options.keepTouched) {
23760
- unset(_formState.touchedFields, name);
23761
- }
23762
- if (!options.keepDirty) {
23763
- unset(_formState.dirtyFields, name);
23764
- _formState.isDirty = options.defaultValue ? _getDirty(name, get(_defaultValues, name)) : _getDirty();
23765
- }
23766
- if (!options.keepError) {
23767
- unset(_formState.errors, name);
23768
- _proxyFormState.isValid && _updateValid();
23769
- }
23770
- _subjects.state.next({ ..._formState });
23771
- }
23772
- };
23773
- const _reset = (formValues, keepStateOptions = {}) => {
23774
- const updatedValues = formValues || _defaultValues;
23775
- const cloneUpdatedValues = cloneObject(updatedValues);
23776
- const values = formValues && !isEmptyObject(formValues) ? cloneUpdatedValues : _defaultValues;
23777
- if (!keepStateOptions.keepDefaultValues) {
23778
- _defaultValues = updatedValues;
23779
- }
23780
- if (!keepStateOptions.keepValues) {
23781
- if (keepStateOptions.keepDirtyValues || shouldCaptureDirtyFields) {
23782
- for (const fieldName of _names.mount) {
23783
- get(_formState.dirtyFields, fieldName) ? set(values, fieldName, get(_formValues, fieldName)) : setValue(fieldName, get(values, fieldName));
23784
- }
23785
- } else {
23786
- if (isWeb && isUndefined(formValues)) {
23787
- for (const name of _names.mount) {
23788
- const field = get(_fields, name);
23789
- if (field && field._f) {
23790
- const fieldReference = Array.isArray(field._f.refs) ? field._f.refs[0] : field._f.ref;
23791
- if (isHTMLElement2(fieldReference)) {
23792
- const form = fieldReference.closest("form");
23793
- if (form) {
23794
- form.reset();
23795
- break;
23796
- }
23797
- }
23798
- }
23799
- }
23800
- }
23801
- _fields = {};
23802
- }
23803
- _formValues = props.shouldUnregister ? keepStateOptions.keepDefaultValues ? cloneObject(_defaultValues) : {} : cloneUpdatedValues;
23804
- _subjects.array.next({
23805
- values: { ...values }
23806
- });
23807
- _subjects.values.next({
23808
- values: { ...values }
23809
- });
23810
- }
23811
- _names = {
23812
- mount: /* @__PURE__ */ new Set(),
23813
- unMount: /* @__PURE__ */ new Set(),
23814
- array: /* @__PURE__ */ new Set(),
23815
- watch: /* @__PURE__ */ new Set(),
23816
- watchAll: false,
23817
- focus: ""
23818
- };
23819
- !_state.mount && flushRootRender();
23820
- _state.mount = !_proxyFormState.isValid || !!keepStateOptions.keepIsValid;
23821
- _state.watch = !!props.shouldUnregister;
23822
- _subjects.state.next({
23823
- submitCount: keepStateOptions.keepSubmitCount ? _formState.submitCount : 0,
23824
- isDirty: keepStateOptions.keepDirty ? _formState.isDirty : !!(keepStateOptions.keepDefaultValues && !deepEqual(formValues, _defaultValues)),
23825
- isSubmitted: keepStateOptions.keepIsSubmitted ? _formState.isSubmitted : false,
23826
- dirtyFields: keepStateOptions.keepDirtyValues ? _formState.dirtyFields : keepStateOptions.keepDefaultValues && formValues ? getDirtyFields(_defaultValues, formValues) : {},
23827
- touchedFields: keepStateOptions.keepTouched ? _formState.touchedFields : {},
23828
- errors: keepStateOptions.keepErrors ? _formState.errors : {},
23829
- isSubmitting: false,
23830
- isSubmitSuccessful: false
23831
- });
23832
- };
23833
- const reset = (formValues, keepStateOptions) => _reset(isFunction4(formValues) ? formValues(_formValues) : formValues, keepStateOptions);
23834
- const setFocus2 = (name, options = {}) => {
23835
- const field = get(_fields, name);
23836
- const fieldReference = field && field._f;
23837
- if (fieldReference) {
23838
- const fieldRef = fieldReference.refs ? fieldReference.refs[0] : fieldReference.ref;
23839
- if (fieldRef.focus) {
23840
- fieldRef.focus();
23841
- options.shouldSelect && fieldRef.select();
23842
- }
23843
- }
23844
- };
23845
- const _updateFormState = (updatedFormState) => {
23846
- _formState = {
23847
- ..._formState,
23848
- ...updatedFormState
23849
- };
23850
- };
23851
- const _resetDefaultValues = () => isFunction4(_options.defaultValues) && _options.defaultValues().then((values) => {
23852
- reset(values, _options.resetOptions);
23853
- _subjects.state.next({
23854
- isLoading: false
23855
- });
23856
- });
23857
- return {
23858
- control: {
23859
- register,
23860
- unregister,
23861
- getFieldState,
23862
- _executeSchema,
23863
- _getWatch,
23864
- _getDirty,
23865
- _updateValid,
23866
- _removeUnmounted,
23867
- _updateFieldArray,
23868
- _getFieldArray,
23869
- _reset,
23870
- _resetDefaultValues,
23871
- _updateFormState,
23872
- _subjects,
23873
- _proxyFormState,
23874
- get _fields() {
23875
- return _fields;
23876
- },
23877
- get _formValues() {
23878
- return _formValues;
23879
- },
23880
- get _state() {
23881
- return _state;
23882
- },
23883
- set _state(value) {
23884
- _state = value;
23885
- },
23886
- get _defaultValues() {
23887
- return _defaultValues;
23888
- },
23889
- get _names() {
23890
- return _names;
23891
- },
23892
- set _names(value) {
23893
- _names = value;
23894
- },
23895
- get _formState() {
23896
- return _formState;
23897
- },
23898
- set _formState(value) {
23899
- _formState = value;
23900
- },
23901
- get _options() {
23902
- return _options;
23903
- },
23904
- set _options(value) {
23905
- _options = {
23906
- ..._options,
23907
- ...value
23908
- };
23909
- }
23910
- },
23911
- trigger,
23912
- register,
23913
- handleSubmit,
23914
- watch,
23915
- setValue,
23916
- getValues,
23917
- reset,
23918
- resetField,
23919
- clearErrors,
23920
- unregister,
23921
- setError,
23922
- setFocus: setFocus2,
23923
- getFieldState
23924
- };
23925
- }
23926
- function useForm(props = {}) {
23927
- const _formControl = import_react11.default.useRef();
23928
- const [formState, updateFormState] = import_react11.default.useState({
23929
- isDirty: false,
23930
- isValidating: false,
23931
- isLoading: isFunction4(props.defaultValues),
23932
- isSubmitted: false,
23933
- isSubmitting: false,
23934
- isSubmitSuccessful: false,
23935
- isValid: false,
23936
- submitCount: 0,
23937
- dirtyFields: {},
23938
- touchedFields: {},
23939
- errors: {},
23940
- defaultValues: isFunction4(props.defaultValues) ? void 0 : props.defaultValues
23941
- });
23942
- if (!_formControl.current) {
23943
- _formControl.current = {
23944
- ...createFormControl(props, () => updateFormState((formState2) => ({ ...formState2 }))),
23945
- formState
23946
- };
23947
- }
23948
- const control = _formControl.current.control;
23949
- control._options = props;
23950
- useSubscribe({
23951
- subject: control._subjects.state,
23952
- next: (value) => {
23953
- if (shouldRenderFormState(value, control._proxyFormState, control._updateFormState, true)) {
23954
- updateFormState({ ...control._formState });
23955
- }
23956
- }
23957
- });
23958
- import_react11.default.useEffect(() => {
23959
- if (props.values && !deepEqual(props.values, control._defaultValues)) {
23960
- control._reset(props.values, control._options.resetOptions);
23961
- } else {
23962
- control._resetDefaultValues();
23963
- }
23964
- }, [props.values, control]);
23965
- import_react11.default.useEffect(() => {
23966
- if (!control._state.mount) {
23967
- control._updateValid();
23968
- control._state.mount = true;
23969
- }
23970
- if (control._state.watch) {
23971
- control._state.watch = false;
23972
- control._subjects.state.next({ ...control._formState });
23973
- }
23974
- control._removeUnmounted();
23975
- });
23976
- _formControl.current.formState = getProxyFormState(formState, control);
23977
- return _formControl.current;
23978
- }
23979
-
23980
- // src/component/edit-form/index.tsx
22500
+ var import_react15 = require("react");
22501
+ var import_react_hook_form4 = require("react-hook-form");
23981
22502
  var import_yup = require("@hookform/resolvers/yup");
23982
22503
  var import_classnames7 = __toESM(require_classnames2());
23983
22504
 
23984
22505
  // src/component/input-text/index.tsx
22506
+ var import_react_hook_form = require("react-hook-form");
23985
22507
  var import_classnames3 = __toESM(require_classnames2());
23986
- var import_react12 = require("react");
22508
+ var import_react11 = require("react");
23987
22509
  var import_jsx_runtime3 = require("react/jsx-runtime");
23988
22510
  var TextInput = (props) => {
23989
22511
  const { t: t2 } = useTranslation();
23990
22512
  const { control, id, name, min: min2, max: max2, type, label, labelSize, required, errors, height, disabled, row, isLabel, placeholder, autoFocus, inLine, callback, readOnly, classes, ...rest } = props;
23991
22513
  const renderLabel = () => {
23992
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react12.Fragment, { children: isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label$1, { for: name, children: [
22514
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react11.Fragment, { children: isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(Label$1, { for: name, children: [
23993
22515
  t2(label ? label : ""),
23994
22516
  " ",
23995
22517
  required ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: "text-danger", children: "*" }) : "",
@@ -23997,9 +22519,9 @@ var TextInput = (props) => {
23997
22519
  ] }) });
23998
22520
  };
23999
22521
  const renderInput2 = () => {
24000
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react12.Fragment, { children: [
22522
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react11.Fragment, { children: [
24001
22523
  /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
24002
- Controller,
22524
+ import_react_hook_form.Controller,
24003
22525
  {
24004
22526
  name,
24005
22527
  control,
@@ -24048,7 +22570,7 @@ var TextInput = (props) => {
24048
22570
  errors && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(FormFeedback$1, { children: errors?.message })
24049
22571
  ] });
24050
22572
  };
24051
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
22573
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react11.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
24052
22574
  "div",
24053
22575
  {
24054
22576
  className: (0, import_classnames3.default)(
@@ -24070,8 +22592,9 @@ var TextInput = (props) => {
24070
22592
  var input_text_default = TextInput;
24071
22593
 
24072
22594
  // src/component/input-number/index.tsx
22595
+ var import_react_hook_form2 = require("react-hook-form");
24073
22596
  var import_classnames4 = __toESM(require_classnames2());
24074
- var import_react13 = require("react");
22597
+ var import_react12 = require("react");
24075
22598
  var import_jsx_runtime4 = require("react/jsx-runtime");
24076
22599
  var NumberInput = (props) => {
24077
22600
  const { t: t2 } = useTranslation();
@@ -24102,7 +22625,7 @@ var NumberInput = (props) => {
24102
22625
  ...rest
24103
22626
  } = props;
24104
22627
  const renderLabel = () => {
24105
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react13.Fragment, { children: isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Label$1, { className: "form-label", for: name, children: [
22628
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react12.Fragment, { children: isLabel === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(Label$1, { className: "form-label", for: name, children: [
24106
22629
  t2(label ? label : ""),
24107
22630
  " ",
24108
22631
  required ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-danger", children: "*" }) : "",
@@ -24110,9 +22633,9 @@ var NumberInput = (props) => {
24110
22633
  ] }) });
24111
22634
  };
24112
22635
  const renderInput2 = () => {
24113
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react13.Fragment, { children: [
22636
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react12.Fragment, { children: [
24114
22637
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
24115
- Controller,
22638
+ import_react_hook_form2.Controller,
24116
22639
  {
24117
22640
  name,
24118
22641
  control,
@@ -24179,7 +22702,7 @@ var NumberInput = (props) => {
24179
22702
  errors && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormFeedback$1, { children: errors?.message })
24180
22703
  ] });
24181
22704
  };
24182
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react13.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
22705
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react12.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
24183
22706
  "div",
24184
22707
  {
24185
22708
  className: (0, import_classnames4.default)(
@@ -24201,15 +22724,16 @@ var NumberInput = (props) => {
24201
22724
  var input_number_default = NumberInput;
24202
22725
 
24203
22726
  // src/component/edit-form/select-table/index.tsx
22727
+ var import_react_hook_form3 = require("react-hook-form");
24204
22728
  var import_classnames6 = __toESM(require_classnames2());
24205
- var import_react15 = require("react");
22729
+ var import_react14 = require("react");
24206
22730
 
24207
22731
  // src/component/select-table/index.tsx
24208
- var import_react14 = __toESM(require("react"));
22732
+ var import_react13 = __toESM(require("react"));
24209
22733
  var import_classnames5 = __toESM(require_classnames2());
24210
22734
  var import_jsx_runtime5 = require("react/jsx-runtime");
24211
22735
  var defaultMaxHeight = 250;
24212
- var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
22736
+ var SelectTable = (0, import_react13.forwardRef)((props, ref) => {
24213
22737
  const {
24214
22738
  id,
24215
22739
  menuWidth,
@@ -24240,17 +22764,17 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24240
22764
  onOpenMenu,
24241
22765
  onPaste
24242
22766
  } = props;
24243
- const selectTableRef = (0, import_react14.useRef)();
24244
- const selectMenuTableRef = (0, import_react14.useRef)();
24245
- const inputRef = (0, import_react14.useRef)();
24246
- const [dropdownOpen, setDropdownOpen] = (0, import_react14.useState)(false);
24247
- const [indexFocus, setIndexFocus] = (0, import_react14.useState)(-1);
24248
- const [isFocus, setIsFocus] = (0, import_react14.useState)(false);
24249
- const [isLoading2, setIsLoading] = (0, import_react14.useState)(false);
24250
- const [searchTerm, setSearchTerm] = (0, import_react14.useState)("");
24251
- const [optionsLoad, setOptionsLoad] = (0, import_react14.useState)();
22767
+ const selectTableRef = (0, import_react13.useRef)();
22768
+ const selectMenuTableRef = (0, import_react13.useRef)();
22769
+ const inputRef = (0, import_react13.useRef)();
22770
+ const [dropdownOpen, setDropdownOpen] = (0, import_react13.useState)(false);
22771
+ const [indexFocus, setIndexFocus] = (0, import_react13.useState)(-1);
22772
+ const [isFocus, setIsFocus] = (0, import_react13.useState)(false);
22773
+ const [isLoading2, setIsLoading] = (0, import_react13.useState)(false);
22774
+ const [searchTerm, setSearchTerm] = (0, import_react13.useState)("");
22775
+ const [optionsLoad, setOptionsLoad] = (0, import_react13.useState)();
24252
22776
  const { t: t2 } = useTranslation();
24253
- const isSelectedAll = (0, import_react14.useMemo)(() => {
22777
+ const isSelectedAll = (0, import_react13.useMemo)(() => {
24254
22778
  return isMulti === true && (optionsLoad ? optionsLoad : options).length > 0 && value?.length >= (optionsLoad ? optionsLoad : options).length;
24255
22779
  }, [optionsLoad, options, value]);
24256
22780
  const defaultColumns = [
@@ -24269,7 +22793,7 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24269
22793
  }
24270
22794
  onChange(val);
24271
22795
  };
24272
- (0, import_react14.useEffect)(() => {
22796
+ (0, import_react13.useEffect)(() => {
24273
22797
  if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
24274
22798
  const index = (optionsLoad ? optionsLoad : options)?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]);
24275
22799
  if (index >= 0) {
@@ -24277,7 +22801,7 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24277
22801
  }
24278
22802
  }
24279
22803
  }, [dropdownOpen]);
24280
- (0, import_react14.useEffect)(() => {
22804
+ (0, import_react13.useEffect)(() => {
24281
22805
  if (inputRef && !isDisabled) {
24282
22806
  inputRef.current.addEventListener("blur", function() {
24283
22807
  setDropdownOpen(false);
@@ -24291,13 +22815,13 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24291
22815
  });
24292
22816
  }
24293
22817
  }, [inputRef]);
24294
- (0, import_react14.useEffect)(() => {
22818
+ (0, import_react13.useEffect)(() => {
24295
22819
  if (searchTerm && !dropdownOpen) {
24296
22820
  setDropdownOpen(true);
24297
22821
  setIndexFocus(0);
24298
22822
  }
24299
22823
  }, [searchTerm]);
24300
- (0, import_react14.useEffect)(() => {
22824
+ (0, import_react13.useEffect)(() => {
24301
22825
  if (dropdownOpen && onOpenMenu) {
24302
22826
  onOpenMenu();
24303
22827
  }
@@ -24421,7 +22945,7 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24421
22945
  };
24422
22946
  const renderHeaderCol = (col, indexCol) => {
24423
22947
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
24424
- import_react14.Fragment,
22948
+ import_react13.Fragment,
24425
22949
  {
24426
22950
  children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
24427
22951
  "th",
@@ -24471,12 +22995,12 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24471
22995
  setIsLoading(false);
24472
22996
  setOptionsLoad(rs);
24473
22997
  };
24474
- (0, import_react14.useEffect)(() => {
22998
+ (0, import_react13.useEffect)(() => {
24475
22999
  if (optionsLoad?.length === 0 && allowCreate && !isMulti) {
24476
23000
  setOptionsLoad([{ label: `Create "${searchTerm}"`, value: searchTerm, isCreated: true }]);
24477
23001
  }
24478
23002
  }, [optionsLoad]);
24479
- (0, import_react14.useEffect)(() => {
23003
+ (0, import_react13.useEffect)(() => {
24480
23004
  if (!searchTerm) {
24481
23005
  setOptionsLoad(void 0);
24482
23006
  }
@@ -24485,7 +23009,7 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24485
23009
  const element = document.getElementById(`select-${id}-${indexRow}-${indexCol}`);
24486
23010
  return element && element.scrollWidth > element.clientWidth;
24487
23011
  };
24488
- const RenderElement = import_react14.default.memo((props2) => {
23012
+ const RenderElement = import_react13.default.memo((props2) => {
24489
23013
  const { indexRow, row, isSelected: isSelected2, level = 0 } = props2;
24490
23014
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
24491
23015
  "tr",
@@ -24538,7 +23062,7 @@ var SelectTable = (0, import_react14.forwardRef)((props, ref) => {
24538
23062
  } else if (col.type === "datetime") {
24539
23063
  valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
24540
23064
  }
24541
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react14.Fragment, { children: [
23065
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react13.Fragment, { children: [
24542
23066
  col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
24543
23067
  "td",
24544
23068
  {
@@ -24800,7 +23324,7 @@ var SelectTableBox = (props) => {
24800
23324
  fieldValue,
24801
23325
  fieldLabel,
24802
23326
  labelComponent,
24803
- defaultOptions: defaultOptions3,
23327
+ defaultOptions: defaultOptions2,
24804
23328
  loadOptions,
24805
23329
  control,
24806
23330
  placeholder,
@@ -24829,7 +23353,7 @@ var SelectTableBox = (props) => {
24829
23353
  const renderLabel = (props2) => {
24830
23354
  const { t: t2 } = useTranslation();
24831
23355
  const { isLabel: isLabel2, desciptionLabel: desciptionLabel2, id: id2, classLabel: classLabel2, name: name2, label: label2, required: required2 } = props2;
24832
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react15.Fragment, { children: [
23356
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_react14.Fragment, { children: [
24833
23357
  isLabel2 === false ? "" : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Label$1, { id: `label-${id2}`, className: classLabel2, for: name2, children: [
24834
23358
  t2(label2 ? label2 : ""),
24835
23359
  " ",
@@ -24838,7 +23362,7 @@ var SelectTableBox = (props) => {
24838
23362
  (!isNullOrUndefined(desciptionLabel2) && desciptionLabel2 !== "") ?? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_jsx_runtime6.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(UncontrolledTooltip, { target: `label-${id2}`, children: t2(desciptionLabel2 ?? "") }) })
24839
23363
  ] });
24840
23364
  };
24841
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react15.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
23365
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react14.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
24842
23366
  "div",
24843
23367
  {
24844
23368
  className: (0, import_classnames6.default)(
@@ -24853,7 +23377,7 @@ var SelectTableBox = (props) => {
24853
23377
  renderLabel({ isLabel, desciptionLabel, classLabel, name, label, required, id: id ?? "" }),
24854
23378
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: (0, import_classnames6.default)("form-input-content", { "hidden-label": isLabel === false }), children: [
24855
23379
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
24856
- Controller,
23380
+ import_react_hook_form3.Controller,
24857
23381
  {
24858
23382
  name,
24859
23383
  control,
@@ -24863,7 +23387,7 @@ var SelectTableBox = (props) => {
24863
23387
  {
24864
23388
  ...rest,
24865
23389
  id,
24866
- value: (isMulti ? value?.length > 0 : value) ? !isMulti ? defaultOptions3.find((val) => val[fieldValue ?? "value"] === value) ?? (defaultValue ?? "") : value : isMulti ? [] : void 0,
23390
+ value: (isMulti ? value?.length > 0 : value) ? !isMulti ? defaultOptions2.find((val) => val[fieldValue ?? "value"] === value) ?? (defaultValue ?? "") : value : isMulti ? [] : void 0,
24867
23391
  onChange: (val) => {
24868
23392
  if (isMulti || (fieldValue && val ? val[fieldValue] : val?.value) !== value) {
24869
23393
  if (confirmHandle) {
@@ -24886,7 +23410,7 @@ var SelectTableBox = (props) => {
24886
23410
  placeholder,
24887
23411
  invalid: errors,
24888
23412
  loadOptions,
24889
- options: defaultOptions3,
23413
+ options: defaultOptions2,
24890
23414
  isDisabled: disabled,
24891
23415
  columns,
24892
23416
  fieldValue,
@@ -24908,7 +23432,7 @@ var select_table_default = SelectTableBox;
24908
23432
  // src/component/edit-form/index.tsx
24909
23433
  var import_jsx_runtime7 = require("react/jsx-runtime");
24910
23434
  var defaultWidth = 200;
24911
- var EditForm = (0, import_react16.forwardRef)((props, ref) => {
23435
+ var EditForm = (0, import_react15.forwardRef)((props, ref) => {
24912
23436
  const {
24913
23437
  id,
24914
23438
  field,
@@ -24934,11 +23458,11 @@ var EditForm = (0, import_react16.forwardRef)((props, ref) => {
24934
23458
  labelSize = "label-small"
24935
23459
  } = props;
24936
23460
  const { innerWidth } = window;
24937
- const inputRef = (0, import_react16.useRef)();
24938
- const editFormRef = (0, import_react16.useRef)();
24939
- const buttonRef = (0, import_react16.useRef)();
24940
- const [dropdownOpen, setDropdownOpen] = (0, import_react16.useState)(false);
24941
- const [itemsField, setItemsField] = (0, import_react16.useState)([]);
23461
+ const inputRef = (0, import_react15.useRef)();
23462
+ const editFormRef = (0, import_react15.useRef)();
23463
+ const buttonRef = (0, import_react15.useRef)();
23464
+ const [dropdownOpen, setDropdownOpen] = (0, import_react15.useState)(false);
23465
+ const [itemsField, setItemsField] = (0, import_react15.useState)([]);
24942
23466
  const { t: t2 } = useTranslation();
24943
23467
  useOnClickOutside(editFormRef, () => {
24944
23468
  closeMenu();
@@ -24955,12 +23479,12 @@ var EditForm = (0, import_react16.forwardRef)((props, ref) => {
24955
23479
  reset,
24956
23480
  setValue,
24957
23481
  formState: { errors }
24958
- } = useForm({
23482
+ } = (0, import_react_hook_form4.useForm)({
24959
23483
  mode: "onChange",
24960
23484
  defaultValues,
24961
23485
  resolver: (0, import_yup.yupResolver)(schema)
24962
23486
  });
24963
- (0, import_react16.useEffect)(() => {
23487
+ (0, import_react15.useEffect)(() => {
24964
23488
  if (dropdownOpen) {
24965
23489
  if (onFormOpen && itemsField.length === 0) {
24966
23490
  onFormOpen(rowData, itemsField, setItemsField);
@@ -24972,7 +23496,7 @@ var EditForm = (0, import_react16.forwardRef)((props, ref) => {
24972
23496
  }
24973
23497
  }
24974
23498
  }, [dropdownOpen]);
24975
- (0, import_react16.useEffect)(() => {
23499
+ (0, import_react15.useEffect)(() => {
24976
23500
  if (dropdownOpen && itemsField.length > 0) {
24977
23501
  itemsField.forEach((ele) => {
24978
23502
  setValue(ele.name, rowData[ele.name] ?? "");
@@ -25242,7 +23766,7 @@ var EditForm = (0, import_react16.forwardRef)((props, ref) => {
25242
23766
  var edit_form_default = EditForm;
25243
23767
 
25244
23768
  // src/component/sidebar-setting-column/index.tsx
25245
- var import_react18 = require("react");
23769
+ var import_react17 = require("react");
25246
23770
 
25247
23771
  // src/component/modal-header/index.tsx
25248
23772
  var import_classnames8 = __toESM(require_classnames2());
@@ -25288,7 +23812,7 @@ var modal_header_default = ModalHeader2;
25288
23812
 
25289
23813
  // src/component/sidebar/index.tsx
25290
23814
  var import_classnames9 = __toESM(require_classnames2());
25291
- var import_react17 = require("react");
23815
+ var import_react16 = require("react");
25292
23816
  var import_jsx_runtime9 = require("react/jsx-runtime");
25293
23817
  var Sidebar = (props) => {
25294
23818
  const {
@@ -25300,9 +23824,9 @@ var Sidebar = (props) => {
25300
23824
  hiddenBackground,
25301
23825
  hiddenFullScreenButton
25302
23826
  } = props;
25303
- const [isFullScreen, setIsFullScreen] = (0, import_react17.useState)(false);
25304
- const [flag, setFlag] = (0, import_react17.useState)(open);
25305
- (0, import_react17.useEffect)(() => {
23827
+ const [isFullScreen, setIsFullScreen] = (0, import_react16.useState)(false);
23828
+ const [flag, setFlag] = (0, import_react16.useState)(open);
23829
+ (0, import_react16.useEffect)(() => {
25306
23830
  if (open !== flag) {
25307
23831
  if (open) {
25308
23832
  setFlag(open);
@@ -25395,9 +23919,9 @@ var import_jsx_runtime10 = require("react/jsx-runtime");
25395
23919
  var SidebarSetColumn = (props) => {
25396
23920
  const { column, setColumn, openSidebar, handleSidebar } = props;
25397
23921
  const { t: t2 } = useTranslation();
25398
- const [dataSource, setDataSource] = (0, import_react18.useState)([]);
25399
- const [indexFocus, setIndexFocus] = (0, import_react18.useState)();
25400
- (0, import_react18.useEffect)(() => {
23922
+ const [dataSource, setDataSource] = (0, import_react17.useState)([]);
23923
+ const [indexFocus, setIndexFocus] = (0, import_react17.useState)();
23924
+ (0, import_react17.useEffect)(() => {
25401
23925
  if (openSidebar) {
25402
23926
  setDataSource(column.map((e2) => ({ ...e2 })));
25403
23927
  }
@@ -25414,8 +23938,8 @@ var SidebarSetColumn = (props) => {
25414
23938
  const { innerWidth, innerHeight } = window;
25415
23939
  return { innerWidth, innerHeight };
25416
23940
  };
25417
- const [windowSize, setWindowSize] = (0, import_react18.useState)(getWindowSize());
25418
- (0, import_react18.useEffect)(() => {
23941
+ const [windowSize, setWindowSize] = (0, import_react17.useState)(getWindowSize());
23942
+ (0, import_react17.useEffect)(() => {
25419
23943
  const handleWindowResize = () => {
25420
23944
  setWindowSize(getWindowSize());
25421
23945
  };
@@ -25425,7 +23949,7 @@ var SidebarSetColumn = (props) => {
25425
23949
  };
25426
23950
  }, []);
25427
23951
  const renderFooterButtons = () => {
25428
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react18.Fragment, { children: [
23952
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_react17.Fragment, { children: [
25429
23953
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button$1, { color: "primary", onClick: handleSubmit, className: "me-1", children: t2("Confirm") }),
25430
23954
  /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(Button$1, { color: "secondary", onClick: handleCancel, outline: true, children: t2("Close") })
25431
23955
  ] });
@@ -25517,7 +24041,7 @@ var SidebarSetColumn = (props) => {
25517
24041
  ];
25518
24042
  const renderHeaderCol = (col, indexCol) => {
25519
24043
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
25520
- import_react18.Fragment,
24044
+ import_react17.Fragment,
25521
24045
  {
25522
24046
  children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
25523
24047
  "th",
@@ -25573,7 +24097,7 @@ var SidebarSetColumn = (props) => {
25573
24097
  if (col.editType === "numeric" || col.editTypeCondition && col.editTypeCondition(row) === "numeric") {
25574
24098
  value = formartNumberic(row[col.field], ",", ".", col.numericSettings?.fraction, true) ?? 0;
25575
24099
  }
25576
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react18.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
24100
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react17.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
25577
24101
  "td",
25578
24102
  {
25579
24103
  className: (0, import_classnames10.default)(
@@ -25643,16 +24167,16 @@ var sidebar_setting_column_default = SidebarSetColumn;
25643
24167
 
25644
24168
  // src/component/table/paging/index.tsx
25645
24169
  var import_classnames11 = __toESM(require_classnames2());
25646
- var import_react19 = require("react");
24170
+ var import_react18 = require("react");
25647
24171
  var import_jsx_runtime11 = require("react/jsx-runtime");
25648
24172
  var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOptions, onChangePageSize }) => {
25649
24173
  const { t: t2 } = useTranslation();
25650
- const [countPage, setCountPage] = (0, import_react19.useState)(0);
25651
- const [currentPageNumber, setCurrentPageNumber] = (0, import_react19.useState)(1);
25652
- (0, import_react19.useEffect)(() => {
24174
+ const [countPage, setCountPage] = (0, import_react18.useState)(0);
24175
+ const [currentPageNumber, setCurrentPageNumber] = (0, import_react18.useState)(1);
24176
+ (0, import_react18.useEffect)(() => {
25653
24177
  setCountPage(Math.floor(totalItem / pageSize) + (Math.floor(totalItem / pageSize) === totalItem / pageSize ? 0 : 1));
25654
24178
  }, [totalItem, pageSize]);
25655
- (0, import_react19.useEffect)(() => {
24179
+ (0, import_react18.useEffect)(() => {
25656
24180
  setCurrentPageNumber(Math.floor(currentPage / 5) + (Math.floor(currentPage / 5) === currentPage / 5 ? 0 : 1));
25657
24181
  }, [currentPage]);
25658
24182
  const renderPageNumber = (number) => {
@@ -25674,7 +24198,7 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
25674
24198
  }
25675
24199
  return arr;
25676
24200
  };
25677
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react19.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "r-pager", children: [
24201
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "r-pager", children: [
25678
24202
  /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "r-pagercontainer", children: [
25679
24203
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SvgChevronsLeft, { fontSize: 16 }) }),
25680
24204
  /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("button", { className: "r-button", type: "button", disabled: countPage <= 1 || currentPage === 1, onClick: () => onChangePage({ totalItem, pageSize, currentPage: currentPage - 1, old: currentPage }), children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SvgChevronLeft, { fontSize: 16 }) }),
@@ -25726,7 +24250,7 @@ var PagingComponent = ({ totalItem, pageSize, currentPage, onChangePage, pageOpt
25726
24250
  };
25727
24251
 
25728
24252
  // src/component/table/header.tsx
25729
- var import_react20 = require("react");
24253
+ var import_react19 = require("react");
25730
24254
  var import_classnames12 = __toESM(require_classnames2());
25731
24255
  var import_react_resizable = __toESM(require_react_resizable());
25732
24256
  var import_jsx_runtime12 = require("react/jsx-runtime");
@@ -25753,7 +24277,7 @@ var HeaderTableCol = (props) => {
25753
24277
  setColumn(newColumns);
25754
24278
  }
25755
24279
  };
25756
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react20.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
24280
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react19.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
25757
24281
  import_react_resizable.Resizable,
25758
24282
  {
25759
24283
  className: "r-resize",
@@ -25813,11 +24337,11 @@ var HeaderTableCol = (props) => {
25813
24337
  var header_default = HeaderTableCol;
25814
24338
 
25815
24339
  // src/component/table/command.tsx
25816
- var import_react22 = require("react");
24340
+ var import_react21 = require("react");
25817
24341
  var import_classnames13 = __toESM(require_classnames2());
25818
24342
 
25819
24343
  // src/component/icon/index.tsx
25820
- var import_react21 = require("react");
24344
+ var import_react20 = require("react");
25821
24345
  var import_jsx_runtime13 = require("react/jsx-runtime");
25822
24346
  var IconCustom = (props) => {
25823
24347
  const { iconName, size } = props;
@@ -25825,7 +24349,7 @@ var IconCustom = (props) => {
25825
24349
  return null;
25826
24350
  } else {
25827
24351
  const TagIcon = iconName === "" ? "" : index_esm_exports[iconName];
25828
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react21.Fragment, { children: iconName === "" ? "" : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TagIcon, { fontSize: size }) });
24352
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react20.Fragment, { children: iconName === "" ? "" : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TagIcon, { fontSize: size }) });
25829
24353
  }
25830
24354
  };
25831
24355
  var icon_default = IconCustom;
@@ -25835,7 +24359,7 @@ var import_jsx_runtime14 = require("react/jsx-runtime");
25835
24359
  var CommandElement = (props) => {
25836
24360
  const { commandItems, rowData, indexRow, handleCommandClick, indexFocus, setIndexFocus } = props;
25837
24361
  const { t: t2 } = useTranslation();
25838
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react22.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
24362
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_react21.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "d-flex align-items-center", style: { columnGap: 10 }, children: commandItems.map((item, index) => {
25839
24363
  return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
25840
24364
  Button$1,
25841
24365
  {
@@ -25865,11 +24389,11 @@ var CommandElement = (props) => {
25865
24389
  var command_default = CommandElement;
25866
24390
 
25867
24391
  // src/component/select-table-tree/index.tsx
25868
- var import_react23 = __toESM(require("react"));
24392
+ var import_react22 = __toESM(require("react"));
25869
24393
  var import_classnames14 = __toESM(require_classnames2());
25870
24394
  var import_jsx_runtime15 = require("react/jsx-runtime");
25871
24395
  var defaultMaxHeight2 = 250;
25872
- var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
24396
+ var SelectTableTree = (0, import_react22.forwardRef)((props, ref) => {
25873
24397
  const {
25874
24398
  id,
25875
24399
  menuWidth,
@@ -25900,12 +24424,12 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
25900
24424
  onOpenMenu,
25901
24425
  onPaste
25902
24426
  } = props;
25903
- const selectTableRef = (0, import_react23.useRef)();
25904
- const selectMenuTableRef = (0, import_react23.useRef)();
25905
- const inputRef = (0, import_react23.useRef)();
25906
- const [dropdownOpen, setDropdownOpen] = (0, import_react23.useState)(false);
25907
- const [isFocus, setIsFocus] = (0, import_react23.useState)(false);
25908
- const [searchTerm, setSearchTerm] = (0, import_react23.useState)("");
24427
+ const selectTableRef = (0, import_react22.useRef)();
24428
+ const selectMenuTableRef = (0, import_react22.useRef)();
24429
+ const inputRef = (0, import_react22.useRef)();
24430
+ const [dropdownOpen, setDropdownOpen] = (0, import_react22.useState)(false);
24431
+ const [isFocus, setIsFocus] = (0, import_react22.useState)(false);
24432
+ const [searchTerm, setSearchTerm] = (0, import_react22.useState)("");
25909
24433
  const { t: t2 } = useTranslation();
25910
24434
  const areAllItemsSelected = (value2, options2, fieldValue2) => {
25911
24435
  const checkAllSelected = (nodes) => {
@@ -25917,10 +24441,10 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
25917
24441
  };
25918
24442
  return checkAllSelected(options2);
25919
24443
  };
25920
- const isSelectedAll = (0, import_react23.useMemo)(() => {
24444
+ const isSelectedAll = (0, import_react22.useMemo)(() => {
25921
24445
  return isMulti === true && options.length > 0 && areAllItemsSelected(value, options, fieldValue ?? "value");
25922
24446
  }, [options, value]);
25923
- (0, import_react23.useEffect)(() => {
24447
+ (0, import_react22.useEffect)(() => {
25924
24448
  if (dropdownOpen && onOpenMenu) {
25925
24449
  onOpenMenu();
25926
24450
  }
@@ -25935,7 +24459,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
25935
24459
  const closeMenu = () => {
25936
24460
  setDropdownOpen(false);
25937
24461
  };
25938
- (0, import_react23.useEffect)(() => {
24462
+ (0, import_react22.useEffect)(() => {
25939
24463
  if (dropdownOpen && value && !isMulti && selectMenuTableRef) {
25940
24464
  const index = options?.findIndex((e2) => e2[fieldValue ?? "value"] === value[fieldValue ?? "value"]);
25941
24465
  if (index >= 0) {
@@ -25943,7 +24467,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
25943
24467
  }
25944
24468
  }
25945
24469
  }, [dropdownOpen]);
25946
- (0, import_react23.useEffect)(() => {
24470
+ (0, import_react22.useEffect)(() => {
25947
24471
  if (inputRef && !isDisabled) {
25948
24472
  inputRef.current.addEventListener("blur", function() {
25949
24473
  setDropdownOpen(false);
@@ -25957,7 +24481,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
25957
24481
  });
25958
24482
  }
25959
24483
  }, [inputRef]);
25960
- (0, import_react23.useEffect)(() => {
24484
+ (0, import_react22.useEffect)(() => {
25961
24485
  if (searchTerm && !dropdownOpen) {
25962
24486
  setDropdownOpen(true);
25963
24487
  }
@@ -26002,7 +24526,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
26002
24526
  }
26003
24527
  };
26004
24528
  const renderHeaderCol = (col, indexCol) => {
26005
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react23.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
24529
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react22.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
26006
24530
  "th",
26007
24531
  {
26008
24532
  className: (0, import_classnames14.default)(`r-select-headercell fix-${col.fixedType}`, { "cell-fixed": col.fixedType }),
@@ -26062,9 +24586,9 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
26062
24586
  traverse(tree);
26063
24587
  return selects;
26064
24588
  };
26065
- const RenderElement = import_react23.default.memo((props2) => {
24589
+ const RenderElement = import_react22.default.memo((props2) => {
26066
24590
  const { indexRow, row, isSelected: isSelected2, level = 0 } = props2;
26067
- const [expanded, setExpanded] = (0, import_react23.useState)(row.expanded);
24591
+ const [expanded, setExpanded] = (0, import_react22.useState)(row.expanded);
26068
24592
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
26069
24593
  /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
26070
24594
  "tr",
@@ -26150,7 +24674,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
26150
24674
  } else if (col.type === "datetime") {
26151
24675
  valueDisplay = valueDisplay ? formatDateTime(valueDisplay, formatSetting?.dateFormat ?? "DD/MM/yyyy HH:mm") : "";
26152
24676
  }
26153
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react23.Fragment, { children: [
24677
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_react22.Fragment, { children: [
26154
24678
  col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
26155
24679
  "td",
26156
24680
  {
@@ -26433,7 +24957,7 @@ var SelectTableTree = (0, import_react23.forwardRef)((props, ref) => {
26433
24957
  });
26434
24958
 
26435
24959
  // node_modules/react-number-format/dist/react-number-format.es.js
26436
- var import_react24 = __toESM(require("react"));
24960
+ var import_react23 = __toESM(require("react"));
26437
24961
  function __rest2(s2, e2) {
26438
24962
  var t2 = {};
26439
24963
  for (var p2 in s2) {
@@ -26506,9 +25030,9 @@ function applyThousandSeparator(str, thousandSeparator, thousandsGroupStyle) {
26506
25030
  return str.substring(0, index) + str.substring(index, str.length).replace(thousandsGroupRegex, "$1" + thousandSeparator);
26507
25031
  }
26508
25032
  function usePersistentCallback(cb) {
26509
- var callbackRef = (0, import_react24.useRef)(cb);
25033
+ var callbackRef = (0, import_react23.useRef)(cb);
26510
25034
  callbackRef.current = cb;
26511
- var persistentCbRef = (0, import_react24.useRef)(function() {
25035
+ var persistentCbRef = (0, import_react23.useRef)(function() {
26512
25036
  var args = [], len = arguments.length;
26513
25037
  while (len--) args[len] = arguments[len];
26514
25038
  return callbackRef.current.apply(callbackRef, args);
@@ -26769,7 +25293,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format2, r
26769
25293
  }
26770
25294
  return { formattedValue, numAsString };
26771
25295
  });
26772
- var ref = (0, import_react24.useState)(function() {
25296
+ var ref = (0, import_react23.useState)(function() {
26773
25297
  return getValues(isNil(value) ? defaultValue : value, valueIsNumericString);
26774
25298
  });
26775
25299
  var values = ref[0];
@@ -26790,7 +25314,7 @@ function useInternalValues(value, defaultValue, valueIsNumericString, format2, r
26790
25314
  _valueIsNumericString = true;
26791
25315
  }
26792
25316
  var newValues = getValues(_value, _valueIsNumericString);
26793
- (0, import_react24.useMemo)(function() {
25317
+ (0, import_react23.useMemo)(function() {
26794
25318
  setValues(newValues);
26795
25319
  }, [newValues.formattedValue]);
26796
25320
  return [values, _onValueChange];
@@ -26839,21 +25363,21 @@ function NumberFormatBase(props) {
26839
25363
  var formattedValue = ref_0.formattedValue;
26840
25364
  var numAsString = ref_0.numAsString;
26841
25365
  var onFormattedValueChange = ref[1];
26842
- var caretPositionBeforeChange = (0, import_react24.useRef)();
26843
- var lastUpdatedValue = (0, import_react24.useRef)({ formattedValue, numAsString });
25366
+ var caretPositionBeforeChange = (0, import_react23.useRef)();
25367
+ var lastUpdatedValue = (0, import_react23.useRef)({ formattedValue, numAsString });
26844
25368
  var _onValueChange = function(values, source) {
26845
25369
  lastUpdatedValue.current = { formattedValue: values.formattedValue, numAsString: values.value };
26846
25370
  onFormattedValueChange(values, source);
26847
25371
  };
26848
- var ref$1 = (0, import_react24.useState)(false);
25372
+ var ref$1 = (0, import_react23.useState)(false);
26849
25373
  var mounted = ref$1[0];
26850
25374
  var setMounted = ref$1[1];
26851
- var focusedElm = (0, import_react24.useRef)(null);
26852
- var timeout2 = (0, import_react24.useRef)({
25375
+ var focusedElm = (0, import_react23.useRef)(null);
25376
+ var timeout2 = (0, import_react23.useRef)({
26853
25377
  setCaretTimeout: null,
26854
25378
  focusTimeout: null
26855
25379
  });
26856
- (0, import_react24.useEffect)(function() {
25380
+ (0, import_react23.useEffect)(function() {
26857
25381
  setMounted(true);
26858
25382
  return function() {
26859
25383
  clearTimeout(timeout2.current.setCaretTimeout);
@@ -26910,7 +25434,7 @@ function NumberFormatBase(props) {
26910
25434
  _onValueChange(getValueObject(newFormattedValue, numAsString2), { event, source });
26911
25435
  }
26912
25436
  };
26913
- (0, import_react24.useEffect)(function() {
25437
+ (0, import_react23.useEffect)(function() {
26914
25438
  var ref2 = lastUpdatedValue.current;
26915
25439
  var lastFormattedValue = ref2.formattedValue;
26916
25440
  var lastNumAsString = ref2.numAsString;
@@ -26922,7 +25446,7 @@ function NumberFormatBase(props) {
26922
25446
  }
26923
25447
  }, [formattedValue, numAsString]);
26924
25448
  var currentCaretPosition = focusedElm.current ? geInputCaretPosition(focusedElm.current) : void 0;
26925
- var useIsomorphicLayoutEffect3 = typeof window !== "undefined" ? import_react24.useLayoutEffect : import_react24.useEffect;
25449
+ var useIsomorphicLayoutEffect3 = typeof window !== "undefined" ? import_react23.useLayoutEffect : import_react23.useEffect;
26926
25450
  useIsomorphicLayoutEffect3(function() {
26927
25451
  var input = focusedElm.current;
26928
25452
  if (formattedValue !== lastUpdatedValue.current.formattedValue && input) {
@@ -27071,12 +25595,12 @@ function NumberFormatBase(props) {
27071
25595
  onBlur: _onBlur
27072
25596
  });
27073
25597
  if (displayType === "text") {
27074
- return renderText ? import_react24.default.createElement(import_react24.default.Fragment, null, renderText(formattedValue, otherProps) || null) : import_react24.default.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue);
25598
+ return renderText ? import_react23.default.createElement(import_react23.default.Fragment, null, renderText(formattedValue, otherProps) || null) : import_react23.default.createElement("span", Object.assign({}, otherProps, { ref: getInputRef }), formattedValue);
27075
25599
  } else if (customInput) {
27076
25600
  var CustomInput = customInput;
27077
- return import_react24.default.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
25601
+ return import_react23.default.createElement(CustomInput, Object.assign({}, inputProps, { ref: getInputRef }));
27078
25602
  }
27079
- return import_react24.default.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
25603
+ return import_react23.default.createElement("input", Object.assign({}, inputProps, { ref: getInputRef }));
27080
25604
  }
27081
25605
  function format(numStr, props) {
27082
25606
  var decimalScale = props.decimalScale;
@@ -27439,12 +25963,12 @@ function useNumericFormat(props) {
27439
25963
  }
27440
25964
  function NumericFormat(props) {
27441
25965
  var numericFormatProps = useNumericFormat(props);
27442
- return import_react24.default.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
25966
+ return import_react23.default.createElement(NumberFormatBase, Object.assign({}, numericFormatProps));
27443
25967
  }
27444
25968
 
27445
25969
  // src/component/table/index.tsx
27446
25970
  var import_jsx_runtime16 = require("react/jsx-runtime");
27447
- var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
25971
+ var TableEdit = (0, import_react24.forwardRef)((props, ref) => {
27448
25972
  const { t: t2 } = useTranslation();
27449
25973
  const {
27450
25974
  idTable,
@@ -27473,35 +25997,35 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
27473
25997
  isMulti,
27474
25998
  disableAutoKey
27475
25999
  } = props;
27476
- (0, import_react25.useImperativeHandle)(ref, () => {
26000
+ (0, import_react24.useImperativeHandle)(ref, () => {
27477
26001
  return {
27478
26002
  refeshFocusRow: handleRefeshRow
27479
26003
  };
27480
26004
  });
27481
- const [refreshRow, setRefreshRow] = (0, import_react25.useState)(false);
27482
- const [indexFocus, setIndexFocus] = (0, import_react25.useState)();
27483
- const [selectedRows, setSelectedRows] = (0, import_react25.useState)([]);
27484
- const [headerColumns, setHeaderColumns] = (0, import_react25.useState)([[]]);
27485
- const [contentColumns, setContentColumns] = (0, import_react25.useState)([]);
27486
- const [levelCol, setLevelCol] = (0, import_react25.useState)(0);
27487
- const [columnFistEdit, setColumnFistEdit] = (0, import_react25.useState)(0);
27488
- const [columnLastEdit, setColumnlastEdit] = (0, import_react25.useState)(0);
27489
- const [objWidthFix, setObjWidthFix] = (0, import_react25.useState)({});
27490
- const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0, import_react25.useState)(false);
27491
- const [searchTerm, setSearchTerm] = (0, import_react25.useState)("");
27492
- const tableElement = (0, import_react25.useRef)(null);
27493
- const gridRef = (0, import_react25.useRef)();
26005
+ const [refreshRow, setRefreshRow] = (0, import_react24.useState)(false);
26006
+ const [indexFocus, setIndexFocus] = (0, import_react24.useState)();
26007
+ const [selectedRows, setSelectedRows] = (0, import_react24.useState)([]);
26008
+ const [headerColumns, setHeaderColumns] = (0, import_react24.useState)([[]]);
26009
+ const [contentColumns, setContentColumns] = (0, import_react24.useState)([]);
26010
+ const [levelCol, setLevelCol] = (0, import_react24.useState)(0);
26011
+ const [columnFistEdit, setColumnFistEdit] = (0, import_react24.useState)(0);
26012
+ const [columnLastEdit, setColumnlastEdit] = (0, import_react24.useState)(0);
26013
+ const [objWidthFix, setObjWidthFix] = (0, import_react24.useState)({});
26014
+ const [openPopupSetupColumn, setOpenPopupSetupColumn] = (0, import_react24.useState)(false);
26015
+ const [searchTerm, setSearchTerm] = (0, import_react24.useState)("");
26016
+ const tableElement = (0, import_react24.useRef)(null);
26017
+ const gridRef = (0, import_react24.useRef)();
27494
26018
  let totalCount = dataSource.length;
27495
26019
  const pagingClient = pagingSetting?.allowPaging && (pagingSetting?.pagingClient || !(editDisable || addDisable));
27496
26020
  const searchClient = searchSetting?.searchEnable && (searchSetting?.searchClient || !(editDisable || addDisable));
27497
26021
  const fieldKey = columns.find((item) => item.isPrimarykey === true)?.field ?? "id";
27498
26022
  const fieldUniKey = columns.filter((item) => item.isUnikey === true)?.map((item) => item.field);
27499
- (0, import_react25.useEffect)(() => {
26023
+ (0, import_react24.useEffect)(() => {
27500
26024
  if (pagingClient && pagingSetting.setCurrentPage && Math.ceil(totalCount / (pagingSetting?.pageSize ?? 1)) < (pagingSetting.currentPage ?? 1)) {
27501
26025
  pagingSetting.setCurrentPage(1);
27502
26026
  }
27503
26027
  }, [dataSource]);
27504
- (0, import_react25.useEffect)(() => {
26028
+ (0, import_react24.useEffect)(() => {
27505
26029
  let indexFirst = -1;
27506
26030
  let indexlast = -1;
27507
26031
  let letfWidthFix = 0;
@@ -27535,7 +26059,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
27535
26059
  setColumnFistEdit(indexFirst + 1);
27536
26060
  setColumnlastEdit(indexlast + 1);
27537
26061
  }, [contentColumns]);
27538
- (0, import_react25.useEffect)(() => {
26062
+ (0, import_react24.useEffect)(() => {
27539
26063
  const arrHeaderColumns = [];
27540
26064
  const arrContentColumns = [];
27541
26065
  let headerLevelRow = 0;
@@ -27552,7 +26076,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
27552
26076
  setHeaderColumns(arrHeaderColumns);
27553
26077
  setContentColumns(arrContentColumns);
27554
26078
  }, [columns]);
27555
- (0, import_react25.useEffect)(() => {
26079
+ (0, import_react24.useEffect)(() => {
27556
26080
  const arrHeaderColumns = [];
27557
26081
  const arrContentColumns = [];
27558
26082
  let headerLevelRow = 0;
@@ -27631,7 +26155,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
27631
26155
  }
27632
26156
  };
27633
26157
  const searchTemplate = () => {
27634
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "me-50 r-search", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
26158
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react24.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { className: "me-50 r-search", children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
27635
26159
  react_input_default,
27636
26160
  {
27637
26161
  style: { width: "230px" },
@@ -28381,7 +26905,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
28381
26905
  }
28382
26906
  }
28383
26907
  };
28384
- (0, import_react25.useEffect)(() => {
26908
+ (0, import_react24.useEffect)(() => {
28385
26909
  setIndexFocus(-1);
28386
26910
  if (setSelectedItem) {
28387
26911
  if (isMulti) {
@@ -28408,7 +26932,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
28408
26932
  }
28409
26933
  }
28410
26934
  }, [selectedRows]);
28411
- (0, import_react25.useEffect)(() => {
26935
+ (0, import_react24.useEffect)(() => {
28412
26936
  if (!isMulti) {
28413
26937
  if (dataSource && selectedItem && selectedItem[fieldKey]) {
28414
26938
  if (selectedRows?.length === 0 || selectedItem[fieldKey] !== selectedRows[0][fieldKey]) {
@@ -28559,7 +27083,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
28559
27083
  }
28560
27084
  const typeDis = !editDisable && (indexFocus === indexRow || col.editType === "checkbox") && (!col.disabledCondition || !col.disabledCondition(row)) ? col.editEnable ? 1 : col.template ? 2 : 3 : col.template ? 2 : 3;
28561
27085
  const errorMessage = typeDis === 1 || col.field === "" || !col.validate ? "" : col.validate(row[col.field], row);
28562
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react25.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
27086
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react24.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
28563
27087
  "td",
28564
27088
  {
28565
27089
  className: (0, import_classnames15.default)(
@@ -28644,7 +27168,7 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
28644
27168
  return element && element.scrollWidth > element.clientWidth;
28645
27169
  };
28646
27170
  const renderFooterCol = (col, indexCol) => {
28647
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react25.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
27171
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_react24.Fragment, { children: col.visible !== false && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
28648
27172
  "td",
28649
27173
  {
28650
27174
  className: (0, import_classnames15.default)(
@@ -28754,12 +27278,12 @@ var TableEdit = (0, import_react25.forwardRef)((props, ref) => {
28754
27278
  }
28755
27279
  });
28756
27280
  };
28757
- (0, import_react25.useEffect)(() => {
27281
+ (0, import_react24.useEffect)(() => {
28758
27282
  if (pagingClient && pagingSetting?.setCurrentPage && (searchSetting?.searchTerm !== void 0 ? searchSetting?.searchTerm : searchTerm)) {
28759
27283
  pagingSetting?.setCurrentPage(1);
28760
27284
  }
28761
27285
  }, [searchTerm, searchSetting?.searchTerm]);
28762
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react25.Fragment, { children: [
27286
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_react24.Fragment, { children: [
28763
27287
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "react-table-edit", children: [
28764
27288
  /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "r-grid", ref: gridRef, children: [
28765
27289
  toolbarSetting?.showTopToolbar ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, { children: renderToolbarTop() }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_jsx_runtime16.Fragment, {}),
@@ -28822,14 +27346,14 @@ var table_default = TableEdit;
28822
27346
 
28823
27347
  // src/component/tab-menu/index.tsx
28824
27348
  var import_classnames16 = __toESM(require_classnames2());
28825
- var import_react26 = require("react");
27349
+ var import_react25 = require("react");
28826
27350
 
28827
27351
  // node_modules/react-router-dom/dist/index.js
28828
- var React16 = __toESM(require("react"));
27352
+ var React15 = __toESM(require("react"));
28829
27353
  var ReactDOM4 = __toESM(require("react-dom"));
28830
27354
 
28831
27355
  // node_modules/react-router/dist/index.js
28832
- var React15 = __toESM(require("react"));
27356
+ var React14 = __toESM(require("react"));
28833
27357
 
28834
27358
  // node_modules/@remix-run/router/dist/router.js
28835
27359
  function _extends3() {
@@ -29098,27 +27622,27 @@ function _extends4() {
29098
27622
  };
29099
27623
  return _extends4.apply(this, arguments);
29100
27624
  }
29101
- var DataRouterContext = /* @__PURE__ */ React15.createContext(null);
27625
+ var DataRouterContext = /* @__PURE__ */ React14.createContext(null);
29102
27626
  if (process.env.NODE_ENV !== "production") {
29103
27627
  DataRouterContext.displayName = "DataRouter";
29104
27628
  }
29105
- var DataRouterStateContext = /* @__PURE__ */ React15.createContext(null);
27629
+ var DataRouterStateContext = /* @__PURE__ */ React14.createContext(null);
29106
27630
  if (process.env.NODE_ENV !== "production") {
29107
27631
  DataRouterStateContext.displayName = "DataRouterState";
29108
27632
  }
29109
- var AwaitContext = /* @__PURE__ */ React15.createContext(null);
27633
+ var AwaitContext = /* @__PURE__ */ React14.createContext(null);
29110
27634
  if (process.env.NODE_ENV !== "production") {
29111
27635
  AwaitContext.displayName = "Await";
29112
27636
  }
29113
- var NavigationContext = /* @__PURE__ */ React15.createContext(null);
27637
+ var NavigationContext = /* @__PURE__ */ React14.createContext(null);
29114
27638
  if (process.env.NODE_ENV !== "production") {
29115
27639
  NavigationContext.displayName = "Navigation";
29116
27640
  }
29117
- var LocationContext = /* @__PURE__ */ React15.createContext(null);
27641
+ var LocationContext = /* @__PURE__ */ React14.createContext(null);
29118
27642
  if (process.env.NODE_ENV !== "production") {
29119
27643
  LocationContext.displayName = "Location";
29120
27644
  }
29121
- var RouteContext = /* @__PURE__ */ React15.createContext({
27645
+ var RouteContext = /* @__PURE__ */ React14.createContext({
29122
27646
  outlet: null,
29123
27647
  matches: [],
29124
27648
  isDataRoute: false
@@ -29126,7 +27650,7 @@ var RouteContext = /* @__PURE__ */ React15.createContext({
29126
27650
  if (process.env.NODE_ENV !== "production") {
29127
27651
  RouteContext.displayName = "Route";
29128
27652
  }
29129
- var RouteErrorContext = /* @__PURE__ */ React15.createContext(null);
27653
+ var RouteErrorContext = /* @__PURE__ */ React14.createContext(null);
29130
27654
  if (process.env.NODE_ENV !== "production") {
29131
27655
  RouteErrorContext.displayName = "RouteError";
29132
27656
  }
@@ -29143,7 +27667,7 @@ function useHref(to, _temp) {
29143
27667
  let {
29144
27668
  basename,
29145
27669
  navigator: navigator2
29146
- } = React15.useContext(NavigationContext);
27670
+ } = React14.useContext(NavigationContext);
29147
27671
  let {
29148
27672
  hash: hash3,
29149
27673
  pathname,
@@ -29162,7 +27686,7 @@ function useHref(to, _temp) {
29162
27686
  });
29163
27687
  }
29164
27688
  function useInRouterContext() {
29165
- return React15.useContext(LocationContext) != null;
27689
+ return React14.useContext(LocationContext) != null;
29166
27690
  }
29167
27691
  function useLocation() {
29168
27692
  !useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(
@@ -29171,19 +27695,19 @@ function useLocation() {
29171
27695
  // router loaded. We can help them understand how to avoid that.
29172
27696
  "useLocation() may be used only in the context of a <Router> component."
29173
27697
  ) : invariant(false) : void 0;
29174
- return React15.useContext(LocationContext).location;
27698
+ return React14.useContext(LocationContext).location;
29175
27699
  }
29176
27700
  var navigateEffectWarning = "You should call navigate() in a React.useEffect(), not when your component is first rendered.";
29177
27701
  function useIsomorphicLayoutEffect2(cb) {
29178
- let isStatic = React15.useContext(NavigationContext).static;
27702
+ let isStatic = React14.useContext(NavigationContext).static;
29179
27703
  if (!isStatic) {
29180
- React15.useLayoutEffect(cb);
27704
+ React14.useLayoutEffect(cb);
29181
27705
  }
29182
27706
  }
29183
27707
  function useNavigate() {
29184
27708
  let {
29185
27709
  isDataRoute
29186
- } = React15.useContext(RouteContext);
27710
+ } = React14.useContext(RouteContext);
29187
27711
  return isDataRoute ? useNavigateStable() : useNavigateUnstable();
29188
27712
  }
29189
27713
  function useNavigateUnstable() {
@@ -29193,24 +27717,24 @@ function useNavigateUnstable() {
29193
27717
  // router loaded. We can help them understand how to avoid that.
29194
27718
  "useNavigate() may be used only in the context of a <Router> component."
29195
27719
  ) : invariant(false) : void 0;
29196
- let dataRouterContext = React15.useContext(DataRouterContext);
27720
+ let dataRouterContext = React14.useContext(DataRouterContext);
29197
27721
  let {
29198
27722
  basename,
29199
27723
  future,
29200
27724
  navigator: navigator2
29201
- } = React15.useContext(NavigationContext);
27725
+ } = React14.useContext(NavigationContext);
29202
27726
  let {
29203
27727
  matches
29204
- } = React15.useContext(RouteContext);
27728
+ } = React14.useContext(RouteContext);
29205
27729
  let {
29206
27730
  pathname: locationPathname
29207
27731
  } = useLocation();
29208
27732
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
29209
- let activeRef = React15.useRef(false);
27733
+ let activeRef = React14.useRef(false);
29210
27734
  useIsomorphicLayoutEffect2(() => {
29211
27735
  activeRef.current = true;
29212
27736
  });
29213
- let navigate = React15.useCallback(function(to, options) {
27737
+ let navigate = React14.useCallback(function(to, options) {
29214
27738
  if (options === void 0) {
29215
27739
  options = {};
29216
27740
  }
@@ -29234,15 +27758,15 @@ function useResolvedPath(to, _temp2) {
29234
27758
  } = _temp2 === void 0 ? {} : _temp2;
29235
27759
  let {
29236
27760
  future
29237
- } = React15.useContext(NavigationContext);
27761
+ } = React14.useContext(NavigationContext);
29238
27762
  let {
29239
27763
  matches
29240
- } = React15.useContext(RouteContext);
27764
+ } = React14.useContext(RouteContext);
29241
27765
  let {
29242
27766
  pathname: locationPathname
29243
27767
  } = useLocation();
29244
27768
  let routePathnamesJson = JSON.stringify(getResolveToMatches(matches, future.v7_relativeSplatPath));
29245
- return React15.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
27769
+ return React14.useMemo(() => resolveTo(to, JSON.parse(routePathnamesJson), locationPathname, relative === "path"), [to, routePathnamesJson, locationPathname, relative]);
29246
27770
  }
29247
27771
  var DataRouterHook = /* @__PURE__ */ function(DataRouterHook3) {
29248
27772
  DataRouterHook3["UseBlocker"] = "useBlocker";
@@ -29267,17 +27791,17 @@ function getDataRouterConsoleError(hookName) {
29267
27791
  return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
29268
27792
  }
29269
27793
  function useDataRouterContext(hookName) {
29270
- let ctx = React15.useContext(DataRouterContext);
27794
+ let ctx = React14.useContext(DataRouterContext);
29271
27795
  !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
29272
27796
  return ctx;
29273
27797
  }
29274
27798
  function useDataRouterState(hookName) {
29275
- let state = React15.useContext(DataRouterStateContext);
27799
+ let state = React14.useContext(DataRouterStateContext);
29276
27800
  !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
29277
27801
  return state;
29278
27802
  }
29279
27803
  function useRouteContext(hookName) {
29280
- let route = React15.useContext(RouteContext);
27804
+ let route = React14.useContext(RouteContext);
29281
27805
  !route ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError(hookName)) : invariant(false) : void 0;
29282
27806
  return route;
29283
27807
  }
@@ -29299,18 +27823,18 @@ function useMatches() {
29299
27823
  matches,
29300
27824
  loaderData
29301
27825
  } = useDataRouterState(DataRouterStateHook.UseMatches);
29302
- return React15.useMemo(() => matches.map((m2) => convertRouteMatchToUiMatch(m2, loaderData)), [matches, loaderData]);
27826
+ return React14.useMemo(() => matches.map((m2) => convertRouteMatchToUiMatch(m2, loaderData)), [matches, loaderData]);
29303
27827
  }
29304
27828
  function useNavigateStable() {
29305
27829
  let {
29306
27830
  router
29307
27831
  } = useDataRouterContext(DataRouterHook.UseNavigateStable);
29308
27832
  let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);
29309
- let activeRef = React15.useRef(false);
27833
+ let activeRef = React14.useRef(false);
29310
27834
  useIsomorphicLayoutEffect2(() => {
29311
27835
  activeRef.current = true;
29312
27836
  });
29313
- let navigate = React15.useCallback(function(to, options) {
27837
+ let navigate = React14.useCallback(function(to, options) {
29314
27838
  if (options === void 0) {
29315
27839
  options = {};
29316
27840
  }
@@ -29327,7 +27851,7 @@ function useNavigateStable() {
29327
27851
  return navigate;
29328
27852
  }
29329
27853
  var START_TRANSITION = "startTransition";
29330
- var startTransitionImpl = React15[START_TRANSITION];
27854
+ var startTransitionImpl = React14[START_TRANSITION];
29331
27855
  function Router(_ref5) {
29332
27856
  let {
29333
27857
  basename: basenameProp = "/",
@@ -29340,7 +27864,7 @@ function Router(_ref5) {
29340
27864
  } = _ref5;
29341
27865
  !!useInRouterContext() ? process.env.NODE_ENV !== "production" ? invariant(false, "You cannot render a <Router> inside another <Router>. You should never have more than one in your app.") : invariant(false) : void 0;
29342
27866
  let basename = basenameProp.replace(/^\/*/, "/");
29343
- let navigationContext = React15.useMemo(() => ({
27867
+ let navigationContext = React14.useMemo(() => ({
29344
27868
  basename,
29345
27869
  navigator: navigator2,
29346
27870
  static: staticProp,
@@ -29358,7 +27882,7 @@ function Router(_ref5) {
29358
27882
  state = null,
29359
27883
  key = "default"
29360
27884
  } = locationProp;
29361
- let locationContext = React15.useMemo(() => {
27885
+ let locationContext = React14.useMemo(() => {
29362
27886
  let trailingPathname = stripBasename(pathname, basename);
29363
27887
  if (trailingPathname == null) {
29364
27888
  return null;
@@ -29378,9 +27902,9 @@ function Router(_ref5) {
29378
27902
  if (locationContext == null) {
29379
27903
  return null;
29380
27904
  }
29381
- return /* @__PURE__ */ React15.createElement(NavigationContext.Provider, {
27905
+ return /* @__PURE__ */ React14.createElement(NavigationContext.Provider, {
29382
27906
  value: navigationContext
29383
- }, /* @__PURE__ */ React15.createElement(LocationContext.Provider, {
27907
+ }, /* @__PURE__ */ React14.createElement(LocationContext.Provider, {
29384
27908
  children,
29385
27909
  value: locationContext
29386
27910
  }));
@@ -29525,22 +28049,22 @@ try {
29525
28049
  window.__reactRouterVersion = REACT_ROUTER_VERSION;
29526
28050
  } catch (e2) {
29527
28051
  }
29528
- var ViewTransitionContext = /* @__PURE__ */ React16.createContext({
28052
+ var ViewTransitionContext = /* @__PURE__ */ React15.createContext({
29529
28053
  isTransitioning: false
29530
28054
  });
29531
28055
  if (process.env.NODE_ENV !== "production") {
29532
28056
  ViewTransitionContext.displayName = "ViewTransition";
29533
28057
  }
29534
- var FetchersContext = /* @__PURE__ */ React16.createContext(/* @__PURE__ */ new Map());
28058
+ var FetchersContext = /* @__PURE__ */ React15.createContext(/* @__PURE__ */ new Map());
29535
28059
  if (process.env.NODE_ENV !== "production") {
29536
28060
  FetchersContext.displayName = "Fetchers";
29537
28061
  }
29538
28062
  var START_TRANSITION2 = "startTransition";
29539
- var startTransitionImpl2 = React16[START_TRANSITION2];
28063
+ var startTransitionImpl2 = React15[START_TRANSITION2];
29540
28064
  var FLUSH_SYNC = "flushSync";
29541
28065
  var flushSyncImpl = ReactDOM4[FLUSH_SYNC];
29542
28066
  var USE_ID = "useId";
29543
- var useIdImpl = React16[USE_ID];
28067
+ var useIdImpl = React15[USE_ID];
29544
28068
  function HistoryRouter(_ref6) {
29545
28069
  let {
29546
28070
  basename,
@@ -29548,18 +28072,18 @@ function HistoryRouter(_ref6) {
29548
28072
  future,
29549
28073
  history
29550
28074
  } = _ref6;
29551
- let [state, setStateImpl] = React16.useState({
28075
+ let [state, setStateImpl] = React15.useState({
29552
28076
  action: history.action,
29553
28077
  location: history.location
29554
28078
  });
29555
28079
  let {
29556
28080
  v7_startTransition
29557
28081
  } = future || {};
29558
- let setState = React16.useCallback((newState) => {
28082
+ let setState = React15.useCallback((newState) => {
29559
28083
  v7_startTransition && startTransitionImpl2 ? startTransitionImpl2(() => setStateImpl(newState)) : setStateImpl(newState);
29560
28084
  }, [setStateImpl, v7_startTransition]);
29561
- React16.useLayoutEffect(() => history.listen(setState), [history, setState]);
29562
- return /* @__PURE__ */ React16.createElement(Router, {
28085
+ React15.useLayoutEffect(() => history.listen(setState), [history, setState]);
28086
+ return /* @__PURE__ */ React15.createElement(Router, {
29563
28087
  basename,
29564
28088
  children,
29565
28089
  location: state.location,
@@ -29573,7 +28097,7 @@ if (process.env.NODE_ENV !== "production") {
29573
28097
  }
29574
28098
  var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
29575
28099
  var ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
29576
- var Link = /* @__PURE__ */ React16.forwardRef(function LinkWithRef(_ref7, ref) {
28100
+ var Link = /* @__PURE__ */ React15.forwardRef(function LinkWithRef(_ref7, ref) {
29577
28101
  let {
29578
28102
  onClick,
29579
28103
  relative,
@@ -29587,7 +28111,7 @@ var Link = /* @__PURE__ */ React16.forwardRef(function LinkWithRef(_ref7, ref) {
29587
28111
  } = _ref7, rest = _objectWithoutPropertiesLoose3(_ref7, _excluded2);
29588
28112
  let {
29589
28113
  basename
29590
- } = React16.useContext(NavigationContext);
28114
+ } = React15.useContext(NavigationContext);
29591
28115
  let absoluteHref;
29592
28116
  let isExternal = false;
29593
28117
  if (typeof to === "string" && ABSOLUTE_URL_REGEX.test(to)) {
@@ -29626,7 +28150,7 @@ var Link = /* @__PURE__ */ React16.forwardRef(function LinkWithRef(_ref7, ref) {
29626
28150
  }
29627
28151
  return (
29628
28152
  // eslint-disable-next-line jsx-a11y/anchor-has-content
29629
- /* @__PURE__ */ React16.createElement("a", _extends5({}, rest, {
28153
+ /* @__PURE__ */ React15.createElement("a", _extends5({}, rest, {
29630
28154
  href: absoluteHref || href,
29631
28155
  onClick: isExternal || reloadDocument ? onClick : handleClick,
29632
28156
  ref,
@@ -29637,7 +28161,7 @@ var Link = /* @__PURE__ */ React16.forwardRef(function LinkWithRef(_ref7, ref) {
29637
28161
  if (process.env.NODE_ENV !== "production") {
29638
28162
  Link.displayName = "Link";
29639
28163
  }
29640
- var NavLink2 = /* @__PURE__ */ React16.forwardRef(function NavLinkWithRef(_ref8, ref) {
28164
+ var NavLink2 = /* @__PURE__ */ React15.forwardRef(function NavLinkWithRef(_ref8, ref) {
29641
28165
  let {
29642
28166
  "aria-current": ariaCurrentProp = "page",
29643
28167
  caseSensitive = false,
@@ -29652,11 +28176,11 @@ var NavLink2 = /* @__PURE__ */ React16.forwardRef(function NavLinkWithRef(_ref8,
29652
28176
  relative: rest.relative
29653
28177
  });
29654
28178
  let location2 = useLocation();
29655
- let routerState = React16.useContext(DataRouterStateContext);
28179
+ let routerState = React15.useContext(DataRouterStateContext);
29656
28180
  let {
29657
28181
  navigator: navigator2,
29658
28182
  basename
29659
- } = React16.useContext(NavigationContext);
28183
+ } = React15.useContext(NavigationContext);
29660
28184
  let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
29661
28185
  // eslint-disable-next-line react-hooks/rules-of-hooks
29662
28186
  useViewTransitionState(path) && viewTransition === true;
@@ -29687,7 +28211,7 @@ var NavLink2 = /* @__PURE__ */ React16.forwardRef(function NavLinkWithRef(_ref8,
29687
28211
  className = [classNameProp, isActive ? "active" : null, isPending ? "pending" : null, isTransitioning ? "transitioning" : null].filter(Boolean).join(" ");
29688
28212
  }
29689
28213
  let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
29690
- return /* @__PURE__ */ React16.createElement(Link, _extends5({}, rest, {
28214
+ return /* @__PURE__ */ React15.createElement(Link, _extends5({}, rest, {
29691
28215
  "aria-current": ariaCurrent,
29692
28216
  className,
29693
28217
  ref,
@@ -29699,7 +28223,7 @@ var NavLink2 = /* @__PURE__ */ React16.forwardRef(function NavLinkWithRef(_ref8,
29699
28223
  if (process.env.NODE_ENV !== "production") {
29700
28224
  NavLink2.displayName = "NavLink";
29701
28225
  }
29702
- var Form3 = /* @__PURE__ */ React16.forwardRef((_ref9, forwardedRef) => {
28226
+ var Form3 = /* @__PURE__ */ React15.forwardRef((_ref9, forwardedRef) => {
29703
28227
  let {
29704
28228
  fetcherKey,
29705
28229
  navigate,
@@ -29735,7 +28259,7 @@ var Form3 = /* @__PURE__ */ React16.forwardRef((_ref9, forwardedRef) => {
29735
28259
  viewTransition
29736
28260
  });
29737
28261
  };
29738
- return /* @__PURE__ */ React16.createElement("form", _extends5({
28262
+ return /* @__PURE__ */ React15.createElement("form", _extends5({
29739
28263
  ref: forwardedRef,
29740
28264
  method: formMethod,
29741
28265
  action: formAction,
@@ -29777,12 +28301,12 @@ function getDataRouterConsoleError2(hookName) {
29777
28301
  return hookName + " must be used within a data router. See https://reactrouter.com/routers/picking-a-router.";
29778
28302
  }
29779
28303
  function useDataRouterContext2(hookName) {
29780
- let ctx = React16.useContext(DataRouterContext);
28304
+ let ctx = React15.useContext(DataRouterContext);
29781
28305
  !ctx ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
29782
28306
  return ctx;
29783
28307
  }
29784
28308
  function useDataRouterState2(hookName) {
29785
- let state = React16.useContext(DataRouterStateContext);
28309
+ let state = React15.useContext(DataRouterStateContext);
29786
28310
  !state ? process.env.NODE_ENV !== "production" ? invariant(false, getDataRouterConsoleError2(hookName)) : invariant(false) : void 0;
29787
28311
  return state;
29788
28312
  }
@@ -29800,7 +28324,7 @@ function useLinkClickHandler(to, _temp) {
29800
28324
  let path = useResolvedPath(to, {
29801
28325
  relative
29802
28326
  });
29803
- return React16.useCallback((event) => {
28327
+ return React15.useCallback((event) => {
29804
28328
  if (shouldProcessLinkClick(event, target)) {
29805
28329
  event.preventDefault();
29806
28330
  let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location2) === createPath(path);
@@ -29827,9 +28351,9 @@ function useSubmit() {
29827
28351
  } = useDataRouterContext2(DataRouterHook2.UseSubmit);
29828
28352
  let {
29829
28353
  basename
29830
- } = React16.useContext(NavigationContext);
28354
+ } = React15.useContext(NavigationContext);
29831
28355
  let currentRouteId = useRouteId();
29832
- return React16.useCallback(function(target, options) {
28356
+ return React15.useCallback(function(target, options) {
29833
28357
  if (options === void 0) {
29834
28358
  options = {};
29835
28359
  }
@@ -29873,8 +28397,8 @@ function useFormAction(action, _temp2) {
29873
28397
  } = _temp2 === void 0 ? {} : _temp2;
29874
28398
  let {
29875
28399
  basename
29876
- } = React16.useContext(NavigationContext);
29877
- let routeContext = React16.useContext(RouteContext);
28400
+ } = React15.useContext(NavigationContext);
28401
+ let routeContext = React15.useContext(RouteContext);
29878
28402
  !routeContext ? process.env.NODE_ENV !== "production" ? invariant(false, "useFormAction must be used inside a RouteContext") : invariant(false) : void 0;
29879
28403
  let [match] = routeContext.matches.slice(-1);
29880
28404
  let path = _extends5({}, useResolvedPath(action ? action : ".", {
@@ -29917,17 +28441,17 @@ function useScrollRestoration(_temp4) {
29917
28441
  } = useDataRouterState2(DataRouterStateHook2.UseScrollRestoration);
29918
28442
  let {
29919
28443
  basename
29920
- } = React16.useContext(NavigationContext);
28444
+ } = React15.useContext(NavigationContext);
29921
28445
  let location2 = useLocation();
29922
28446
  let matches = useMatches();
29923
28447
  let navigation = useNavigation();
29924
- React16.useEffect(() => {
28448
+ React15.useEffect(() => {
29925
28449
  window.history.scrollRestoration = "manual";
29926
28450
  return () => {
29927
28451
  window.history.scrollRestoration = "auto";
29928
28452
  };
29929
28453
  }, []);
29930
- usePageHide(React16.useCallback(() => {
28454
+ usePageHide(React15.useCallback(() => {
29931
28455
  if (navigation.state === "idle") {
29932
28456
  let key = (getKey ? getKey(location2, matches) : null) || location2.key;
29933
28457
  savedScrollPositions[key] = window.scrollY;
@@ -29940,7 +28464,7 @@ function useScrollRestoration(_temp4) {
29940
28464
  window.history.scrollRestoration = "auto";
29941
28465
  }, [storageKey, getKey, navigation.state, location2, matches]));
29942
28466
  if (typeof document !== "undefined") {
29943
- React16.useLayoutEffect(() => {
28467
+ React15.useLayoutEffect(() => {
29944
28468
  try {
29945
28469
  let sessionPositions = sessionStorage.getItem(storageKey || SCROLL_RESTORATION_STORAGE_KEY);
29946
28470
  if (sessionPositions) {
@@ -29949,7 +28473,7 @@ function useScrollRestoration(_temp4) {
29949
28473
  } catch (e2) {
29950
28474
  }
29951
28475
  }, [storageKey]);
29952
- React16.useLayoutEffect(() => {
28476
+ React15.useLayoutEffect(() => {
29953
28477
  let getKeyWithoutBasename = getKey && basename !== "/" ? (location3, matches2) => getKey(
29954
28478
  // Strip the basename to match useLocation()
29955
28479
  _extends5({}, location3, {
@@ -29960,7 +28484,7 @@ function useScrollRestoration(_temp4) {
29960
28484
  let disableScrollRestoration = router == null ? void 0 : router.enableScrollRestoration(savedScrollPositions, () => window.scrollY, getKeyWithoutBasename);
29961
28485
  return () => disableScrollRestoration && disableScrollRestoration();
29962
28486
  }, [router, basename, getKey]);
29963
- React16.useLayoutEffect(() => {
28487
+ React15.useLayoutEffect(() => {
29964
28488
  if (restoreScrollPosition === false) {
29965
28489
  return;
29966
28490
  }
@@ -29986,7 +28510,7 @@ function usePageHide(callback, options) {
29986
28510
  let {
29987
28511
  capture
29988
28512
  } = options || {};
29989
- React16.useEffect(() => {
28513
+ React15.useEffect(() => {
29990
28514
  let opts = capture != null ? {
29991
28515
  capture
29992
28516
  } : void 0;
@@ -30000,7 +28524,7 @@ function useViewTransitionState(to, opts) {
30000
28524
  if (opts === void 0) {
30001
28525
  opts = {};
30002
28526
  }
30003
- let vtContext = React16.useContext(ViewTransitionContext);
28527
+ let vtContext = React15.useContext(ViewTransitionContext);
30004
28528
  !(vtContext != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?") : invariant(false) : void 0;
30005
28529
  let {
30006
28530
  basename
@@ -30029,14 +28553,14 @@ var TabsMenuComponent = ({
30029
28553
  renderModal
30030
28554
  }) => {
30031
28555
  const navigate = useNavigate();
30032
- const [dataMenu, setDataMenu] = (0, import_react26.useState)([]);
30033
- const [openMenu, setOpenMenu] = (0, import_react26.useState)(false);
30034
- const [url, setUrl] = (0, import_react26.useState)("");
30035
- const [contentWidth, setContentWidth] = (0, import_react26.useState)(0);
30036
- const [componentWidth, setComponentWidth] = (0, import_react26.useState)(0);
30037
- const [scrollPosition, setScrollPosition] = (0, import_react26.useState)(0);
30038
- const [dataItem, setDataItem] = (0, import_react26.useState)([]);
30039
- const [openModal, setOpenModal] = (0, import_react26.useState)({});
28556
+ const [dataMenu, setDataMenu] = (0, import_react25.useState)([]);
28557
+ const [openMenu, setOpenMenu] = (0, import_react25.useState)(false);
28558
+ const [url, setUrl] = (0, import_react25.useState)("");
28559
+ const [contentWidth, setContentWidth] = (0, import_react25.useState)(0);
28560
+ const [componentWidth, setComponentWidth] = (0, import_react25.useState)(0);
28561
+ const [scrollPosition, setScrollPosition] = (0, import_react25.useState)(0);
28562
+ const [dataItem, setDataItem] = (0, import_react25.useState)([]);
28563
+ const [openModal, setOpenModal] = (0, import_react25.useState)({});
30040
28564
  const handleWindowResize = () => {
30041
28565
  const tabEle = document.getElementById(`tab-component-${resourceCode}`);
30042
28566
  const tabContent = document.getElementById(`content-component-${resourceCode}`);
@@ -30045,7 +28569,7 @@ var TabsMenuComponent = ({
30045
28569
  setContentWidth(tabContent?.offsetWidth ?? 0);
30046
28570
  }
30047
28571
  };
30048
- (0, import_react26.useEffect)(() => {
28572
+ (0, import_react25.useEffect)(() => {
30049
28573
  setUrl(window.location.pathname);
30050
28574
  window.addEventListener("resize", handleWindowResize);
30051
28575
  setTimeout(() => {
@@ -30061,7 +28585,7 @@ var TabsMenuComponent = ({
30061
28585
  window.removeEventListener("resize", handleWindowResize);
30062
28586
  };
30063
28587
  }, []);
30064
- (0, import_react26.useEffect)(() => {
28588
+ (0, import_react25.useEffect)(() => {
30065
28589
  const item = resources?.find((x) => x.code === (resourceCodeParent ? resourceCodeParent : resourceCode));
30066
28590
  if (item) {
30067
28591
  if (resourceCodeParent) {
@@ -30092,7 +28616,7 @@ var TabsMenuComponent = ({
30092
28616
  const handleModal = (name) => {
30093
28617
  setOpenModal((old) => ({ ...old, [name]: !(openModal[name] ?? false) }));
30094
28618
  };
30095
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react26.Fragment, { children: [
28619
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_react25.Fragment, { children: [
30096
28620
  renderModal ? renderModal({ handleModal, windowSize, openModal, setDataItem, dataItem }) : "",
30097
28621
  /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: (0, import_classnames16.default)("tab-custom", { "tab-parent": tabParent }, { "tab-child": tabChild }), style: { width: `calc(100% - ${buttonWidth ?? 100}px` }, children: [
30098
28622
  /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
@@ -30149,7 +28673,7 @@ var TabsMenuComponent = ({
30149
28673
 
30150
28674
  // src/component/input-style/index.tsx
30151
28675
  var import_classnames17 = __toESM(require_classnames2());
30152
- var import_react27 = require("react");
28676
+ var import_react26 = require("react");
30153
28677
 
30154
28678
  // src/component/input-style/fonts.ts
30155
28679
  var OptionFont = [
@@ -31022,7 +29546,7 @@ var InputStyleComponent = (props) => {
31022
29546
  disabledItalic,
31023
29547
  disabledUnderline
31024
29548
  } = props;
31025
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react27.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex align-items-center", children: [
29549
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react26.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "d-flex align-items-center", children: [
31026
29550
  /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
31027
29551
  SelectTable,
31028
29552
  {