wini-web-components 2.4.7 → 2.4.9
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/button/button.d.ts +2 -0
- package/dist/component/button/button.js +5 -2
- package/dist/component/input-multi-select/input-multi-select.js +10 -7
- package/dist/component/popup/popup.d.ts +7 -0
- package/dist/component/popup/popup.js +10 -5
- 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
|
@@ -28,8 +28,11 @@ var Button = /** @class */ (function (_super) {
|
|
|
28
28
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
29
29
|
}
|
|
30
30
|
Button.prototype.render = function () {
|
|
31
|
-
var _a, _b;
|
|
32
|
-
return react_1.default.createElement("
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
return this.props.linkTo ? react_1.default.createElement("a", { id: this.props.id, href: this.props.disabled ? undefined : this.props.linkTo, target: this.props.target, className: "".concat(button_module_css_1.default['button-container'], " row ").concat((_a = this.props.className) !== null && _a !== void 0 ? _a : "button-text-3"), style: this.props.style },
|
|
33
|
+
this.props.prefix,
|
|
34
|
+
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, this.props.label),
|
|
35
|
+
this.props.suffix) : react_1.default.createElement("button", { id: this.props.id, type: (_b = this.props.type) !== null && _b !== void 0 ? _b : "button", disabled: this.props.disabled, className: "".concat(button_module_css_1.default['button-container'], " row ").concat((_c = this.props.className) !== null && _c !== void 0 ? _c : "button-text-3"), style: this.props.style, onClick: this.props.onClick },
|
|
33
36
|
this.props.prefix,
|
|
34
37
|
react_1.default.createElement(text_1.Text, { maxLine: 1, className: button_module_css_1.default['button-label'] }, this.props.label),
|
|
35
38
|
this.props.suffix);
|
|
@@ -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'], " hidden-overlay 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; }); });
|
|
@@ -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");
|
|
@@ -134,19 +135,23 @@ var Popup = /** @class */ (function (_super) {
|
|
|
134
135
|
}(react_1.default.Component));
|
|
135
136
|
exports.Popup = Popup;
|
|
136
137
|
function PopupOverlay(_a) {
|
|
137
|
-
var children = _a.children, onClose = _a.onClose, className = _a.className;
|
|
138
|
+
var children = _a.children, onClose = _a.onClose, className = _a.className, style = _a.style, onOpen = _a.onOpen;
|
|
138
139
|
var overlayRef = (0, react_1.useRef)(null);
|
|
139
140
|
(0, react_1.useEffect)(function () {
|
|
140
141
|
if (overlayRef.current && onClose) {
|
|
141
142
|
var onClickDropDown_1 = function (ev) {
|
|
142
143
|
if (ev.target !== overlayRef.current && !overlayRef.current.contains(ev.target))
|
|
143
|
-
onClose();
|
|
144
|
+
onClose(ev);
|
|
144
145
|
};
|
|
145
|
-
window.document.body.addEventListener("
|
|
146
|
+
window.document.body.addEventListener("mousedown", onClickDropDown_1);
|
|
146
147
|
return function () {
|
|
147
|
-
window.document.body.removeEventListener("
|
|
148
|
+
window.document.body.removeEventListener("mousedown", onClickDropDown_1);
|
|
148
149
|
};
|
|
149
150
|
}
|
|
150
151
|
}, [overlayRef]);
|
|
151
|
-
|
|
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);
|
|
152
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'], " hidden-overlay 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 () {
|