@nutui/nutui-react 2.0.0-alpha.5 → 2.0.0-alpha.6
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/CHANGELOG.md +14 -0
- package/dist/esm/Cascader.js +46 -58
- package/dist/esm/DatePicker.js +10 -10
- package/dist/esm/Image.js +3 -5
- package/dist/esm/Picker.js +175 -160
- package/dist/esm/TabPane.js +39 -3
- package/dist/esm/Table.js +20 -34
- package/dist/esm/TextArea.js +53 -81
- package/dist/esm/tabs2.js +10 -0
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.mjs +418 -433
- package/dist/nutui.react.umd.js +418 -433
- package/dist/packages/cascader/cascader.scss +0 -26
- package/dist/packages/picker/picker.scss +66 -137
- package/dist/packages/table/table.scss +0 -56
- package/dist/packages/textarea/textarea.scss +5 -12
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/styles/variables-jmapp.scss +1 -4
- package/dist/styles/variables.scss +2 -6
- package/dist/types/index.d.ts +41 -45
- package/package.json +1 -1
- package/dist/esm/tabpane2.js +0 -42
package/dist/nutui.react.umd.js
CHANGED
|
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
|
9
9
|
return value;
|
|
10
10
|
};
|
|
11
11
|
/*!
|
|
12
|
-
* @nutui/nutui-react v2.0.0-alpha.
|
|
12
|
+
* @nutui/nutui-react v2.0.0-alpha.6 Fri May 12 2023 15:13:32 GMT+0800 (China Standard Time)
|
|
13
13
|
* (c) 2023 @jdf2e.
|
|
14
14
|
* Released under the MIT License.
|
|
15
15
|
*/
|
|
@@ -3251,7 +3251,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3251
3251
|
style: {}
|
|
3252
3252
|
};
|
|
3253
3253
|
const prefixCls = "nut-button";
|
|
3254
|
-
const defaultProps$
|
|
3254
|
+
const defaultProps$1s = {
|
|
3255
3255
|
...ComponentDefaults,
|
|
3256
3256
|
color: "",
|
|
3257
3257
|
type: "default",
|
|
@@ -3283,7 +3283,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3283
3283
|
style,
|
|
3284
3284
|
...rest
|
|
3285
3285
|
} = {
|
|
3286
|
-
...defaultProps$
|
|
3286
|
+
...defaultProps$1s,
|
|
3287
3287
|
...props
|
|
3288
3288
|
};
|
|
3289
3289
|
const getStyle = React.useCallback(() => {
|
|
@@ -3340,7 +3340,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3340
3340
|
}
|
|
3341
3341
|
);
|
|
3342
3342
|
Button.displayName = "NutButton";
|
|
3343
|
-
const defaultProps$
|
|
3343
|
+
const defaultProps$1r = {
|
|
3344
3344
|
...ComponentDefaults,
|
|
3345
3345
|
title: null,
|
|
3346
3346
|
description: null,
|
|
@@ -3364,7 +3364,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3364
3364
|
style,
|
|
3365
3365
|
...rest
|
|
3366
3366
|
} = {
|
|
3367
|
-
...defaultProps$
|
|
3367
|
+
...defaultProps$1r,
|
|
3368
3368
|
...props
|
|
3369
3369
|
};
|
|
3370
3370
|
const handleClick2 = (event) => {
|
|
@@ -3403,9 +3403,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3403
3403
|
}
|
|
3404
3404
|
);
|
|
3405
3405
|
};
|
|
3406
|
-
Cell.defaultProps = defaultProps$
|
|
3406
|
+
Cell.defaultProps = defaultProps$1r;
|
|
3407
3407
|
Cell.displayName = "NutCell";
|
|
3408
|
-
const defaultProps$
|
|
3408
|
+
const defaultProps$1q = {
|
|
3409
3409
|
...ComponentDefaults,
|
|
3410
3410
|
title: "",
|
|
3411
3411
|
description: "",
|
|
@@ -3414,7 +3414,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3414
3414
|
const classPrefix$f = "nut-cell-group";
|
|
3415
3415
|
const CellGroup = (props) => {
|
|
3416
3416
|
const { children, className, style, title, description, divider, ...rest } = {
|
|
3417
|
-
...defaultProps$
|
|
3417
|
+
...defaultProps$1q,
|
|
3418
3418
|
...props
|
|
3419
3419
|
};
|
|
3420
3420
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classNames(classPrefix$f, className), ...rest, children: [
|
|
@@ -3429,7 +3429,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3429
3429
|
)
|
|
3430
3430
|
] });
|
|
3431
3431
|
};
|
|
3432
|
-
CellGroup.defaultProps = defaultProps$
|
|
3432
|
+
CellGroup.defaultProps = defaultProps$1q;
|
|
3433
3433
|
CellGroup.displayName = "NutCellGroup";
|
|
3434
3434
|
var INFINITY = 1 / 0;
|
|
3435
3435
|
var symbolTag = "[object Symbol]";
|
|
@@ -3844,7 +3844,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3844
3844
|
errorCanvasTips: "当前环境不支持Canvas"
|
|
3845
3845
|
}
|
|
3846
3846
|
};
|
|
3847
|
-
const defaultProps$
|
|
3847
|
+
const defaultProps$1p = {
|
|
3848
3848
|
locale: zhCN
|
|
3849
3849
|
};
|
|
3850
3850
|
const defaultConfigRef = {
|
|
@@ -3867,7 +3867,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3867
3867
|
return cssVars;
|
|
3868
3868
|
}
|
|
3869
3869
|
const ConfigProvider = (props) => {
|
|
3870
|
-
const { children, ...config2 } = { ...defaultProps$
|
|
3870
|
+
const { children, ...config2 } = { ...defaultProps$1p, ...props };
|
|
3871
3871
|
const parentConfig = useConfig();
|
|
3872
3872
|
const theme = config2.theme || {};
|
|
3873
3873
|
const style = React.useMemo(
|
|
@@ -3885,12 +3885,12 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3885
3885
|
}
|
|
3886
3886
|
);
|
|
3887
3887
|
};
|
|
3888
|
-
ConfigProvider.defaultProps = defaultProps$
|
|
3888
|
+
ConfigProvider.defaultProps = defaultProps$1p;
|
|
3889
3889
|
ConfigProvider.displayName = "NutConfigProvider";
|
|
3890
3890
|
const pxCheck = (value) => {
|
|
3891
3891
|
return Number.isNaN(Number(value)) ? String(value) : `${value}px`;
|
|
3892
3892
|
};
|
|
3893
|
-
const defaultProps$
|
|
3893
|
+
const defaultProps$1o = {
|
|
3894
3894
|
...ComponentDefaults,
|
|
3895
3895
|
fit: "fill",
|
|
3896
3896
|
position: "center",
|
|
@@ -3919,21 +3919,19 @@ Check the top-level render call using <` + t + ">.");
|
|
|
3919
3919
|
onClick,
|
|
3920
3920
|
onLoad,
|
|
3921
3921
|
onError
|
|
3922
|
-
} = { ...defaultProps$
|
|
3922
|
+
} = { ...defaultProps$1o, ...props };
|
|
3923
3923
|
const [innerLoading, setInnerLoading] = React.useState(true);
|
|
3924
3924
|
const [isError, setIsError] = React.useState(false);
|
|
3925
|
-
const [_src, setSrc] = React.useState("");
|
|
3926
3925
|
const imgRef = React.useRef(null);
|
|
3927
3926
|
React.useEffect(() => {
|
|
3928
3927
|
if (imgRef.current && imgRef.current.complete && imgRef.current.naturalHeight !== 0) {
|
|
3929
3928
|
setInnerLoading(false);
|
|
3930
3929
|
} else if (src) {
|
|
3931
|
-
setSrc(src);
|
|
3932
|
-
setIsError(false);
|
|
3933
3930
|
setInnerLoading(true);
|
|
3934
3931
|
}
|
|
3935
3932
|
}, [src]);
|
|
3936
3933
|
const handleLoad = () => {
|
|
3934
|
+
setIsError(false);
|
|
3937
3935
|
setInnerLoading(false);
|
|
3938
3936
|
onLoad && onLoad();
|
|
3939
3937
|
};
|
|
@@ -4029,7 +4027,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4029
4027
|
ref: imgRef,
|
|
4030
4028
|
className: "nut-img lazyload",
|
|
4031
4029
|
style: imgStyle,
|
|
4032
|
-
"data-src":
|
|
4030
|
+
"data-src": src,
|
|
4033
4031
|
alt,
|
|
4034
4032
|
loading: "lazy",
|
|
4035
4033
|
onLoad: handleLoad,
|
|
@@ -4041,7 +4039,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4041
4039
|
ref: imgRef,
|
|
4042
4040
|
className: "nut-img",
|
|
4043
4041
|
style: imgStyle,
|
|
4044
|
-
src
|
|
4042
|
+
src,
|
|
4045
4043
|
alt,
|
|
4046
4044
|
onLoad: handleLoad,
|
|
4047
4045
|
onError: handleError
|
|
@@ -4053,7 +4051,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4053
4051
|
}
|
|
4054
4052
|
);
|
|
4055
4053
|
};
|
|
4056
|
-
Image$1.defaultProps = defaultProps$
|
|
4054
|
+
Image$1.defaultProps = defaultProps$1o;
|
|
4057
4055
|
Image$1.displayName = "NutImage";
|
|
4058
4056
|
const defaultOverlayProps = {
|
|
4059
4057
|
...ComponentDefaults,
|
|
@@ -4138,7 +4136,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4138
4136
|
Overlay.defaultProps = defaultOverlayProps;
|
|
4139
4137
|
Overlay.displayName = "NutOverlay";
|
|
4140
4138
|
const DataContext$2 = React.createContext({});
|
|
4141
|
-
const defaultProps$
|
|
4139
|
+
const defaultProps$1n = {
|
|
4142
4140
|
...ComponentDefaults,
|
|
4143
4141
|
span: "24",
|
|
4144
4142
|
offset: "0",
|
|
@@ -4146,7 +4144,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4146
4144
|
};
|
|
4147
4145
|
const Col = (props) => {
|
|
4148
4146
|
const { className, style, span, offset, children, onClick } = {
|
|
4149
|
-
...defaultProps$
|
|
4147
|
+
...defaultProps$1n,
|
|
4150
4148
|
...props
|
|
4151
4149
|
};
|
|
4152
4150
|
const [colName, setColName] = React.useState("");
|
|
@@ -4178,9 +4176,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4178
4176
|
}
|
|
4179
4177
|
);
|
|
4180
4178
|
};
|
|
4181
|
-
Col.defaultProps = defaultProps$
|
|
4179
|
+
Col.defaultProps = defaultProps$1n;
|
|
4182
4180
|
Col.displayName = "NutCol";
|
|
4183
|
-
const defaultProps$
|
|
4181
|
+
const defaultProps$1m = {
|
|
4184
4182
|
...ComponentDefaults,
|
|
4185
4183
|
contentPosition: "center",
|
|
4186
4184
|
direction: "horizontal"
|
|
@@ -4188,7 +4186,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4188
4186
|
const classPrefix$d = `nut-divider`;
|
|
4189
4187
|
const Divider = (props) => {
|
|
4190
4188
|
const { children, contentPosition, style, className, direction, ...rest } = {
|
|
4191
|
-
...defaultProps$
|
|
4189
|
+
...defaultProps$1m,
|
|
4192
4190
|
...props
|
|
4193
4191
|
};
|
|
4194
4192
|
const classes = direction === "horizontal" ? classNames({
|
|
@@ -4203,14 +4201,14 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4203
4201
|
});
|
|
4204
4202
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classes} ${className || ""}`, style, ...rest, children });
|
|
4205
4203
|
};
|
|
4206
|
-
Divider.defaultProps = defaultProps$
|
|
4204
|
+
Divider.defaultProps = defaultProps$1m;
|
|
4207
4205
|
Divider.displayName = "NutDivider";
|
|
4208
4206
|
const gridContext = {
|
|
4209
4207
|
onClick: (item, index) => {
|
|
4210
4208
|
}
|
|
4211
4209
|
};
|
|
4212
4210
|
const GridContext = React.createContext(gridContext);
|
|
4213
|
-
const defaultProps$
|
|
4211
|
+
const defaultProps$1l = {
|
|
4214
4212
|
text: "",
|
|
4215
4213
|
columns: 4,
|
|
4216
4214
|
gap: 0,
|
|
@@ -4236,7 +4234,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4236
4234
|
onClick,
|
|
4237
4235
|
...rest
|
|
4238
4236
|
} = {
|
|
4239
|
-
...defaultProps$
|
|
4237
|
+
...defaultProps$1l,
|
|
4240
4238
|
...props
|
|
4241
4239
|
};
|
|
4242
4240
|
const classPrefix2 = "nut-grid-item";
|
|
@@ -4297,9 +4295,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4297
4295
|
}
|
|
4298
4296
|
);
|
|
4299
4297
|
};
|
|
4300
|
-
GridItem.defaultProps = defaultProps$
|
|
4298
|
+
GridItem.defaultProps = defaultProps$1l;
|
|
4301
4299
|
GridItem.displayName = "NutGridItem";
|
|
4302
|
-
const defaultProps$
|
|
4300
|
+
const defaultProps$1k = {
|
|
4303
4301
|
columns: 4,
|
|
4304
4302
|
gap: 0,
|
|
4305
4303
|
center: true,
|
|
@@ -4320,7 +4318,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4320
4318
|
className,
|
|
4321
4319
|
onClick,
|
|
4322
4320
|
...rest
|
|
4323
|
-
} = { ...defaultProps$
|
|
4321
|
+
} = { ...defaultProps$1k, ...props };
|
|
4324
4322
|
const childrenDom = React.Children.toArray(children);
|
|
4325
4323
|
const classPrefix2 = "nut-grid";
|
|
4326
4324
|
const rootClass = () => {
|
|
@@ -4350,18 +4348,18 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4350
4348
|
});
|
|
4351
4349
|
}) }) });
|
|
4352
4350
|
};
|
|
4353
|
-
Grid.defaultProps = defaultProps$
|
|
4351
|
+
Grid.defaultProps = defaultProps$1k;
|
|
4354
4352
|
Grid.displayName = "NutGrid";
|
|
4355
4353
|
Grid.Item = GridItem;
|
|
4356
|
-
const defaultProps$
|
|
4354
|
+
const defaultProps$1j = {};
|
|
4357
4355
|
const Layout = (props) => {
|
|
4358
|
-
({ ...defaultProps$
|
|
4356
|
+
({ ...defaultProps$1j, ...props });
|
|
4359
4357
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-layout", children: "Layout" });
|
|
4360
4358
|
};
|
|
4361
|
-
Layout.defaultProps = defaultProps$
|
|
4359
|
+
Layout.defaultProps = defaultProps$1j;
|
|
4362
4360
|
Layout.displayName = "NutLayout";
|
|
4363
4361
|
const classPrefix$c = "nut-row";
|
|
4364
|
-
const defaultProps$
|
|
4362
|
+
const defaultProps$1i = {
|
|
4365
4363
|
...ComponentDefaults,
|
|
4366
4364
|
type: "",
|
|
4367
4365
|
justify: "start",
|
|
@@ -4381,7 +4379,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4381
4379
|
gutter,
|
|
4382
4380
|
onClick
|
|
4383
4381
|
} = {
|
|
4384
|
-
...defaultProps$
|
|
4382
|
+
...defaultProps$1i,
|
|
4385
4383
|
...props
|
|
4386
4384
|
};
|
|
4387
4385
|
const getClass = (prefix2, type22) => {
|
|
@@ -4413,7 +4411,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4413
4411
|
children
|
|
4414
4412
|
) });
|
|
4415
4413
|
};
|
|
4416
|
-
Row.defaultProps = defaultProps$
|
|
4414
|
+
Row.defaultProps = defaultProps$1i;
|
|
4417
4415
|
Row.displayName = "NutRow";
|
|
4418
4416
|
const canUseDom = !!(typeof window !== "undefined" && typeof document !== "undefined" && window.document && window.document.createElement);
|
|
4419
4417
|
const defaultRoot = canUseDom ? window : void 0;
|
|
@@ -4488,7 +4486,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4488
4486
|
stop2.current = true;
|
|
4489
4487
|
};
|
|
4490
4488
|
}
|
|
4491
|
-
const defaultProps$
|
|
4489
|
+
const defaultProps$1h = {
|
|
4492
4490
|
...ComponentDefaults,
|
|
4493
4491
|
position: "top",
|
|
4494
4492
|
threshold: 0,
|
|
@@ -4506,7 +4504,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4506
4504
|
threshold,
|
|
4507
4505
|
onChange,
|
|
4508
4506
|
...rest
|
|
4509
|
-
} = { ...defaultProps$
|
|
4507
|
+
} = { ...defaultProps$1h, ...props };
|
|
4510
4508
|
const stickyRef = React.useRef(null);
|
|
4511
4509
|
const rootRef = React.useRef(null);
|
|
4512
4510
|
const [isFixed, setIsFixed] = React.useState(false);
|
|
@@ -4622,9 +4620,9 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4622
4620
|
}
|
|
4623
4621
|
);
|
|
4624
4622
|
};
|
|
4625
|
-
Sticky.defaultProps = defaultProps$
|
|
4623
|
+
Sticky.defaultProps = defaultProps$1h;
|
|
4626
4624
|
Sticky.displayName = "NutSticky";
|
|
4627
|
-
const defaultProps$
|
|
4625
|
+
const defaultProps$1g = {
|
|
4628
4626
|
...ComponentDefaults,
|
|
4629
4627
|
target: "",
|
|
4630
4628
|
threshold: 200,
|
|
@@ -4642,7 +4640,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4642
4640
|
style,
|
|
4643
4641
|
onClick
|
|
4644
4642
|
} = {
|
|
4645
|
-
...defaultProps$
|
|
4643
|
+
...defaultProps$1g,
|
|
4646
4644
|
...props
|
|
4647
4645
|
};
|
|
4648
4646
|
const classPrefix2 = "nut-backtop";
|
|
@@ -4740,7 +4738,7 @@ Check the top-level render call using <` + t + ">.");
|
|
|
4740
4738
|
}
|
|
4741
4739
|
);
|
|
4742
4740
|
};
|
|
4743
|
-
BackTop.defaultProps = defaultProps$
|
|
4741
|
+
BackTop.defaultProps = defaultProps$1g;
|
|
4744
4742
|
BackTop.displayName = "NutBackTop";
|
|
4745
4743
|
function clamp$1(v, min, max) {
|
|
4746
4744
|
return Math.max(min, Math.min(v, max));
|
|
@@ -9858,7 +9856,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9858
9856
|
});
|
|
9859
9857
|
const animated = host.animated;
|
|
9860
9858
|
const elevatorContext = React.createContext({});
|
|
9861
|
-
const defaultProps$
|
|
9859
|
+
const defaultProps$1f = {
|
|
9862
9860
|
...ComponentDefaults,
|
|
9863
9861
|
height: "200px",
|
|
9864
9862
|
floorKey: "title",
|
|
@@ -9882,7 +9880,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
9882
9880
|
children,
|
|
9883
9881
|
...rest
|
|
9884
9882
|
} = {
|
|
9885
|
-
...defaultProps$
|
|
9883
|
+
...defaultProps$1f,
|
|
9886
9884
|
...props
|
|
9887
9885
|
};
|
|
9888
9886
|
const classPrefix2 = "nut-elevator";
|
|
@@ -10065,10 +10063,10 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10065
10063
|
) })
|
|
10066
10064
|
] });
|
|
10067
10065
|
};
|
|
10068
|
-
Elevator.defaultProps = defaultProps$
|
|
10066
|
+
Elevator.defaultProps = defaultProps$1f;
|
|
10069
10067
|
Elevator.displayName = "NutElevator";
|
|
10070
10068
|
Elevator.Context = elevatorContext;
|
|
10071
|
-
const defaultProps$
|
|
10069
|
+
const defaultProps$1e = {
|
|
10072
10070
|
...ComponentDefaults,
|
|
10073
10071
|
activeText: "",
|
|
10074
10072
|
inactiveText: "",
|
|
@@ -10096,7 +10094,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10096
10094
|
content,
|
|
10097
10095
|
...rest
|
|
10098
10096
|
} = {
|
|
10099
|
-
...defaultProps$
|
|
10097
|
+
...defaultProps$1e,
|
|
10100
10098
|
...props
|
|
10101
10099
|
};
|
|
10102
10100
|
const classPrefix2 = "nut-fixednav";
|
|
@@ -10155,9 +10153,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10155
10153
|
}
|
|
10156
10154
|
);
|
|
10157
10155
|
};
|
|
10158
|
-
FixedNav.defaultProps = defaultProps$
|
|
10156
|
+
FixedNav.defaultProps = defaultProps$1e;
|
|
10159
10157
|
FixedNav.displayName = "NutFixedNav";
|
|
10160
|
-
const defaultProps$
|
|
10158
|
+
const defaultProps$1d = {
|
|
10161
10159
|
...ComponentDefaults,
|
|
10162
10160
|
left: "",
|
|
10163
10161
|
right: "",
|
|
@@ -10180,7 +10178,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10180
10178
|
zIndex,
|
|
10181
10179
|
onClickBack
|
|
10182
10180
|
} = {
|
|
10183
|
-
...defaultProps$
|
|
10181
|
+
...defaultProps$1d,
|
|
10184
10182
|
...props
|
|
10185
10183
|
};
|
|
10186
10184
|
const classPrefix2 = "nut-navbar";
|
|
@@ -10224,7 +10222,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
10224
10222
|
const cls = classNames(classPrefix2, classes, className);
|
|
10225
10223
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: fixed && placeholder ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}--placeholder`, children: renderWrapper() }) : renderWrapper() });
|
|
10226
10224
|
};
|
|
10227
|
-
NavBar.defaultProps = defaultProps$
|
|
10225
|
+
NavBar.defaultProps = defaultProps$1d;
|
|
10228
10226
|
NavBar.displayName = "NutNavBar";
|
|
10229
10227
|
function _extends$1() {
|
|
10230
10228
|
_extends$1 = Object.assign ? Object.assign.bind() : function(target) {
|
|
@@ -11967,7 +11965,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
11967
11965
|
onExited: propTypesExports.func
|
|
11968
11966
|
}) : {};
|
|
11969
11967
|
const CSSTransition$1 = CSSTransition;
|
|
11970
|
-
const defaultProps$
|
|
11968
|
+
const defaultProps$1c = {
|
|
11971
11969
|
...ComponentDefaults,
|
|
11972
11970
|
position: "center",
|
|
11973
11971
|
transition: "",
|
|
@@ -12146,7 +12144,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12146
12144
|
}, [position, transition]);
|
|
12147
12145
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: renderToContainer(portal, renderNode()) });
|
|
12148
12146
|
};
|
|
12149
|
-
Popup.defaultProps = defaultProps$
|
|
12147
|
+
Popup.defaultProps = defaultProps$1c;
|
|
12150
12148
|
Popup.displayName = "NutPopup";
|
|
12151
12149
|
const handleClick = (e) => {
|
|
12152
12150
|
e.stopPropagation();
|
|
@@ -12162,7 +12160,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12162
12160
|
}
|
|
12163
12161
|
};
|
|
12164
12162
|
const OffsetContext = React.createContext(20);
|
|
12165
|
-
const defaultProps$
|
|
12163
|
+
const defaultProps$1b = {
|
|
12166
12164
|
showhead: false,
|
|
12167
12165
|
position: "left",
|
|
12168
12166
|
width: "80%"
|
|
@@ -12179,7 +12177,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12179
12177
|
onClose,
|
|
12180
12178
|
...rest
|
|
12181
12179
|
} = {
|
|
12182
|
-
...defaultProps$
|
|
12180
|
+
...defaultProps$1b,
|
|
12183
12181
|
...props
|
|
12184
12182
|
};
|
|
12185
12183
|
const offset = props.offset ? Number(props.offset) : 20;
|
|
@@ -12215,7 +12213,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12215
12213
|
}
|
|
12216
12214
|
);
|
|
12217
12215
|
};
|
|
12218
|
-
SideNavBar.defaultProps = defaultProps$
|
|
12216
|
+
SideNavBar.defaultProps = defaultProps$1b;
|
|
12219
12217
|
SideNavBar.displayName = "NutSideNavBar";
|
|
12220
12218
|
const SideNavBarItem = (props) => {
|
|
12221
12219
|
const { title, key, children, onClick, ...rest } = props;
|
|
@@ -12233,12 +12231,12 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12233
12231
|
}
|
|
12234
12232
|
);
|
|
12235
12233
|
};
|
|
12236
|
-
const defaultProps$
|
|
12234
|
+
const defaultProps$1a = {
|
|
12237
12235
|
open: true
|
|
12238
12236
|
};
|
|
12239
12237
|
const SubSideNavBar = (props) => {
|
|
12240
12238
|
const { title, key, children, onClick, open, ...rest } = {
|
|
12241
|
-
...defaultProps$
|
|
12239
|
+
...defaultProps$1a,
|
|
12242
12240
|
...props
|
|
12243
12241
|
};
|
|
12244
12242
|
const offset = React.useContext(OffsetContext);
|
|
@@ -12312,7 +12310,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12312
12310
|
}
|
|
12313
12311
|
return [uncontrolled, handleUncontrolledChange];
|
|
12314
12312
|
}
|
|
12315
|
-
const defaultProps$
|
|
12313
|
+
const defaultProps$19 = {
|
|
12316
12314
|
...ComponentDefaults,
|
|
12317
12315
|
value: "",
|
|
12318
12316
|
dot: false,
|
|
@@ -12323,7 +12321,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12323
12321
|
};
|
|
12324
12322
|
const Badge = (props) => {
|
|
12325
12323
|
const { className, style, value, max, children, dot, top, right, color } = {
|
|
12326
|
-
...defaultProps$
|
|
12324
|
+
...defaultProps$19,
|
|
12327
12325
|
...props
|
|
12328
12326
|
};
|
|
12329
12327
|
const classPrefix2 = "nut-badge";
|
|
@@ -12354,9 +12352,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12354
12352
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: contentClasses, style: getStyle(), children: content() })
|
|
12355
12353
|
] });
|
|
12356
12354
|
};
|
|
12357
|
-
Badge.defaultProps = defaultProps$
|
|
12355
|
+
Badge.defaultProps = defaultProps$19;
|
|
12358
12356
|
Badge.displayName = "NutBadge";
|
|
12359
|
-
const defaultProps$
|
|
12357
|
+
const defaultProps$18 = {
|
|
12360
12358
|
...ComponentDefaults,
|
|
12361
12359
|
title: "",
|
|
12362
12360
|
icon: null,
|
|
@@ -12378,7 +12376,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12378
12376
|
handleClick: handleClick2,
|
|
12379
12377
|
...rest
|
|
12380
12378
|
} = {
|
|
12381
|
-
...defaultProps$
|
|
12379
|
+
...defaultProps$18,
|
|
12382
12380
|
...props
|
|
12383
12381
|
};
|
|
12384
12382
|
const classPrefix2 = "nut-tabbar-item";
|
|
@@ -12405,7 +12403,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12405
12403
|
}
|
|
12406
12404
|
);
|
|
12407
12405
|
};
|
|
12408
|
-
const defaultProps$
|
|
12406
|
+
const defaultProps$17 = {
|
|
12409
12407
|
...ComponentDefaults,
|
|
12410
12408
|
defaultValue: 0,
|
|
12411
12409
|
fixed: false,
|
|
@@ -12428,7 +12426,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12428
12426
|
style,
|
|
12429
12427
|
onSwitch
|
|
12430
12428
|
} = {
|
|
12431
|
-
...defaultProps$
|
|
12429
|
+
...defaultProps$17,
|
|
12432
12430
|
...props
|
|
12433
12431
|
};
|
|
12434
12432
|
const classPrefix2 = "nut-tabbar";
|
|
@@ -12465,17 +12463,17 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12465
12463
|
}
|
|
12466
12464
|
);
|
|
12467
12465
|
};
|
|
12468
|
-
Tabbar.defaultProps = defaultProps$
|
|
12466
|
+
Tabbar.defaultProps = defaultProps$17;
|
|
12469
12467
|
Tabbar.displayName = "NutTabbar";
|
|
12470
12468
|
Tabbar.Item = TabbarItem;
|
|
12471
|
-
const defaultProps$
|
|
12469
|
+
const defaultProps$16 = {
|
|
12472
12470
|
title: "",
|
|
12473
12471
|
value: "",
|
|
12474
12472
|
disabled: false
|
|
12475
12473
|
};
|
|
12476
12474
|
const TabPane = (props) => {
|
|
12477
12475
|
const { children, autoHeightClassName, className, disabled } = {
|
|
12478
|
-
...defaultProps$
|
|
12476
|
+
...defaultProps$16,
|
|
12479
12477
|
...props
|
|
12480
12478
|
};
|
|
12481
12479
|
const classPrefix2 = "nut-tabpane";
|
|
@@ -12502,7 +12500,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12502
12500
|
}
|
|
12503
12501
|
}
|
|
12504
12502
|
const requestAniFrame$1 = requestAniFrame();
|
|
12505
|
-
const defaultProps$
|
|
12503
|
+
const defaultProps$15 = {
|
|
12506
12504
|
...ComponentDefaults,
|
|
12507
12505
|
tabStyle: {},
|
|
12508
12506
|
activeColor: "",
|
|
@@ -12528,7 +12526,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12528
12526
|
autoHeight,
|
|
12529
12527
|
...rest
|
|
12530
12528
|
} = {
|
|
12531
|
-
...defaultProps$
|
|
12529
|
+
...defaultProps$15,
|
|
12532
12530
|
...props
|
|
12533
12531
|
};
|
|
12534
12532
|
const [value, setValue] = usePropsValue({
|
|
@@ -12589,6 +12587,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12589
12587
|
return titles2;
|
|
12590
12588
|
};
|
|
12591
12589
|
const titles = React.useRef(getTitles());
|
|
12590
|
+
React.useEffect(() => {
|
|
12591
|
+
titles.current = getTitles();
|
|
12592
|
+
let current = "";
|
|
12593
|
+
titles.current.forEach((title2) => {
|
|
12594
|
+
if (title2.value === value) {
|
|
12595
|
+
current = value;
|
|
12596
|
+
}
|
|
12597
|
+
});
|
|
12598
|
+
setValue(current);
|
|
12599
|
+
}, [children]);
|
|
12592
12600
|
const classes = classNames(
|
|
12593
12601
|
classPrefix$a,
|
|
12594
12602
|
`${classPrefix$a}--${direction}`,
|
|
@@ -12683,7 +12691,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12683
12691
|
}) }) })
|
|
12684
12692
|
] });
|
|
12685
12693
|
};
|
|
12686
|
-
Tabs.defaultProps = defaultProps$
|
|
12694
|
+
Tabs.defaultProps = defaultProps$15;
|
|
12687
12695
|
Tabs.displayName = "NutTabs";
|
|
12688
12696
|
Tabs.TabPane = TabPane;
|
|
12689
12697
|
var classnameExports = {};
|
|
@@ -12806,7 +12814,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12806
12814
|
}
|
|
12807
12815
|
})(classname);
|
|
12808
12816
|
const cn = classnameExports.withNaming({ n: "nut-", e: "__", m: "--", v: "-" });
|
|
12809
|
-
const defaultProps$
|
|
12817
|
+
const defaultProps$14 = {
|
|
12810
12818
|
type: "custom",
|
|
12811
12819
|
existAddress: [],
|
|
12812
12820
|
defaultIcon: null,
|
|
@@ -12828,7 +12836,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12828
12836
|
onClose,
|
|
12829
12837
|
onSwitchModule,
|
|
12830
12838
|
...rest
|
|
12831
|
-
} = { ...defaultProps$
|
|
12839
|
+
} = { ...defaultProps$14, ...props };
|
|
12832
12840
|
const b = cn("address");
|
|
12833
12841
|
const selectedExist = (item) => {
|
|
12834
12842
|
const copyExistAdd = existAddress;
|
|
@@ -12870,7 +12878,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12870
12878
|
isShowCustomAddress && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("choose-other"), onClick: onSwitch, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: b("choose-other-btn"), children: customAndExistTitle || locale.address.chooseAnotherAddress }) })
|
|
12871
12879
|
] });
|
|
12872
12880
|
};
|
|
12873
|
-
const defaultProps$
|
|
12881
|
+
const defaultProps$13 = {
|
|
12874
12882
|
modelValue: [],
|
|
12875
12883
|
type: "custom",
|
|
12876
12884
|
province: [],
|
|
@@ -12895,7 +12903,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
12895
12903
|
onClose,
|
|
12896
12904
|
...rest
|
|
12897
12905
|
} = {
|
|
12898
|
-
...defaultProps$
|
|
12906
|
+
...defaultProps$13,
|
|
12899
12907
|
...props
|
|
12900
12908
|
};
|
|
12901
12909
|
const b = cn("address");
|
|
@@ -13064,28 +13072,28 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13064
13072
|
nextAreaList(item);
|
|
13065
13073
|
};
|
|
13066
13074
|
React.useEffect(() => {
|
|
13067
|
-
const { province: province2 } = { ...defaultProps$
|
|
13075
|
+
const { province: province2 } = { ...defaultProps$13, ...props };
|
|
13068
13076
|
setRegionList({
|
|
13069
13077
|
...regionList,
|
|
13070
13078
|
province: isCustom2() ? transformData(province2) : province2
|
|
13071
13079
|
});
|
|
13072
13080
|
}, [province]);
|
|
13073
13081
|
React.useEffect(() => {
|
|
13074
|
-
const { city: city2 } = { ...defaultProps$
|
|
13082
|
+
const { city: city2 } = { ...defaultProps$13, ...props };
|
|
13075
13083
|
setRegionList({
|
|
13076
13084
|
...regionList,
|
|
13077
13085
|
city: isCustom2() ? transformData(city2) : city2
|
|
13078
13086
|
});
|
|
13079
13087
|
}, [city]);
|
|
13080
13088
|
React.useEffect(() => {
|
|
13081
|
-
const { country: country2 } = { ...defaultProps$
|
|
13089
|
+
const { country: country2 } = { ...defaultProps$13, ...props };
|
|
13082
13090
|
setRegionList({
|
|
13083
13091
|
...regionList,
|
|
13084
13092
|
country: isCustom2() ? transformData(country2) : country2
|
|
13085
13093
|
});
|
|
13086
13094
|
}, [country]);
|
|
13087
13095
|
React.useEffect(() => {
|
|
13088
|
-
const { town: town2 } = { ...defaultProps$
|
|
13096
|
+
const { town: town2 } = { ...defaultProps$13, ...props };
|
|
13089
13097
|
setRegionList({
|
|
13090
13098
|
...regionList,
|
|
13091
13099
|
town: isCustom2() ? transformData(town2) : town2
|
|
@@ -13160,7 +13168,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13160
13168
|
) })
|
|
13161
13169
|
] });
|
|
13162
13170
|
};
|
|
13163
|
-
const defaultProps$
|
|
13171
|
+
const defaultProps$12 = {
|
|
13164
13172
|
...ComponentDefaults,
|
|
13165
13173
|
modelValue: false,
|
|
13166
13174
|
modelSelect: [],
|
|
@@ -13211,7 +13219,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13211
13219
|
className,
|
|
13212
13220
|
...rest
|
|
13213
13221
|
} = {
|
|
13214
|
-
...defaultProps$
|
|
13222
|
+
...defaultProps$12,
|
|
13215
13223
|
...props
|
|
13216
13224
|
};
|
|
13217
13225
|
const b = cn("address");
|
|
@@ -13369,7 +13377,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13369
13377
|
}
|
|
13370
13378
|
) });
|
|
13371
13379
|
};
|
|
13372
|
-
Address.defaultProps = defaultProps$
|
|
13380
|
+
Address.defaultProps = defaultProps$12;
|
|
13373
13381
|
Address.displayName = "NutAddress";
|
|
13374
13382
|
const Utils = {
|
|
13375
13383
|
/**
|
|
@@ -13489,7 +13497,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13489
13497
|
return false;
|
|
13490
13498
|
}
|
|
13491
13499
|
};
|
|
13492
|
-
const defaultProps$
|
|
13500
|
+
const defaultProps$11 = {
|
|
13493
13501
|
type: "one",
|
|
13494
13502
|
isAutoBackFill: false,
|
|
13495
13503
|
poppable: true,
|
|
@@ -13541,7 +13549,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
13541
13549
|
onUpdate,
|
|
13542
13550
|
onSelected,
|
|
13543
13551
|
onYearMonthChange
|
|
13544
|
-
} = { ...defaultProps$
|
|
13552
|
+
} = { ...defaultProps$11, ...props };
|
|
13545
13553
|
const weeks = locale.calendaritem.weekdays;
|
|
13546
13554
|
const [yearMonthTitle, setYearMonthTitle] = React.useState("");
|
|
13547
13555
|
const [monthsData, setMonthsData] = React.useState([]);
|
|
@@ -14137,9 +14145,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14137
14145
|
poppable && !isAutoBackFill ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-calendar-footer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "calendar-confirm-btn", onClick: confirm2, children: confirmText || locale.confirm }) }) : ""
|
|
14138
14146
|
] }) });
|
|
14139
14147
|
});
|
|
14140
|
-
CalendarItem.defaultProps = defaultProps$
|
|
14148
|
+
CalendarItem.defaultProps = defaultProps$11;
|
|
14141
14149
|
CalendarItem.displayName = "NutCalendarItem";
|
|
14142
|
-
const defaultProps
|
|
14150
|
+
const defaultProps$10 = {
|
|
14143
14151
|
type: "one",
|
|
14144
14152
|
isAutoBackFill: false,
|
|
14145
14153
|
poppable: true,
|
|
@@ -14194,7 +14202,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14194
14202
|
onChoose,
|
|
14195
14203
|
onSelected,
|
|
14196
14204
|
onYearMonthChange
|
|
14197
|
-
} = { ...defaultProps
|
|
14205
|
+
} = { ...defaultProps$10, ...props };
|
|
14198
14206
|
const calendarRef = React.useRef(null);
|
|
14199
14207
|
const close = () => {
|
|
14200
14208
|
onClose && onClose();
|
|
@@ -14264,9 +14272,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14264
14272
|
}
|
|
14265
14273
|
) : renderItem() });
|
|
14266
14274
|
});
|
|
14267
|
-
Calendar.defaultProps = defaultProps
|
|
14275
|
+
Calendar.defaultProps = defaultProps$10;
|
|
14268
14276
|
Calendar.displayName = "NutCalendar";
|
|
14269
|
-
const defaultProps
|
|
14277
|
+
const defaultProps$$ = {
|
|
14270
14278
|
data: {
|
|
14271
14279
|
text: "",
|
|
14272
14280
|
value: "",
|
|
@@ -14277,32 +14285,37 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14277
14285
|
},
|
|
14278
14286
|
activeColor: "",
|
|
14279
14287
|
checked: false,
|
|
14280
|
-
|
|
14288
|
+
activeIcon: "checklist",
|
|
14281
14289
|
chooseItem: () => {
|
|
14282
14290
|
}
|
|
14283
14291
|
};
|
|
14284
14292
|
const InternalCascaderItem = (props, ref) => {
|
|
14285
|
-
const { data, checked,
|
|
14286
|
-
...defaultProps
|
|
14293
|
+
const { data, checked, activeIcon, chooseItem, activeColor } = {
|
|
14294
|
+
...defaultProps$$,
|
|
14287
14295
|
...props
|
|
14288
14296
|
};
|
|
14289
|
-
const
|
|
14297
|
+
const classPrefix2 = "nut-cascader-item";
|
|
14290
14298
|
const classes = classNames(
|
|
14291
14299
|
{
|
|
14292
14300
|
active: checked,
|
|
14293
14301
|
disabled: data.disabled
|
|
14294
14302
|
},
|
|
14295
|
-
|
|
14303
|
+
classPrefix2
|
|
14296
14304
|
);
|
|
14297
14305
|
const classesTitle = classNames({
|
|
14298
|
-
[`${
|
|
14306
|
+
[`${classPrefix2}__title`]: true
|
|
14299
14307
|
});
|
|
14300
14308
|
const renderIcon = () => {
|
|
14301
14309
|
if (checked) {
|
|
14302
|
-
if (React.isValidElement(
|
|
14303
|
-
return
|
|
14310
|
+
if (React.isValidElement(activeIcon)) {
|
|
14311
|
+
return activeIcon;
|
|
14304
14312
|
}
|
|
14305
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14313
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14314
|
+
x$c,
|
|
14315
|
+
{
|
|
14316
|
+
className: `${checked ? `${classPrefix2}__icon-check` : ""}`
|
|
14317
|
+
}
|
|
14318
|
+
);
|
|
14306
14319
|
}
|
|
14307
14320
|
return null;
|
|
14308
14321
|
};
|
|
@@ -14322,7 +14335,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14322
14335
|
);
|
|
14323
14336
|
};
|
|
14324
14337
|
const CascaderItem = React.forwardRef(InternalCascaderItem);
|
|
14325
|
-
CascaderItem.defaultProps = defaultProps
|
|
14338
|
+
CascaderItem.defaultProps = defaultProps$$;
|
|
14326
14339
|
CascaderItem.displayName = "NutCascaderItem";
|
|
14327
14340
|
const formatTree = (tree, parent, config2) => tree.map((node) => {
|
|
14328
14341
|
const {
|
|
@@ -14460,26 +14473,22 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14460
14473
|
}
|
|
14461
14474
|
}
|
|
14462
14475
|
const Tree$1 = Tree;
|
|
14463
|
-
const defaultProps$
|
|
14464
|
-
|
|
14465
|
-
style: {},
|
|
14476
|
+
const defaultProps$_ = {
|
|
14477
|
+
...ComponentDefaults,
|
|
14466
14478
|
activeColor: "",
|
|
14467
|
-
|
|
14468
|
-
|
|
14469
|
-
poppable: true,
|
|
14479
|
+
activeIcon: "checklist",
|
|
14480
|
+
popup: true,
|
|
14470
14481
|
visible: false,
|
|
14471
14482
|
options: [],
|
|
14472
14483
|
value: [],
|
|
14473
14484
|
title: "",
|
|
14474
|
-
textKey: "text",
|
|
14475
|
-
|
|
14476
|
-
childrenKey: "children",
|
|
14477
|
-
convertConfig: {},
|
|
14485
|
+
optionKey: { textKey: "text", valueKey: "value", childrenKey: "children" },
|
|
14486
|
+
format: {},
|
|
14478
14487
|
closeable: false,
|
|
14479
14488
|
closeIconPosition: "top-right",
|
|
14480
14489
|
closeIcon: "close",
|
|
14481
14490
|
lazy: false,
|
|
14482
|
-
|
|
14491
|
+
onLoad: () => {
|
|
14483
14492
|
},
|
|
14484
14493
|
onClose: () => {
|
|
14485
14494
|
},
|
|
@@ -14493,28 +14502,25 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14493
14502
|
const {
|
|
14494
14503
|
className,
|
|
14495
14504
|
style,
|
|
14496
|
-
|
|
14497
|
-
poppable,
|
|
14505
|
+
popup,
|
|
14498
14506
|
visible,
|
|
14499
14507
|
options: options2,
|
|
14500
14508
|
value,
|
|
14501
14509
|
title,
|
|
14502
|
-
|
|
14503
|
-
|
|
14504
|
-
childrenKey,
|
|
14505
|
-
convertConfig: convertConfig2,
|
|
14510
|
+
optionKey: optionKey2,
|
|
14511
|
+
format: format2,
|
|
14506
14512
|
closeable,
|
|
14507
14513
|
closeIconPosition,
|
|
14508
14514
|
closeIcon,
|
|
14509
14515
|
lazy,
|
|
14510
|
-
|
|
14516
|
+
onLoad,
|
|
14511
14517
|
onClose,
|
|
14512
14518
|
onChange,
|
|
14513
14519
|
onPathChange
|
|
14514
|
-
} = { ...defaultProps$
|
|
14520
|
+
} = { ...defaultProps$_, ...props };
|
|
14515
14521
|
const [tabvalue, setTabvalue] = React.useState("c1");
|
|
14516
14522
|
const [optionsData, setOptionsData] = React.useState([]);
|
|
14517
|
-
const isLazy = () => state.configs.lazy && Boolean(state.configs.
|
|
14523
|
+
const isLazy = () => state.configs.lazy && Boolean(state.configs.onLoad);
|
|
14518
14524
|
const [state] = React.useState({
|
|
14519
14525
|
optionsData: [],
|
|
14520
14526
|
panes: [
|
|
@@ -14532,44 +14538,38 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14532
14538
|
currentProcessNode: [],
|
|
14533
14539
|
configs: {
|
|
14534
14540
|
lazy,
|
|
14535
|
-
|
|
14536
|
-
|
|
14537
|
-
|
|
14538
|
-
childrenKey,
|
|
14539
|
-
convertConfig: convertConfig2
|
|
14541
|
+
onLoad,
|
|
14542
|
+
optionKey: optionKey2,
|
|
14543
|
+
format: format2
|
|
14540
14544
|
},
|
|
14541
14545
|
lazyLoadMap: /* @__PURE__ */ new Map()
|
|
14542
14546
|
});
|
|
14543
|
-
const
|
|
14544
|
-
const classes = classNames(b(""));
|
|
14547
|
+
const classPrefix2 = classNames(`nut-cascader`);
|
|
14545
14548
|
const classesPane = classNames({
|
|
14546
|
-
[`${
|
|
14549
|
+
[`${classPrefix2}-pane`]: true
|
|
14547
14550
|
});
|
|
14548
14551
|
React.useEffect(() => {
|
|
14549
14552
|
initData();
|
|
14550
|
-
}, []);
|
|
14553
|
+
}, [options2]);
|
|
14551
14554
|
React.useEffect(() => {
|
|
14552
14555
|
if (value !== state.innerValue) {
|
|
14553
14556
|
state.innerValue = value;
|
|
14554
14557
|
}
|
|
14555
14558
|
}, [value]);
|
|
14556
|
-
React.useEffect(() => {
|
|
14557
|
-
initData();
|
|
14558
|
-
}, [options2]);
|
|
14559
14559
|
const initData = async () => {
|
|
14560
14560
|
state.lazyLoadMap.clear();
|
|
14561
|
-
if (
|
|
14561
|
+
if (format2 && Object.keys(format2).length > 0) {
|
|
14562
14562
|
state.optionsData = convertListToOptions(
|
|
14563
14563
|
options2,
|
|
14564
|
-
|
|
14564
|
+
format2
|
|
14565
14565
|
);
|
|
14566
14566
|
} else {
|
|
14567
14567
|
state.optionsData = options2;
|
|
14568
14568
|
}
|
|
14569
14569
|
state.tree = new Tree$1(state.optionsData, {
|
|
14570
|
-
value: state.configs.valueKey,
|
|
14571
|
-
text: state.configs.textKey,
|
|
14572
|
-
children: state.configs.childrenKey
|
|
14570
|
+
value: state.configs.optionKey.valueKey,
|
|
14571
|
+
text: state.configs.optionKey.textKey,
|
|
14572
|
+
children: state.configs.optionKey.childrenKey
|
|
14573
14573
|
});
|
|
14574
14574
|
if (isLazy() && !state.tree.nodes.length) {
|
|
14575
14575
|
await invokeLazyLoad({
|
|
@@ -14635,7 +14635,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14635
14635
|
if (!node) {
|
|
14636
14636
|
return;
|
|
14637
14637
|
}
|
|
14638
|
-
if (!state.configs.
|
|
14638
|
+
if (!state.configs.onLoad) {
|
|
14639
14639
|
node.leaf = true;
|
|
14640
14640
|
return;
|
|
14641
14641
|
}
|
|
@@ -14648,7 +14648,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14648
14648
|
if (!lazyLoadPromise) {
|
|
14649
14649
|
lazyLoadPromise = new Promise((resolve) => {
|
|
14650
14650
|
var _a2, _b;
|
|
14651
|
-
(_b = (_a2 = state.configs).
|
|
14651
|
+
(_b = (_a2 = state.configs).onLoad) == null ? void 0 : _b.call(_a2, node, resolve);
|
|
14652
14652
|
});
|
|
14653
14653
|
state.lazyLoadMap.set(node, lazyLoadPromise);
|
|
14654
14654
|
}
|
|
@@ -14695,8 +14695,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14695
14695
|
selectedNode: null,
|
|
14696
14696
|
paneKey: `c${state.tabsCursor + 1}`
|
|
14697
14697
|
});
|
|
14698
|
-
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
14699
14698
|
setOptionsData(state.panes);
|
|
14699
|
+
setTabvalue(`c${state.tabsCursor + 1}`);
|
|
14700
14700
|
if (!type2) {
|
|
14701
14701
|
const pathNodes = state.panes.map((item) => item.selectedNode);
|
|
14702
14702
|
const optionParams = pathNodes.map((item) => item == null ? void 0 : item.value);
|
|
@@ -14716,8 +14716,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14716
14716
|
setOptionsData(state.panes);
|
|
14717
14717
|
};
|
|
14718
14718
|
const renderItem = () => {
|
|
14719
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${
|
|
14720
|
-
|
|
14719
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2} ${className}`, style, children: [
|
|
14720
|
+
popup && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-cascader__title", children: title }),
|
|
14721
14721
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14722
14722
|
Tabs,
|
|
14723
14723
|
{
|
|
@@ -14732,27 +14732,21 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14732
14732
|
setTabvalue(pane.paneKey);
|
|
14733
14733
|
state.tabsCursor = index;
|
|
14734
14734
|
},
|
|
14735
|
-
className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "active" : ""}`,
|
|
14735
|
+
className: `nut-tabs__titles-item ${tabvalue === pane.paneKey ? "nut-tabs__titles-item--active" : ""}`,
|
|
14736
14736
|
children: [
|
|
14737
14737
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "nut-tabs__titles-item__text", children: [
|
|
14738
14738
|
!state.initLoading && state.panes.length && ((_a2 = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _a2.text),
|
|
14739
14739
|
!state.initLoading && state.panes.length && !((_b = pane == null ? void 0 : pane.selectedNode) == null ? void 0 : _b.text) && "请选择",
|
|
14740
14740
|
!(!state.initLoading && state.panes.length) && "Loading..."
|
|
14741
14741
|
] }),
|
|
14742
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14743
|
-
"span",
|
|
14744
|
-
{
|
|
14745
|
-
className: "nut-tabs__titles-item__line",
|
|
14746
|
-
style: { background: tabsColor }
|
|
14747
|
-
}
|
|
14748
|
-
)
|
|
14742
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "nut-tabs__titles-item__line" })
|
|
14749
14743
|
]
|
|
14750
14744
|
},
|
|
14751
14745
|
pane.paneKey
|
|
14752
14746
|
);
|
|
14753
14747
|
});
|
|
14754
14748
|
},
|
|
14755
|
-
children: !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { value: pane.paneKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane, children: pane.nodes && pane.nodes.map((node, index) => {
|
|
14749
|
+
children: !state.initLoading && state.panes.length ? optionsData.map((pane) => /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { value: pane.paneKey, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane, children: pane.nodes && pane.nodes.map((node, index) => {
|
|
14756
14750
|
var _a2;
|
|
14757
14751
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14758
14752
|
CascaderItem,
|
|
@@ -14764,15 +14758,14 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14764
14758
|
},
|
|
14765
14759
|
index
|
|
14766
14760
|
);
|
|
14767
|
-
}) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
|
|
14761
|
+
}) }) }, pane.paneKey)) : /* @__PURE__ */ jsxRuntimeExports.jsx(Tabs.TabPane, { children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: classesPane }) })
|
|
14768
14762
|
}
|
|
14769
14763
|
)
|
|
14770
14764
|
] });
|
|
14771
14765
|
};
|
|
14772
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children:
|
|
14766
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: popup ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
14773
14767
|
Popup,
|
|
14774
14768
|
{
|
|
14775
|
-
className: "cascadar-popup",
|
|
14776
14769
|
visible,
|
|
14777
14770
|
position: "bottom",
|
|
14778
14771
|
round: true,
|
|
@@ -14786,11 +14779,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14786
14779
|
) : renderItem() });
|
|
14787
14780
|
};
|
|
14788
14781
|
const Cascader = React.forwardRef(InternalCascader);
|
|
14789
|
-
Cascader.defaultProps = defaultProps$
|
|
14782
|
+
Cascader.defaultProps = defaultProps$_;
|
|
14790
14783
|
Cascader.displayName = "NutCascader";
|
|
14791
14784
|
const CheckboxGroupContext = React.createContext(null);
|
|
14792
14785
|
const Context = CheckboxGroupContext;
|
|
14793
|
-
const defaultProps$
|
|
14786
|
+
const defaultProps$Z = {
|
|
14794
14787
|
max: void 0,
|
|
14795
14788
|
labelPosition: "right",
|
|
14796
14789
|
direction: "vertical",
|
|
@@ -14801,7 +14794,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14801
14794
|
const classPrefix$9 = "nut-checkboxgroup";
|
|
14802
14795
|
const CheckboxGroup = React.forwardRef(
|
|
14803
14796
|
(props, ref) => {
|
|
14804
|
-
const { children } = { ...defaultProps$
|
|
14797
|
+
const { children } = { ...defaultProps$Z, ...props };
|
|
14805
14798
|
const {
|
|
14806
14799
|
className,
|
|
14807
14800
|
disabled,
|
|
@@ -14891,9 +14884,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14891
14884
|
);
|
|
14892
14885
|
}
|
|
14893
14886
|
);
|
|
14894
|
-
CheckboxGroup.defaultProps = defaultProps$
|
|
14887
|
+
CheckboxGroup.defaultProps = defaultProps$Z;
|
|
14895
14888
|
CheckboxGroup.displayName = "NutCheckboxGroup";
|
|
14896
|
-
const defaultProps$
|
|
14889
|
+
const defaultProps$Y = {
|
|
14897
14890
|
...ComponentDefaults,
|
|
14898
14891
|
disabled: false,
|
|
14899
14892
|
labelPosition: "right",
|
|
@@ -14906,7 +14899,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
14906
14899
|
const classPrefix$8 = "nut-checkbox";
|
|
14907
14900
|
const Checkbox = (props) => {
|
|
14908
14901
|
const { children } = {
|
|
14909
|
-
...defaultProps$
|
|
14902
|
+
...defaultProps$Y,
|
|
14910
14903
|
...props
|
|
14911
14904
|
};
|
|
14912
14905
|
const {
|
|
@@ -15011,7 +15004,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15011
15004
|
}
|
|
15012
15005
|
);
|
|
15013
15006
|
};
|
|
15014
|
-
Checkbox.defaultProps = defaultProps$
|
|
15007
|
+
Checkbox.defaultProps = defaultProps$Y;
|
|
15015
15008
|
Checkbox.displayName = "NutCheckBox";
|
|
15016
15009
|
Checkbox.Group = CheckboxGroup;
|
|
15017
15010
|
const MIN_DISTANCE = 10;
|
|
@@ -15079,13 +15072,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15079
15072
|
isHorizontal
|
|
15080
15073
|
};
|
|
15081
15074
|
}
|
|
15082
|
-
const
|
|
15075
|
+
const InternalPickerPanel = (props, ref) => {
|
|
15083
15076
|
const {
|
|
15084
15077
|
keyIndex = 0,
|
|
15085
15078
|
defaultValue,
|
|
15086
|
-
|
|
15079
|
+
options: options2 = [],
|
|
15087
15080
|
threeDimensional = true,
|
|
15088
|
-
|
|
15081
|
+
duration = 1e3,
|
|
15089
15082
|
chooseItem
|
|
15090
15083
|
} = props;
|
|
15091
15084
|
const touch = useTouch();
|
|
@@ -15099,9 +15092,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15099
15092
|
const rotation = 20;
|
|
15100
15093
|
const moving = React.useRef(false);
|
|
15101
15094
|
let timer;
|
|
15102
|
-
React.useRef(null);
|
|
15103
15095
|
const rollerRef = React.useRef(null);
|
|
15104
|
-
const
|
|
15096
|
+
const PickerPanelRef = React.useRef(null);
|
|
15105
15097
|
const [startTime, setStartTime] = React.useState(0);
|
|
15106
15098
|
const [startY, setStartY] = React.useState(0);
|
|
15107
15099
|
const transformY = React.useRef(0);
|
|
@@ -15127,8 +15119,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15127
15119
|
if (updateMove > 0) {
|
|
15128
15120
|
updateMove = 0;
|
|
15129
15121
|
}
|
|
15130
|
-
if (updateMove < -(
|
|
15131
|
-
updateMove = -(
|
|
15122
|
+
if (updateMove < -(options2.length - 1) * lineSpacing) {
|
|
15123
|
+
updateMove = -(options2.length - 1) * lineSpacing;
|
|
15132
15124
|
}
|
|
15133
15125
|
const endMove = Math.round(updateMove / lineSpacing) * lineSpacing;
|
|
15134
15126
|
const deg = `${(Math.abs(Math.round(endMove / lineSpacing)) + 1) * rotation}deg`;
|
|
@@ -15137,7 +15129,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15137
15129
|
} else {
|
|
15138
15130
|
let deg = 0;
|
|
15139
15131
|
const currentDeg = (-updateMove / lineSpacing + 1) * rotation;
|
|
15140
|
-
const maxDeg = (
|
|
15132
|
+
const maxDeg = (options2.length + 1) * rotation;
|
|
15141
15133
|
const minDeg = 0;
|
|
15142
15134
|
deg = Math.min(Math.max(currentDeg, minDeg), maxDeg);
|
|
15143
15135
|
if (minDeg < deg && deg < maxDeg) {
|
|
@@ -15147,7 +15139,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15147
15139
|
}
|
|
15148
15140
|
};
|
|
15149
15141
|
const setChooseValue = (move) => {
|
|
15150
|
-
chooseItem && chooseItem(
|
|
15142
|
+
chooseItem && chooseItem(options2 == null ? void 0 : options2[Math.round(-move / lineSpacing)], keyIndex);
|
|
15151
15143
|
};
|
|
15152
15144
|
const touchStart = (event) => {
|
|
15153
15145
|
touch.start(event);
|
|
@@ -15171,7 +15163,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15171
15163
|
const moveTime = Date.now() - startTime;
|
|
15172
15164
|
if (moveTime <= INERTIA_TIME && Math.abs(move) > INERTIA_DISTANCE) {
|
|
15173
15165
|
const distance = momentum(move, moveTime);
|
|
15174
|
-
setMove(distance, "end", +
|
|
15166
|
+
setMove(distance, "end", +duration);
|
|
15175
15167
|
} else {
|
|
15176
15168
|
setMove(move, "end");
|
|
15177
15169
|
}
|
|
@@ -15179,9 +15171,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15179
15171
|
touch.reset();
|
|
15180
15172
|
}, 0);
|
|
15181
15173
|
};
|
|
15182
|
-
const momentum = (distance,
|
|
15174
|
+
const momentum = (distance, duration2) => {
|
|
15183
15175
|
let nDistance = distance;
|
|
15184
|
-
const speed = Math.abs(nDistance /
|
|
15176
|
+
const speed = Math.abs(nDistance / duration2);
|
|
15185
15177
|
nDistance = speed / 3e-3 * (nDistance < 0 ? -1 : 1);
|
|
15186
15178
|
return nDistance;
|
|
15187
15179
|
};
|
|
@@ -15189,7 +15181,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15189
15181
|
const value = val || defaultValue;
|
|
15190
15182
|
let index = -1;
|
|
15191
15183
|
if (value) {
|
|
15192
|
-
|
|
15184
|
+
options2.some((item, idx) => {
|
|
15193
15185
|
if (item.value === value) {
|
|
15194
15186
|
index = idx;
|
|
15195
15187
|
return true;
|
|
@@ -15197,7 +15189,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15197
15189
|
return false;
|
|
15198
15190
|
});
|
|
15199
15191
|
} else {
|
|
15200
|
-
|
|
15192
|
+
options2.forEach((item, i) => {
|
|
15201
15193
|
if (item.value === defaultValue) {
|
|
15202
15194
|
index = i;
|
|
15203
15195
|
}
|
|
@@ -15240,7 +15232,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15240
15232
|
return () => {
|
|
15241
15233
|
clearTimeout(timer);
|
|
15242
15234
|
};
|
|
15243
|
-
}, [
|
|
15235
|
+
}, [options2]);
|
|
15244
15236
|
React.useImperativeHandle(ref, () => ({
|
|
15245
15237
|
stopMomentum,
|
|
15246
15238
|
moving: moving.current
|
|
@@ -15249,7 +15241,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15249
15241
|
"div",
|
|
15250
15242
|
{
|
|
15251
15243
|
className: "nut-picker-list",
|
|
15252
|
-
ref:
|
|
15244
|
+
ref: PickerPanelRef,
|
|
15253
15245
|
onTouchStart: touchStart,
|
|
15254
15246
|
onTouchMove: touchMove,
|
|
15255
15247
|
onTouchEnd: touchEnd,
|
|
@@ -15262,7 +15254,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15262
15254
|
style: threeDimensional ? touchRollerStyle() : touchTileStyle(),
|
|
15263
15255
|
onTransitionEnd: stopMomentum,
|
|
15264
15256
|
children: [
|
|
15265
|
-
threeDimensional &&
|
|
15257
|
+
threeDimensional && options2.map((item, index) => {
|
|
15266
15258
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15267
15259
|
"div",
|
|
15268
15260
|
{
|
|
@@ -15275,7 +15267,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15275
15267
|
item.value ? item.value : index
|
|
15276
15268
|
);
|
|
15277
15269
|
}),
|
|
15278
|
-
!threeDimensional &&
|
|
15270
|
+
!threeDimensional && options2.map((item, index) => {
|
|
15279
15271
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15280
15272
|
"div",
|
|
15281
15273
|
{
|
|
@@ -15294,8 +15286,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15294
15286
|
}
|
|
15295
15287
|
);
|
|
15296
15288
|
};
|
|
15297
|
-
const
|
|
15298
|
-
const
|
|
15289
|
+
const PickerPanel = React.forwardRef(InternalPickerPanel);
|
|
15290
|
+
const PickerPanel$1 = PickerPanel;
|
|
15299
15291
|
function useRefs() {
|
|
15300
15292
|
const refs = React.useRef([]);
|
|
15301
15293
|
const setRefs = React.useCallback(
|
|
@@ -15310,180 +15302,202 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15310
15302
|
}, []);
|
|
15311
15303
|
return [refs.current, setRefs, reset];
|
|
15312
15304
|
}
|
|
15305
|
+
const defaultProps$X = {
|
|
15306
|
+
...ComponentDefaults,
|
|
15307
|
+
visible: false,
|
|
15308
|
+
title: "",
|
|
15309
|
+
options: [],
|
|
15310
|
+
value: [],
|
|
15311
|
+
defaultValue: [],
|
|
15312
|
+
threeDimensional: true,
|
|
15313
|
+
duration: 1e3
|
|
15314
|
+
};
|
|
15313
15315
|
const InternalPicker = (props, ref) => {
|
|
15314
15316
|
const { locale } = useConfig();
|
|
15315
15317
|
const {
|
|
15316
15318
|
visible,
|
|
15317
15319
|
title,
|
|
15318
|
-
|
|
15319
|
-
|
|
15320
|
-
onConfirm,
|
|
15321
|
-
onClose,
|
|
15322
|
-
onCloseUpdate,
|
|
15323
|
-
onChange,
|
|
15320
|
+
options: options2 = [],
|
|
15321
|
+
defaultValue = [],
|
|
15324
15322
|
className,
|
|
15325
15323
|
style,
|
|
15326
15324
|
threeDimensional,
|
|
15327
|
-
|
|
15325
|
+
duration,
|
|
15326
|
+
onConfirm,
|
|
15327
|
+
onClose,
|
|
15328
|
+
afterClose,
|
|
15329
|
+
onChange,
|
|
15328
15330
|
...rest
|
|
15329
|
-
} = props;
|
|
15330
|
-
const
|
|
15331
|
-
const
|
|
15331
|
+
} = { ...defaultProps$X, ...props };
|
|
15332
|
+
const classPrefix2 = "nut-picker";
|
|
15333
|
+
const classes = classNames(classPrefix2, className);
|
|
15334
|
+
const [selectedValue, setSelectedValue] = usePropsValue({
|
|
15335
|
+
value: props.value,
|
|
15336
|
+
defaultValue: [...defaultValue],
|
|
15337
|
+
finalValue: [...defaultValue],
|
|
15338
|
+
onChange: (val) => {
|
|
15339
|
+
var _a2;
|
|
15340
|
+
(_a2 = props.onConfirm) == null ? void 0 : _a2.call(props, setSelectedOptions(), val);
|
|
15341
|
+
}
|
|
15342
|
+
});
|
|
15343
|
+
const [columnIndex, setColumnIndex] = React.useState(0);
|
|
15332
15344
|
const pickerRef = React.useRef(null);
|
|
15333
15345
|
const [refs, setRefs] = useRefs();
|
|
15334
15346
|
const [columnsList, setColumnsList] = React.useState([]);
|
|
15335
|
-
const b = cn("picker");
|
|
15336
15347
|
const isConfirmEvent = React.useRef(false);
|
|
15337
|
-
|
|
15338
|
-
|
|
15339
|
-
|
|
15340
|
-
|
|
15341
|
-
|
|
15348
|
+
const formatCascade = (columns, values) => {
|
|
15349
|
+
const formatted = [];
|
|
15350
|
+
let columnOptions = {
|
|
15351
|
+
text: "",
|
|
15352
|
+
value: "",
|
|
15353
|
+
children: columns
|
|
15354
|
+
};
|
|
15355
|
+
let columnIndex2 = 0;
|
|
15356
|
+
while (columnOptions && columnOptions.children) {
|
|
15357
|
+
const options22 = columnOptions.children;
|
|
15358
|
+
const value = values[columnIndex2];
|
|
15359
|
+
let index = options22.findIndex(
|
|
15360
|
+
(columnItem) => columnItem.value === value
|
|
15361
|
+
);
|
|
15362
|
+
if (index === -1)
|
|
15363
|
+
index = 0;
|
|
15364
|
+
columnOptions = columnOptions.children[index];
|
|
15365
|
+
columnIndex2++;
|
|
15366
|
+
formatted.push(options22);
|
|
15342
15367
|
}
|
|
15343
|
-
|
|
15344
|
-
|
|
15345
|
-
|
|
15346
|
-
|
|
15347
|
-
|
|
15348
|
-
|
|
15368
|
+
return formatted;
|
|
15369
|
+
};
|
|
15370
|
+
const columnsType = () => {
|
|
15371
|
+
const firstColumn = options2[0];
|
|
15372
|
+
if (firstColumn) {
|
|
15373
|
+
if (Array.isArray(firstColumn)) {
|
|
15374
|
+
return "multiple";
|
|
15375
|
+
}
|
|
15376
|
+
if ("children" in firstColumn) {
|
|
15377
|
+
return "cascade";
|
|
15378
|
+
}
|
|
15349
15379
|
}
|
|
15350
|
-
|
|
15351
|
-
React.useEffect(() => {
|
|
15352
|
-
init();
|
|
15353
|
-
}, [listData]);
|
|
15354
|
-
const closeActionSheet = () => {
|
|
15355
|
-
onClose && onClose(chooseValueData, selectedOptions());
|
|
15356
|
-
onCloseUpdate && onCloseUpdate(chooseValueData, selectedOptions(), pickerRef);
|
|
15380
|
+
return "single";
|
|
15357
15381
|
};
|
|
15358
|
-
const
|
|
15359
|
-
|
|
15360
|
-
|
|
15361
|
-
|
|
15362
|
-
|
|
15363
|
-
|
|
15382
|
+
const normalListData = () => {
|
|
15383
|
+
const type2 = columnsType();
|
|
15384
|
+
switch (type2) {
|
|
15385
|
+
case "multiple":
|
|
15386
|
+
return options2;
|
|
15387
|
+
case "cascade":
|
|
15388
|
+
return formatCascade(options2, selectedValue);
|
|
15389
|
+
default:
|
|
15390
|
+
return [options2];
|
|
15391
|
+
}
|
|
15392
|
+
};
|
|
15393
|
+
const init = () => {
|
|
15394
|
+
const normalData = normalListData();
|
|
15395
|
+
setColumnsList(normalData);
|
|
15396
|
+
const data = [];
|
|
15397
|
+
normalData.length > 0 && normalData.map((item) => {
|
|
15398
|
+
item[0] && data.push(item[0].value);
|
|
15399
|
+
return item;
|
|
15364
15400
|
});
|
|
15365
|
-
if (
|
|
15366
|
-
|
|
15367
|
-
} else {
|
|
15368
|
-
onConfirm && onConfirm(chooseValueData, selectedOptions());
|
|
15401
|
+
if (!defaultValue.length && selectedValue.length === 0) {
|
|
15402
|
+
setSelectedValue([...data]);
|
|
15369
15403
|
}
|
|
15370
|
-
onClose && onClose(chooseValueData, selectedOptions());
|
|
15371
|
-
setTimeout(() => {
|
|
15372
|
-
isConfirmEvent.current = false;
|
|
15373
|
-
}, 0);
|
|
15374
15404
|
};
|
|
15375
|
-
|
|
15376
|
-
|
|
15377
|
-
|
|
15378
|
-
|
|
15379
|
-
|
|
15380
|
-
|
|
15405
|
+
React.useEffect(() => {
|
|
15406
|
+
if (!visible) {
|
|
15407
|
+
return;
|
|
15408
|
+
}
|
|
15409
|
+
init();
|
|
15410
|
+
}, [options2, visible]);
|
|
15411
|
+
const setSelectedOptions = () => {
|
|
15412
|
+
const options22 = [];
|
|
15413
|
+
let currOptions = [];
|
|
15414
|
+
columnsList.forEach((columnOptions, index) => {
|
|
15415
|
+
currOptions = columnOptions.filter(
|
|
15416
|
+
(item) => item.value === selectedValue[index]
|
|
15381
15417
|
);
|
|
15382
15418
|
if (currOptions[0]) {
|
|
15383
|
-
|
|
15419
|
+
options22.push(currOptions[0]);
|
|
15384
15420
|
} else {
|
|
15385
|
-
|
|
15421
|
+
columnOptions[0] && options22.push(columnOptions[0]);
|
|
15386
15422
|
}
|
|
15387
|
-
return column;
|
|
15388
15423
|
});
|
|
15389
|
-
return
|
|
15424
|
+
return options22;
|
|
15390
15425
|
};
|
|
15391
|
-
|
|
15392
|
-
if (
|
|
15393
|
-
|
|
15426
|
+
React.useEffect(() => {
|
|
15427
|
+
if (!visible) {
|
|
15428
|
+
return;
|
|
15429
|
+
}
|
|
15430
|
+
onChange && onChange(setSelectedOptions(), selectedValue, columnIndex);
|
|
15431
|
+
if (isConfirmEvent.current) {
|
|
15432
|
+
isConfirmEvent.current = false;
|
|
15433
|
+
onConfirm && onConfirm(setSelectedOptions(), selectedValue);
|
|
15434
|
+
}
|
|
15435
|
+
}, [selectedValue, columnsList, visible]);
|
|
15436
|
+
const chooseItem = (columnOptions, columnIndex2) => {
|
|
15437
|
+
var _a2, _b;
|
|
15438
|
+
if (columnOptions && Object.keys(columnOptions).length) {
|
|
15439
|
+
if (selectedValue[columnIndex2] !== columnOptions.value) {
|
|
15394
15440
|
if (columnsType() === "cascade") {
|
|
15395
|
-
|
|
15396
|
-
|
|
15397
|
-
|
|
15398
|
-
|
|
15399
|
-
|
|
15400
|
-
|
|
15401
|
-
|
|
15402
|
-
index++;
|
|
15403
|
-
const cc = cursor.children[0];
|
|
15404
|
-
cursor = cc;
|
|
15441
|
+
selectedValue[columnIndex2] = columnOptions.value || "";
|
|
15442
|
+
setSelectedValue([...selectedValue]);
|
|
15443
|
+
while ((_a2 = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _a2[0]) {
|
|
15444
|
+
selectedValue[columnIndex2 + 1] = columnOptions.children[0].value;
|
|
15445
|
+
setSelectedValue([...selectedValue]);
|
|
15446
|
+
columnIndex2++;
|
|
15447
|
+
columnOptions = columnOptions.children[0];
|
|
15405
15448
|
}
|
|
15406
|
-
if (
|
|
15407
|
-
|
|
15408
|
-
|
|
15449
|
+
if ((_b = columnOptions == null ? void 0 : columnOptions.children) == null ? void 0 : _b.length) {
|
|
15450
|
+
selectedValue[columnIndex2 + 1] = "";
|
|
15451
|
+
setSelectedValue([...selectedValue]);
|
|
15409
15452
|
}
|
|
15410
15453
|
setColumnsList(normalListData());
|
|
15411
15454
|
} else {
|
|
15412
|
-
|
|
15455
|
+
setSelectedValue((data) => {
|
|
15413
15456
|
const cdata = [...data];
|
|
15414
15457
|
cdata[columnIndex2] = Object.prototype.hasOwnProperty.call(
|
|
15415
|
-
|
|
15458
|
+
columnOptions,
|
|
15416
15459
|
"value"
|
|
15417
|
-
) ?
|
|
15460
|
+
) ? columnOptions.value : "";
|
|
15418
15461
|
return cdata;
|
|
15419
15462
|
});
|
|
15420
15463
|
}
|
|
15421
|
-
|
|
15464
|
+
setColumnIndex(columnIndex2);
|
|
15422
15465
|
}
|
|
15423
15466
|
}
|
|
15424
15467
|
};
|
|
15425
|
-
const
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
return formatCascade(listData, chooseValueData);
|
|
15432
|
-
default:
|
|
15433
|
-
return [listData];
|
|
15434
|
-
}
|
|
15435
|
-
};
|
|
15436
|
-
const columnsType = () => {
|
|
15437
|
-
const firstColumn = listData[0];
|
|
15438
|
-
if (firstColumn) {
|
|
15439
|
-
if (Array.isArray(firstColumn)) {
|
|
15440
|
-
return "multiple";
|
|
15441
|
-
}
|
|
15442
|
-
if ("children" in firstColumn) {
|
|
15443
|
-
return "cascade";
|
|
15444
|
-
}
|
|
15445
|
-
}
|
|
15446
|
-
return "single";
|
|
15447
|
-
};
|
|
15448
|
-
const formatCascade = (columns, defaultValues) => {
|
|
15449
|
-
const formatted = [];
|
|
15450
|
-
let cursor = {
|
|
15451
|
-
text: "",
|
|
15452
|
-
value: "",
|
|
15453
|
-
children: columns
|
|
15454
|
-
};
|
|
15455
|
-
let columnIndex2 = 0;
|
|
15456
|
-
while (cursor && cursor.children) {
|
|
15457
|
-
const options2 = cursor.children;
|
|
15458
|
-
const value = defaultValues[columnIndex2];
|
|
15459
|
-
let index = options2.findIndex(
|
|
15460
|
-
(columnItem) => columnItem.value === value
|
|
15461
|
-
);
|
|
15462
|
-
if (index === -1)
|
|
15463
|
-
index = 0;
|
|
15464
|
-
cursor = cursor.children[index];
|
|
15465
|
-
columnIndex2++;
|
|
15466
|
-
formatted.push(options2);
|
|
15467
|
-
}
|
|
15468
|
-
return formatted;
|
|
15469
|
-
};
|
|
15470
|
-
const init = () => {
|
|
15471
|
-
const data = [];
|
|
15472
|
-
const normalData = normalListData();
|
|
15473
|
-
setColumnsList(normalData);
|
|
15474
|
-
normalData.length > 0 && normalData.map((item) => {
|
|
15475
|
-
item[0] && data.push(item[0].value);
|
|
15476
|
-
return item;
|
|
15468
|
+
const confirm2 = () => {
|
|
15469
|
+
let movings = false;
|
|
15470
|
+
refs.forEach((ref2) => {
|
|
15471
|
+
if (ref2.moving)
|
|
15472
|
+
movings = true;
|
|
15473
|
+
ref2.stopMomentum();
|
|
15477
15474
|
});
|
|
15478
|
-
if (
|
|
15479
|
-
|
|
15475
|
+
if (movings) {
|
|
15476
|
+
isConfirmEvent.current = true;
|
|
15477
|
+
} else {
|
|
15478
|
+
onConfirm && onConfirm(setSelectedOptions(), selectedValue);
|
|
15479
|
+
closePicker();
|
|
15480
15480
|
}
|
|
15481
|
+
setTimeout(() => {
|
|
15482
|
+
isConfirmEvent.current = false;
|
|
15483
|
+
}, 0);
|
|
15484
|
+
};
|
|
15485
|
+
const closePicker = () => {
|
|
15486
|
+
onClose && onClose(setSelectedOptions(), selectedValue);
|
|
15487
|
+
afterClose && afterClose(setSelectedOptions(), selectedValue, pickerRef);
|
|
15481
15488
|
};
|
|
15482
|
-
const
|
|
15483
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className:
|
|
15484
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15485
|
-
|
|
15486
|
-
|
|
15489
|
+
const renderTitleBar = () => {
|
|
15490
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__control`, children: [
|
|
15491
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15492
|
+
"span",
|
|
15493
|
+
{
|
|
15494
|
+
className: `${classPrefix2}__cancel-btn`,
|
|
15495
|
+
onClick: () => closePicker(),
|
|
15496
|
+
children: locale.cancel
|
|
15497
|
+
}
|
|
15498
|
+
),
|
|
15499
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__title`, children: title || "" }),
|
|
15500
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: `${classPrefix2}__confirm-btn`, onClick: confirm2, children: locale.confirm })
|
|
15487
15501
|
] });
|
|
15488
15502
|
};
|
|
15489
15503
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
@@ -15492,20 +15506,20 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15492
15506
|
visible,
|
|
15493
15507
|
position: "bottom",
|
|
15494
15508
|
onClose: () => {
|
|
15495
|
-
|
|
15509
|
+
closePicker();
|
|
15496
15510
|
},
|
|
15497
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className:
|
|
15498
|
-
|
|
15499
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
|
15511
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: classes, style, ...rest, children: [
|
|
15512
|
+
renderTitleBar(),
|
|
15513
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__panel`, ref: pickerRef, children: columnsList == null ? void 0 : columnsList.map((item, index) => {
|
|
15500
15514
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15501
|
-
|
|
15515
|
+
PickerPanel$1,
|
|
15502
15516
|
{
|
|
15503
15517
|
ref: setRefs(index),
|
|
15504
|
-
defaultValue:
|
|
15505
|
-
|
|
15518
|
+
defaultValue: selectedValue == null ? void 0 : selectedValue[index],
|
|
15519
|
+
options: item,
|
|
15506
15520
|
threeDimensional,
|
|
15507
15521
|
chooseItem: (value, index2) => chooseItem(value, index2),
|
|
15508
|
-
|
|
15522
|
+
duration,
|
|
15509
15523
|
keyIndex: index
|
|
15510
15524
|
},
|
|
15511
15525
|
index
|
|
@@ -15556,7 +15570,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15556
15570
|
const [show, setShow] = React.useState(false);
|
|
15557
15571
|
const [currentDate, setCurrentDate] = React.useState(modelValue);
|
|
15558
15572
|
const [defaultValue, setDefaultValue] = React.useState([]);
|
|
15559
|
-
const [
|
|
15573
|
+
const [options2, setListData] = React.useState([]);
|
|
15560
15574
|
const pickerRef = React.useRef(null);
|
|
15561
15575
|
const isDate = (val) => {
|
|
15562
15576
|
return Object.prototype.toString.call(val) === "[object Date]" && !Number.isNaN(val.getTime());
|
|
@@ -15674,7 +15688,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15674
15688
|
}
|
|
15675
15689
|
return result;
|
|
15676
15690
|
};
|
|
15677
|
-
const updateChooseValueCustmer = (
|
|
15691
|
+
const updateChooseValueCustmer = (cacheValueData, selectedValue, index) => {
|
|
15678
15692
|
if (["date", "datetime", "datehour", "month-day", "year-month"].includes(
|
|
15679
15693
|
type2.toLocaleLowerCase()
|
|
15680
15694
|
)) {
|
|
@@ -15713,7 +15727,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15713
15727
|
const isEqual2 = (currentDate == null ? void 0 : currentDate.getTime()) === (date2 == null ? void 0 : date2.getTime());
|
|
15714
15728
|
date2 && isDate(date2) && !isEqual2 && setCurrentDate(formatValue(date2));
|
|
15715
15729
|
}
|
|
15716
|
-
props.onChange && props.onChange(
|
|
15730
|
+
props.onChange && props.onChange(cacheValueData, selectedValue, index);
|
|
15717
15731
|
};
|
|
15718
15732
|
const padZero = (num, targetLength = 2) => {
|
|
15719
15733
|
let str = `${num}`;
|
|
@@ -15809,16 +15823,16 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
15809
15823
|
className: `nut-datepicker ${className || ""}`,
|
|
15810
15824
|
style,
|
|
15811
15825
|
...rest,
|
|
15812
|
-
children:
|
|
15826
|
+
children: options2.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15813
15827
|
Picker$1,
|
|
15814
15828
|
{
|
|
15815
15829
|
title,
|
|
15816
15830
|
visible: show,
|
|
15817
|
-
|
|
15831
|
+
options: options2,
|
|
15818
15832
|
onClose: onCloseDatePicker,
|
|
15819
|
-
|
|
15820
|
-
onConfirm: (
|
|
15821
|
-
onChange: (
|
|
15833
|
+
defaultValue,
|
|
15834
|
+
onConfirm: (options22, values) => onConfirmDatePicker && onConfirmDatePicker(options22, values),
|
|
15835
|
+
onChange: (list, value, index) => updateChooseValueCustmer(list, value, index),
|
|
15822
15836
|
threeDimensional,
|
|
15823
15837
|
ref: pickerRef
|
|
15824
15838
|
}
|
|
@@ -19768,144 +19782,120 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
19768
19782
|
Switch.defaultProps = defaultProps$H;
|
|
19769
19783
|
Switch.displayName = "NutSwitch";
|
|
19770
19784
|
const defaultProps$G = {
|
|
19785
|
+
...ComponentDefaults,
|
|
19771
19786
|
defaultValue: "",
|
|
19772
|
-
|
|
19773
|
-
|
|
19774
|
-
|
|
19775
|
-
rows: "",
|
|
19787
|
+
showCount: false,
|
|
19788
|
+
rows: 2,
|
|
19789
|
+
maxLength: 140,
|
|
19776
19790
|
placeholder: "",
|
|
19777
|
-
|
|
19791
|
+
readOnly: false,
|
|
19778
19792
|
disabled: false,
|
|
19779
|
-
|
|
19793
|
+
autoSize: false
|
|
19780
19794
|
};
|
|
19781
19795
|
const TextArea = (props) => {
|
|
19782
19796
|
const { locale } = useConfig();
|
|
19783
19797
|
const {
|
|
19784
19798
|
className,
|
|
19799
|
+
value,
|
|
19785
19800
|
defaultValue,
|
|
19786
|
-
|
|
19787
|
-
|
|
19788
|
-
maxlength,
|
|
19801
|
+
showCount,
|
|
19802
|
+
maxLength,
|
|
19789
19803
|
rows,
|
|
19790
19804
|
placeholder,
|
|
19791
|
-
|
|
19805
|
+
readOnly,
|
|
19792
19806
|
disabled,
|
|
19793
|
-
|
|
19807
|
+
autoSize,
|
|
19794
19808
|
style,
|
|
19795
19809
|
onChange,
|
|
19796
19810
|
onBlur,
|
|
19797
|
-
onFocus
|
|
19811
|
+
onFocus,
|
|
19812
|
+
...rest
|
|
19798
19813
|
} = { ...defaultProps$G, ...props };
|
|
19799
|
-
const
|
|
19800
|
-
const [inputValue, SetInputValue] = React.useState("");
|
|
19814
|
+
const classPrefix2 = "nut-textarea";
|
|
19801
19815
|
const textareaRef = React.useRef(null);
|
|
19802
|
-
const
|
|
19803
|
-
|
|
19804
|
-
|
|
19805
|
-
|
|
19806
|
-
initValue = initValue.substring(0, Number(maxlength));
|
|
19816
|
+
const compositionRef = React.useRef(false);
|
|
19817
|
+
const format2 = (value2) => {
|
|
19818
|
+
if (maxLength !== void 0 && value2.length > maxLength) {
|
|
19819
|
+
return value2.substring(0, maxLength);
|
|
19807
19820
|
}
|
|
19808
|
-
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
19813
|
-
|
|
19814
|
-
|
|
19821
|
+
return value2;
|
|
19822
|
+
};
|
|
19823
|
+
const [inputValue, setInputValue] = usePropsValue({
|
|
19824
|
+
value,
|
|
19825
|
+
defaultValue,
|
|
19826
|
+
finalValue: format2(defaultValue),
|
|
19827
|
+
onChange
|
|
19828
|
+
});
|
|
19815
19829
|
React.useEffect(() => {
|
|
19816
|
-
if (
|
|
19817
|
-
|
|
19818
|
-
setContentHeight();
|
|
19819
|
-
}
|
|
19830
|
+
if (autoSize) {
|
|
19831
|
+
setContentHeight();
|
|
19820
19832
|
}
|
|
19821
|
-
}, [inputValue]);
|
|
19833
|
+
}, [autoSize, defaultValue, inputValue]);
|
|
19822
19834
|
const setContentHeight = () => {
|
|
19823
19835
|
const textarea = textareaRef.current;
|
|
19824
19836
|
if (textarea) {
|
|
19825
19837
|
textarea.style.height = "auto";
|
|
19826
|
-
|
|
19827
|
-
if (typeof autosize === "object") {
|
|
19828
|
-
const { maxHeight, minHeight } = autosize;
|
|
19829
|
-
if (maxHeight !== void 0) {
|
|
19830
|
-
height = Math.min(height, maxHeight);
|
|
19831
|
-
}
|
|
19832
|
-
if (minHeight !== void 0) {
|
|
19833
|
-
height = Math.max(height, minHeight);
|
|
19834
|
-
}
|
|
19835
|
-
}
|
|
19838
|
+
const height = textarea == null ? void 0 : textarea.scrollHeight;
|
|
19836
19839
|
if (height) {
|
|
19837
19840
|
textarea.style.height = `${height}px`;
|
|
19838
19841
|
}
|
|
19839
19842
|
}
|
|
19840
19843
|
};
|
|
19841
|
-
const
|
|
19844
|
+
const handleChange = (event) => {
|
|
19842
19845
|
const text = event.target;
|
|
19843
|
-
|
|
19844
|
-
|
|
19845
|
-
}
|
|
19846
|
-
SetInputValue(text.value);
|
|
19847
|
-
onChange && onChange(text.value, event);
|
|
19846
|
+
const value2 = compositionRef.current ? text.value : format2(text.value);
|
|
19847
|
+
setInputValue(value2);
|
|
19848
19848
|
};
|
|
19849
|
-
const
|
|
19849
|
+
const handleFocus = (event) => {
|
|
19850
19850
|
if (disabled)
|
|
19851
19851
|
return;
|
|
19852
|
-
if (
|
|
19852
|
+
if (readOnly)
|
|
19853
19853
|
return;
|
|
19854
19854
|
onFocus && onFocus(event);
|
|
19855
19855
|
};
|
|
19856
|
-
const
|
|
19856
|
+
const handleBlur = (event) => {
|
|
19857
19857
|
if (disabled)
|
|
19858
19858
|
return;
|
|
19859
|
-
if (
|
|
19859
|
+
if (readOnly)
|
|
19860
19860
|
return;
|
|
19861
|
-
const text = event.target;
|
|
19862
|
-
onChange && onChange(text.value, event);
|
|
19863
19861
|
onBlur && onBlur(event);
|
|
19864
19862
|
};
|
|
19865
|
-
const startComposing = () => {
|
|
19866
|
-
compositingRef.current = true;
|
|
19867
|
-
};
|
|
19868
|
-
const endComposing = () => {
|
|
19869
|
-
compositingRef.current = false;
|
|
19870
|
-
};
|
|
19871
19863
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
19872
19864
|
"div",
|
|
19873
19865
|
{
|
|
19874
|
-
className:
|
|
19866
|
+
className: classNames(classPrefix2, className, {
|
|
19867
|
+
[`${classPrefix2}__disabled`]: disabled
|
|
19868
|
+
}),
|
|
19875
19869
|
children: [
|
|
19876
19870
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
19877
19871
|
"textarea",
|
|
19878
19872
|
{
|
|
19879
19873
|
ref: textareaRef,
|
|
19880
|
-
className:
|
|
19881
|
-
style
|
|
19882
|
-
textAlign,
|
|
19883
|
-
...style
|
|
19884
|
-
},
|
|
19874
|
+
className: `${classPrefix2}__textarea`,
|
|
19875
|
+
style,
|
|
19885
19876
|
disabled,
|
|
19886
|
-
readOnly
|
|
19877
|
+
readOnly,
|
|
19887
19878
|
value: inputValue,
|
|
19888
|
-
onChange: (e) =>
|
|
19889
|
-
|
|
19890
|
-
|
|
19891
|
-
|
|
19892
|
-
|
|
19879
|
+
onChange: (e) => handleChange(e),
|
|
19880
|
+
onBlur: (e) => handleBlur(e),
|
|
19881
|
+
onFocus: (e) => handleFocus(e),
|
|
19882
|
+
onCompositionEnd: () => {
|
|
19883
|
+
compositionRef.current = false;
|
|
19893
19884
|
},
|
|
19894
|
-
|
|
19895
|
-
|
|
19885
|
+
onCompositionStart: () => {
|
|
19886
|
+
compositionRef.current = true;
|
|
19896
19887
|
},
|
|
19897
|
-
onCompositionEnd: (e) => endComposing(),
|
|
19898
|
-
onCompositionStart: (e) => startComposing(),
|
|
19899
19888
|
rows,
|
|
19900
|
-
maxLength:
|
|
19901
|
-
placeholder: placeholder || locale.placeholder
|
|
19889
|
+
maxLength: maxLength === -1 ? void 0 : maxLength,
|
|
19890
|
+
placeholder: placeholder || locale.placeholder,
|
|
19891
|
+
...rest
|
|
19902
19892
|
}
|
|
19903
19893
|
),
|
|
19904
|
-
|
|
19905
|
-
|
|
19894
|
+
showCount && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `${classPrefix2}__limit`, children: [
|
|
19895
|
+
inputValue.length,
|
|
19906
19896
|
"/",
|
|
19907
|
-
|
|
19908
|
-
] })
|
|
19897
|
+
maxLength < 0 ? 0 : maxLength
|
|
19898
|
+
] })
|
|
19909
19899
|
]
|
|
19910
19900
|
}
|
|
19911
19901
|
);
|
|
@@ -25088,13 +25078,11 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25088
25078
|
Steps.displayName = "NutSteps";
|
|
25089
25079
|
const defaultProps$8 = {
|
|
25090
25080
|
...ComponentDefaults,
|
|
25091
|
-
className: "",
|
|
25092
|
-
style: {},
|
|
25093
25081
|
columns: [],
|
|
25094
25082
|
data: [],
|
|
25095
25083
|
bordered: true,
|
|
25096
25084
|
striped: false,
|
|
25097
|
-
noData: "
|
|
25085
|
+
noData: "",
|
|
25098
25086
|
sorterIcon: null,
|
|
25099
25087
|
showHeader: true
|
|
25100
25088
|
};
|
|
@@ -25111,9 +25099,9 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25111
25099
|
summary,
|
|
25112
25100
|
striped,
|
|
25113
25101
|
noData,
|
|
25114
|
-
onSorter,
|
|
25115
25102
|
sorterIcon,
|
|
25116
25103
|
showHeader,
|
|
25104
|
+
onSort,
|
|
25117
25105
|
...rest
|
|
25118
25106
|
} = {
|
|
25119
25107
|
...defaultProps$8,
|
|
@@ -25125,12 +25113,13 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25125
25113
|
setCurData(data);
|
|
25126
25114
|
}
|
|
25127
25115
|
}, [data]);
|
|
25128
|
-
const
|
|
25129
|
-
const
|
|
25130
|
-
const
|
|
25116
|
+
const classPrefix2 = "nut-table";
|
|
25117
|
+
const headerClassPrefix = `${classPrefix2}__main__head__tr`;
|
|
25118
|
+
const bodyClassPrefix = `${classPrefix2}__main__body__tr`;
|
|
25119
|
+
const cls = classNames(classPrefix2, className);
|
|
25131
25120
|
const handleSorterClick = (item) => {
|
|
25132
25121
|
if (item.sorter) {
|
|
25133
|
-
|
|
25122
|
+
onSort && onSort(item, curData);
|
|
25134
25123
|
if (typeof item.sorter === "function") {
|
|
25135
25124
|
setCurData(curData.sort(item.sorter));
|
|
25136
25125
|
} else {
|
|
@@ -25140,8 +25129,8 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25140
25129
|
};
|
|
25141
25130
|
const cellClasses = (item) => {
|
|
25142
25131
|
return {
|
|
25143
|
-
|
|
25144
|
-
[
|
|
25132
|
+
[`${headerClassPrefix}--border`]: props.bordered,
|
|
25133
|
+
[`${headerClassPrefix}--align${item.align ? item.align : ""}`]: true
|
|
25145
25134
|
};
|
|
25146
25135
|
};
|
|
25147
25136
|
const getColumnItem = (value) => {
|
|
@@ -25152,10 +25141,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25152
25141
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
25153
25142
|
"span",
|
|
25154
25143
|
{
|
|
25155
|
-
className: classNames(
|
|
25156
|
-
"nut-table__main__head__tr__th",
|
|
25157
|
-
cellClasses(item)
|
|
25158
|
-
),
|
|
25144
|
+
className: classNames(`${headerClassPrefix}__th`, cellClasses(item)),
|
|
25159
25145
|
onClick: () => handleSorterClick(item),
|
|
25160
25146
|
children: [
|
|
25161
25147
|
item.title,
|
|
@@ -25178,7 +25164,7 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25178
25164
|
"span",
|
|
25179
25165
|
{
|
|
25180
25166
|
className: classNames(
|
|
25181
|
-
|
|
25167
|
+
`${bodyClassPrefix}__td`,
|
|
25182
25168
|
cellClasses(getColumnItem(value))
|
|
25183
25169
|
),
|
|
25184
25170
|
children: typeof item[value] === "function" || typeof render2 === "function" ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { children: render2 ? render2(item) : item[value](item) }) : item[value]
|
|
@@ -25189,24 +25175,23 @@ Please add \`${key}Action\` when creating your handler.`);
|
|
|
25189
25175
|
};
|
|
25190
25176
|
const renderBoyTrs = () => {
|
|
25191
25177
|
return curData.map((item, index) => {
|
|
25192
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
|
25178
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: bodyClassPrefix, children: renderBodyTds(item) }, index);
|
|
25193
25179
|
});
|
|
25194
25180
|
};
|
|
25195
25181
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: cls, style, ...rest, children: [
|
|
25196
25182
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
25197
25183
|
"div",
|
|
25198
25184
|
{
|
|
25199
|
-
className: classNames(
|
|
25200
|
-
|
|
25185
|
+
className: classNames(`${classPrefix2}__main`, {
|
|
25186
|
+
[`${classPrefix2}__main--striped`]: striped
|
|
25201
25187
|
}),
|
|
25202
25188
|
children: [
|
|
25203
|
-
showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
|
25204
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className:
|
|
25189
|
+
showHeader && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__head`, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: headerClassPrefix, children: renderHeadCells() }) }),
|
|
25190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__main__body`, children: renderBoyTrs() })
|
|
25205
25191
|
]
|
|
25206
25192
|
}
|
|
25207
25193
|
),
|
|
25208
|
-
summary
|
|
25209
|
-
curData.length === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "nut-table__nodata__text", children: noData }) }) })
|
|
25194
|
+
(summary || curData.length === 0) && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: `${classPrefix2}__summary`, children: summary || noData })
|
|
25210
25195
|
] });
|
|
25211
25196
|
};
|
|
25212
25197
|
Table.defaultProps = defaultProps$8;
|