funda-ui 4.2.717 → 4.2.811
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/DynamicFields/index.js +1 -3
- package/MultipleCheckboxes/index.js +3 -5
- package/MultipleSelect/index.d.ts +2 -1
- package/MultipleSelect/index.js +18 -4
- package/lib/cjs/DynamicFields/index.js +1 -3
- package/lib/cjs/MultipleCheckboxes/index.js +3 -5
- package/lib/cjs/MultipleSelect/index.d.ts +2 -1
- package/lib/cjs/MultipleSelect/index.js +18 -4
- package/lib/esm/DynamicFields/index.tsx +2 -3
- package/lib/esm/MultipleCheckboxes/index.tsx +0 -3
- package/lib/esm/MultipleSelect/ItemList.tsx +21 -5
- package/lib/esm/MultipleSelect/index.tsx +6 -1
- package/package.json +1 -1
package/DynamicFields/index.js
CHANGED
|
@@ -773,9 +773,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
773
773
|
}, innerAppendHeadData.map(function (item, i) {
|
|
774
774
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
775
775
|
key: 'inner-header-row' + i,
|
|
776
|
-
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)(innerAppendHeadCellClassName, Array.isArray(innerAppendHeadCellClassName) ? typeof innerAppendHeadCellClassName[i] !== 'undefined' ? innerAppendHeadCellClassName[i] : '' : undefined,
|
|
777
|
-
ITEM_LAST_CLASSNAME: i === innerAppendHeadData.length - 1
|
|
778
|
-
}),
|
|
776
|
+
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)(innerAppendHeadCellClassName, Array.isArray(innerAppendHeadCellClassName) ? typeof innerAppendHeadCellClassName[i] !== 'undefined' ? innerAppendHeadCellClassName[i] : '' : undefined, i === innerAppendHeadData.length - 1 ? ITEM_LAST_CLASSNAME : undefined),
|
|
779
777
|
style: innerAppendHeadCellStyles && typeof innerAppendHeadCellStyles[i] !== 'undefined' ? innerAppendHeadCellStyles[i] : {}
|
|
780
778
|
}, item);
|
|
781
779
|
}))) : null, generateGroup(val)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
@@ -1332,7 +1332,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1332
1332
|
|
|
1333
1333
|
//
|
|
1334
1334
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
1335
|
-
_context.next =
|
|
1335
|
+
_context.next = 16;
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
_context.next = 4;
|
|
@@ -1362,9 +1362,8 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1362
1362
|
|
|
1363
1363
|
//
|
|
1364
1364
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
1365
|
-
console.log('======', _ORGIN_DATA);
|
|
1366
1365
|
return _context.abrupt("return", _ORGIN_DATA);
|
|
1367
|
-
case
|
|
1366
|
+
case 16:
|
|
1368
1367
|
// remove Duplicate objects from JSON Array
|
|
1369
1368
|
optionsFormatGroupOpt(optionsDataInit); // prevent the value from being filtered out
|
|
1370
1369
|
optionsDataInit = (0,funda_utils_dist_cjs_object__WEBPACK_IMPORTED_MODULE_5__.removeArrDuplicateItems)(optionsDataInit, 'value');
|
|
@@ -1377,9 +1376,8 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1377
1376
|
|
|
1378
1377
|
//
|
|
1379
1378
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(optionsDataInit);
|
|
1380
|
-
console.log('======', optionsDataInit);
|
|
1381
1379
|
return _context.abrupt("return", optionsDataInit);
|
|
1382
|
-
case
|
|
1380
|
+
case 22:
|
|
1383
1381
|
case "end":
|
|
1384
1382
|
return _context.stop();
|
|
1385
1383
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface OptionConfig {
|
|
3
|
-
[propName: string]: string | number | boolean;
|
|
3
|
+
[propName: string]: string | number | boolean | Function;
|
|
4
4
|
}
|
|
5
5
|
export declare type MultipleSelectProps = {
|
|
6
6
|
wrapperClassName?: string;
|
|
@@ -26,6 +26,7 @@ export declare type MultipleSelectProps = {
|
|
|
26
26
|
options?: OptionConfig[] | string;
|
|
27
27
|
disabled?: any;
|
|
28
28
|
required?: any;
|
|
29
|
+
appendControl?: React.ReactNode;
|
|
29
30
|
/** Whether to use square brackets to save result and initialize default value */
|
|
30
31
|
extractValueByBrackets?: boolean;
|
|
31
32
|
/** Incoming data, you can set the third parameter of `onFetch` */
|
package/MultipleSelect/index.js
CHANGED
|
@@ -1959,7 +1959,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
1959
1959
|
-------------------------------------------------*/
|
|
1960
1960
|
|
|
1961
1961
|
var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
|
|
1962
|
-
var
|
|
1962
|
+
var appendControl = props.appendControl,
|
|
1963
|
+
root = props.root,
|
|
1963
1964
|
listContainerClassName = props.listContainerClassName,
|
|
1964
1965
|
valSelected = props.valSelected,
|
|
1965
1966
|
indentStr = props.indentStr,
|
|
@@ -2116,6 +2117,13 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2116
2117
|
}
|
|
2117
2118
|
}
|
|
2118
2119
|
}, data ? data.map(function (item, i) {
|
|
2120
|
+
// callback from each option
|
|
2121
|
+
if (typeof item.appendControlCallback === 'function') {
|
|
2122
|
+
setTimeout(function () {
|
|
2123
|
+
var _item$appendControlCa;
|
|
2124
|
+
(_item$appendControlCa = item.appendControlCallback) === null || _item$appendControlCa === void 0 ? void 0 : _item$appendControlCa.call(item);
|
|
2125
|
+
}, 0);
|
|
2126
|
+
}
|
|
2119
2127
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
2120
2128
|
key: selected ? 'item-selected' + i : 'item' + i,
|
|
2121
2129
|
className: selected ? 'selected' : (0,cls.combinedCls)({
|
|
@@ -2138,10 +2146,13 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2138
2146
|
}
|
|
2139
2147
|
}), item.children && item.children.length > 0 && !selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2140
2148
|
className: "arrow"
|
|
2141
|
-
}, arrowGenerator()) : ''), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("
|
|
2149
|
+
}, arrowGenerator()) : ''), selected && appendControl ? /*#__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", {
|
|
2150
|
+
className: "m-select__ext",
|
|
2151
|
+
id: "m-select__ext-".concat(item.value).concat(selected ? '-selected' : '')
|
|
2152
|
+
}, appendControl)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
|
|
2142
2153
|
onClick: function onClick(e) {
|
|
2143
2154
|
e.stopPropagation();
|
|
2144
|
-
onSelect(e.target.closest('li'));
|
|
2155
|
+
onSelect(e.target.closest('li'), undefined);
|
|
2145
2156
|
}
|
|
2146
2157
|
}, selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove) : /*#__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("svg", {
|
|
2147
2158
|
width: "15px",
|
|
@@ -2182,7 +2193,7 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2182
2193
|
});
|
|
2183
2194
|
/* harmony default export */ const src_ItemList = (ItemList);
|
|
2184
2195
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
2185
|
-
var _excluded = ["wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
2196
|
+
var _excluded = ["wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "options", "disabled", "required", "appendControl", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
2186
2197
|
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; }
|
|
2187
2198
|
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); }
|
|
2188
2199
|
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); }
|
|
@@ -2231,6 +2242,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2231
2242
|
options = props.options,
|
|
2232
2243
|
disabled = props.disabled,
|
|
2233
2244
|
required = props.required,
|
|
2245
|
+
appendControl = props.appendControl,
|
|
2234
2246
|
value = props.value,
|
|
2235
2247
|
label = props.label,
|
|
2236
2248
|
name = props.name,
|
|
@@ -2572,6 +2584,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2572
2584
|
className: "m-select__btn--add-all",
|
|
2573
2585
|
onClick: handleSelectAll
|
|
2574
2586
|
}, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
|
|
2587
|
+
appendControl: appendControl,
|
|
2575
2588
|
root: rootRef.current,
|
|
2576
2589
|
listContainerClassName: "m-select__available m-select__options-contentlist",
|
|
2577
2590
|
ref: availableListRef,
|
|
@@ -2603,6 +2616,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2603
2616
|
className: "m-select__btn--remove-all",
|
|
2604
2617
|
onClick: handleRemoveAll
|
|
2605
2618
|
}, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
|
|
2619
|
+
appendControl: appendControl,
|
|
2606
2620
|
root: rootRef.current,
|
|
2607
2621
|
listContainerClassName: "m-select__selected m-select__options-contentlist--sortable m-select__options-contentlist",
|
|
2608
2622
|
ref: selectedListRef,
|
|
@@ -773,9 +773,7 @@ var DynamicFields = function DynamicFields(props) {
|
|
|
773
773
|
}, innerAppendHeadData.map(function (item, i) {
|
|
774
774
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
775
775
|
key: 'inner-header-row' + i,
|
|
776
|
-
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)(innerAppendHeadCellClassName, Array.isArray(innerAppendHeadCellClassName) ? typeof innerAppendHeadCellClassName[i] !== 'undefined' ? innerAppendHeadCellClassName[i] : '' : undefined,
|
|
777
|
-
ITEM_LAST_CLASSNAME: i === innerAppendHeadData.length - 1
|
|
778
|
-
}),
|
|
776
|
+
className: (0,funda_utils_dist_cjs_cls__WEBPACK_IMPORTED_MODULE_2__.combinedCls)(innerAppendHeadCellClassName, Array.isArray(innerAppendHeadCellClassName) ? typeof innerAppendHeadCellClassName[i] !== 'undefined' ? innerAppendHeadCellClassName[i] : '' : undefined, i === innerAppendHeadData.length - 1 ? ITEM_LAST_CLASSNAME : undefined),
|
|
779
777
|
style: innerAppendHeadCellStyles && typeof innerAppendHeadCellStyles[i] !== 'undefined' ? innerAppendHeadCellStyles[i] : {}
|
|
780
778
|
}, item);
|
|
781
779
|
}))) : null, generateGroup(val)), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
@@ -1332,7 +1332,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1332
1332
|
|
|
1333
1333
|
//
|
|
1334
1334
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
1335
|
-
_context.next =
|
|
1335
|
+
_context.next = 16;
|
|
1336
1336
|
break;
|
|
1337
1337
|
}
|
|
1338
1338
|
_context.next = 4;
|
|
@@ -1362,9 +1362,8 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1362
1362
|
|
|
1363
1363
|
//
|
|
1364
1364
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
1365
|
-
console.log('======', _ORGIN_DATA);
|
|
1366
1365
|
return _context.abrupt("return", _ORGIN_DATA);
|
|
1367
|
-
case
|
|
1366
|
+
case 16:
|
|
1368
1367
|
// remove Duplicate objects from JSON Array
|
|
1369
1368
|
optionsFormatGroupOpt(optionsDataInit); // prevent the value from being filtered out
|
|
1370
1369
|
optionsDataInit = (0,funda_utils_dist_cjs_object__WEBPACK_IMPORTED_MODULE_5__.removeArrDuplicateItems)(optionsDataInit, 'value');
|
|
@@ -1377,9 +1376,8 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
1377
1376
|
|
|
1378
1377
|
//
|
|
1379
1378
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(optionsDataInit);
|
|
1380
|
-
console.log('======', optionsDataInit);
|
|
1381
1379
|
return _context.abrupt("return", optionsDataInit);
|
|
1382
|
-
case
|
|
1380
|
+
case 22:
|
|
1383
1381
|
case "end":
|
|
1384
1382
|
return _context.stop();
|
|
1385
1383
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface OptionConfig {
|
|
3
|
-
[propName: string]: string | number | boolean;
|
|
3
|
+
[propName: string]: string | number | boolean | Function;
|
|
4
4
|
}
|
|
5
5
|
export declare type MultipleSelectProps = {
|
|
6
6
|
wrapperClassName?: string;
|
|
@@ -26,6 +26,7 @@ export declare type MultipleSelectProps = {
|
|
|
26
26
|
options?: OptionConfig[] | string;
|
|
27
27
|
disabled?: any;
|
|
28
28
|
required?: any;
|
|
29
|
+
appendControl?: React.ReactNode;
|
|
29
30
|
/** Whether to use square brackets to save result and initialize default value */
|
|
30
31
|
extractValueByBrackets?: boolean;
|
|
31
32
|
/** Incoming data, you can set the third parameter of `onFetch` */
|
|
@@ -1959,7 +1959,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
1959
1959
|
-------------------------------------------------*/
|
|
1960
1960
|
|
|
1961
1961
|
var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_react_amd_react_.forwardRef)(function (props, externalRef) {
|
|
1962
|
-
var
|
|
1962
|
+
var appendControl = props.appendControl,
|
|
1963
|
+
root = props.root,
|
|
1963
1964
|
listContainerClassName = props.listContainerClassName,
|
|
1964
1965
|
valSelected = props.valSelected,
|
|
1965
1966
|
indentStr = props.indentStr,
|
|
@@ -2116,6 +2117,13 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2116
2117
|
}
|
|
2117
2118
|
}
|
|
2118
2119
|
}, data ? data.map(function (item, i) {
|
|
2120
|
+
// callback from each option
|
|
2121
|
+
if (typeof item.appendControlCallback === 'function') {
|
|
2122
|
+
setTimeout(function () {
|
|
2123
|
+
var _item$appendControlCa;
|
|
2124
|
+
(_item$appendControlCa = item.appendControlCallback) === null || _item$appendControlCa === void 0 ? void 0 : _item$appendControlCa.call(item);
|
|
2125
|
+
}, 0);
|
|
2126
|
+
}
|
|
2119
2127
|
return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("li", {
|
|
2120
2128
|
key: selected ? 'item-selected' + i : 'item' + i,
|
|
2121
2129
|
className: selected ? 'selected' : (0,cls.combinedCls)({
|
|
@@ -2138,10 +2146,13 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2138
2146
|
}
|
|
2139
2147
|
}), item.children && item.children.length > 0 && !selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("span", {
|
|
2140
2148
|
className: "arrow"
|
|
2141
|
-
}, arrowGenerator()) : ''), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("
|
|
2149
|
+
}, arrowGenerator()) : ''), selected && appendControl ? /*#__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", {
|
|
2150
|
+
className: "m-select__ext",
|
|
2151
|
+
id: "m-select__ext-".concat(item.value).concat(selected ? '-selected' : '')
|
|
2152
|
+
}, appendControl)) : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement("i", {
|
|
2142
2153
|
onClick: function onClick(e) {
|
|
2143
2154
|
e.stopPropagation();
|
|
2144
|
-
onSelect(e.target.closest('li'));
|
|
2155
|
+
onSelect(e.target.closest('li'), undefined);
|
|
2145
2156
|
}
|
|
2146
2157
|
}, selected ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement((external_root_React_commonjs2_react_commonjs_react_amd_react_default()).Fragment, null, iconRemove) : /*#__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("svg", {
|
|
2147
2158
|
width: "15px",
|
|
@@ -2182,7 +2193,7 @@ var ItemList = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonjs_reac
|
|
|
2182
2193
|
});
|
|
2183
2194
|
/* harmony default export */ const src_ItemList = (ItemList);
|
|
2184
2195
|
;// CONCATENATED MODULE: ./src/index.tsx
|
|
2185
|
-
var _excluded = ["wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
2196
|
+
var _excluded = ["wrapperClassName", "childClassName", "wrapperMinHeight", "wrapperMinWidth", "availableHeaderTitle", "selectedHeaderTitle", "selectedHeaderNote", "removeAllBtnLabel", "addAllBtnLabel", "iconAdd", "iconRemove", "unattachedSelect", "hierarchical", "indentation", "doubleIndent", "alternateCollapse", "arrow", "options", "disabled", "required", "appendControl", "value", "label", "name", "id", "extractValueByBrackets", "style", "data", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onChange"];
|
|
2186
2197
|
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; }
|
|
2187
2198
|
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); }
|
|
2188
2199
|
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); }
|
|
@@ -2231,6 +2242,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2231
2242
|
options = props.options,
|
|
2232
2243
|
disabled = props.disabled,
|
|
2233
2244
|
required = props.required,
|
|
2245
|
+
appendControl = props.appendControl,
|
|
2234
2246
|
value = props.value,
|
|
2235
2247
|
label = props.label,
|
|
2236
2248
|
name = props.name,
|
|
@@ -2572,6 +2584,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2572
2584
|
className: "m-select__btn--add-all",
|
|
2573
2585
|
onClick: handleSelectAll
|
|
2574
2586
|
}, addAllBtnLabel || 'Add all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
|
|
2587
|
+
appendControl: appendControl,
|
|
2575
2588
|
root: rootRef.current,
|
|
2576
2589
|
listContainerClassName: "m-select__available m-select__options-contentlist",
|
|
2577
2590
|
ref: availableListRef,
|
|
@@ -2603,6 +2616,7 @@ var MultipleSelect = /*#__PURE__*/(0,external_root_React_commonjs2_react_commonj
|
|
|
2603
2616
|
className: "m-select__btn--remove-all",
|
|
2604
2617
|
onClick: handleRemoveAll
|
|
2605
2618
|
}, removeAllBtnLabel || 'Remove all')), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default().createElement(src_ItemList, {
|
|
2619
|
+
appendControl: appendControl,
|
|
2606
2620
|
root: rootRef.current,
|
|
2607
2621
|
listContainerClassName: "m-select__selected m-select__options-contentlist--sortable m-select__options-contentlist",
|
|
2608
2622
|
ref: selectedListRef,
|
|
@@ -5,6 +5,7 @@ import useComId from 'funda-utils/dist/cjs/useComId';
|
|
|
5
5
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
|
|
8
9
|
export type DynamicFieldsValueProps = {
|
|
9
10
|
init: React.ReactNode[];
|
|
10
11
|
tmpl: React.ReactNode;
|
|
@@ -332,9 +333,7 @@ const DynamicFields = (props: DynamicFieldsProps) => {
|
|
|
332
333
|
return <div key={'inner-header-row' + i} className={combinedCls(
|
|
333
334
|
innerAppendHeadCellClassName,
|
|
334
335
|
Array.isArray(innerAppendHeadCellClassName) ? (typeof innerAppendHeadCellClassName[i] !== 'undefined' ? innerAppendHeadCellClassName[i] : '') : undefined,
|
|
335
|
-
|
|
336
|
-
ITEM_LAST_CLASSNAME: i === innerAppendHeadData.length - 1
|
|
337
|
-
}
|
|
336
|
+
i === innerAppendHeadData.length - 1 ? ITEM_LAST_CLASSNAME : undefined
|
|
338
337
|
)} style={innerAppendHeadCellStyles && typeof innerAppendHeadCellStyles[i] !== 'undefined' ? innerAppendHeadCellStyles[i] : {}}>{item}</div>;
|
|
339
338
|
})}
|
|
340
339
|
</div>
|
|
@@ -216,7 +216,6 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
216
216
|
//
|
|
217
217
|
onFetch?.(_ORGIN_DATA);
|
|
218
218
|
|
|
219
|
-
console.log('======', _ORGIN_DATA)
|
|
220
219
|
return _ORGIN_DATA;
|
|
221
220
|
} else {
|
|
222
221
|
|
|
@@ -234,8 +233,6 @@ const MultipleCheckboxes = forwardRef((props: MultipleCheckboxesProps, externalR
|
|
|
234
233
|
//
|
|
235
234
|
onFetch?.(optionsDataInit);
|
|
236
235
|
|
|
237
|
-
|
|
238
|
-
console.log('======', optionsDataInit)
|
|
239
236
|
return optionsDataInit;
|
|
240
237
|
}
|
|
241
238
|
|
|
@@ -6,11 +6,13 @@ import {
|
|
|
6
6
|
} from 'funda-utils/dist/cjs/dom';
|
|
7
7
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
8
8
|
|
|
9
|
+
|
|
9
10
|
import { formatIndentVal, multiSelControlOptionExist } from './multiple-select-utils/func';
|
|
10
11
|
|
|
11
12
|
/* Recursively nested components to traverse nodes
|
|
12
13
|
-------------------------------------------------*/
|
|
13
14
|
export type ItemListProps = {
|
|
15
|
+
appendControl?: React.ReactNode;
|
|
14
16
|
root: any;
|
|
15
17
|
listContainerClassName: string;
|
|
16
18
|
valSelected: any[];
|
|
@@ -18,7 +20,7 @@ export type ItemListProps = {
|
|
|
18
20
|
iconAdd?: React.ReactNode | string;
|
|
19
21
|
iconRemove?: React.ReactNode | string;
|
|
20
22
|
selected?: boolean;
|
|
21
|
-
onSelect: (any) => void;
|
|
23
|
+
onSelect: (v: any, cb?: () => void) => void;
|
|
22
24
|
alternateCollapse?: boolean;
|
|
23
25
|
first?: boolean;
|
|
24
26
|
arrow?: React.ReactNode;
|
|
@@ -29,6 +31,7 @@ export type ItemListProps = {
|
|
|
29
31
|
const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
|
|
30
32
|
|
|
31
33
|
const {
|
|
34
|
+
appendControl,
|
|
32
35
|
root,
|
|
33
36
|
listContainerClassName,
|
|
34
37
|
valSelected,
|
|
@@ -104,8 +107,6 @@ const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
|
|
|
104
107
|
const hyperlink = e.currentTarget.querySelector('div');
|
|
105
108
|
const subElement = getNextSiblings(hyperlink, 'ul');
|
|
106
109
|
|
|
107
|
-
|
|
108
|
-
|
|
109
110
|
// hide child if expandedLink doesn't exist, on the contrary
|
|
110
111
|
//=====================
|
|
111
112
|
if ( hyperlink.getAttribute('aria-expanded') === 'false' || hyperlink.getAttribute('aria-expanded') === null ) {
|
|
@@ -164,7 +165,7 @@ const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
|
|
|
164
165
|
|
|
165
166
|
// Expand the currently active item by default
|
|
166
167
|
if ( hyperlink.actived ) {
|
|
167
|
-
|
|
168
|
+
|
|
168
169
|
hyperlink.el.setAttribute('aria-expanded', 'true');
|
|
169
170
|
|
|
170
171
|
if ( hyperlink.expandedLink ) {
|
|
@@ -228,6 +229,14 @@ const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
|
|
|
228
229
|
|
|
229
230
|
{data ? data.map((item: any, i: number) => {
|
|
230
231
|
|
|
232
|
+
// callback from each option
|
|
233
|
+
if (typeof item.appendControlCallback === 'function') {
|
|
234
|
+
setTimeout(() => {
|
|
235
|
+
item.appendControlCallback?.();
|
|
236
|
+
}, 0);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
|
|
231
240
|
return <li
|
|
232
241
|
key={selected ? 'item-selected' + i : 'item' + i}
|
|
233
242
|
className={selected ? 'selected' : combinedCls(
|
|
@@ -255,10 +264,17 @@ const ItemList = forwardRef((props: ItemListProps, externalRef: any) => {
|
|
|
255
264
|
{item.children && item.children.length > 0 && !selected ? <span className="arrow">{arrowGenerator()}</span> : ''}
|
|
256
265
|
</strong>
|
|
257
266
|
|
|
267
|
+
{selected && appendControl ? <>
|
|
268
|
+
<span className="m-select__ext" id={`m-select__ext-${item.value}${selected ? '-selected' : ''}`}>
|
|
269
|
+
{appendControl}
|
|
270
|
+
</span>
|
|
271
|
+
</> : null}
|
|
272
|
+
|
|
273
|
+
|
|
258
274
|
<i
|
|
259
275
|
onClick={(e: React.MouseEvent) => {
|
|
260
276
|
e.stopPropagation();
|
|
261
|
-
onSelect((e.target as any).closest('li'));
|
|
277
|
+
onSelect((e.target as any).closest('li'), undefined);
|
|
262
278
|
}}>
|
|
263
279
|
|
|
264
280
|
{selected ? <>
|
|
@@ -22,12 +22,13 @@ import {
|
|
|
22
22
|
import { clsWrite, combinedCls } from 'funda-utils/dist/cjs/cls';
|
|
23
23
|
|
|
24
24
|
|
|
25
|
+
|
|
25
26
|
import { multiSelControlOptionExist, uniqueArr } from './multiple-select-utils/func';
|
|
26
27
|
import ItemList from './ItemList';
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
export interface OptionConfig {
|
|
30
|
-
[propName: string]: string | number | boolean;
|
|
31
|
+
[propName: string]: string | number | boolean | Function;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
|
|
@@ -55,6 +56,7 @@ export type MultipleSelectProps = {
|
|
|
55
56
|
options?: OptionConfig[] | string;
|
|
56
57
|
disabled?: any;
|
|
57
58
|
required?: any;
|
|
59
|
+
appendControl?: React.ReactNode;
|
|
58
60
|
/** Whether to use square brackets to save result and initialize default value */
|
|
59
61
|
extractValueByBrackets?: boolean;
|
|
60
62
|
/** Incoming data, you can set the third parameter of `onFetch` */
|
|
@@ -95,6 +97,7 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
95
97
|
options,
|
|
96
98
|
disabled,
|
|
97
99
|
required,
|
|
100
|
+
appendControl,
|
|
98
101
|
value,
|
|
99
102
|
label,
|
|
100
103
|
name,
|
|
@@ -503,6 +506,7 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
503
506
|
|
|
504
507
|
{/* OPTIONS LIST */}
|
|
505
508
|
<ItemList
|
|
509
|
+
appendControl={appendControl}
|
|
506
510
|
root={rootRef.current}
|
|
507
511
|
listContainerClassName="m-select__available m-select__options-contentlist"
|
|
508
512
|
ref={availableListRef}
|
|
@@ -536,6 +540,7 @@ const MultipleSelect = forwardRef((props: MultipleSelectProps, externalRef: any)
|
|
|
536
540
|
|
|
537
541
|
{/* OPTIONS LIST */}
|
|
538
542
|
<ItemList
|
|
543
|
+
appendControl={appendControl}
|
|
539
544
|
root={rootRef.current}
|
|
540
545
|
listContainerClassName="m-select__selected m-select__options-contentlist--sortable m-select__options-contentlist"
|
|
541
546
|
ref={selectedListRef}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"author": "UIUX Lab",
|
|
3
3
|
"email": "uiuxlab@gmail.com",
|
|
4
4
|
"name": "funda-ui",
|
|
5
|
-
"version": "4.2.
|
|
5
|
+
"version": "4.2.811",
|
|
6
6
|
"description": "React components using pure Bootstrap 5+ which does not contain any external style and script libraries.",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|