funda-ui 1.1.162 → 1.1.170
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/Accordion/index.js +3 -0
- package/DropdownMenu/index.js +23 -0
- package/HorizontalScrollContent/index.js +3 -0
- package/LiveSearch/index.d.ts +2 -0
- package/LiveSearch/index.js +27 -21
- package/MultiFuncSelect/index.js +10 -1
- package/MultipleCheckboxes/index.js +13 -13
- package/MultipleSelect/index.css +175 -0
- package/MultipleSelect/index.d.ts +39 -0
- package/MultipleSelect/index.js +795 -0
- package/README.md +1 -1
- package/all.d.ts +1 -0
- package/all.js +1 -0
- package/lib/cjs/Accordion/index.js +3 -0
- package/lib/cjs/DropdownMenu/index.js +23 -0
- package/lib/cjs/HorizontalScrollContent/index.js +3 -0
- package/lib/cjs/LiveSearch/index.d.ts +2 -0
- package/lib/cjs/LiveSearch/index.js +27 -21
- package/lib/cjs/MultiFuncSelect/index.js +10 -1
- package/lib/cjs/MultipleCheckboxes/index.js +13 -13
- package/lib/cjs/MultipleSelect/index.d.ts +39 -0
- package/lib/cjs/MultipleSelect/index.js +795 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/css/MultipleSelect/index.css +175 -0
- package/lib/esm/Accordion/AccordionItem.tsx +7 -0
- package/lib/esm/Accordion/utils/performance.js +52 -0
- package/lib/esm/DropdownMenu/index.tsx +37 -2
- package/lib/esm/HorizontalScrollContent/index.tsx +6 -1
- package/lib/esm/HorizontalScrollContent/utils/performance.js +52 -0
- package/lib/esm/LiveSearch/index.tsx +23 -18
- package/lib/esm/MultiFuncSelect/index.tsx +11 -1
- package/lib/esm/MultipleCheckboxes/index.tsx +11 -11
- package/lib/esm/MultipleSelect/index.scss +216 -0
- package/lib/esm/MultipleSelect/index.tsx +517 -0
- package/lib/esm/MultipleSelect/utils/convert.js +59 -0
- package/lib/esm/MultipleSelect/utils/extract.js +63 -0
- package/lib/esm/MultipleSelect/utils/tree.js +119 -0
- package/lib/esm/ScrollReveal/utils/performance.js +52 -0
- package/lib/esm/index.js +1 -0
- package/package.json +1 -1
package/Accordion/index.js
CHANGED
|
@@ -476,6 +476,9 @@ var AccordionItem = function AccordionItem(props) {
|
|
|
476
476
|
if (contentRef.current && contentWrapperRef.current) {
|
|
477
477
|
var _contentPadding = window.getComputedStyle(contentRef.current).getPropertyValue('padding-bottom');
|
|
478
478
|
observer.current = new ResizeObserver(function (entries) {
|
|
479
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
479
482
|
entries.forEach(function (entry) {
|
|
480
483
|
if (contentWrapperRef.current !== null) contentWrapperRef.current.style.height = entry.contentRect.bottom + parseFloat(_contentPadding) + 'px';
|
|
481
484
|
});
|
package/DropdownMenu/index.js
CHANGED
|
@@ -155,6 +155,8 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
155
155
|
options = props.options,
|
|
156
156
|
tabIndex = props.tabIndex,
|
|
157
157
|
onChange = props.onChange;
|
|
158
|
+
var POS_OFFSET = 10;
|
|
159
|
+
var modalRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
|
|
158
160
|
var _useState = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(false),
|
|
159
161
|
_useState2 = _slicedToArray(_useState, 2),
|
|
160
162
|
isOpen = _useState2[0],
|
|
@@ -182,6 +184,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
182
184
|
if (!hoverOn || typeof hoverOn === 'undefined') return;
|
|
183
185
|
setTimeout(function () {
|
|
184
186
|
setIsOpen(true);
|
|
187
|
+
popwinListInit();
|
|
185
188
|
}, _hoverDelay);
|
|
186
189
|
}
|
|
187
190
|
function handleHoverOff(event) {
|
|
@@ -202,6 +205,25 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
202
205
|
onChange(option);
|
|
203
206
|
}
|
|
204
207
|
}
|
|
208
|
+
function popwinListInit() {
|
|
209
|
+
if (modalRef.current === null) return;
|
|
210
|
+
setTimeout(function () {
|
|
211
|
+
// Determine whether it exceeds the far right or left side of the screen
|
|
212
|
+
var _modalContent = modalRef.current;
|
|
213
|
+
var _modalBox = _modalContent.getBoundingClientRect();
|
|
214
|
+
if (_modalBox.right > window.innerWidth) {
|
|
215
|
+
var _modalOffsetPosition = _modalBox.right - window.innerWidth + POS_OFFSET;
|
|
216
|
+
_modalContent.style.marginLeft = "-".concat(_modalOffsetPosition, "px");
|
|
217
|
+
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (_modalBox.left < 0) {
|
|
221
|
+
var _modalOffsetPosition2 = Math.abs(_modalBox.left) + POS_OFFSET;
|
|
222
|
+
_modalContent.style.marginLeft = "".concat(_modalOffsetPosition2, "px");
|
|
223
|
+
// console.log('_modalPosition: ', _modalOffsetPosition)
|
|
224
|
+
}
|
|
225
|
+
}, 0);
|
|
226
|
+
}
|
|
205
227
|
(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useEffect)(function () {
|
|
206
228
|
document.removeEventListener('pointerdown', handleClose);
|
|
207
229
|
document.addEventListener('pointerdown', handleClose);
|
|
@@ -233,6 +255,7 @@ var DropdownMenu = function DropdownMenu(props) {
|
|
|
233
255
|
type: "hidden",
|
|
234
256
|
value: selected === null || selected === void 0 ? void 0 : selected.value
|
|
235
257
|
}), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("ul", {
|
|
258
|
+
ref: modalRef,
|
|
236
259
|
className: isOpen ? "".concat(listClassName ? listClassName : 'dropdown-menu-default', " ").concat(showClassName ? showClassName : 'show') : "".concat(listClassName ? listClassName : 'dropdown-menu-default')
|
|
237
260
|
}, selectOptionsListPresentation)));
|
|
238
261
|
};
|
|
@@ -190,6 +190,9 @@ var HorizontalScrollContent = function HorizontalScrollContent(props) {
|
|
|
190
190
|
var el = scrollContentRef.current;
|
|
191
191
|
if (el) {
|
|
192
192
|
observer.current = new ResizeObserver(function (entries) {
|
|
193
|
+
if (!Array.isArray(entries) || !entries.length) {
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
193
196
|
entries.forEach(function (entry) {
|
|
194
197
|
resetNextBtn();
|
|
195
198
|
});
|
package/LiveSearch/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ declare type LiveSearchProps = {
|
|
|
18
18
|
/** Set the depth value of the control to control the display of the pop-up layer appear above.
|
|
19
19
|
* Please set it when multiple controls are used at the same time. */
|
|
20
20
|
depth?: number;
|
|
21
|
+
/** Incoming data, you can set the third parameter of `onFetch` */
|
|
22
|
+
data?: any;
|
|
21
23
|
/** -- */
|
|
22
24
|
id?: string;
|
|
23
25
|
style?: React.CSSProperties;
|
package/LiveSearch/index.js
CHANGED
|
@@ -599,11 +599,13 @@ var useDebounce = function useDebounce(fn, delay, dependence) {
|
|
|
599
599
|
var cjs = __webpack_require__(962);
|
|
600
600
|
var cjs_default = /*#__PURE__*/__webpack_require__.n(cjs);
|
|
601
601
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
602
|
+
var _excluded = ["wrapperClassName", "controlClassName", "appearance", "disabled", "required", "placeholder", "value", "label", "name", "id", "icon", "btnId", "fetchTrigger", "hideIcon", "depth", "maxLength", "style", "winWidth", "tabIndex", "data", "fetchAutoShow", "fetchNoneInfo", "fetchUpdate", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onSelect", "onChange", "onBlur"];
|
|
602
603
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
603
604
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
604
605
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
605
606
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
606
607
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
608
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
607
609
|
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
608
610
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
609
611
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
@@ -613,6 +615,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
613
615
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
614
616
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
615
617
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
618
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
619
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
616
620
|
|
|
617
621
|
|
|
618
622
|
|
|
@@ -637,6 +641,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
637
641
|
style = props.style,
|
|
638
642
|
winWidth = props.winWidth,
|
|
639
643
|
tabIndex = props.tabIndex,
|
|
644
|
+
data = props.data,
|
|
640
645
|
fetchAutoShow = props.fetchAutoShow,
|
|
641
646
|
fetchNoneInfo = props.fetchNoneInfo,
|
|
642
647
|
fetchUpdate = props.fetchUpdate,
|
|
@@ -647,7 +652,8 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
647
652
|
onFetch = props.onFetch,
|
|
648
653
|
onSelect = props.onSelect,
|
|
649
654
|
onChange = props.onChange,
|
|
650
|
-
onBlur = props.onBlur
|
|
655
|
+
onBlur = props.onBlur,
|
|
656
|
+
attributes = _objectWithoutProperties(props, _excluded);
|
|
651
657
|
var INPUT_MATCH_ENABLED = typeof fetchAutoShow === 'undefined' || fetchAutoShow === false ? true : false;
|
|
652
658
|
var WIN_WIDTH = typeof winWidth === 'function' ? winWidth() : winWidth ? winWidth : 'auto';
|
|
653
659
|
var uniqueID = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useId)();
|
|
@@ -666,11 +672,11 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
666
672
|
var _useState3 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
667
673
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
668
674
|
dataInit = _useState4[0],
|
|
669
|
-
|
|
675
|
+
setOrginalDataInit = _useState4[1];
|
|
670
676
|
var _useState5 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)([]),
|
|
671
677
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
672
|
-
|
|
673
|
-
|
|
678
|
+
orginalData = _useState6[0],
|
|
679
|
+
setOrginalData = _useState6[1];
|
|
674
680
|
var _useState7 = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useState)(value || ''),
|
|
675
681
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
676
682
|
changedVal = _useState8[0],
|
|
@@ -851,7 +857,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
851
857
|
//
|
|
852
858
|
if (!fetchTrigger) {
|
|
853
859
|
matchData(val, fetchUpdate).then(function (response) {
|
|
854
|
-
|
|
860
|
+
setOrginalData(response);
|
|
855
861
|
|
|
856
862
|
//
|
|
857
863
|
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, response);
|
|
@@ -861,7 +867,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
861
867
|
});
|
|
862
868
|
} else {
|
|
863
869
|
//
|
|
864
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current,
|
|
870
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(inputRef.current, orginalData);
|
|
865
871
|
}
|
|
866
872
|
} else {
|
|
867
873
|
//
|
|
@@ -890,7 +896,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
890
896
|
return matchData(changedVal, fetchUpdate);
|
|
891
897
|
case 3:
|
|
892
898
|
res = _context3.sent;
|
|
893
|
-
|
|
899
|
+
setOrginalData(res);
|
|
894
900
|
|
|
895
901
|
//
|
|
896
902
|
setIsOpen(res.length === 0 ? true : false);
|
|
@@ -935,7 +941,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
935
941
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
936
942
|
|
|
937
943
|
//
|
|
938
|
-
|
|
944
|
+
setOrginalDataInit(_ORGIN_DATA);
|
|
939
945
|
|
|
940
946
|
//
|
|
941
947
|
// window position
|
|
@@ -1005,7 +1011,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1005
1011
|
case 20:
|
|
1006
1012
|
// cancel
|
|
1007
1013
|
setIsOpen(false);
|
|
1008
|
-
|
|
1014
|
+
setOrginalData([]);
|
|
1009
1015
|
case 22:
|
|
1010
1016
|
case "end":
|
|
1011
1017
|
return _context5.stop();
|
|
@@ -1024,7 +1030,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1024
1030
|
}
|
|
1025
1031
|
function handleClick() {
|
|
1026
1032
|
if (!INPUT_MATCH_ENABLED) {
|
|
1027
|
-
|
|
1033
|
+
setOrginalData(dataInit);
|
|
1028
1034
|
setIsOpen(true);
|
|
1029
1035
|
}
|
|
1030
1036
|
|
|
@@ -1038,8 +1044,8 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1038
1044
|
if (!fetchTrigger) {
|
|
1039
1045
|
setTimeout(function () {
|
|
1040
1046
|
//
|
|
1041
|
-
onBlur === null || onBlur === void 0 ? void 0 : onBlur(inputRef.current,
|
|
1042
|
-
|
|
1047
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(inputRef.current, orginalData);
|
|
1048
|
+
setOrginalData([]);
|
|
1043
1049
|
}, 300);
|
|
1044
1050
|
}
|
|
1045
1051
|
}
|
|
@@ -1050,7 +1056,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1050
1056
|
if (event.target.closest(".".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'livesearch__wrapper')) === null) {
|
|
1051
1057
|
// cancel
|
|
1052
1058
|
setIsOpen(false);
|
|
1053
|
-
|
|
1059
|
+
setOrginalData([]);
|
|
1054
1060
|
}
|
|
1055
1061
|
}
|
|
1056
1062
|
function optionFocus(type) {
|
|
@@ -1201,7 +1207,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1201
1207
|
window.removeEventListener('scroll', windowScrollUpdate);
|
|
1202
1208
|
window.removeEventListener('touchmove', windowScrollUpdate);
|
|
1203
1209
|
};
|
|
1204
|
-
}, [value]);
|
|
1210
|
+
}, [value, data]);
|
|
1205
1211
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, label ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1206
1212
|
className: "livesearch__wrapper__label"
|
|
1207
1213
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("label", {
|
|
@@ -1214,7 +1220,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1214
1220
|
className: "livesearch__wrapper ".concat(wrapperClassName || wrapperClassName === '' ? wrapperClassName : 'mb-3 position-relative', " ").concat(isOpen ? 'active' : ''),
|
|
1215
1221
|
ref: rootRef,
|
|
1216
1222
|
onMouseLeave: handleMouseLeaveTrigger
|
|
1217
|
-
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), {
|
|
1223
|
+
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((cjs_default()), _extends({
|
|
1218
1224
|
wrapperClassName: "",
|
|
1219
1225
|
controlClassName: controlClassName,
|
|
1220
1226
|
ref: inputRef,
|
|
@@ -1238,7 +1244,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1238
1244
|
icon: hideIcon ? '' : !fetchTrigger ? '' : icon,
|
|
1239
1245
|
btnId: btnId,
|
|
1240
1246
|
autoComplete: "off"
|
|
1241
|
-
}),
|
|
1247
|
+
}, attributes)), orginalData && orginalData.length > 0 && !hasErr ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1242
1248
|
ref: listRef,
|
|
1243
1249
|
className: "list-group position-absolute border shadow small ".concat(winWidth ? '' : 'w-100'),
|
|
1244
1250
|
style: {
|
|
@@ -1251,22 +1257,22 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1251
1257
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1252
1258
|
className: "rounded",
|
|
1253
1259
|
ref: listContentRef
|
|
1254
|
-
},
|
|
1260
|
+
}, orginalData ? orginalData.map(function (item, index) {
|
|
1255
1261
|
var startItemBorder = index === 0 ? 'border-top-0' : '';
|
|
1256
|
-
var endItemBorder = index ===
|
|
1262
|
+
var endItemBorder = index === orginalData.length - 1 ? 'border-bottom-0' : '';
|
|
1257
1263
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1258
1264
|
tabIndex: -1,
|
|
1259
1265
|
onClick: handleSelect,
|
|
1260
1266
|
type: "button",
|
|
1261
1267
|
"data-index": index,
|
|
1262
1268
|
key: index,
|
|
1263
|
-
className: "list-group-item list-group-item-action border-start-0 border-end-0 ".concat(startItemBorder, " ").concat(endItemBorder),
|
|
1269
|
+
className: "list-group-item list-group-item-action border-start-0 border-end-0 border-top-0 border-bottom-0 ".concat(startItemBorder, " ").concat(endItemBorder),
|
|
1264
1270
|
"data-value": "".concat(item.value),
|
|
1265
1271
|
"data-label": "".concat(item.label),
|
|
1266
1272
|
"data-querystring": "".concat(typeof item.queryString === 'undefined' ? '' : item.queryString),
|
|
1267
1273
|
role: "tab"
|
|
1268
1274
|
}, item.label);
|
|
1269
|
-
}) : null))) : null,
|
|
1275
|
+
}) : null))) : null, orginalData && orginalData.length === 0 && !hasErr && isOpen ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("div", {
|
|
1270
1276
|
ref: listRef,
|
|
1271
1277
|
className: "list-group position-absolute border shadow small ".concat(winWidth ? '' : 'w-100'),
|
|
1272
1278
|
style: {
|
|
@@ -1282,7 +1288,7 @@ var LiveSearch = function LiveSearch(props) {
|
|
|
1282
1288
|
}, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("button", {
|
|
1283
1289
|
tabIndex: -1,
|
|
1284
1290
|
type: "button",
|
|
1285
|
-
className: "list-group-item list-group-item-action no-match",
|
|
1291
|
+
className: "list-group-item list-group-item-action border-top-0 border-bottom-0 no-match",
|
|
1286
1292
|
disabled: true
|
|
1287
1293
|
}, fetchNoneInfo || 'No match yet')))) : null, hideIcon ? null : /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, !fetchTrigger ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
1288
1294
|
className: "livesearch__wrapper-searchbtn position-absolute top-0 end-0"
|
package/MultiFuncSelect/index.js
CHANGED
|
@@ -1719,8 +1719,17 @@ var MultiFuncSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_common
|
|
|
1719
1719
|
// pop win initalization
|
|
1720
1720
|
setTimeout(function () {
|
|
1721
1721
|
popwinPosInit();
|
|
1722
|
-
popwinBtnEventsInit(
|
|
1722
|
+
popwinBtnEventsInit(orginalData);
|
|
1723
1723
|
}, 0);
|
|
1724
|
+
|
|
1725
|
+
// make sure the event handler is registered
|
|
1726
|
+
if (orginalData.length === 0) {
|
|
1727
|
+
setTimeout(function () {
|
|
1728
|
+
// no data label
|
|
1729
|
+
popwinNoMatchInit();
|
|
1730
|
+
popwinBtnEventsInit(orginalData);
|
|
1731
|
+
}, 500);
|
|
1732
|
+
}
|
|
1724
1733
|
if (LIVE_SEARCH_OK) {
|
|
1725
1734
|
// clean data
|
|
1726
1735
|
setOptionsData([]);
|
|
@@ -702,12 +702,12 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
702
702
|
var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
|
|
703
703
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
704
704
|
_useState2 = _slicedToArray(_useState, 2),
|
|
705
|
-
|
|
706
|
-
|
|
705
|
+
valData = _useState2[0],
|
|
706
|
+
setValData = _useState2[1];
|
|
707
707
|
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
708
708
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
709
|
-
|
|
710
|
-
|
|
709
|
+
valSelected = _useState4[0],
|
|
710
|
+
setValSelected = _useState4[1];
|
|
711
711
|
var _inline = typeof inline === 'undefined' ? true : inline;
|
|
712
712
|
|
|
713
713
|
// Determine whether it is in JSON format
|
|
@@ -733,15 +733,15 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
733
733
|
function initDefaultValue(defaultValue) {
|
|
734
734
|
// change the value to trigger component rendering
|
|
735
735
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
736
|
-
|
|
736
|
+
setValSelected([]);
|
|
737
737
|
} else {
|
|
738
738
|
var _val = VALUE_BY_BRACKETS ? (0,_utils_extract__WEBPACK_IMPORTED_MODULE_2__.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
|
|
739
739
|
if (Array.isArray(_val)) {
|
|
740
|
-
|
|
740
|
+
setValSelected(_val.filter(function (v) {
|
|
741
741
|
return v !== '';
|
|
742
742
|
}));
|
|
743
743
|
} else {
|
|
744
|
-
|
|
744
|
+
setValSelected([]);
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
}
|
|
@@ -752,7 +752,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
752
752
|
|
|
753
753
|
// Initialize options
|
|
754
754
|
//--------------
|
|
755
|
-
|
|
755
|
+
setValData(optionsRes);
|
|
756
756
|
}, [value, options]);
|
|
757
757
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
758
758
|
className: wrapperClassName || wrapperClassName === '' ? "multiple-checkboxes__wrapper ".concat(wrapperClassName) : "multiple-checkboxes__wrapper mb-3 position-relative",
|
|
@@ -766,7 +766,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
766
766
|
})) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
767
767
|
className: "multiple-checkboxes__control-wrapper",
|
|
768
768
|
style: style
|
|
769
|
-
},
|
|
769
|
+
}, valData ? valData.map(function (item, i) {
|
|
770
770
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
771
771
|
key: 'checkbox' + i,
|
|
772
772
|
className: "multiple-checkboxes__control ".concat(_inline ? 'd-inline-block' : '', " pe-3"),
|
|
@@ -780,18 +780,18 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
780
780
|
value: item.value,
|
|
781
781
|
disabled: disabled || null,
|
|
782
782
|
onChange: function onChange(e, val) {
|
|
783
|
-
|
|
783
|
+
setValSelected(function (prevState) {
|
|
784
784
|
var newData = JSON.parse(JSON.stringify(prevState));
|
|
785
785
|
var index = newData.findIndex(function (item) {
|
|
786
786
|
return item == e.target.value;
|
|
787
787
|
});
|
|
788
788
|
if (index !== -1) newData.splice(index, 1);
|
|
789
789
|
var _res = val ? Array.from(new Set([e.target.value].concat(_toConsumableArray(newData)))) : newData;
|
|
790
|
-
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
790
|
+
_onChange === null || _onChange === void 0 ? void 0 : _onChange(e.target, _res, VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(_res) : _res.join(','));
|
|
791
791
|
return _res;
|
|
792
792
|
});
|
|
793
793
|
},
|
|
794
|
-
checked:
|
|
794
|
+
checked: valSelected.includes(item.value)
|
|
795
795
|
}));
|
|
796
796
|
}) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", _extends({
|
|
797
797
|
ref: inputRef,
|
|
@@ -799,7 +799,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
799
799
|
type: "hidden",
|
|
800
800
|
id: idRes,
|
|
801
801
|
name: name,
|
|
802
|
-
value: VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(
|
|
802
|
+
value: VALUE_BY_BRACKETS ? (0,_utils_convert__WEBPACK_IMPORTED_MODULE_3__.convertArrToValByBrackets)(valSelected) : valSelected.join(','),
|
|
803
803
|
required: required || null
|
|
804
804
|
}, attributes))), required ? /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement((react__WEBPACK_IMPORTED_MODULE_0___default().Fragment), null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("span", {
|
|
805
805
|
className: "position-absolute end-0 top-0 my-2 mx-2"
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/* ======================================================
|
|
2
|
+
<!-- Multiple Select -->
|
|
3
|
+
/* ====================================================== */
|
|
4
|
+
.m-select__wrapper {
|
|
5
|
+
--m-select-scrollbar-color: rgba(0, 0, 0, 0.2);
|
|
6
|
+
--m-select-scrollbar-track: rgba(0, 0, 0, 0);
|
|
7
|
+
--m-select-scrollbar-w: 3px;
|
|
8
|
+
min-width: 350px;
|
|
9
|
+
min-height: 315px;
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
border: solid 1px #dee2e6;
|
|
13
|
+
border-radius: 0.35rem;
|
|
14
|
+
position: relative;
|
|
15
|
+
background: #fff;
|
|
16
|
+
/*-------- List --------*/
|
|
17
|
+
}
|
|
18
|
+
.m-select__wrapper .m-select-diving-line {
|
|
19
|
+
width: 1px;
|
|
20
|
+
background-color: #dee2e6;
|
|
21
|
+
left: 50%;
|
|
22
|
+
top: 0;
|
|
23
|
+
position: absolute;
|
|
24
|
+
height: 100%;
|
|
25
|
+
z-index: 1;
|
|
26
|
+
}
|
|
27
|
+
.m-select__wrapper .m-select-inner {
|
|
28
|
+
display: flex;
|
|
29
|
+
font-size: 0.8em;
|
|
30
|
+
height: 100%;
|
|
31
|
+
}
|
|
32
|
+
.m-select__wrapper .m-select-inner ul,
|
|
33
|
+
.m-select__wrapper .m-select-inner li {
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
list-style: none;
|
|
37
|
+
}
|
|
38
|
+
.m-select__wrapper .m-select-inner div.m-select__selected__container,
|
|
39
|
+
.m-select__wrapper .m-select-inner div.m-select__available__container {
|
|
40
|
+
position: relative;
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
.m-select__wrapper .m-select-inner ul.m-select__selected,
|
|
44
|
+
.m-select__wrapper .m-select-inner ul.m-select__available {
|
|
45
|
+
position: relative;
|
|
46
|
+
overflow: auto;
|
|
47
|
+
overflow-x: hidden;
|
|
48
|
+
background: #fff;
|
|
49
|
+
border: none;
|
|
50
|
+
position: relative;
|
|
51
|
+
width: 100%;
|
|
52
|
+
}
|
|
53
|
+
.m-select__wrapper .m-select-inner ul {
|
|
54
|
+
user-select: none;
|
|
55
|
+
}
|
|
56
|
+
.m-select__wrapper .m-select-inner li {
|
|
57
|
+
cursor: default;
|
|
58
|
+
position: relative;
|
|
59
|
+
font-size: 0.75rem;
|
|
60
|
+
display: flex;
|
|
61
|
+
justify-content: space-between;
|
|
62
|
+
background: #f6f6f6;
|
|
63
|
+
border-bottom: 1px solid rgb(255, 255, 255);
|
|
64
|
+
}
|
|
65
|
+
.m-select__wrapper .m-select-inner li.disabled {
|
|
66
|
+
pointer-events: none;
|
|
67
|
+
opacity: 0.4;
|
|
68
|
+
}
|
|
69
|
+
.m-select__wrapper .m-select-inner li.hide {
|
|
70
|
+
display: none;
|
|
71
|
+
}
|
|
72
|
+
.m-select__wrapper .m-select-inner li:hover {
|
|
73
|
+
opacity: 0.8;
|
|
74
|
+
}
|
|
75
|
+
.m-select__wrapper .m-select-inner li.selected {
|
|
76
|
+
background: #0b5ed7;
|
|
77
|
+
color: #fff;
|
|
78
|
+
}
|
|
79
|
+
.m-select__wrapper .m-select-inner li.selected > i svg path {
|
|
80
|
+
fill: #fff;
|
|
81
|
+
}
|
|
82
|
+
.m-select__wrapper .m-select-inner li:last-child {
|
|
83
|
+
border-bottom: none;
|
|
84
|
+
}
|
|
85
|
+
.m-select__wrapper .m-select-inner li > span {
|
|
86
|
+
padding: 0.35rem 0.75rem;
|
|
87
|
+
display: inline-block;
|
|
88
|
+
max-width: 100%;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
text-overflow: ellipsis;
|
|
91
|
+
word-break: break-all;
|
|
92
|
+
}
|
|
93
|
+
.m-select__wrapper .m-select-inner li > strong {
|
|
94
|
+
font-weight: normal;
|
|
95
|
+
}
|
|
96
|
+
.m-select__wrapper .m-select-inner li > i {
|
|
97
|
+
display: inline-block;
|
|
98
|
+
padding: 0.35rem 0.75rem;
|
|
99
|
+
cursor: pointer;
|
|
100
|
+
}
|
|
101
|
+
.m-select__wrapper .m-select-inner li a {
|
|
102
|
+
color: #999;
|
|
103
|
+
text-decoration: none;
|
|
104
|
+
padding: 0;
|
|
105
|
+
display: block;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
}
|
|
108
|
+
.m-select__wrapper .m-select-inner li a.m-select__item-action {
|
|
109
|
+
position: absolute;
|
|
110
|
+
right: 0.5rem;
|
|
111
|
+
top: 0.5rem;
|
|
112
|
+
}
|
|
113
|
+
.m-select__wrapper .m-select-inner div.m-select__selected__container .m-select__header {
|
|
114
|
+
border-radius: 0 0.35rem 0 0;
|
|
115
|
+
}
|
|
116
|
+
.m-select__wrapper .m-select-inner div.m-select__available__container .m-select__header {
|
|
117
|
+
border-radius: 0.35rem 0 0 0;
|
|
118
|
+
}
|
|
119
|
+
.m-select__wrapper .m-select-inner .m-select__header {
|
|
120
|
+
border: none;
|
|
121
|
+
font-size: 0.75rem;
|
|
122
|
+
margin-bottom: 1px;
|
|
123
|
+
background: #dee2e6;
|
|
124
|
+
display: flex;
|
|
125
|
+
justify-content: space-between;
|
|
126
|
+
align-items: center;
|
|
127
|
+
height: 1.625rem;
|
|
128
|
+
}
|
|
129
|
+
.m-select__wrapper .m-select-inner .m-select__btn--add-all {
|
|
130
|
+
padding: 0.2rem;
|
|
131
|
+
}
|
|
132
|
+
.m-select__wrapper .m-select-inner .m-select__btn--remove-all {
|
|
133
|
+
padding: 0.2rem;
|
|
134
|
+
}
|
|
135
|
+
.m-select__wrapper .m-select-inner .m-select__count {
|
|
136
|
+
padding: 0.2rem;
|
|
137
|
+
}
|
|
138
|
+
.m-select__wrapper .m-select-inner .m-select__title {
|
|
139
|
+
padding: 0.2rem;
|
|
140
|
+
font-weight: bold;
|
|
141
|
+
}
|
|
142
|
+
.m-select__wrapper .m-select-inner input.m-select__search {
|
|
143
|
+
height: 14px;
|
|
144
|
+
padding: 0.1rem 0.5rem;
|
|
145
|
+
opacity: 0.5;
|
|
146
|
+
margin: 4px;
|
|
147
|
+
width: 100px;
|
|
148
|
+
border-radius: 25px;
|
|
149
|
+
border: none;
|
|
150
|
+
outline: none;
|
|
151
|
+
box-shadow: none;
|
|
152
|
+
}
|
|
153
|
+
.m-select__wrapper .m-select__options-contentlist {
|
|
154
|
+
position: relative;
|
|
155
|
+
width: 100%;
|
|
156
|
+
overflow: hidden;
|
|
157
|
+
overflow-y: auto;
|
|
158
|
+
max-height: calc(315px - 1.75rem);
|
|
159
|
+
}
|
|
160
|
+
.m-select__wrapper .m-select__options-contentlist::-webkit-scrollbar {
|
|
161
|
+
width: var(--m-select-scrollbar-w);
|
|
162
|
+
}
|
|
163
|
+
.m-select__wrapper .m-select__options-contentlist::-webkit-scrollbar-thumb {
|
|
164
|
+
background: var(--m-select-scrollbar-color);
|
|
165
|
+
}
|
|
166
|
+
.m-select__wrapper .m-select__options-contentlist::-webkit-scrollbar-track {
|
|
167
|
+
background: var(--m-select-scrollbar-track);
|
|
168
|
+
}
|
|
169
|
+
.m-select__wrapper .m-select__options-contentlist.dragging {
|
|
170
|
+
cursor: grab;
|
|
171
|
+
}
|
|
172
|
+
.m-select__wrapper .m-select__options-contentlist--hide {
|
|
173
|
+
overflow: hidden;
|
|
174
|
+
height: auto;
|
|
175
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface OptionConfig {
|
|
3
|
+
[propName: string]: string | number | boolean;
|
|
4
|
+
}
|
|
5
|
+
declare type MultipleSelectProps = {
|
|
6
|
+
wrapperClassName?: string;
|
|
7
|
+
availableHeaderTitle?: string;
|
|
8
|
+
selectedHeaderTitle?: string;
|
|
9
|
+
selectedHeaderNote?: string;
|
|
10
|
+
removeAllBtnLabel?: string | React.ReactNode;
|
|
11
|
+
addAllBtnLabel?: string | React.ReactNode;
|
|
12
|
+
iconAdd?: React.ReactNode | string;
|
|
13
|
+
iconRemove?: React.ReactNode | string;
|
|
14
|
+
hierarchical?: boolean;
|
|
15
|
+
indentation?: string;
|
|
16
|
+
doubleIndent?: boolean;
|
|
17
|
+
value?: string;
|
|
18
|
+
label?: React.ReactNode | string;
|
|
19
|
+
name?: string;
|
|
20
|
+
options?: OptionConfig[] | string;
|
|
21
|
+
disabled?: any;
|
|
22
|
+
required?: any;
|
|
23
|
+
/** Whether to use square brackets to save result and initialize default value */
|
|
24
|
+
extractValueByBrackets?: boolean;
|
|
25
|
+
/** Incoming data, you can set the third parameter of `onFetch` */
|
|
26
|
+
data?: any;
|
|
27
|
+
/** -- */
|
|
28
|
+
id?: string;
|
|
29
|
+
style?: React.CSSProperties;
|
|
30
|
+
[key: `data-${string}`]: string | undefined;
|
|
31
|
+
fetchFuncAsync?: any;
|
|
32
|
+
fetchFuncMethod?: string;
|
|
33
|
+
fetchFuncMethodParams?: any[];
|
|
34
|
+
fetchCallback?: (data: any) => void;
|
|
35
|
+
onFetch?: (data: any) => void;
|
|
36
|
+
onChange?: (e: any, data: any, dataStr: any) => void;
|
|
37
|
+
};
|
|
38
|
+
declare const MultipleSelect: React.ForwardRefExoticComponent<MultipleSelectProps & React.RefAttributes<unknown>>;
|
|
39
|
+
export default MultipleSelect;
|