@evergis/uilib-gl 1.0.100 → 1.0.102
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/organisms/DatePicker/Calendar.d.ts +4 -2
- package/dist/organisms/FilterInput/types.d.ts +1 -4
- package/dist/organisms/Preview/hooks/useImageSlideShow.d.ts +1 -1
- package/dist/organisms/Preview/types.d.ts +1 -0
- package/dist/uilib-gl.esm.js +37 -74
- package/dist/uilib-gl.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
2
|
import { DatePickerDate } from "../DatePicker";
|
|
3
3
|
import { IOption } from "../Menu";
|
|
4
4
|
export declare enum ComparisonOperator {
|
|
@@ -64,9 +64,6 @@ export interface FilterInputProps {
|
|
|
64
64
|
max?: number | Date;
|
|
65
65
|
disabled?: boolean;
|
|
66
66
|
prefix?: ReactNode;
|
|
67
|
-
fromTable?: boolean;
|
|
68
|
-
onInputClick?: (e: MouseEvent<HTMLInputElement>, option?: FilterTypeOption | null) => void;
|
|
69
67
|
active?: boolean;
|
|
70
|
-
checkboxSelectedText?: string;
|
|
71
68
|
menuMaxHeight?: string;
|
|
72
69
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { IPreviewImage, ImageSlideShowType } from "../types";
|
|
2
|
-
export declare const useImageSlideShow: (images: IPreviewImage[]) => ImageSlideShowType;
|
|
2
|
+
export declare const useImageSlideShow: (images: IPreviewImage[], initialIndex?: number) => ImageSlideShowType;
|
package/dist/uilib-gl.esm.js
CHANGED
|
@@ -22812,7 +22812,8 @@ const PopupComponent$1 = _ref => {
|
|
|
22812
22812
|
return React.createElement(Tippy, Object.assign({
|
|
22813
22813
|
content: React.createElement(GlobalsContainer, null, React.createElement(CustomBlank, {
|
|
22814
22814
|
maxHeight: maxHeight,
|
|
22815
|
-
className: className
|
|
22815
|
+
className: className,
|
|
22816
|
+
style: blankStyles
|
|
22816
22817
|
}, children)),
|
|
22817
22818
|
hideOnClick: false,
|
|
22818
22819
|
trigger: "manual",
|
|
@@ -23947,7 +23948,8 @@ const CalendarComponent = props => {
|
|
|
23947
23948
|
locale,
|
|
23948
23949
|
withHeader,
|
|
23949
23950
|
onPickDate,
|
|
23950
|
-
timeLabelText
|
|
23951
|
+
timeLabelText,
|
|
23952
|
+
style
|
|
23951
23953
|
} = props;
|
|
23952
23954
|
const [date, setDate] = useState(value || new Date());
|
|
23953
23955
|
const [time$1, setTime] = useState({
|
|
@@ -23987,7 +23989,8 @@ const CalendarComponent = props => {
|
|
|
23987
23989
|
}, [date]);
|
|
23988
23990
|
return React.createElement(CalendarContainer, {
|
|
23989
23991
|
width: "20rem",
|
|
23990
|
-
height: withTime ? `calc(31.125rem - ${differenceHeaderHeight})` : `calc(26.5rem - ${differenceHeaderHeight})
|
|
23992
|
+
height: withTime ? `calc(31.125rem - ${differenceHeaderHeight})` : `calc(26.5rem - ${differenceHeaderHeight})`,
|
|
23993
|
+
style: style
|
|
23991
23994
|
}, withHeader && React.createElement(Header$2, {
|
|
23992
23995
|
height: headerHeight,
|
|
23993
23996
|
withTime: withTime,
|
|
@@ -25284,16 +25287,6 @@ const RangeSliderButtons = /*#__PURE__*/styled(Flex)`
|
|
|
25284
25287
|
|
|
25285
25288
|
const DateRangePickerContainer = styled.div`
|
|
25286
25289
|
padding-bottom: 0.5rem;
|
|
25287
|
-
background: ${_ref => {
|
|
25288
|
-
let {
|
|
25289
|
-
theme: {
|
|
25290
|
-
palette
|
|
25291
|
-
}
|
|
25292
|
-
} = _ref;
|
|
25293
|
-
return palette.background;
|
|
25294
|
-
}};
|
|
25295
|
-
border-radius: 2px;
|
|
25296
|
-
box-shadow: 0 3px 10px 0 rgba(0, 0, 0, 0.15);
|
|
25297
25290
|
|
|
25298
25291
|
${InputLabel} {
|
|
25299
25292
|
margin: 0 auto;
|
|
@@ -25861,7 +25854,6 @@ const RangeDateInputComponent = _ref => {
|
|
|
25861
25854
|
onChange && onChange(newValue);
|
|
25862
25855
|
toggleCalendarPopup();
|
|
25863
25856
|
}, [endDate, onChange, startDate, toggleCalendarPopup]);
|
|
25864
|
-
const isLoading = minDate === undefined && maxDate === undefined;
|
|
25865
25857
|
return React.createElement(Popup$1, {
|
|
25866
25858
|
placement: "bottom-start",
|
|
25867
25859
|
isVisible: calendarIsOpen,
|
|
@@ -25869,7 +25861,7 @@ const RangeDateInputComponent = _ref => {
|
|
|
25869
25861
|
zIndex: zIndex,
|
|
25870
25862
|
anchor: ref => renderAnchor(ref),
|
|
25871
25863
|
onShown: onShown
|
|
25872
|
-
}, React.createElement(DateRangePickerContainer, null,
|
|
25864
|
+
}, React.createElement(DateRangePickerContainer, null, isRange && withHeader && React.createElement(RangeHeader, {
|
|
25873
25865
|
range: [startDate, endDate],
|
|
25874
25866
|
withTime: withTime,
|
|
25875
25867
|
height: "100px"
|
|
@@ -25892,6 +25884,10 @@ const RangeDateInputComponent = _ref => {
|
|
|
25892
25884
|
withTime: withTime,
|
|
25893
25885
|
withHeader: withHeader,
|
|
25894
25886
|
locale: Locale,
|
|
25887
|
+
style: {
|
|
25888
|
+
boxShadow: "none",
|
|
25889
|
+
padding: 0
|
|
25890
|
+
},
|
|
25895
25891
|
onPickDate: value => setRangeDate && setRangeDate(value)
|
|
25896
25892
|
}), isRange && withTime && React.createElement(DateRangeTime, {
|
|
25897
25893
|
startDate: startDate,
|
|
@@ -25900,13 +25896,7 @@ const RangeDateInputComponent = _ref => {
|
|
|
25900
25896
|
onChangeEndDate: handleChangeEndTime,
|
|
25901
25897
|
firstDayText: firstDayText,
|
|
25902
25898
|
lastDayText: lastDayText
|
|
25903
|
-
})
|
|
25904
|
-
kind: "close",
|
|
25905
|
-
onClick: toggleCalendarPopup
|
|
25906
|
-
}), React.createElement(IconButton, {
|
|
25907
|
-
kind: "success",
|
|
25908
|
-
onClick: onRequestClose
|
|
25909
|
-
}))));
|
|
25899
|
+
})));
|
|
25910
25900
|
};
|
|
25911
25901
|
|
|
25912
25902
|
const RangeDateInput = /*#__PURE__*/memo(RangeDateInputComponent);
|
|
@@ -26130,14 +26120,6 @@ const FILTER_OPTIONS_COMMON = [{
|
|
|
26130
26120
|
icon: "not_equals",
|
|
26131
26121
|
value: ComparisonOperator.NotEquals,
|
|
26132
26122
|
text: "Не равно"
|
|
26133
|
-
}, {
|
|
26134
|
-
icon: "greater_than",
|
|
26135
|
-
value: ComparisonOperator.GreaterThan,
|
|
26136
|
-
text: "Больше"
|
|
26137
|
-
}, {
|
|
26138
|
-
icon: "greater_or_equal",
|
|
26139
|
-
value: ComparisonOperator.GreaterOrEquals,
|
|
26140
|
-
text: "Больше или равно"
|
|
26141
26123
|
}, {
|
|
26142
26124
|
icon: "less_than",
|
|
26143
26125
|
value: ComparisonOperator.LessThan,
|
|
@@ -26146,7 +26128,22 @@ const FILTER_OPTIONS_COMMON = [{
|
|
|
26146
26128
|
icon: "less_or_equal",
|
|
26147
26129
|
value: ComparisonOperator.LessOrEquals,
|
|
26148
26130
|
text: "Меньше или равно"
|
|
26131
|
+
}, {
|
|
26132
|
+
icon: "greater_than",
|
|
26133
|
+
value: ComparisonOperator.GreaterThan,
|
|
26134
|
+
text: "Больше"
|
|
26135
|
+
}, {
|
|
26136
|
+
icon: "greater_or_equal",
|
|
26137
|
+
value: ComparisonOperator.GreaterOrEquals,
|
|
26138
|
+
text: "Больше или равно"
|
|
26149
26139
|
}, ...FILTER_OPTIONS_INACTIVE];
|
|
26140
|
+
const FILTER_OPTIONS_NUMBER = [...FILTER_OPTIONS_COMMON];
|
|
26141
|
+
const FILTER_OPTIONS_DATE = [... /*#__PURE__*/FILTER_OPTIONS_COMMON.filter(_ref => {
|
|
26142
|
+
let {
|
|
26143
|
+
value
|
|
26144
|
+
} = _ref;
|
|
26145
|
+
return ![ComparisonOperator.Equals, ComparisonOperator.NotEquals].includes(value);
|
|
26146
|
+
})];
|
|
26150
26147
|
|
|
26151
26148
|
/* eslint-disable max-lines */
|
|
26152
26149
|
const FilterInput = /*#__PURE__*/memo( // eslint-disable-next-line max-lines-per-function
|
|
@@ -26168,10 +26165,7 @@ _ref => {
|
|
|
26168
26165
|
max,
|
|
26169
26166
|
disabled,
|
|
26170
26167
|
prefix,
|
|
26171
|
-
fromTable,
|
|
26172
|
-
onInputClick,
|
|
26173
26168
|
active,
|
|
26174
|
-
checkboxSelectedText,
|
|
26175
26169
|
menuMaxHeight
|
|
26176
26170
|
} = _ref;
|
|
26177
26171
|
const isNumber = inputType === "number";
|
|
@@ -26181,7 +26175,7 @@ _ref => {
|
|
|
26181
26175
|
const [isMenuOpened, toggleMenu] = useToggle();
|
|
26182
26176
|
const isDisabled = disabled ?? (selectedOption == null ? void 0 : selectedOption.inactive);
|
|
26183
26177
|
const isSeveralValues = useMemo(() => selectedOption == null ? void 0 : selectedOption.checkboxes, [selectedOption]);
|
|
26184
|
-
const defaultFilterType = isDate ?
|
|
26178
|
+
const defaultFilterType = isDate ? FILTER_OPTIONS_DATE[0] : isNumber ? FILTER_OPTIONS_NUMBER[0] : Array.isArray(options) && options.length ? options.find(item => item.value === defaultOption) || options[0] : null;
|
|
26185
26179
|
const onFilterChange = useCallback((selectedFilterType, selectedFilterValue) => {
|
|
26186
26180
|
if (!selectedFilterType) return;
|
|
26187
26181
|
onChange && onChange(selectedFilterType, selectedFilterValue);
|
|
@@ -26256,21 +26250,6 @@ _ref => {
|
|
|
26256
26250
|
case "double":
|
|
26257
26251
|
case "int64":
|
|
26258
26252
|
case "int32":
|
|
26259
|
-
if (fromTable && selectedOption != null && selectedOption.range) {
|
|
26260
|
-
return React.createElement(Input$1, {
|
|
26261
|
-
label: label,
|
|
26262
|
-
width: "100%",
|
|
26263
|
-
iconBefore: prefix ?? renderMenu(options),
|
|
26264
|
-
value: Array.isArray(filterValue) && filterValue[0] !== undefined ? filterValue.join(" - ") : "",
|
|
26265
|
-
placeholder: selectedOption != null && selectedOption.inactive ? selectedOption == null ? void 0 : selectedOption.text : "0 - 0",
|
|
26266
|
-
disabled: isDisabled,
|
|
26267
|
-
onKeyDown: onKeyDown,
|
|
26268
|
-
readOnly: true,
|
|
26269
|
-
onMouseDown: e => onInputClick && onInputClick(e, selectedOption),
|
|
26270
|
-
active: active
|
|
26271
|
-
}, !isDisabled ? renderClearButton : undefined);
|
|
26272
|
-
}
|
|
26273
|
-
|
|
26274
26253
|
return selectedOption != null && selectedOption.range ? React.createElement(RangeNumberInput, {
|
|
26275
26254
|
label: label,
|
|
26276
26255
|
value: filterValue,
|
|
@@ -26300,34 +26279,13 @@ _ref => {
|
|
|
26300
26279
|
}, !isDisabled ? renderClearButton : undefined);
|
|
26301
26280
|
|
|
26302
26281
|
case "string":
|
|
26303
|
-
if (fromTable && selectedOption != null && selectedOption.checkboxes) {
|
|
26304
|
-
return React.createElement(Input$1, {
|
|
26305
|
-
label: label,
|
|
26306
|
-
width: "100%",
|
|
26307
|
-
iconBefore: prefix ?? renderMenu(options),
|
|
26308
|
-
value: Array.isArray(filterValue) && filterValue.length ? `${filterValue.length} ${checkboxSelectedText ?? "выбрано"}` : "",
|
|
26309
|
-
placeholder: selectedOption != null && selectedOption.inactive ? selectedOption == null ? void 0 : selectedOption.text : "",
|
|
26310
|
-
disabled: isDisabled,
|
|
26311
|
-
onKeyDown: onKeyDown,
|
|
26312
|
-
readOnly: true,
|
|
26313
|
-
onMouseDown: e => onInputClick && onInputClick(e, selectedOption),
|
|
26314
|
-
active: active,
|
|
26315
|
-
asChip: true,
|
|
26316
|
-
onRemove: () => {
|
|
26317
|
-
setFilterValue(null);
|
|
26318
|
-
onFilterChange(selectedOption, null);
|
|
26319
|
-
isMenuOpened && toggleMenu();
|
|
26320
|
-
}
|
|
26321
|
-
});
|
|
26322
|
-
}
|
|
26323
|
-
|
|
26324
26282
|
return selectedOption != null && selectedOption.autocomplete ? React.createElement(AutoComplete$1, {
|
|
26325
26283
|
label: label,
|
|
26326
26284
|
asyncCallback: asyncCallback,
|
|
26327
26285
|
zIndex: zIndex,
|
|
26328
26286
|
width: "100%",
|
|
26329
26287
|
iconBefore: prefix ?? renderMenu(options),
|
|
26330
|
-
value: filterValue || "",
|
|
26288
|
+
value: typeof (filterValue == null ? void 0 : filterValue.getMonth) === "function" ? "" : filterValue || "",
|
|
26331
26289
|
placeholder: selectedOption != null && selectedOption.inactive ? selectedOption.text : "",
|
|
26332
26290
|
disableInputOnly: isDisabled,
|
|
26333
26291
|
onKeyDown: onKeyDown,
|
|
@@ -27286,8 +27244,12 @@ const PreviewSlideShow = /*#__PURE__*/memo(_ref => {
|
|
|
27286
27244
|
})));
|
|
27287
27245
|
});
|
|
27288
27246
|
|
|
27289
|
-
const useImageSlideShow = images
|
|
27290
|
-
|
|
27247
|
+
const useImageSlideShow = function (images, initialIndex) {
|
|
27248
|
+
if (initialIndex === void 0) {
|
|
27249
|
+
initialIndex = 0;
|
|
27250
|
+
}
|
|
27251
|
+
|
|
27252
|
+
const [chosenImageIndex, setChosenImageIndex] = useState(initialIndex);
|
|
27291
27253
|
const [fullscreen, setFullscreen] = useState(false);
|
|
27292
27254
|
const chosenImage = useMemo(() => images[chosenImageIndex], [chosenImageIndex, images]);
|
|
27293
27255
|
const prev = useCallback(() => {
|
|
@@ -27321,6 +27283,7 @@ const useImageSlideShow = images => {
|
|
|
27321
27283
|
const PreviewComponent = _ref => {
|
|
27322
27284
|
let {
|
|
27323
27285
|
images = [],
|
|
27286
|
+
initialIndex = 0,
|
|
27324
27287
|
isOpen,
|
|
27325
27288
|
root,
|
|
27326
27289
|
onClose,
|
|
@@ -27340,7 +27303,7 @@ const PreviewComponent = _ref => {
|
|
|
27340
27303
|
prev,
|
|
27341
27304
|
next,
|
|
27342
27305
|
toggleFullscreen
|
|
27343
|
-
}] = useImageSlideShow(images);
|
|
27306
|
+
}] = useImageSlideShow(images, initialIndex);
|
|
27344
27307
|
const [failedSrcs, setFailedSrcs] = useState({});
|
|
27345
27308
|
const handleImageError = useCallback(src => {
|
|
27346
27309
|
if (!src) return;
|