funda-ui 1.2.135 → 2.0.125
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/MultipleCheckboxes/index.d.ts +9 -0
- package/MultipleCheckboxes/index.js +101 -20
- package/Radio/index.js +9 -7
- package/Table/index.css +50 -0
- package/Table/index.js +11 -9
- package/lib/cjs/MultipleCheckboxes/index.d.ts +9 -0
- package/lib/cjs/MultipleCheckboxes/index.js +101 -20
- package/lib/cjs/Radio/index.js +9 -7
- package/lib/cjs/Table/index.js +11 -9
- package/lib/css/Table/index.css +50 -0
- package/lib/esm/MultipleCheckboxes/index.tsx +132 -44
- package/lib/esm/Radio/index.tsx +8 -5
- package/lib/esm/Table/TableFieldRow.tsx +1 -1
- package/lib/esm/Table/TableHeaders.tsx +0 -1
- package/lib/esm/Table/index.scss +62 -0
- package/lib/esm/Table/index.tsx +2 -2
- package/package.json +1 -1
|
@@ -19,6 +19,15 @@ declare type MultipleCheckboxesProps = {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
style?: React.CSSProperties;
|
|
21
21
|
[key: `data-${string}`]: string | undefined;
|
|
22
|
+
/** This function is called whenever the data is updated.
|
|
23
|
+
* Exposes the JSON format data about the option as an argument.
|
|
24
|
+
*/
|
|
25
|
+
fetchFuncAsync?: any;
|
|
26
|
+
fetchFuncMethod?: string;
|
|
27
|
+
fetchFuncMethodParams?: any[];
|
|
28
|
+
fetchCallback?: (data: any) => void;
|
|
29
|
+
onFetch?: (data: any) => void;
|
|
30
|
+
onLoad?: (arg1: any, arg2: any, arg3: any) => void;
|
|
22
31
|
onChange?: (e: any, value: any, valueStr: any, label: any, labelStr: any, currentData: any) => void;
|
|
23
32
|
};
|
|
24
33
|
declare const MultipleCheckboxes: React.ForwardRefExoticComponent<MultipleCheckboxesProps & React.RefAttributes<unknown>>;
|
|
@@ -661,13 +661,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
661
661
|
/* harmony import */ var _utils_extract__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_utils_extract__WEBPACK_IMPORTED_MODULE_2__);
|
|
662
662
|
/* harmony import */ var _utils_convert__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(498);
|
|
663
663
|
/* harmony import */ var _utils_convert__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_utils_convert__WEBPACK_IMPORTED_MODULE_3__);
|
|
664
|
-
var _excluded = ["wrapperClassName", "groupWrapperClassName", "groupLabelClassName", "inline", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "onChange"];
|
|
664
|
+
var _excluded = ["wrapperClassName", "groupWrapperClassName", "groupLabelClassName", "inline", "options", "disabled", "required", "value", "label", "name", "id", "extractValueByBrackets", "style", "fetchFuncAsync", "fetchFuncMethod", "fetchFuncMethodParams", "fetchCallback", "onFetch", "onLoad", "onChange"];
|
|
665
|
+
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; }
|
|
665
666
|
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); }
|
|
666
667
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
667
668
|
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."); }
|
|
668
669
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
669
670
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
670
671
|
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); }
|
|
672
|
+
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); } }
|
|
673
|
+
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); }); }; }
|
|
671
674
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
672
675
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
673
676
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -694,6 +697,12 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
694
697
|
id = props.id,
|
|
695
698
|
extractValueByBrackets = props.extractValueByBrackets,
|
|
696
699
|
style = props.style,
|
|
700
|
+
fetchFuncAsync = props.fetchFuncAsync,
|
|
701
|
+
fetchFuncMethod = props.fetchFuncMethod,
|
|
702
|
+
fetchFuncMethodParams = props.fetchFuncMethodParams,
|
|
703
|
+
fetchCallback = props.fetchCallback,
|
|
704
|
+
onFetch = props.onFetch,
|
|
705
|
+
onLoad = props.onLoad,
|
|
697
706
|
_onChange = props.onChange,
|
|
698
707
|
attributes = _objectWithoutProperties(props, _excluded);
|
|
699
708
|
var VALUE_BY_BRACKETS = typeof extractValueByBrackets === 'undefined' ? true : extractValueByBrackets;
|
|
@@ -704,13 +713,22 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
704
713
|
var optionsRes = options ? isJSON(options) ? JSON.parse(options) : options : [];
|
|
705
714
|
var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
706
715
|
_useState2 = _slicedToArray(_useState, 2),
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)([]),
|
|
710
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
711
|
-
valSelected = _useState4[0],
|
|
712
|
-
setValSelected = _useState4[1];
|
|
716
|
+
valSelected = _useState2[0],
|
|
717
|
+
setValSelected = _useState2[1];
|
|
713
718
|
var _inline = typeof inline === 'undefined' ? true : inline;
|
|
719
|
+
|
|
720
|
+
// return a array of options
|
|
721
|
+
var optionsDataInit = optionsRes;
|
|
722
|
+
|
|
723
|
+
//
|
|
724
|
+
var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(optionsDataInit),
|
|
725
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
726
|
+
dataInit = _useState4[0],
|
|
727
|
+
setDataInit = _useState4[1];
|
|
728
|
+
var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(false),
|
|
729
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
730
|
+
hasErr = _useState6[0],
|
|
731
|
+
setHasErr = _useState6[1];
|
|
714
732
|
var optionsFlat = function optionsFlat(allData) {
|
|
715
733
|
var flatItems = [];
|
|
716
734
|
allData.forEach(function (item) {
|
|
@@ -724,8 +742,65 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
724
742
|
});
|
|
725
743
|
return flatItems;
|
|
726
744
|
};
|
|
745
|
+
function fetchData(_x2) {
|
|
746
|
+
return _fetchData.apply(this, arguments);
|
|
747
|
+
} // Determine whether it is in JSON format
|
|
748
|
+
function _fetchData() {
|
|
749
|
+
_fetchData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
|
|
750
|
+
var response, _ORGIN_DATA;
|
|
751
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
752
|
+
while (1) switch (_context.prev = _context.next) {
|
|
753
|
+
case 0:
|
|
754
|
+
// set default value
|
|
755
|
+
if (typeof value !== 'undefined' && value !== '') rootRef.current.dataset.value = value;
|
|
756
|
+
|
|
757
|
+
//
|
|
758
|
+
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
759
|
+
_context.next = 14;
|
|
760
|
+
break;
|
|
761
|
+
}
|
|
762
|
+
_context.next = 4;
|
|
763
|
+
return fetchFuncAsync["".concat(fetchFuncMethod)].apply(fetchFuncAsync, _toConsumableArray(params.split(',')));
|
|
764
|
+
case 4:
|
|
765
|
+
response = _context.sent;
|
|
766
|
+
_ORGIN_DATA = response.data; // reset data structure
|
|
767
|
+
if (typeof fetchCallback === 'function') {
|
|
768
|
+
_ORGIN_DATA = fetchCallback(_ORGIN_DATA);
|
|
769
|
+
}
|
|
727
770
|
|
|
728
|
-
|
|
771
|
+
// Determine whether the data structure matches
|
|
772
|
+
if (_ORGIN_DATA.length > 0 && typeof _ORGIN_DATA[0].value === 'undefined') {
|
|
773
|
+
console.warn('The data structure does not match, please refer to the example in the component documentation.');
|
|
774
|
+
_ORGIN_DATA = [];
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
//
|
|
778
|
+
initDefaultValue(value, _ORGIN_DATA); // value must be initialized
|
|
779
|
+
|
|
780
|
+
//
|
|
781
|
+
setDataInit(_ORGIN_DATA); // data must be initialized
|
|
782
|
+
|
|
783
|
+
//
|
|
784
|
+
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
785
|
+
return _context.abrupt("return", _ORGIN_DATA);
|
|
786
|
+
case 14:
|
|
787
|
+
//
|
|
788
|
+
initDefaultValue(value, optionsDataInit); // value must be initialized
|
|
789
|
+
|
|
790
|
+
//
|
|
791
|
+
setDataInit(optionsDataInit); // data must be initialized
|
|
792
|
+
|
|
793
|
+
//
|
|
794
|
+
onFetch === null || onFetch === void 0 ? void 0 : onFetch(optionsDataInit);
|
|
795
|
+
return _context.abrupt("return", optionsDataInit);
|
|
796
|
+
case 18:
|
|
797
|
+
case "end":
|
|
798
|
+
return _context.stop();
|
|
799
|
+
}
|
|
800
|
+
}, _callee);
|
|
801
|
+
}));
|
|
802
|
+
return _fetchData.apply(this, arguments);
|
|
803
|
+
}
|
|
729
804
|
function isJSON(str) {
|
|
730
805
|
if (typeof str === 'string' && str.length > 0) {
|
|
731
806
|
if (str.replace(/\"\"/g, '').replace(/\,/g, '') == '[{}]') {
|
|
@@ -745,10 +820,13 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
745
820
|
}
|
|
746
821
|
}
|
|
747
822
|
}
|
|
748
|
-
function initDefaultValue(defaultValue) {
|
|
823
|
+
function initDefaultValue(defaultValue, latestData) {
|
|
749
824
|
// change the value to trigger component rendering
|
|
750
825
|
if (typeof defaultValue === 'undefined' || defaultValue === '') {
|
|
751
826
|
setValSelected([]);
|
|
827
|
+
|
|
828
|
+
//
|
|
829
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(latestData, defaultValue, rootRef.current);
|
|
752
830
|
} else {
|
|
753
831
|
var _val = VALUE_BY_BRACKETS ? (0,_utils_extract__WEBPACK_IMPORTED_MODULE_2__.extractContentsOfBrackets)(defaultValue) : defaultValue.trim().replace(/^\,|\,$/g, '').split(',');
|
|
754
832
|
if (Array.isArray(_val)) {
|
|
@@ -757,10 +835,10 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
757
835
|
return v !== '';
|
|
758
836
|
});
|
|
759
837
|
var filterRes = [];
|
|
760
|
-
var filterResQueryValue =
|
|
838
|
+
var filterResQueryValue = latestData.filter(function (item) {
|
|
761
839
|
return _val.includes(item.value);
|
|
762
840
|
});
|
|
763
|
-
var filterResQueryLabel =
|
|
841
|
+
var filterResQueryLabel = latestData.filter(function (item) {
|
|
764
842
|
return _val.includes(item.label);
|
|
765
843
|
});
|
|
766
844
|
if (filterResQueryValue.length === 0 && filterResQueryLabel.length > 0) {
|
|
@@ -775,19 +853,22 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
775
853
|
|
|
776
854
|
//
|
|
777
855
|
setValSelected(_realValue);
|
|
856
|
+
|
|
857
|
+
//
|
|
858
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(latestData, _realValue, rootRef.current);
|
|
778
859
|
} else {
|
|
779
860
|
setValSelected([]);
|
|
861
|
+
|
|
862
|
+
//
|
|
863
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(latestData, defaultValue, rootRef.current);
|
|
780
864
|
}
|
|
781
865
|
}
|
|
782
866
|
}
|
|
783
867
|
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
|
|
784
|
-
//
|
|
785
|
-
//--------------
|
|
786
|
-
initDefaultValue(value);
|
|
787
|
-
|
|
788
|
-
// Initialize options
|
|
868
|
+
// data init
|
|
789
869
|
//--------------
|
|
790
|
-
|
|
870
|
+
var _params = fetchFuncMethodParams || [];
|
|
871
|
+
fetchData(_params.join(','));
|
|
791
872
|
}, [value, options]);
|
|
792
873
|
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", {
|
|
793
874
|
className: wrapperClassName || wrapperClassName === '' ? "multiple-checkboxes__wrapper ".concat(wrapperClassName) : "multiple-checkboxes__wrapper mb-3 position-relative",
|
|
@@ -801,7 +882,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
801
882
|
})) : null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
802
883
|
className: "multiple-checkboxes__control-wrapper",
|
|
803
884
|
style: style
|
|
804
|
-
},
|
|
885
|
+
}, dataInit ? dataInit.map(function (item, index) {
|
|
805
886
|
if (typeof item.optgroup !== 'undefined') {
|
|
806
887
|
return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", {
|
|
807
888
|
className: "multiple-checkboxes-group__wrapper ".concat(groupWrapperClassName || ''),
|
|
@@ -836,7 +917,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
836
917
|
});
|
|
837
918
|
if (elIndex !== -1) newData.splice(elIndex, 1);
|
|
838
919
|
var _res = val ? Array.from(new Set([e.target.value].concat(_toConsumableArray(newData)))) : newData;
|
|
839
|
-
var _resLabel = optionsFlat(
|
|
920
|
+
var _resLabel = optionsFlat(dataInit).filter(function (v) {
|
|
840
921
|
return _res.includes(v.value);
|
|
841
922
|
}).map(function (k) {
|
|
842
923
|
return k.label;
|
|
@@ -888,7 +969,7 @@ var MultipleCheckboxes = /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.forw
|
|
|
888
969
|
});
|
|
889
970
|
if (elIndex !== -1) newData.splice(elIndex, 1);
|
|
890
971
|
var _res = val ? Array.from(new Set([e.target.value].concat(_toConsumableArray(newData)))) : newData;
|
|
891
|
-
var _resLabel =
|
|
972
|
+
var _resLabel = dataInit.filter(function (v) {
|
|
892
973
|
return _res.includes(v.value);
|
|
893
974
|
}).map(function (k) {
|
|
894
975
|
return k.label;
|
package/Radio/index.js
CHANGED
|
@@ -175,7 +175,7 @@ var Radio = function Radio(props) {
|
|
|
175
175
|
|
|
176
176
|
//
|
|
177
177
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
178
|
-
_context.next =
|
|
178
|
+
_context.next = 20;
|
|
179
179
|
break;
|
|
180
180
|
}
|
|
181
181
|
_context.next = 4;
|
|
@@ -217,8 +217,11 @@ var Radio = function Radio(props) {
|
|
|
217
217
|
|
|
218
218
|
//
|
|
219
219
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
220
|
+
|
|
221
|
+
//
|
|
222
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(_ORGIN_DATA, _realValue, rootRef.current);
|
|
220
223
|
return _context.abrupt("return", _ORGIN_DATA);
|
|
221
|
-
case
|
|
224
|
+
case 20:
|
|
222
225
|
// If the default value is label, match value
|
|
223
226
|
_realValue2 = value;
|
|
224
227
|
_filterRes = [];
|
|
@@ -242,8 +245,11 @@ var Radio = function Radio(props) {
|
|
|
242
245
|
|
|
243
246
|
//
|
|
244
247
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(optionsDataInit);
|
|
248
|
+
|
|
249
|
+
//
|
|
250
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(optionsDataInit, _realValue2, rootRef.current);
|
|
245
251
|
return _context.abrupt("return", optionsDataInit);
|
|
246
|
-
case
|
|
252
|
+
case 30:
|
|
247
253
|
case "end":
|
|
248
254
|
return _context.stop();
|
|
249
255
|
}
|
|
@@ -416,10 +422,6 @@ var Radio = function Radio(props) {
|
|
|
416
422
|
//--------------
|
|
417
423
|
var _params = fetchFuncMethodParams || [];
|
|
418
424
|
fetchData(_params.join(','));
|
|
419
|
-
|
|
420
|
-
//
|
|
421
|
-
//--------------
|
|
422
|
-
onLoad === null || onLoad === void 0 ? void 0 : onLoad(dataInit, value, rootRef.current);
|
|
423
425
|
}, [value, options]);
|
|
424
426
|
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", {
|
|
425
427
|
id: "radio__wrapper-".concat(idRes),
|
package/Table/index.css
CHANGED
|
@@ -9,10 +9,26 @@
|
|
|
9
9
|
--table-dis-top: 1rem;
|
|
10
10
|
--table-checkbox-indeterminate-color: #bbbbbb;
|
|
11
11
|
--table-row-active-bg: #f0f8ff;
|
|
12
|
+
--table-scrollbar-color: rgba(0, 0, 0, 0.2);
|
|
13
|
+
--table-scrollbar-track: rgba(0, 0, 0, 0);
|
|
14
|
+
--table-scrollbar-h: 3px;
|
|
15
|
+
--table-scrollbar-w: 3px;
|
|
12
16
|
/*------ enable sort ------*/
|
|
13
17
|
/*------ has checkbox ------*/
|
|
14
18
|
/*------ allow drag and drop ------*/
|
|
15
19
|
}
|
|
20
|
+
.table__wrapper.table-responsive {
|
|
21
|
+
overflow-x: auto;
|
|
22
|
+
}
|
|
23
|
+
.table__wrapper.table-responsive::-webkit-scrollbar {
|
|
24
|
+
height: var(--table-scrollbar-h);
|
|
25
|
+
}
|
|
26
|
+
.table__wrapper.table-responsive::-webkit-scrollbar-thumb {
|
|
27
|
+
background: var(--table-scrollbar-color);
|
|
28
|
+
}
|
|
29
|
+
.table__wrapper.table-responsive::-webkit-scrollbar-track {
|
|
30
|
+
background: var(--table-scrollbar-track);
|
|
31
|
+
}
|
|
16
32
|
.table__wrapper table td,
|
|
17
33
|
.table__wrapper table th {
|
|
18
34
|
position: relative;
|
|
@@ -480,6 +496,16 @@
|
|
|
480
496
|
border-right: 0 !important;
|
|
481
497
|
overflow: auto;
|
|
482
498
|
}
|
|
499
|
+
.table__wrapper.table-enhanced-responsive-scrolled table::-webkit-scrollbar {
|
|
500
|
+
height: var(--table-scrollbar-h);
|
|
501
|
+
width: var(--table-scrollbar-w);
|
|
502
|
+
}
|
|
503
|
+
.table__wrapper.table-enhanced-responsive-scrolled table::-webkit-scrollbar-thumb {
|
|
504
|
+
background: var(--table-scrollbar-color);
|
|
505
|
+
}
|
|
506
|
+
.table__wrapper.table-enhanced-responsive-scrolled table::-webkit-scrollbar-track {
|
|
507
|
+
background: var(--table-scrollbar-track);
|
|
508
|
+
}
|
|
483
509
|
.table__wrapper.table-enhanced-responsive-scrolled table thead {
|
|
484
510
|
display: block;
|
|
485
511
|
float: left;
|
|
@@ -500,6 +526,15 @@
|
|
|
500
526
|
border-bottom: 1px solid var(--table-border-color);
|
|
501
527
|
border-right: 1px solid var(--table-border-color);
|
|
502
528
|
}
|
|
529
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody::-webkit-scrollbar {
|
|
530
|
+
height: var(--table-scrollbar-h);
|
|
531
|
+
}
|
|
532
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody::-webkit-scrollbar-thumb {
|
|
533
|
+
background: var(--table-scrollbar-color);
|
|
534
|
+
}
|
|
535
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody::-webkit-scrollbar-track {
|
|
536
|
+
background: var(--table-scrollbar-track);
|
|
537
|
+
}
|
|
503
538
|
.table__wrapper.table-enhanced-responsive-scrolled table thead tr,
|
|
504
539
|
.table__wrapper.table-enhanced-responsive-scrolled table tbody tr {
|
|
505
540
|
display: block;
|
|
@@ -512,6 +547,21 @@
|
|
|
512
547
|
overflow-x: hidden;
|
|
513
548
|
overflow-y: auto;
|
|
514
549
|
}
|
|
550
|
+
.table__wrapper.table-enhanced-responsive-scrolled table th::-webkit-scrollbar,
|
|
551
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody td::-webkit-scrollbar,
|
|
552
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody th::-webkit-scrollbar {
|
|
553
|
+
width: var(--table-scrollbar-w);
|
|
554
|
+
}
|
|
555
|
+
.table__wrapper.table-enhanced-responsive-scrolled table th::-webkit-scrollbar-thumb,
|
|
556
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody td::-webkit-scrollbar-thumb,
|
|
557
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody th::-webkit-scrollbar-thumb {
|
|
558
|
+
background: var(--table-scrollbar-color);
|
|
559
|
+
}
|
|
560
|
+
.table__wrapper.table-enhanced-responsive-scrolled table th::-webkit-scrollbar-track,
|
|
561
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody td::-webkit-scrollbar-track,
|
|
562
|
+
.table__wrapper.table-enhanced-responsive-scrolled table tbody th::-webkit-scrollbar-track {
|
|
563
|
+
background: var(--table-scrollbar-track);
|
|
564
|
+
}
|
|
515
565
|
.table__wrapper.table-enhanced-responsive-scrolled table th:first-child,
|
|
516
566
|
.table__wrapper.table-enhanced-responsive-scrolled table tbody td:first-child,
|
|
517
567
|
.table__wrapper.table-enhanced-responsive-scrolled table tbody th:first-child {
|
package/Table/index.js
CHANGED
|
@@ -1083,7 +1083,7 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1083
1083
|
|
|
1084
1084
|
//
|
|
1085
1085
|
if (!(_typeof(fetchFuncAsync) === 'object')) {
|
|
1086
|
-
_context.next =
|
|
1086
|
+
_context.next = 20;
|
|
1087
1087
|
break;
|
|
1088
1088
|
}
|
|
1089
1089
|
_context.next = 4;
|
|
@@ -1125,8 +1125,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1125
1125
|
|
|
1126
1126
|
//
|
|
1127
1127
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(_ORGIN_DATA);
|
|
1128
|
+
|
|
1129
|
+
//
|
|
1130
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(_ORGIN_DATA, _realValue, rootRef.current);
|
|
1128
1131
|
return _context.abrupt("return", _ORGIN_DATA);
|
|
1129
|
-
case
|
|
1132
|
+
case 20:
|
|
1130
1133
|
// If the default value is label, match value
|
|
1131
1134
|
_realValue2 = value;
|
|
1132
1135
|
_filterRes = [];
|
|
@@ -1150,8 +1153,11 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1150
1153
|
|
|
1151
1154
|
//
|
|
1152
1155
|
onFetch === null || onFetch === void 0 ? void 0 : onFetch(optionsDataInit);
|
|
1156
|
+
|
|
1157
|
+
//
|
|
1158
|
+
onLoad === null || onLoad === void 0 ? void 0 : onLoad(optionsDataInit, _realValue2, rootRef.current);
|
|
1153
1159
|
return _context.abrupt("return", optionsDataInit);
|
|
1154
|
-
case
|
|
1160
|
+
case 30:
|
|
1155
1161
|
case "end":
|
|
1156
1162
|
return _context.stop();
|
|
1157
1163
|
}
|
|
@@ -1326,10 +1332,6 @@ var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_
|
|
|
1326
1332
|
//--------------
|
|
1327
1333
|
var _params = fetchFuncMethodParams || [];
|
|
1328
1334
|
fetchData(_params.join(','));
|
|
1329
|
-
|
|
1330
|
-
//
|
|
1331
|
-
//--------------
|
|
1332
|
-
onLoad === null || onLoad === void 0 ? void 0 : onLoad(dataInit, value, rootRef.current);
|
|
1333
1335
|
}, [value, options]);
|
|
1334
1336
|
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", {
|
|
1335
1337
|
id: "radio__wrapper-".concat(idRes),
|
|
@@ -2250,7 +2252,7 @@ var Table = function Table(props) {
|
|
|
2250
2252
|
|
|
2251
2253
|
//
|
|
2252
2254
|
var responsiveClasses = '';
|
|
2253
|
-
if (responsive)
|
|
2255
|
+
if (typeof responsive === 'undefined' || responsive === true) responsiveClasses += ' table-responsive';
|
|
2254
2256
|
|
|
2255
2257
|
//
|
|
2256
2258
|
var enhancedResponsiveClasses = '';
|
|
@@ -2324,7 +2326,7 @@ var Table = function Table(props) {
|
|
|
2324
2326
|
}
|
|
2325
2327
|
;
|
|
2326
2328
|
function tableDataScrolledInit(w) {
|
|
2327
|
-
if (w <= 768) {
|
|
2329
|
+
if (w <= 768 && tbodyRef.current.querySelector('tr') !== null) {
|
|
2328
2330
|
var _loop = function _loop() {
|
|
2329
2331
|
var tbodyRows = rootRef.current.querySelectorAll("tbody tr [data-table-col=\"".concat(i, "\"]"));
|
|
2330
2332
|
var maxHeight = maxDimension(tbodyRows).height;
|
|
@@ -19,6 +19,15 @@ declare type MultipleCheckboxesProps = {
|
|
|
19
19
|
id?: string;
|
|
20
20
|
style?: React.CSSProperties;
|
|
21
21
|
[key: `data-${string}`]: string | undefined;
|
|
22
|
+
/** This function is called whenever the data is updated.
|
|
23
|
+
* Exposes the JSON format data about the option as an argument.
|
|
24
|
+
*/
|
|
25
|
+
fetchFuncAsync?: any;
|
|
26
|
+
fetchFuncMethod?: string;
|
|
27
|
+
fetchFuncMethodParams?: any[];
|
|
28
|
+
fetchCallback?: (data: any) => void;
|
|
29
|
+
onFetch?: (data: any) => void;
|
|
30
|
+
onLoad?: (arg1: any, arg2: any, arg3: any) => void;
|
|
22
31
|
onChange?: (e: any, value: any, valueStr: any, label: any, labelStr: any, currentData: any) => void;
|
|
23
32
|
};
|
|
24
33
|
declare const MultipleCheckboxes: React.ForwardRefExoticComponent<MultipleCheckboxesProps & React.RefAttributes<unknown>>;
|