wini-web-components 2.4.6 → 2.4.8
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/component/input-multi-select/input-multi-select.js +10 -7
- package/dist/component/popup/popup.d.ts +9 -2
- package/dist/component/popup/popup.js +23 -4
- package/dist/component/select1/select1.js +7 -8
- package/dist/component/slider/slider.js +2 -0
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -115,6 +115,7 @@ var checkbox_1 = require("../checkbox/checkbox");
|
|
|
115
115
|
var text_1 = require("../text/text");
|
|
116
116
|
var winicon_1 = require("../wini-icon/winicon");
|
|
117
117
|
var react_i18next_1 = require("react-i18next");
|
|
118
|
+
var popup_1 = require("../popup/popup");
|
|
118
119
|
;
|
|
119
120
|
var TSelectMultiple = /** @class */ (function (_super) {
|
|
120
121
|
__extends(TSelectMultiple, _super);
|
|
@@ -122,6 +123,7 @@ var TSelectMultiple = /** @class */ (function (_super) {
|
|
|
122
123
|
var _a;
|
|
123
124
|
var _this = _super.call(this, props) || this;
|
|
124
125
|
_this.containerRef = (0, react_1.createRef)();
|
|
126
|
+
_this.inputRef = (0, react_1.createRef)();
|
|
125
127
|
_this.state = {
|
|
126
128
|
value: (_a = props.value) !== null && _a !== void 0 ? _a : [],
|
|
127
129
|
options: props.options,
|
|
@@ -279,11 +281,9 @@ var TSelectMultiple = /** @class */ (function (_super) {
|
|
|
279
281
|
react_1.default.createElement(text_1.Text, { style: { color: "var(--neutral-text-title-color)", fontSize: '1.2rem', lineHeight: '1.4rem' } }, optionItem === null || optionItem === void 0 ? void 0 : optionItem.name),
|
|
280
282
|
react_1.default.createElement(winicon_1.Winicon, { src: "outline/user interface/e-remove", size: '1.2rem' }));
|
|
281
283
|
}),
|
|
282
|
-
(!this.state.value.length || this.state.isOpen) && react_1.default.createElement("input", { autoFocus: this.state.value.length > 0, onChange: this.search, placeholder: this.state.value.length ? undefined : this.props.placeholder, onBlur: function (ev) {
|
|
283
|
-
if (_this.state.
|
|
284
|
+
(!this.state.value.length || this.state.isOpen) && react_1.default.createElement("input", { ref: this.inputRef, autoFocus: this.state.value.length > 0, onChange: this.search, placeholder: this.state.value.length ? undefined : this.props.placeholder, onBlur: function (ev) {
|
|
285
|
+
if (_this.state.isOpen)
|
|
284
286
|
ev.target.focus();
|
|
285
|
-
else
|
|
286
|
-
_this.setState(__assign(__assign({}, _this.state), { isOpen: false, onSelect: null }));
|
|
287
287
|
} })),
|
|
288
288
|
this.props.showClearValueButton && this.state.value.length ? react_1.default.createElement("button", { type: 'button', className: 'row', style: { padding: '0.4rem' }, onClick: function (ev) {
|
|
289
289
|
ev.stopPropagation();
|
|
@@ -296,12 +296,15 @@ var TSelectMultiple = /** @class */ (function (_super) {
|
|
|
296
296
|
}, className: 'row' },
|
|
297
297
|
react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: '1.2rem' })),
|
|
298
298
|
this.state.isOpen &&
|
|
299
|
-
react_dom_1.default.createPortal(react_1.default.createElement(
|
|
299
|
+
react_dom_1.default.createPortal(react_1.default.createElement(popup_1.PopupOverlay, { className: "".concat(input_multi_select_module_css_1.default['select-multi-popup'], " select-multi-popup col ").concat((_e = this.props.popupClassName) !== null && _e !== void 0 ? _e : ""), style: (_f = this.state.style) !== null && _f !== void 0 ? _f : {
|
|
300
300
|
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
301
301
|
left: this.state.offset.x + 'px',
|
|
302
302
|
width: this.state.offset.width,
|
|
303
|
-
},
|
|
304
|
-
|
|
303
|
+
}, onClose: function (ev) {
|
|
304
|
+
if (ev.target !== _this.inputRef.current)
|
|
305
|
+
_this.setState(__assign(__assign({}, _this.state), { isOpen: false }));
|
|
306
|
+
} },
|
|
307
|
+
react_1.default.createElement("div", { style: { padding: '1.2rem 1.6rem', width: '100%', borderBottom: "var(--neutral-main-border)" } }, (function () {
|
|
305
308
|
var _a, _b;
|
|
306
309
|
var _list = ((_b = (_a = _this.state.search) !== null && _a !== void 0 ? _a : _this.props.options) !== null && _b !== void 0 ? _b : []);
|
|
307
310
|
var isSelectedAll = _list.every(function (item) { return _this.state.value.some(function (vl) { return vl === item.id; }); });
|
|
@@ -11,7 +11,7 @@ interface PopupState {
|
|
|
11
11
|
hideButtonClose?: boolean;
|
|
12
12
|
}
|
|
13
13
|
export declare const showPopup: (props: {
|
|
14
|
-
ref: React.
|
|
14
|
+
ref: React.RefObject<Popup | undefined>;
|
|
15
15
|
heading?: ReactNode;
|
|
16
16
|
content?: ReactNode;
|
|
17
17
|
body?: ReactNode;
|
|
@@ -20,7 +20,7 @@ export declare const showPopup: (props: {
|
|
|
20
20
|
style?: CSSProperties;
|
|
21
21
|
hideButtonClose?: boolean;
|
|
22
22
|
}) => void;
|
|
23
|
-
export declare const closePopup: (ref: React.
|
|
23
|
+
export declare const closePopup: (ref: React.RefObject<Popup>) => void;
|
|
24
24
|
export declare class Popup extends React.Component<Object, PopupState> {
|
|
25
25
|
private ref;
|
|
26
26
|
constructor(props: Object | Readonly<Object>);
|
|
@@ -30,4 +30,11 @@ export declare class Popup extends React.Component<Object, PopupState> {
|
|
|
30
30
|
componentDidUpdate(prevProps: Readonly<Object>, prevState: Readonly<PopupState>): void;
|
|
31
31
|
render(): React.JSX.Element;
|
|
32
32
|
}
|
|
33
|
+
export declare function PopupOverlay({ children, onClose, className, style, onOpen }: {
|
|
34
|
+
children?: ReactNode;
|
|
35
|
+
className?: string;
|
|
36
|
+
onClose?: (ev: MouseEvent) => void;
|
|
37
|
+
style?: CSSProperties;
|
|
38
|
+
onOpen?: (ev: HTMLDivElement) => void;
|
|
39
|
+
}): React.JSX.Element;
|
|
33
40
|
export {};
|
|
@@ -63,6 +63,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
63
63
|
};
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
65
|
exports.Popup = exports.closePopup = exports.showPopup = void 0;
|
|
66
|
+
exports.PopupOverlay = PopupOverlay;
|
|
66
67
|
var react_1 = __importStar(require("react"));
|
|
67
68
|
var react_dom_1 = __importDefault(require("react-dom"));
|
|
68
69
|
require("./popup.css");
|
|
@@ -122,10 +123,7 @@ var Popup = /** @class */ (function (_super) {
|
|
|
122
123
|
var _this = this;
|
|
123
124
|
var _a;
|
|
124
125
|
return (react_1.default.createElement(react_1.default.Fragment, null, this.state.open &&
|
|
125
|
-
react_dom_1.default.createPortal(react_1.default.createElement(
|
|
126
|
-
if (ev.target.classList.contains('popup-overlay'))
|
|
127
|
-
_this.onClose();
|
|
128
|
-
} : undefined }, (_a = this.state.content) !== null && _a !== void 0 ? _a : react_1.default.createElement("div", { ref: this.ref, className: 'popup-container col', onClick: function (e) { return e.stopPropagation(); }, style: this.state.style },
|
|
126
|
+
react_dom_1.default.createPortal(react_1.default.createElement(PopupOverlay, { className: this.state.clickOverlayClosePopup ? 'hidden-overlay' : '', onClose: this.state.clickOverlayClosePopup ? function () { _this.onClose(); } : undefined }, (_a = this.state.content) !== null && _a !== void 0 ? _a : react_1.default.createElement("div", { ref: this.ref, className: 'popup-container col', onClick: function (e) { return e.stopPropagation(); }, style: this.state.style },
|
|
129
127
|
this.state.heading,
|
|
130
128
|
this.state.body,
|
|
131
129
|
this.state.footer,
|
|
@@ -136,3 +134,24 @@ var Popup = /** @class */ (function (_super) {
|
|
|
136
134
|
return Popup;
|
|
137
135
|
}(react_1.default.Component));
|
|
138
136
|
exports.Popup = Popup;
|
|
137
|
+
function PopupOverlay(_a) {
|
|
138
|
+
var children = _a.children, onClose = _a.onClose, className = _a.className, style = _a.style, onOpen = _a.onOpen;
|
|
139
|
+
var overlayRef = (0, react_1.useRef)(null);
|
|
140
|
+
(0, react_1.useEffect)(function () {
|
|
141
|
+
if (overlayRef.current && onClose) {
|
|
142
|
+
var onClickDropDown_1 = function (ev) {
|
|
143
|
+
if (ev.target !== overlayRef.current && !overlayRef.current.contains(ev.target))
|
|
144
|
+
onClose(ev);
|
|
145
|
+
};
|
|
146
|
+
window.document.body.addEventListener("mousedown", onClickDropDown_1);
|
|
147
|
+
return function () {
|
|
148
|
+
window.document.body.removeEventListener("mousedown", onClickDropDown_1);
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}, [overlayRef]);
|
|
152
|
+
(0, react_1.useEffect)(function () {
|
|
153
|
+
if (overlayRef.current && onOpen)
|
|
154
|
+
onOpen(overlayRef.current);
|
|
155
|
+
}, [overlayRef, onOpen]);
|
|
156
|
+
return react_1.default.createElement("div", { ref: overlayRef, className: "popup-overlay ".concat(className !== null && className !== void 0 ? className : ""), style: style }, children);
|
|
157
|
+
}
|
|
@@ -105,6 +105,7 @@ var react_dom_1 = __importDefault(require("react-dom"));
|
|
|
105
105
|
var winicon_1 = require("../wini-icon/winicon");
|
|
106
106
|
var text_1 = require("../text/text");
|
|
107
107
|
var react_i18next_1 = require("react-i18next");
|
|
108
|
+
var popup_1 = require("../popup/popup");
|
|
108
109
|
;
|
|
109
110
|
var TSelect1 = /** @class */ (function (_super) {
|
|
110
111
|
__extends(TSelect1, _super);
|
|
@@ -269,25 +270,23 @@ var TSelect1 = /** @class */ (function (_super) {
|
|
|
269
270
|
}
|
|
270
271
|
} },
|
|
271
272
|
this.props.prefix,
|
|
272
|
-
(!_value || typeof _value.name === "string" || typeof _value.name === "number") ? react_1.default.createElement("input", { ref: this.inputRef, readOnly: this.props.readOnly, onChange: this.search, placeholder: this.props.placeholder,
|
|
273
|
+
(!_value || typeof _value.name === "string" || typeof _value.name === "number") ? react_1.default.createElement("input", { ref: this.inputRef, readOnly: this.props.readOnly, onChange: this.search, placeholder: this.props.placeholder, onBlur: function (ev) {
|
|
273
274
|
if (_this.state.onSelect && !_this.props.readOnly)
|
|
274
275
|
ev.target.focus();
|
|
275
|
-
else if (!_this.state.onSelect)
|
|
276
|
-
_this.setState(__assign(__assign({}, _this.state), { isOpen: false, onSelect: null }));
|
|
277
276
|
} }) : _value.name, (_e = this.props.suffix) !== null && _e !== void 0 ? _e : react_1.default.createElement("div", { ref: function (iconRef) {
|
|
278
277
|
if ((iconRef === null || iconRef === void 0 ? void 0 : iconRef.parentElement) && iconRef.parentElement.getBoundingClientRect().width < 88)
|
|
279
278
|
iconRef.style.display = "none";
|
|
280
279
|
}, className: 'row' },
|
|
281
280
|
react_1.default.createElement(winicon_1.Winicon, { src: this.state.isOpen ? "fill/arrows/up-arrow" : "fill/arrows/down-arrow", size: "1.2rem" })),
|
|
282
281
|
this.state.isOpen &&
|
|
283
|
-
react_dom_1.default.createPortal(react_1.default.createElement("
|
|
284
|
-
if (popupRef && _this.props.onOpenOptions)
|
|
285
|
-
_this.props.onOpenOptions(popupRef);
|
|
286
|
-
}, className: "".concat(select1_module_css_1.default['select1-popup'], " select1-popup col ").concat((_f = this.props.popupClassName) !== null && _f !== void 0 ? _f : ""), style: (_g = this.state.style) !== null && _g !== void 0 ? _g : {
|
|
282
|
+
react_dom_1.default.createPortal(react_1.default.createElement(popup_1.PopupOverlay, { onOpen: this.props.onOpenOptions, className: "".concat(select1_module_css_1.default['select1-popup'], " select1-popup col ").concat((_f = this.props.popupClassName) !== null && _f !== void 0 ? _f : ""), style: (_g = this.state.style) !== null && _g !== void 0 ? _g : {
|
|
287
283
|
top: this.state.offset.y + this.state.offset.height + 2 + 'px',
|
|
288
284
|
left: this.state.offset.x + 'px',
|
|
289
285
|
width: this.state.offset.width,
|
|
290
|
-
},
|
|
286
|
+
}, onClose: function (ev) {
|
|
287
|
+
if (ev.target !== _this.inputRef.current)
|
|
288
|
+
_this.setState(__assign(__assign({}, _this.state), { isOpen: false }));
|
|
289
|
+
} },
|
|
291
290
|
react_1.default.createElement("div", { className: "col ".concat(select1_module_css_1.default['select-body']), onScroll: this.props.handleLoadmore ? function (ev) {
|
|
292
291
|
if (_this.props.handleLoadmore) {
|
|
293
292
|
var scrollElement = ev.target;
|
|
@@ -60,6 +60,8 @@ var CustomSlider = /** @class */ (function (_super) {
|
|
|
60
60
|
page: 0
|
|
61
61
|
};
|
|
62
62
|
_this.autoPlay = _this.autoPlay.bind(_this);
|
|
63
|
+
_this.nextPage = _this.nextPage.bind(_this);
|
|
64
|
+
_this.previousPage = _this.previousPage.bind(_this);
|
|
63
65
|
return _this;
|
|
64
66
|
}
|
|
65
67
|
CustomSlider.prototype.componentDidMount = function () {
|