forstok-ui-lib 8.7.2 → 8.8.0
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.d.ts +1 -1
- package/dist/index.js +53 -53
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -44
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/assets/javascripts/function.ts +4 -1
- package/src/components/select/all.tsx +34 -2
- package/src/components/select/asyncPaginate.tsx +27 -3
- package/src/components/select/index.tsx +46 -9
package/package.json
CHANGED
|
@@ -1270,7 +1270,10 @@ export const getFileType = (file?: File | null): string => {
|
|
|
1270
1270
|
}
|
|
1271
1271
|
};
|
|
1272
1272
|
|
|
1273
|
-
export function capitalizeWords(
|
|
1273
|
+
export function capitalizeWords(
|
|
1274
|
+
text: string,
|
|
1275
|
+
ignoreWords: string[] = [],
|
|
1276
|
+
): string {
|
|
1274
1277
|
const ignoreSet = new Set<string>(ignoreWords);
|
|
1275
1278
|
|
|
1276
1279
|
return text.replace(/\S+/g, (word, offset) => {
|
|
@@ -114,7 +114,10 @@ const SelectAllComponent = (props: TSelect) => {
|
|
|
114
114
|
container: (provided: CSSObject) =>
|
|
115
115
|
({
|
|
116
116
|
...provided,
|
|
117
|
-
display: "
|
|
117
|
+
display: "block",
|
|
118
|
+
width: "100%",
|
|
119
|
+
maxWidth: "100%",
|
|
120
|
+
minWidth: 0,
|
|
118
121
|
minHeight: "1px",
|
|
119
122
|
textAlign: "left",
|
|
120
123
|
border: "none",
|
|
@@ -125,6 +128,8 @@ const SelectAllComponent = (props: TSelect) => {
|
|
|
125
128
|
) =>
|
|
126
129
|
({
|
|
127
130
|
...provided,
|
|
131
|
+
width: "100%",
|
|
132
|
+
minWidth: 0,
|
|
128
133
|
borderRadius: ".5rem",
|
|
129
134
|
cursor: "pointer",
|
|
130
135
|
minHeight: mode === "store" ? "30px" : "38px",
|
|
@@ -172,6 +177,15 @@ const SelectAllComponent = (props: TSelect) => {
|
|
|
172
177
|
boxShadow: "none !important",
|
|
173
178
|
},
|
|
174
179
|
}) as CSSObjectWithLabel,
|
|
180
|
+
singleValue: (provided: CSSObject) =>
|
|
181
|
+
({
|
|
182
|
+
...provided,
|
|
183
|
+
minWidth: 0,
|
|
184
|
+
maxWidth: "100%",
|
|
185
|
+
overflow: "hidden",
|
|
186
|
+
textOverflow: "ellipsis",
|
|
187
|
+
whiteSpace: "nowrap",
|
|
188
|
+
}) as CSSObjectWithLabel,
|
|
175
189
|
dropdownIndicator: (provided: CSSObject) =>
|
|
176
190
|
({
|
|
177
191
|
...provided,
|
|
@@ -199,10 +213,15 @@ const SelectAllComponent = (props: TSelect) => {
|
|
|
199
213
|
valueContainer: (provided: CSSObject) =>
|
|
200
214
|
({
|
|
201
215
|
...provided,
|
|
216
|
+
flex: 1,
|
|
217
|
+
minWidth: 0,
|
|
202
218
|
height: "100%",
|
|
203
219
|
maxHeight: "300px",
|
|
204
220
|
minHeight: "30px",
|
|
205
|
-
|
|
221
|
+
overflowX: "hidden",
|
|
222
|
+
overflowY: "auto",
|
|
223
|
+
flexWrap: "wrap",
|
|
224
|
+
alignContent: "flex-start",
|
|
206
225
|
paddingTop: "0",
|
|
207
226
|
paddingBottom: "0",
|
|
208
227
|
paddingRight: "2px",
|
|
@@ -266,11 +285,24 @@ const SelectAllComponent = (props: TSelect) => {
|
|
|
266
285
|
"0rem .5rem 1.5rem -.5rem rgba(0, 0, 0, .05), 0rem .5rem 1rem -.25rem rgba(0, 0, 0, .05), 0rem .1875rem .375rem 0rem rgba(0, 0, 0, .05), 0rem .125rem .25rem 0rem rgba(0, 0, 0, .05), 0rem .0625rem .125rem 0rem rgba(0, 0, 0, .05), 0rem 0rem 0rem .0625rem rgba(0, 0, 0, .06)",
|
|
267
286
|
border: "none",
|
|
268
287
|
}) as CSSObjectWithLabel,
|
|
288
|
+
multiValue: (provided: CSSObject) =>
|
|
289
|
+
({
|
|
290
|
+
...provided,
|
|
291
|
+
maxWidth: "100%",
|
|
292
|
+
}) as CSSObjectWithLabel,
|
|
293
|
+
multiValueLabel: (provided: CSSObject) =>
|
|
294
|
+
({
|
|
295
|
+
...provided,
|
|
296
|
+
overflow: "hidden",
|
|
297
|
+
textOverflow: "ellipsis",
|
|
298
|
+
whiteSpace: "nowrap",
|
|
299
|
+
}) as CSSObjectWithLabel,
|
|
269
300
|
};
|
|
270
301
|
|
|
271
302
|
return (
|
|
272
303
|
<div
|
|
273
304
|
className="_refContainer"
|
|
305
|
+
style={{ width: "100%", minWidth: 0 }}
|
|
274
306
|
{...(rest["data-qa-id"] && { "data-qa-id": rest["data-qa-id"] })}
|
|
275
307
|
>
|
|
276
308
|
<ReactSelect
|
|
@@ -136,8 +136,10 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
136
136
|
container: (provided: CSSObject) =>
|
|
137
137
|
({
|
|
138
138
|
...provided,
|
|
139
|
-
display: "
|
|
139
|
+
display: "block",
|
|
140
140
|
width: "100%",
|
|
141
|
+
maxWidth: "100%",
|
|
142
|
+
minWidth: 0,
|
|
141
143
|
minHeight: "1px",
|
|
142
144
|
textAlign: "left",
|
|
143
145
|
border: "none",
|
|
@@ -146,6 +148,7 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
146
148
|
({
|
|
147
149
|
...provided,
|
|
148
150
|
width: "100%",
|
|
151
|
+
minWidth: 0,
|
|
149
152
|
borderRadius: ".5rem",
|
|
150
153
|
minHeight: "1px",
|
|
151
154
|
height: isMulti ? "100%" : mode === "small" ? "30px" : "32px",
|
|
@@ -197,6 +200,11 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
197
200
|
({
|
|
198
201
|
...provided,
|
|
199
202
|
minHeight: "1px",
|
|
203
|
+
minWidth: 0,
|
|
204
|
+
maxWidth: "100%",
|
|
205
|
+
overflow: "hidden",
|
|
206
|
+
textOverflow: "ellipsis",
|
|
207
|
+
whiteSpace: "nowrap",
|
|
200
208
|
paddingBottom: "2px",
|
|
201
209
|
color: "initial",
|
|
202
210
|
}) as CSSObjectWithLabel,
|
|
@@ -227,6 +235,8 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
227
235
|
valueContainer: (provided: CSSObject) =>
|
|
228
236
|
({
|
|
229
237
|
...provided,
|
|
238
|
+
flex: 1,
|
|
239
|
+
minWidth: 0,
|
|
230
240
|
minHeight: "1px",
|
|
231
241
|
height: isMulti
|
|
232
242
|
? "100%"
|
|
@@ -240,7 +250,9 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
240
250
|
paddingLeft: iconLeft ? "28px" : "8px",
|
|
241
251
|
paddingRight: "2px",
|
|
242
252
|
maxHeight: isMulti ? "300px" : "unset",
|
|
243
|
-
|
|
253
|
+
overflowX: isMulti ? "hidden" : "initial",
|
|
254
|
+
overflowY: isMulti ? "auto" : "initial",
|
|
255
|
+
flexWrap: isMulti ? "wrap" : "nowrap",
|
|
244
256
|
alignContent: isMulti ? "flex-start" : "initial",
|
|
245
257
|
}) as CSSObjectWithLabel,
|
|
246
258
|
option: (provided: CSSObject, state: OptionProps<TOption, boolean>) =>
|
|
@@ -299,6 +311,18 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
299
311
|
letterSpacing: "normal",
|
|
300
312
|
lineHeight: "normal",
|
|
301
313
|
}) as CSSObjectWithLabel,
|
|
314
|
+
multiValue: (provided: CSSObject) =>
|
|
315
|
+
({
|
|
316
|
+
...provided,
|
|
317
|
+
maxWidth: "100%",
|
|
318
|
+
}) as CSSObjectWithLabel,
|
|
319
|
+
multiValueLabel: (provided: CSSObject) =>
|
|
320
|
+
({
|
|
321
|
+
...provided,
|
|
322
|
+
overflow: "hidden",
|
|
323
|
+
textOverflow: "ellipsis",
|
|
324
|
+
whiteSpace: "nowrap",
|
|
325
|
+
}) as CSSObjectWithLabel,
|
|
302
326
|
};
|
|
303
327
|
|
|
304
328
|
const onMenuOpen = useCallback(() => {
|
|
@@ -327,7 +351,7 @@ const SelectAsyncPaginateComponent = ({ loadOptions, ...props }: TSelect) => {
|
|
|
327
351
|
};
|
|
328
352
|
|
|
329
353
|
return (
|
|
330
|
-
<div className="_refContainer">
|
|
354
|
+
<div className="_refContainer" style={{ width: "100%", minWidth: 0 }}>
|
|
331
355
|
<AsyncPaginate
|
|
332
356
|
isSearchable={isSearchable}
|
|
333
357
|
placeholder={placeholder}
|
|
@@ -284,12 +284,17 @@ const SelectComponent = ({
|
|
|
284
284
|
);
|
|
285
285
|
};
|
|
286
286
|
|
|
287
|
+
const isScrollableValueContainer =
|
|
288
|
+
isMulti || mode === "multi" || mode === "picklist";
|
|
289
|
+
|
|
287
290
|
const customStyles: StylesConfig<TOption, typeof isMulti> = {
|
|
288
291
|
container: (provided: CSSObject) =>
|
|
289
292
|
({
|
|
290
293
|
...provided,
|
|
291
|
-
display: "
|
|
294
|
+
display: "block",
|
|
292
295
|
width: width ? width + "px" : "100%",
|
|
296
|
+
maxWidth: "100%",
|
|
297
|
+
minWidth: 0,
|
|
293
298
|
minHeight: "1px",
|
|
294
299
|
textAlign: "left",
|
|
295
300
|
border: "none",
|
|
@@ -300,6 +305,8 @@ const SelectComponent = ({
|
|
|
300
305
|
) =>
|
|
301
306
|
({
|
|
302
307
|
...provided,
|
|
308
|
+
width: "100%",
|
|
309
|
+
minWidth: 0,
|
|
303
310
|
borderRadius: ".5rem",
|
|
304
311
|
minHeight:
|
|
305
312
|
mode === "multi" ? "50px" : mode === "picklist" ? "30px" : "1px",
|
|
@@ -398,6 +405,8 @@ const SelectComponent = ({
|
|
|
398
405
|
valueContainer: (provided: CSSObject) =>
|
|
399
406
|
({
|
|
400
407
|
...provided,
|
|
408
|
+
flex: 1,
|
|
409
|
+
minWidth: 0,
|
|
401
410
|
height: isMulti ? "100%" : mode === "multi" ? "auto" : "30px",
|
|
402
411
|
maxHeight: isMulti
|
|
403
412
|
? "300px"
|
|
@@ -408,10 +417,10 @@ const SelectComponent = ({
|
|
|
408
417
|
: "none",
|
|
409
418
|
minHeight:
|
|
410
419
|
mode === "multi" ? "44px" : mode === "picklist" ? "30px" : "1px",
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
420
|
+
overflowX: isScrollableValueContainer ? "hidden" : "initial",
|
|
421
|
+
overflowY: isScrollableValueContainer ? "auto" : "initial",
|
|
422
|
+
flexWrap: isScrollableValueContainer ? "wrap" : "nowrap",
|
|
423
|
+
alignContent: isScrollableValueContainer ? "flex-start" : "center",
|
|
415
424
|
paddingTop: "0",
|
|
416
425
|
paddingBottom: "0",
|
|
417
426
|
paddingRight: "2px",
|
|
@@ -420,6 +429,11 @@ const SelectComponent = ({
|
|
|
420
429
|
({
|
|
421
430
|
...provided,
|
|
422
431
|
minHeight: "1px",
|
|
432
|
+
minWidth: 0,
|
|
433
|
+
maxWidth: "100%",
|
|
434
|
+
overflow: "hidden",
|
|
435
|
+
textOverflow: "ellipsis",
|
|
436
|
+
whiteSpace: "nowrap",
|
|
423
437
|
paddingBottom: "2px",
|
|
424
438
|
color: disabled ? "#ADADAD" : mode === "form" ? "#2d3c48" : "initial",
|
|
425
439
|
opacity: disabled ? ".7" : 1,
|
|
@@ -487,15 +501,34 @@ const SelectComponent = ({
|
|
|
487
501
|
base: any,
|
|
488
502
|
state: MultiValueProps<TOption, typeof isMulti>,
|
|
489
503
|
) => {
|
|
490
|
-
|
|
504
|
+
const nextStyles = {
|
|
505
|
+
...base,
|
|
506
|
+
maxWidth: "100%",
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
return state.data.isFixed
|
|
510
|
+
? { ...nextStyles, backgroundColor: "gray" }
|
|
511
|
+
: nextStyles;
|
|
491
512
|
},
|
|
492
513
|
multiValueLabel: (
|
|
493
514
|
base: any,
|
|
494
515
|
state: MultiValueProps<TOption, typeof isMulti>,
|
|
495
516
|
) => {
|
|
517
|
+
const nextStyles = {
|
|
518
|
+
...base,
|
|
519
|
+
overflow: "hidden",
|
|
520
|
+
textOverflow: "ellipsis",
|
|
521
|
+
whiteSpace: "nowrap",
|
|
522
|
+
};
|
|
523
|
+
|
|
496
524
|
return state.data.isFixed
|
|
497
|
-
? {
|
|
498
|
-
|
|
525
|
+
? {
|
|
526
|
+
...nextStyles,
|
|
527
|
+
fontWeight: "bold",
|
|
528
|
+
color: "white",
|
|
529
|
+
paddingRight: 6,
|
|
530
|
+
}
|
|
531
|
+
: nextStyles;
|
|
499
532
|
},
|
|
500
533
|
multiValueRemove: (
|
|
501
534
|
provided: CSSObject,
|
|
@@ -591,7 +624,11 @@ const SelectComponent = ({
|
|
|
591
624
|
);
|
|
592
625
|
|
|
593
626
|
return (
|
|
594
|
-
<section
|
|
627
|
+
<section
|
|
628
|
+
className="_refSelectContainer"
|
|
629
|
+
style={{ width: "100%", minWidth: 0 }}
|
|
630
|
+
{...props}
|
|
631
|
+
>
|
|
595
632
|
{SelectEl}
|
|
596
633
|
</section>
|
|
597
634
|
);
|