@geneui/components 2.11.1
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/ActionableList.js +1761 -0
- package/AdvancedSearch.js +872 -0
- package/Alert.js +98 -0
- package/Avatar.js +77 -0
- package/Badge.js +76 -0
- package/Breadcrumb.js +128 -0
- package/BusyLoader.js +69 -0
- package/Button.js +130 -0
- package/CHANGELOG.md +424 -0
- package/Card.js +513 -0
- package/CardList.js +705 -0
- package/CellMeasurerCache-c11cec83.js +229 -0
- package/Charts.js +99 -0
- package/Checkbox.js +232 -0
- package/CheckboxGroup.js +206 -0
- package/CheckboxGroupWithSearch.js +279 -0
- package/Collapse.js +196 -0
- package/ColorPicker.js +210 -0
- package/ComboBox.js +99 -0
- package/Counter.js +99 -0
- package/DateFilter.js +179 -0
- package/DatePicker.js +1231 -0
- package/DatePickerInput.js +30 -0
- package/Divider.js +56 -0
- package/Drawer.js +264 -0
- package/Dropdown.js +99 -0
- package/Editor.js +22965 -0
- package/Empty.js +132 -0
- package/ExtendedInput.js +578 -0
- package/Form.js +116 -0
- package/FormContainer.js +189 -0
- package/FormableCheckbox.js +27 -0
- package/FormableDatePicker.js +39 -0
- package/FormableDropdown.js +105 -0
- package/FormableEditor.js +24 -0
- package/FormableHOC-21051057.js +83 -0
- package/FormableMultiSelectDropdown.js +105 -0
- package/FormableNumberInput.js +31 -0
- package/FormableRadio.js +23 -0
- package/FormableSwitcher.js +23 -0
- package/FormableTextInput.js +31 -0
- package/FormableUploader.js +40 -0
- package/GeneUIProvider.js +256 -0
- package/Grid.js +166 -0
- package/Holder.js +99 -0
- package/Icon.js +63 -0
- package/Image.js +130 -0
- package/ImagePreview.js +99 -0
- package/KeyValue.js +63 -0
- package/Label.js +58 -0
- package/LinkButton.js +104 -0
- package/Menu.js +277 -0
- package/MobileNavigation.js +95 -0
- package/MobilePopup.js +180 -0
- package/Modal.js +251 -0
- package/ModuleTitle.js +99 -0
- package/NavigationMenu.js +212 -0
- package/Notification.js +120 -0
- package/Option.js +186 -0
- package/Overlay.js +99 -0
- package/Overspread.js +343 -0
- package/Pagination.js +258 -0
- package/Paper.js +97 -0
- package/Popover-f4d1cac0.js +411 -0
- package/Popover.js +20 -0
- package/PopoverV2.js +19 -0
- package/Portal.js +58 -0
- package/Products.js +115 -0
- package/Profile.js +99 -0
- package/Progress.js +200 -0
- package/QRCode.js +816 -0
- package/README.md +90 -0
- package/Radio.js +152 -0
- package/RadioGroup.js +105 -0
- package/Range.js +14 -0
- package/RichEditor-b7928765.js +228 -0
- package/RichEditor.js +13 -0
- package/Scrollbar.js +1587 -0
- package/Search.js +72 -0
- package/SearchWithDropdown.js +195 -0
- package/Section.js +62 -0
- package/SkeletonLoader.js +82 -0
- package/Slider.js +256 -0
- package/Status.js +104 -0
- package/Steps.js +312 -0
- package/SuggestionList.js +15 -0
- package/Switcher.js +194 -0
- package/Table.js +102 -0
- package/TableCompositions.js +17028 -0
- package/Tabs.js +236 -0
- package/Tag.js +103 -0
- package/TextLink.js +22 -0
- package/Textarea.js +239 -0
- package/Time.js +63 -0
- package/TimePicker.js +99 -0
- package/Timeline.js +114 -0
- package/Title.js +66 -0
- package/Toaster.js +116 -0
- package/Tooltip.js +157 -0
- package/TransferList.js +502 -0
- package/Uploader.js +32 -0
- package/ValidatableCheckbox.js +126 -0
- package/ValidatableDatePicker.js +312 -0
- package/ValidatableDropdown.js +99 -0
- package/ValidatableElements.js +99 -0
- package/ValidatableMultiSelectDropdown.js +99 -0
- package/ValidatableNumberInput.js +194 -0
- package/ValidatableRadio.js +117 -0
- package/ValidatableSwitcher.js +94 -0
- package/ValidatableTextInput.js +164 -0
- package/ValidatableTimeInput.js +171 -0
- package/ValidatableUploader.js +94 -0
- package/Widget.js +99 -0
- package/_commonjsHelpers-24198af3.js +35 -0
- package/_rollupPluginBabelHelpers-e8fb2e5c.js +16 -0
- package/checkTimeValidation-e56771be.js +16 -0
- package/checkboxRadioSwitcher-5b69d7bd.js +4 -0
- package/clsx.m-2bb6df4b.js +3 -0
- package/configs-91c86664.js +96 -0
- package/configs.js +131 -0
- package/dateValidation-67caec66.js +225 -0
- package/debounce-4419bc2f.js +17 -0
- package/globalStyling-9c60a159.js +4 -0
- package/guid-8ddf77b3.js +16 -0
- package/index-00fe8887.js +193 -0
- package/index-0cf65939.js +30991 -0
- package/index-122432cd.js +270 -0
- package/index-262edd7a.js +77 -0
- package/index-5cea9a7d.js +407 -0
- package/index-5e722d91.js +867 -0
- package/index-67f4d4d1.js +6568 -0
- package/index-6ff23041.js +66 -0
- package/index-702bf24a.js +1938 -0
- package/index-a4635754.js +329 -0
- package/index-a59530cd.js +4 -0
- package/index-ac59cb10.js +169 -0
- package/index-b7a33c58.js +11 -0
- package/index-d9e8a888.js +987 -0
- package/index-e0af0caf.js +1182 -0
- package/index-e8776f3d.js +807 -0
- package/index.js +128 -0
- package/localization-4ba17032.js +46 -0
- package/objectWithoutPropertiesLoose-299691d8.js +78 -0
- package/package.json +190 -0
- package/rangeAndSlider-20599da4.js +8839 -0
- package/react-beautiful-dnd.esm-38c37304.js +10117 -0
- package/style-inject.es-746bb8ed.js +28 -0
- package/useClickOutside-5183e396.js +25 -0
- package/useDeviceType-dd51db38.js +15 -0
- package/useEllipsisDetection-ef536015.js +23 -0
- package/useKeyDown-38102ae7.js +21 -0
- package/useMount-6fef51a5.js +9 -0
- package/useWidth-9f4647f8.js +15 -0
- package/useWindowSize-80369d76.js +33 -0
package/TransferList.js
ADDED
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
import React__default, { useRef, useEffect, forwardRef, useState, useMemo, useCallback } from 'react';
|
|
2
|
+
import { p as propTypesExports } from './index-e0af0caf.js';
|
|
3
|
+
import { P as PublicDraggable, C as ConnectedDroppable, D as DragDropContext } from './react-beautiful-dnd.esm-38c37304.js';
|
|
4
|
+
import { c as classnames } from './index-6ff23041.js';
|
|
5
|
+
import { n as noop } from './index-ac59cb10.js';
|
|
6
|
+
import './configs-91c86664.js';
|
|
7
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
8
|
+
import Icon from './Icon.js';
|
|
9
|
+
import Empty from './Empty.js';
|
|
10
|
+
import Search from './Search.js';
|
|
11
|
+
import Checkbox from './Checkbox.js';
|
|
12
|
+
import CustomScrollbar from './Scrollbar.js';
|
|
13
|
+
import './Label.js';
|
|
14
|
+
import { s as styleInject } from './style-inject.es-746bb8ed.js';
|
|
15
|
+
import Button from './Button.js';
|
|
16
|
+
import Tooltip from './Tooltip.js';
|
|
17
|
+
import './objectWithoutPropertiesLoose-299691d8.js';
|
|
18
|
+
import './index-e8776f3d.js';
|
|
19
|
+
import 'react-dom';
|
|
20
|
+
import './dateValidation-67caec66.js';
|
|
21
|
+
import './_commonjsHelpers-24198af3.js';
|
|
22
|
+
import './globalStyling-9c60a159.js';
|
|
23
|
+
import './ExtendedInput.js';
|
|
24
|
+
import './useDeviceType-dd51db38.js';
|
|
25
|
+
import './useWindowSize-80369d76.js';
|
|
26
|
+
import './index-5cea9a7d.js';
|
|
27
|
+
import './useKeyDown-38102ae7.js';
|
|
28
|
+
import './useClickOutside-5183e396.js';
|
|
29
|
+
import './Popover-f4d1cac0.js';
|
|
30
|
+
import './GeneUIProvider.js';
|
|
31
|
+
import './checkboxRadioSwitcher-5b69d7bd.js';
|
|
32
|
+
import './guid-8ddf77b3.js';
|
|
33
|
+
|
|
34
|
+
const useDidMount = function () {
|
|
35
|
+
let callback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : () => {};
|
|
36
|
+
let deps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
37
|
+
const _isFirstUpdate = useRef(true);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!_isFirstUpdate.current) {
|
|
40
|
+
callback();
|
|
41
|
+
}
|
|
42
|
+
_isFirstUpdate.current = false;
|
|
43
|
+
}, deps);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
function n(n){for(var r=arguments.length,t=Array(r>1?r-1:0),e=1;e<r;e++)t[e-1]=arguments[e];if("production"!==process.env.NODE_ENV){var i=Y[n],o=i?"function"==typeof i?i.apply(null,t):i:"unknown error nr: "+n;throw Error("[Immer] "+o)}throw Error("[Immer] minified error nr: "+n+(t.length?" "+t.map((function(n){return "'"+n+"'"})).join(","):"")+". Find the full error at: https://bit.ly/3cXEKWf")}function r(n){return !!n&&!!n[Q]}function t(n){var r;return !!n&&(function(n){if(!n||"object"!=typeof n)return !1;var r=Object.getPrototypeOf(n);if(null===r)return !0;var t=Object.hasOwnProperty.call(r,"constructor")&&r.constructor;return t===Object||"function"==typeof t&&Function.toString.call(t)===Z}(n)||Array.isArray(n)||!!n[L]||!!(null===(r=n.constructor)||void 0===r?void 0:r[L])||s(n)||v(n))}function i(n,r,t){void 0===t&&(t=!1),0===o(n)?(t?Object.keys:nn)(n).forEach((function(e){t&&"symbol"==typeof e||r(e,n[e],n);})):n.forEach((function(t,e){return r(e,t,n)}));}function o(n){var r=n[Q];return r?r.i>3?r.i-4:r.i:Array.isArray(n)?1:s(n)?2:v(n)?3:0}function u(n,r){return 2===o(n)?n.has(r):Object.prototype.hasOwnProperty.call(n,r)}function a(n,r){return 2===o(n)?n.get(r):n[r]}function f(n,r,t){var e=o(n);2===e?n.set(r,t):3===e?n.add(t):n[r]=t;}function c(n,r){return n===r?0!==n||1/n==1/r:n!=n&&r!=r}function s(n){return X&&n instanceof Map}function v(n){return q&&n instanceof Set}function p(n){return n.o||n.t}function l(n){if(Array.isArray(n))return Array.prototype.slice.call(n);var r=rn(n);delete r[Q];for(var t=nn(r),e=0;e<t.length;e++){var i=t[e],o=r[i];!1===o.writable&&(o.writable=!0,o.configurable=!0),(o.get||o.set)&&(r[i]={configurable:!0,writable:!0,enumerable:o.enumerable,value:n[i]});}return Object.create(Object.getPrototypeOf(n),r)}function d(n,e){return void 0===e&&(e=!1),y(n)||r(n)||!t(n)||(o(n)>1&&(n.set=n.add=n.clear=n.delete=h),Object.freeze(n),e&&i(n,(function(n,r){return d(r,!0)}),!0)),n}function h(){n(2);}function y(n){return null==n||"object"!=typeof n||Object.isFrozen(n)}function b(r){var t=tn[r];return t||n(18,r),t}function _(){return "production"===process.env.NODE_ENV||U||n(0),U}function j(n,r){r&&(b("Patches"),n.u=[],n.s=[],n.v=r);}function g(n){O(n),n.p.forEach(S),n.p=null;}function O(n){n===U&&(U=n.l);}function w(n){return U={p:[],l:U,h:n,m:!0,_:0}}function S(n){var r=n[Q];0===r.i||1===r.i?r.j():r.g=!0;}function P(r,e){e._=e.p.length;var i=e.p[0],o=void 0!==r&&r!==i;return e.h.O||b("ES5").S(e,r,o),o?(i[Q].P&&(g(e),n(4)),t(r)&&(r=M(e,r),e.l||x(e,r)),e.u&&b("Patches").M(i[Q].t,r,e.u,e.s)):r=M(e,i,[]),g(e),e.u&&e.v(e.u,e.s),r!==H?r:void 0}function M(n,r,t){if(y(r))return r;var e=r[Q];if(!e)return i(r,(function(i,o){return A(n,e,r,i,o,t)}),!0),r;if(e.A!==n)return r;if(!e.P)return x(n,e.t,!0),e.t;if(!e.I){e.I=!0,e.A._--;var o=4===e.i||5===e.i?e.o=l(e.k):e.o,u=o,a=!1;3===e.i&&(u=new Set(o),o.clear(),a=!0),i(u,(function(r,i){return A(n,e,o,r,i,t,a)})),x(n,o,!1),t&&n.u&&b("Patches").N(e,t,n.u,n.s);}return e.o}function A(e,i,o,a,c,s,v){if("production"!==process.env.NODE_ENV&&c===o&&n(5),r(c)){var p=M(e,c,s&&i&&3!==i.i&&!u(i.R,a)?s.concat(a):void 0);if(f(o,a,p),!r(p))return;e.m=!1;}else v&&o.add(c);if(t(c)&&!y(c)){if(!e.h.D&&e._<1)return;M(e,c),i&&i.A.l||x(e,c);}}function x(n,r,t){void 0===t&&(t=!1),!n.l&&n.h.D&&n.m&&d(r,t);}function z(n,r){var t=n[Q];return (t?p(t):n)[r]}function I(n,r){if(r in n)for(var t=Object.getPrototypeOf(n);t;){var e=Object.getOwnPropertyDescriptor(t,r);if(e)return e;t=Object.getPrototypeOf(t);}}function k(n){n.P||(n.P=!0,n.l&&k(n.l));}function E(n){n.o||(n.o=l(n.t));}function N(n,r,t){var e=s(r)?b("MapSet").F(r,t):v(r)?b("MapSet").T(r,t):n.O?function(n,r){var t=Array.isArray(n),e={i:t?1:0,A:r?r.A:_(),P:!1,I:!1,R:{},l:r,t:n,k:null,o:null,j:null,C:!1},i=e,o=en;t&&(i=[e],o=on);var u=Proxy.revocable(i,o),a=u.revoke,f=u.proxy;return e.k=f,e.j=a,f}(r,t):b("ES5").J(r,t);return (t?t.A:_()).p.push(e),e}function R(e){return r(e)||n(22,e),function n(r){if(!t(r))return r;var e,u=r[Q],c=o(r);if(u){if(!u.P&&(u.i<4||!b("ES5").K(u)))return u.t;u.I=!0,e=D(r,c),u.I=!1;}else e=D(r,c);return i(e,(function(r,t){u&&a(u.t,r)===t||f(e,r,n(t));})),3===c?new Set(e):e}(e)}function D(n,r){switch(r){case 2:return new Map(n);case 3:return Array.from(n)}return l(n)}var G,U,W="undefined"!=typeof Symbol&&"symbol"==typeof Symbol("x"),X="undefined"!=typeof Map,q="undefined"!=typeof Set,B="undefined"!=typeof Proxy&&void 0!==Proxy.revocable&&"undefined"!=typeof Reflect,H=W?Symbol.for("immer-nothing"):((G={})["immer-nothing"]=!0,G),L=W?Symbol.for("immer-draftable"):"__$immer_draftable",Q=W?Symbol.for("immer-state"):"__$immer_state",Y={0:"Illegal state",1:"Immer drafts cannot have computed properties",2:"This object has been frozen and should not be mutated",3:function(n){return "Cannot use a proxy that has been revoked. Did you pass an object from inside an immer function to an async process? "+n},4:"An immer producer returned a new value *and* modified its draft. Either return a new value *or* modify the draft.",5:"Immer forbids circular references",6:"The first or second argument to `produce` must be a function",7:"The third argument to `produce` must be a function or undefined",8:"First argument to `createDraft` must be a plain object, an array, or an immerable object",9:"First argument to `finishDraft` must be a draft returned by `createDraft`",10:"The given draft is already finalized",11:"Object.defineProperty() cannot be used on an Immer draft",12:"Object.setPrototypeOf() cannot be used on an Immer draft",13:"Immer only supports deleting array indices",14:"Immer only supports setting array indices and the 'length' property",15:function(n){return "Cannot apply patch, path doesn't resolve: "+n},16:'Sets cannot have "replace" patches.',17:function(n){return "Unsupported patch operation: "+n},18:function(n){return "The plugin for '"+n+"' has not been loaded into Immer. To enable the plugin, import and call `enable"+n+"()` when initializing your application."},20:"Cannot use proxies if Proxy, Proxy.revocable or Reflect are not available",21:function(n){return "produce can only be called on things that are draftable: plain objects, arrays, Map, Set or classes that are marked with '[immerable]: true'. Got '"+n+"'"},22:function(n){return "'current' expects a draft, got: "+n},23:function(n){return "'original' expects a draft, got: "+n},24:"Patching reserved attributes like __proto__, prototype and constructor is not allowed"},Z=""+Object.prototype.constructor,nn="undefined"!=typeof Reflect&&Reflect.ownKeys?Reflect.ownKeys:void 0!==Object.getOwnPropertySymbols?function(n){return Object.getOwnPropertyNames(n).concat(Object.getOwnPropertySymbols(n))}:Object.getOwnPropertyNames,rn=Object.getOwnPropertyDescriptors||function(n){var r={};return nn(n).forEach((function(t){r[t]=Object.getOwnPropertyDescriptor(n,t);})),r},tn={},en={get:function(n,r){if(r===Q)return n;var e=p(n);if(!u(e,r))return function(n,r,t){var e,i=I(r,t);return i?"value"in i?i.value:null===(e=i.get)||void 0===e?void 0:e.call(n.k):void 0}(n,e,r);var i=e[r];return n.I||!t(i)?i:i===z(n.t,r)?(E(n),n.o[r]=N(n.A.h,i,n)):i},has:function(n,r){return r in p(n)},ownKeys:function(n){return Reflect.ownKeys(p(n))},set:function(n,r,t){var e=I(p(n),r);if(null==e?void 0:e.set)return e.set.call(n.k,t),!0;if(!n.P){var i=z(p(n),r),o=null==i?void 0:i[Q];if(o&&o.t===t)return n.o[r]=t,n.R[r]=!1,!0;if(c(t,i)&&(void 0!==t||u(n.t,r)))return !0;E(n),k(n);}return n.o[r]===t&&(void 0!==t||r in n.o)||Number.isNaN(t)&&Number.isNaN(n.o[r])||(n.o[r]=t,n.R[r]=!0),!0},deleteProperty:function(n,r){return void 0!==z(n.t,r)||r in n.t?(n.R[r]=!1,E(n),k(n)):delete n.R[r],n.o&&delete n.o[r],!0},getOwnPropertyDescriptor:function(n,r){var t=p(n),e=Reflect.getOwnPropertyDescriptor(t,r);return e?{writable:!0,configurable:1!==n.i||"length"!==r,enumerable:e.enumerable,value:t[r]}:e},defineProperty:function(){n(11);},getPrototypeOf:function(n){return Object.getPrototypeOf(n.t)},setPrototypeOf:function(){n(12);}},on={};i(en,(function(n,r){on[n]=function(){return arguments[0]=arguments[0][0],r.apply(this,arguments)};})),on.deleteProperty=function(r,t){return "production"!==process.env.NODE_ENV&&isNaN(parseInt(t))&&n(13),on.set.call(this,r,t,void 0)},on.set=function(r,t,e){return "production"!==process.env.NODE_ENV&&"length"!==t&&isNaN(parseInt(t))&&n(14),en.set.call(this,r[0],t,e,r[0])};var un=function(){function e(r){var e=this;this.O=B,this.D=!0,this.produce=function(r,i,o){if("function"==typeof r&&"function"!=typeof i){var u=i;i=r;var a=e;return function(n){var r=this;void 0===n&&(n=u);for(var t=arguments.length,e=Array(t>1?t-1:0),o=1;o<t;o++)e[o-1]=arguments[o];return a.produce(n,(function(n){var t;return (t=i).call.apply(t,[r,n].concat(e))}))}}var f;if("function"!=typeof i&&n(6),void 0!==o&&"function"!=typeof o&&n(7),t(r)){var c=w(e),s=N(e,r,void 0),v=!0;try{f=i(s),v=!1;}finally{v?g(c):O(c);}return "undefined"!=typeof Promise&&f instanceof Promise?f.then((function(n){return j(c,o),P(n,c)}),(function(n){throw g(c),n})):(j(c,o),P(f,c))}if(!r||"object"!=typeof r){if(void 0===(f=i(r))&&(f=r),f===H&&(f=void 0),e.D&&d(f,!0),o){var p=[],l=[];b("Patches").M(r,f,p,l),o(p,l);}return f}n(21,r);},this.produceWithPatches=function(n,r){if("function"==typeof n)return function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),o=1;o<t;o++)i[o-1]=arguments[o];return e.produceWithPatches(r,(function(r){return n.apply(void 0,[r].concat(i))}))};var t,i,o=e.produce(n,r,(function(n,r){t=n,i=r;}));return "undefined"!=typeof Promise&&o instanceof Promise?o.then((function(n){return [n,t,i]})):[o,t,i]},"boolean"==typeof(null==r?void 0:r.useProxies)&&this.setUseProxies(r.useProxies),"boolean"==typeof(null==r?void 0:r.autoFreeze)&&this.setAutoFreeze(r.autoFreeze);}var i=e.prototype;return i.createDraft=function(e){t(e)||n(8),r(e)&&(e=R(e));var i=w(this),o=N(this,e,void 0);return o[Q].C=!0,O(i),o},i.finishDraft=function(r,t){var e=r&&r[Q];"production"!==process.env.NODE_ENV&&(e&&e.C||n(9),e.I&&n(10));var i=e.A;return j(i,t),P(void 0,i)},i.setAutoFreeze=function(n){this.D=n;},i.setUseProxies=function(r){r&&!B&&n(20),this.O=r;},i.applyPatches=function(n,t){var e;for(e=t.length-1;e>=0;e--){var i=t[e];if(0===i.path.length&&"replace"===i.op){n=i.value;break}}e>-1&&(t=t.slice(e+1));var o=b("Patches").$;return r(n)?o(n,t):this.produce(n,(function(n){return o(n,t)}))},e}(),an=new un,fn=an.produce;an.produceWithPatches.bind(an);an.setAutoFreeze.bind(an);an.setUseProxies.bind(an);an.applyPatches.bind(an);an.createDraft.bind(an);an.finishDraft.bind(an);var produce = fn;
|
|
47
|
+
|
|
48
|
+
const reorderElement = (container, startIndex, endIndex) => produce(container, draft => {
|
|
49
|
+
const [removed] = draft.splice(startIndex, 1);
|
|
50
|
+
draft.splice(endIndex, 0, removed);
|
|
51
|
+
});
|
|
52
|
+
const moveElement = (containers, source, destination) => produce(containers, draft => {
|
|
53
|
+
const [removed] = draft[source.droppableId].splice(source.index, 1);
|
|
54
|
+
draft[destination.droppableId].splice(destination.index, 0, removed);
|
|
55
|
+
});
|
|
56
|
+
const multiMoveElement = _ref => {
|
|
57
|
+
let {
|
|
58
|
+
containers,
|
|
59
|
+
selectedElements,
|
|
60
|
+
destination
|
|
61
|
+
} = _ref;
|
|
62
|
+
return produce(containers, draft => {
|
|
63
|
+
let removed = [];
|
|
64
|
+
Object.entries(selectedElements).forEach(_ref2 => {
|
|
65
|
+
let [source, elements] = _ref2;
|
|
66
|
+
removed = [...removed, ...draft[source].filter((_, index) => elements.includes(index))];
|
|
67
|
+
draft[source] = draft[source].filter((_, index) => !elements.includes(index));
|
|
68
|
+
});
|
|
69
|
+
draft[destination.droppableId].splice(destination.index, 0, ...removed);
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
const selectedInitialState = containers => {
|
|
73
|
+
const data = {};
|
|
74
|
+
Object.keys(containers).forEach(key => {
|
|
75
|
+
data[key] = [];
|
|
76
|
+
});
|
|
77
|
+
return data;
|
|
78
|
+
};
|
|
79
|
+
const unionIndexes = arr => Array.from(new Set(arr));
|
|
80
|
+
const addOrRemove = (data, value) => produce(data, draft => {
|
|
81
|
+
const index = draft.indexOf(value);
|
|
82
|
+
if (index === -1) {
|
|
83
|
+
draft.push(value);
|
|
84
|
+
} else {
|
|
85
|
+
draft.splice(index, 1);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
const DEFAULT_TRANSLATE_MESSAGE = {
|
|
90
|
+
empty: 'No data',
|
|
91
|
+
dropHere: 'Drop Element Here',
|
|
92
|
+
multiSelectText: 'Elements',
|
|
93
|
+
moveTo: 'Move to'
|
|
94
|
+
};
|
|
95
|
+
const DEFAULT_DATA_ERROR_MESSAGE = 'TransferList: Be sure to send the defaultDate according to the documentation standard';
|
|
96
|
+
|
|
97
|
+
var css_248z$2 = "[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element{grid-column-gap:1.2rem;--crs-grid-column-gap:2rem;align-items:center;cursor:pointer;display:grid;grid-template-columns:1fr auto;margin:.75rem 0;overflow:hidden;padding:0 1.5rem 0 2rem;transition:color .4s,background .4s,opacity .4s,box-shadow .4s;width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element:not(.minimalistic){background:var(--background);border:1px solid rgba(var(--background-sc-rgb),.1);border-radius:1rem;box-shadow:inset 0 0 0 4.2rem rgba(var(--hero-rgb),0),0 .2rem .4rem 0 rgba(var(--hero-rgb),0);height:4.2rem}@media (hover:hover){[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element:not(.minimalistic):hover{border-color:rgba(var(--hero-rgb),.2);box-shadow:inset 0 0 0 4.2rem rgba(var(--hero-rgb),.1),0 .2rem .4rem 0 rgba(var(--hero-rgb),0);color:var(--hero)}}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element.hovered{border-color:rgba(var(--hero-rgb),.2);box-shadow:inset 0 0 0 4.2rem rgba(var(--hero-rgb),.1),0 .2rem .4rem 0 rgba(var(--hero-rgb),0);color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element.disabled{opacity:.5;pointer-events:none}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element.dragged{border-color:rgba(var(--hero-rgb),.1);box-shadow:inset 0 0 0 4.2rem rgba(var(--hero-rgb),.1),0 .2rem .4rem 0 rgba(var(--hero-rgb),.1);color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element.readOnly{cursor:default}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element.readOnly .crs-holder .crs-component{display:none}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element>.icon{cursor:grab}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element>.icon:active{cursor:grabbing}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-element .crs-holder{pointer-events:none}";
|
|
98
|
+
styleInject(css_248z$2);
|
|
99
|
+
|
|
100
|
+
const TransferElement = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
101
|
+
let {
|
|
102
|
+
disabled,
|
|
103
|
+
hovered,
|
|
104
|
+
dragged,
|
|
105
|
+
checked,
|
|
106
|
+
label,
|
|
107
|
+
onClick,
|
|
108
|
+
readOnly,
|
|
109
|
+
minimalistic,
|
|
110
|
+
indeterminate
|
|
111
|
+
} = _ref;
|
|
112
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
113
|
+
ref: ref,
|
|
114
|
+
onClick: onClick,
|
|
115
|
+
className: classnames('bc-transfer-element', 'crs-external-hover', 'crs-external-active', {
|
|
116
|
+
minimalistic,
|
|
117
|
+
disabled,
|
|
118
|
+
hovered,
|
|
119
|
+
dragged,
|
|
120
|
+
readOnly
|
|
121
|
+
})
|
|
122
|
+
}, /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
123
|
+
indeterminate: indeterminate,
|
|
124
|
+
checked: checked,
|
|
125
|
+
label: label
|
|
126
|
+
}), !readOnly && !minimalistic && /*#__PURE__*/React__default.createElement(Icon, {
|
|
127
|
+
type: "bc-icon-drag"
|
|
128
|
+
}));
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
function TransferListItem(_ref) {
|
|
132
|
+
let {
|
|
133
|
+
index,
|
|
134
|
+
element,
|
|
135
|
+
onClick,
|
|
136
|
+
selected,
|
|
137
|
+
readOnly,
|
|
138
|
+
isDragActive,
|
|
139
|
+
multiSelectText,
|
|
140
|
+
selectedElementsLength
|
|
141
|
+
} = _ref;
|
|
142
|
+
const isDisabled = readOnly || element.disabled;
|
|
143
|
+
const handleClick = event => !isDisabled && onClick(index, event);
|
|
144
|
+
return /*#__PURE__*/React__default.createElement(PublicDraggable, {
|
|
145
|
+
isDragDisabled: isDisabled,
|
|
146
|
+
draggableId: element.id,
|
|
147
|
+
index: index
|
|
148
|
+
}, (_ref2, _ref3) => {
|
|
149
|
+
let {
|
|
150
|
+
innerRef,
|
|
151
|
+
draggableProps,
|
|
152
|
+
dragHandleProps
|
|
153
|
+
} = _ref2;
|
|
154
|
+
let {
|
|
155
|
+
isDragging
|
|
156
|
+
} = _ref3;
|
|
157
|
+
return /*#__PURE__*/React__default.createElement("div", _extends({
|
|
158
|
+
ref: innerRef
|
|
159
|
+
}, draggableProps, dragHandleProps, {
|
|
160
|
+
onClick: handleClick,
|
|
161
|
+
className: "bc-tl-item"
|
|
162
|
+
}), /*#__PURE__*/React__default.createElement(TransferElement, {
|
|
163
|
+
label: isDragging && selectedElementsLength > 1 ? "".concat(selectedElementsLength, " ").concat(multiSelectText) : element.title,
|
|
164
|
+
checked: selected,
|
|
165
|
+
readOnly: readOnly,
|
|
166
|
+
dragged: isDragging,
|
|
167
|
+
disabled: element.disabled || selected && isDragActive && !isDragging
|
|
168
|
+
}));
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function TransferListButtons(_ref) {
|
|
173
|
+
let {
|
|
174
|
+
onTransmit,
|
|
175
|
+
send,
|
|
176
|
+
receive,
|
|
177
|
+
readOnly
|
|
178
|
+
} = _ref;
|
|
179
|
+
const handleReceive = () => onTransmit(send.id, receive.id);
|
|
180
|
+
const handleSend = () => onTransmit(receive.id, send.id);
|
|
181
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
182
|
+
className: "bc-tl-buttons"
|
|
183
|
+
}, /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
184
|
+
text: send.title
|
|
185
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
186
|
+
onClick: handleSend,
|
|
187
|
+
disabled: readOnly || send.disabled,
|
|
188
|
+
icon: "bc-icon-arrow-right",
|
|
189
|
+
appearance: "clean"
|
|
190
|
+
})), /*#__PURE__*/React__default.createElement(Tooltip, {
|
|
191
|
+
text: receive.title
|
|
192
|
+
}, /*#__PURE__*/React__default.createElement(Button, {
|
|
193
|
+
onClick: handleReceive,
|
|
194
|
+
disabled: readOnly || receive.disabled,
|
|
195
|
+
icon: "bc-icon-arrow-left",
|
|
196
|
+
appearance: "clean"
|
|
197
|
+
})));
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var css_248z$1 = "[data-gene-ui-version=\"2.11.0\"] .bc-transfer-container{width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-container>li+li{border-top:1px solid var(--transfer-container-border-color,#0000)}[data-gene-ui-version=\"2.11.0\"] .bc-tl-head{align-items:center;display:flex;font:600 1.4rem/1.8rem var(--font-family);height:5.1rem;justify-content:space-between;padding:0 2rem}[data-gene-ui-version=\"2.11.0\"] .bc-tl-head h5{color:var(--hero)}[data-gene-ui-version=\"2.11.0\"] .bc-tl-head span{color:rgba(var(--background-sc-rgb),.5)}[data-gene-ui-version=\"2.11.0\"] .bc-tl-buttons{--button-external-size:4rem;border-width:medium;border-bottom:0 solid rgba(var(--background-sc-rgb),.1);border-left:1px solid rgba(var(--background-sc-rgb),.1);border-right:1px solid rgba(var(--background-sc-rgb),.1);border-top:0 solid rgba(var(--background-sc-rgb),.1);display:flex;flex-direction:column;flex-shrink:0;justify-content:center;padding:0 1rem}[data-gene-ui-version=\"2.11.0\"] .bc-tl-buttons>*+*{margin:1rem 0 0}[data-gene-ui-version=\"2.11.0\"] .bc-tl-search{padding:2rem}[data-gene-ui-version=\"2.11.0\"] .bc-tl-content-holder{height:var(--transfer-container-content-height);overflow:hidden;position:relative}[data-gene-ui-version=\"2.11.0\"] .bc-tl-content{display:flex;flex-direction:column;justify-content:flex-start;min-height:100%;padding:.7rem 2rem;width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-tl-content>.bc-tl-item{opacity:1!important}[data-gene-ui-version=\"2.11.0\"] .bc-tl-placeholder{align-items:center;display:flex;height:100%;justify-content:center;left:0;padding:0 0 3.6rem;position:absolute;top:0;width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-tl-drop-here{align-items:center;display:flex;flex-direction:column;font:600 1.4rem/1.8rem var(--font-family);text-align:center;width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-tl-drop-here i{color:rgba(var(--hero-rgb),.1);font-size:11rem}";
|
|
201
|
+
styleInject(css_248z$1);
|
|
202
|
+
|
|
203
|
+
function TransferListContainer(_ref) {
|
|
204
|
+
let {
|
|
205
|
+
data,
|
|
206
|
+
isEditable,
|
|
207
|
+
messages,
|
|
208
|
+
onTransmit,
|
|
209
|
+
containerId,
|
|
210
|
+
isDragActive,
|
|
211
|
+
onElementSelect,
|
|
212
|
+
selectedElements,
|
|
213
|
+
onSelectAllElements,
|
|
214
|
+
transmissionButtons,
|
|
215
|
+
selectedElementsLength
|
|
216
|
+
} = _ref;
|
|
217
|
+
const [searchText, setSearchText] = useState('');
|
|
218
|
+
const filteredData = useMemo(() => {
|
|
219
|
+
const elements = [];
|
|
220
|
+
data.forEach((element, index) => {
|
|
221
|
+
if (element.title.toLowerCase().includes(searchText)) {
|
|
222
|
+
elements.push({
|
|
223
|
+
...element,
|
|
224
|
+
index
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
});
|
|
228
|
+
return elements;
|
|
229
|
+
}, [data, searchText]);
|
|
230
|
+
const selectableElements = useMemo(() => filteredData.filter(_ref2 => {
|
|
231
|
+
let {
|
|
232
|
+
disabled
|
|
233
|
+
} = _ref2;
|
|
234
|
+
return !disabled;
|
|
235
|
+
}), [filteredData]);
|
|
236
|
+
const isAllSelected = useMemo(() => {
|
|
237
|
+
const selectableElements = filteredData.filter(_ref3 => {
|
|
238
|
+
let {
|
|
239
|
+
disabled
|
|
240
|
+
} = _ref3;
|
|
241
|
+
return !disabled;
|
|
242
|
+
});
|
|
243
|
+
const filteredSelectedElements = selectableElements.filter(_ref4 => {
|
|
244
|
+
let {
|
|
245
|
+
index
|
|
246
|
+
} = _ref4;
|
|
247
|
+
return selectedElements.includes(index);
|
|
248
|
+
});
|
|
249
|
+
return !!selectableElements.length && selectableElements.length === filteredSelectedElements.length && selectedElements.length === filteredSelectedElements.length;
|
|
250
|
+
}, [selectedElements, filteredData]);
|
|
251
|
+
const handleSelectAll = () => onSelectAllElements(containerId, isAllSelected);
|
|
252
|
+
const handleElementClick = index => onElementSelect(containerId, index);
|
|
253
|
+
const handleSearchChange = event => {
|
|
254
|
+
setSearchText(event.target.value.toLowerCase());
|
|
255
|
+
};
|
|
256
|
+
return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ConnectedDroppable, {
|
|
257
|
+
key: containerId,
|
|
258
|
+
droppableId: containerId,
|
|
259
|
+
isDropDisabled: isEditable,
|
|
260
|
+
children: (_ref5, _ref6) => {
|
|
261
|
+
let {
|
|
262
|
+
innerRef,
|
|
263
|
+
placeholder,
|
|
264
|
+
droppableProps
|
|
265
|
+
} = _ref5;
|
|
266
|
+
let {
|
|
267
|
+
isDraggingOver
|
|
268
|
+
} = _ref6;
|
|
269
|
+
return /*#__PURE__*/React__default.createElement("ul", {
|
|
270
|
+
className: classnames('bc-transfer-container', {
|
|
271
|
+
isDraggingOver,
|
|
272
|
+
isDragActive
|
|
273
|
+
})
|
|
274
|
+
}, /*#__PURE__*/React__default.createElement("li", {
|
|
275
|
+
className: "bc-tl-head"
|
|
276
|
+
}, /*#__PURE__*/React__default.createElement("h5", null, messages && messages.titles ? messages.titles[containerId] : containerId), /*#__PURE__*/React__default.createElement("span", null, messages && messages.countTitle && messages.countTitle[containerId], " (", selectedElements.length, "/", data.length, ")")), /*#__PURE__*/React__default.createElement("li", {
|
|
277
|
+
className: "bc-tl-search"
|
|
278
|
+
}, /*#__PURE__*/React__default.createElement(Search, {
|
|
279
|
+
inputSize: "big",
|
|
280
|
+
disabled: !data.length,
|
|
281
|
+
onChange: handleSearchChange
|
|
282
|
+
})), /*#__PURE__*/React__default.createElement("li", {
|
|
283
|
+
className: "bc-tl-content-holder"
|
|
284
|
+
}, /*#__PURE__*/React__default.createElement(CustomScrollbar, null, /*#__PURE__*/React__default.createElement("div", _extends({
|
|
285
|
+
ref: innerRef
|
|
286
|
+
}, droppableProps, {
|
|
287
|
+
className: "bc-tl-content"
|
|
288
|
+
}), filteredData.length ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, !isEditable && /*#__PURE__*/React__default.createElement(TransferElement, {
|
|
289
|
+
minimalistic: true,
|
|
290
|
+
label: "Select All",
|
|
291
|
+
checked: isAllSelected,
|
|
292
|
+
onClick: handleSelectAll,
|
|
293
|
+
disabled: !selectableElements.length,
|
|
294
|
+
indeterminate: !isAllSelected && !!selectedElements.length
|
|
295
|
+
}), filteredData.map(element => /*#__PURE__*/React__default.createElement(TransferListItem, {
|
|
296
|
+
key: element.id,
|
|
297
|
+
element: element,
|
|
298
|
+
readOnly: isEditable,
|
|
299
|
+
index: element.index,
|
|
300
|
+
isDragActive: isDragActive,
|
|
301
|
+
onClick: handleElementClick,
|
|
302
|
+
selectedElementsLength: selectedElementsLength,
|
|
303
|
+
selected: selectedElements.includes(element.index),
|
|
304
|
+
multiSelectText: messages.multiSelectText
|
|
305
|
+
}))) : /*#__PURE__*/React__default.createElement("div", {
|
|
306
|
+
className: "bc-tl-placeholder pointer-events-none"
|
|
307
|
+
}, isDraggingOver ? /*#__PURE__*/React__default.createElement("div", {
|
|
308
|
+
className: "bc-tl-drop-here"
|
|
309
|
+
}, /*#__PURE__*/React__default.createElement(Icon, {
|
|
310
|
+
type: "bc-icon-drag-here"
|
|
311
|
+
}), /*#__PURE__*/React__default.createElement("p", null, messages.dropHere)) : /*#__PURE__*/React__default.createElement(Empty, {
|
|
312
|
+
size: "medium",
|
|
313
|
+
type: "data",
|
|
314
|
+
appearance: "greyscale",
|
|
315
|
+
title: messages.empty
|
|
316
|
+
}))), placeholder)));
|
|
317
|
+
}
|
|
318
|
+
}), transmissionButtons && /*#__PURE__*/React__default.createElement(TransferListButtons, _extends({
|
|
319
|
+
readOnly: isEditable,
|
|
320
|
+
onTransmit: onTransmit
|
|
321
|
+
}, transmissionButtons)));
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
var css_248z = "[data-gene-ui-version=\"2.11.0\"] .bc-transfer-list{--transfer-container-border-color:rgba(var(--background-sc-rgb),0.1);--transfer-container-content-height:33.4rem;background:var(--background);box-shadow:0 0 0 1px var(--transfer-container-border-color);display:flex;grid-template-columns:1fr auto 1fr;-webkit-user-select:none;user-select:none;width:100%}[data-gene-ui-version=\"2.11.0\"] .bc-transfer-list .scroll-holder .scroll-content{z-index:inherit}";
|
|
325
|
+
styleInject(css_248z);
|
|
326
|
+
|
|
327
|
+
function TransferList(_ref) {
|
|
328
|
+
let {
|
|
329
|
+
onChange,
|
|
330
|
+
className,
|
|
331
|
+
isEditable,
|
|
332
|
+
defaultData,
|
|
333
|
+
translateMessages,
|
|
334
|
+
...props
|
|
335
|
+
} = _ref;
|
|
336
|
+
if (!(defaultData && Object.keys(defaultData).length)) {
|
|
337
|
+
console.error(DEFAULT_DATA_ERROR_MESSAGE);
|
|
338
|
+
return null;
|
|
339
|
+
}
|
|
340
|
+
const [isDragActive, setIsDragActive] = useState(false);
|
|
341
|
+
const [containers, setContainers] = useState(defaultData);
|
|
342
|
+
const [selectedElements, setSelectedElements] = useState(selectedInitialState(defaultData));
|
|
343
|
+
useEffect(() => {
|
|
344
|
+
setContainers(defaultData);
|
|
345
|
+
setSelectedElements(selectedInitialState(defaultData));
|
|
346
|
+
}, [defaultData, isEditable]);
|
|
347
|
+
const messages = useMemo(() => ({
|
|
348
|
+
...DEFAULT_TRANSLATE_MESSAGE,
|
|
349
|
+
...translateMessages
|
|
350
|
+
}), [translateMessages]);
|
|
351
|
+
const containersEntries = useMemo(() => Object.entries(containers), [containers]);
|
|
352
|
+
const selectedElementsLength = useMemo(() => selectedElements && Object.values(selectedElements).reduce((length, data) => {
|
|
353
|
+
length += data.length;
|
|
354
|
+
return length;
|
|
355
|
+
}, 0), [selectedElements]);
|
|
356
|
+
useDidMount(() => {
|
|
357
|
+
onChange(containers);
|
|
358
|
+
}, [onChange, containers]);
|
|
359
|
+
function handleDragStart() {
|
|
360
|
+
setIsDragActive(true);
|
|
361
|
+
}
|
|
362
|
+
function handleDragEnd(_ref2) {
|
|
363
|
+
let {
|
|
364
|
+
destination,
|
|
365
|
+
source
|
|
366
|
+
} = _ref2;
|
|
367
|
+
if (destination && source) {
|
|
368
|
+
if (selectedElementsLength) {
|
|
369
|
+
setContainers(containers => multiMoveElement({
|
|
370
|
+
containers,
|
|
371
|
+
destination,
|
|
372
|
+
selectedElements: {
|
|
373
|
+
...selectedElements,
|
|
374
|
+
[source.droppableId]: unionIndexes([...selectedElements[source.droppableId], source.index])
|
|
375
|
+
}
|
|
376
|
+
}));
|
|
377
|
+
} else if (destination.droppableId === source.droppableId) {
|
|
378
|
+
setContainers(prev => ({
|
|
379
|
+
...prev,
|
|
380
|
+
[source.droppableId]: reorderElement(prev[source.droppableId], source.index, destination.index)
|
|
381
|
+
}));
|
|
382
|
+
} else {
|
|
383
|
+
setContainers(prev => moveElement(prev, source, destination));
|
|
384
|
+
}
|
|
385
|
+
setSelectedElements(selectedInitialState(containers));
|
|
386
|
+
}
|
|
387
|
+
setIsDragActive(false);
|
|
388
|
+
}
|
|
389
|
+
const handleElementSelect = useCallback((source, index) => {
|
|
390
|
+
setSelectedElements(prev => ({
|
|
391
|
+
...prev,
|
|
392
|
+
[source]: addOrRemove(prev[source], index)
|
|
393
|
+
}));
|
|
394
|
+
}, []);
|
|
395
|
+
const handleSelectAllElements = useCallback((containerId, isUnselect) => {
|
|
396
|
+
let indexes = [];
|
|
397
|
+
if (!isUnselect) {
|
|
398
|
+
indexes = containers[containerId].map((_ref3, index) => {
|
|
399
|
+
let {
|
|
400
|
+
disabled
|
|
401
|
+
} = _ref3;
|
|
402
|
+
return !disabled && index;
|
|
403
|
+
}).filter(index => typeof index === 'number');
|
|
404
|
+
}
|
|
405
|
+
setSelectedElements(prev => ({
|
|
406
|
+
...prev,
|
|
407
|
+
[containerId]: indexes
|
|
408
|
+
}));
|
|
409
|
+
}, [containers]);
|
|
410
|
+
const transmissionButtons = useCallback(index => {
|
|
411
|
+
var _containersEntries$in, _containersEntries;
|
|
412
|
+
const prev = (_containersEntries$in = containersEntries[index]) === null || _containersEntries$in === void 0 ? void 0 : _containersEntries$in[0];
|
|
413
|
+
const next = (_containersEntries = containersEntries[index + 1]) === null || _containersEntries === void 0 ? void 0 : _containersEntries[0];
|
|
414
|
+
if (prev && next) {
|
|
415
|
+
return {
|
|
416
|
+
send: {
|
|
417
|
+
id: next,
|
|
418
|
+
disabled: !selectedElements[prev].length,
|
|
419
|
+
title: "".concat(messages.moveTo, " ").concat(messages.titles[next])
|
|
420
|
+
},
|
|
421
|
+
receive: {
|
|
422
|
+
id: prev,
|
|
423
|
+
disabled: !selectedElements[next].length,
|
|
424
|
+
title: "".concat(messages.moveTo, " ").concat(messages.titles[prev])
|
|
425
|
+
}
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
}, [messages, containersEntries, selectedElements]);
|
|
429
|
+
const handleTransmit = useCallback((ofContainer, toConteiner) => {
|
|
430
|
+
setContainers(prev => multiMoveElement({
|
|
431
|
+
containers: prev,
|
|
432
|
+
selectedElements: {
|
|
433
|
+
[ofContainer]: selectedElements[ofContainer]
|
|
434
|
+
},
|
|
435
|
+
destination: {
|
|
436
|
+
index: 0,
|
|
437
|
+
droppableId: toConteiner
|
|
438
|
+
}
|
|
439
|
+
}));
|
|
440
|
+
setSelectedElements(prev => ({
|
|
441
|
+
...prev,
|
|
442
|
+
[toConteiner]: prev[toConteiner].map(i => i + prev[ofContainer].length),
|
|
443
|
+
[ofContainer]: []
|
|
444
|
+
}));
|
|
445
|
+
}, [selectedElements]);
|
|
446
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
447
|
+
className: classnames('bc-transfer-list', className)
|
|
448
|
+
}, /*#__PURE__*/React__default.createElement(DragDropContext, {
|
|
449
|
+
onDragEnd: handleDragEnd,
|
|
450
|
+
onDragStart: handleDragStart
|
|
451
|
+
}, containersEntries.map((_ref4, index) => {
|
|
452
|
+
let [id, data] = _ref4;
|
|
453
|
+
return /*#__PURE__*/React__default.createElement(TransferListContainer, {
|
|
454
|
+
key: id,
|
|
455
|
+
data: data,
|
|
456
|
+
containerId: id,
|
|
457
|
+
messages: messages,
|
|
458
|
+
isEditable: isEditable,
|
|
459
|
+
onTransmit: handleTransmit,
|
|
460
|
+
isDragActive: isDragActive,
|
|
461
|
+
onElementSelect: handleElementSelect,
|
|
462
|
+
selectedElements: selectedElements[id],
|
|
463
|
+
onSelectAllElements: handleSelectAllElements,
|
|
464
|
+
selectedElementsLength: selectedElementsLength,
|
|
465
|
+
transmissionButtons: transmissionButtons(index)
|
|
466
|
+
});
|
|
467
|
+
})));
|
|
468
|
+
}
|
|
469
|
+
TransferList.propTypes = {
|
|
470
|
+
/**
|
|
471
|
+
* DefaultData there should be objects with different keys names, inside which there should be container data
|
|
472
|
+
* { taskts: [], toDo: [{ id: 1, name: "Element 1", disabled: false }] }
|
|
473
|
+
*/
|
|
474
|
+
defaultData: propTypesExports.object.isRequired,
|
|
475
|
+
/**
|
|
476
|
+
* onChange listen to the change in the container and return you the new object
|
|
477
|
+
*/
|
|
478
|
+
onChange: propTypesExports.func,
|
|
479
|
+
/**
|
|
480
|
+
* Using translateMessages prop you can add/change the text title of the containers, count subtitle, empty Text, etc.
|
|
481
|
+
*/
|
|
482
|
+
translateMessages: propTypesExports.shape({
|
|
483
|
+
titles: propTypesExports.object,
|
|
484
|
+
countTitle: propTypesExports.object,
|
|
485
|
+
dropHere: propTypesExports.string,
|
|
486
|
+
empty: propTypesExports.string
|
|
487
|
+
}),
|
|
488
|
+
/**
|
|
489
|
+
* CSS classname to add on the outer container.
|
|
490
|
+
*/
|
|
491
|
+
className: propTypesExports.string,
|
|
492
|
+
/**
|
|
493
|
+
* When do you send: false
|
|
494
|
+
* Hide Select All buttons / items checkboxes / disabled all drag and drop functionality
|
|
495
|
+
*/
|
|
496
|
+
isEditable: propTypesExports.bool
|
|
497
|
+
};
|
|
498
|
+
TransferList.defaultProps = {
|
|
499
|
+
onChange: noop
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
export { TransferList as default };
|
package/Uploader.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import './_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import './index-e0af0caf.js';
|
|
4
|
+
import './index-6ff23041.js';
|
|
5
|
+
import './configs-91c86664.js';
|
|
6
|
+
import './index-ac59cb10.js';
|
|
7
|
+
export { U as default } from './index-d9e8a888.js';
|
|
8
|
+
import './Grid.js';
|
|
9
|
+
import './Button.js';
|
|
10
|
+
import './ExtendedInput.js';
|
|
11
|
+
import './globalStyling-9c60a159.js';
|
|
12
|
+
import './dateValidation-67caec66.js';
|
|
13
|
+
import './_commonjsHelpers-24198af3.js';
|
|
14
|
+
import 'react-dom';
|
|
15
|
+
import './useKeyDown-38102ae7.js';
|
|
16
|
+
import './BusyLoader.js';
|
|
17
|
+
import './Icon.js';
|
|
18
|
+
import './style-inject.es-746bb8ed.js';
|
|
19
|
+
import './Image.js';
|
|
20
|
+
import './Empty.js';
|
|
21
|
+
import './Tooltip.js';
|
|
22
|
+
import './Popover-f4d1cac0.js';
|
|
23
|
+
import './useDeviceType-dd51db38.js';
|
|
24
|
+
import './useWindowSize-80369d76.js';
|
|
25
|
+
import './GeneUIProvider.js';
|
|
26
|
+
import './Checkbox.js';
|
|
27
|
+
import './checkboxRadioSwitcher-5b69d7bd.js';
|
|
28
|
+
import './guid-8ddf77b3.js';
|
|
29
|
+
import './useWidth-9f4647f8.js';
|
|
30
|
+
import './index-5cea9a7d.js';
|
|
31
|
+
import './useClickOutside-5183e396.js';
|
|
32
|
+
import './Scrollbar.js';
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { _ as _extends } from './_rollupPluginBabelHelpers-e8fb2e5c.js';
|
|
2
|
+
import React__default, { forwardRef, useState, useCallback, useEffect } from 'react';
|
|
3
|
+
import { p as propTypesExports } from './index-e0af0caf.js';
|
|
4
|
+
import { n as noop, i as interceptValue } from './index-ac59cb10.js';
|
|
5
|
+
import { u as useMount } from './useMount-6fef51a5.js';
|
|
6
|
+
import './configs-91c86664.js';
|
|
7
|
+
import Checkbox from './Checkbox.js';
|
|
8
|
+
import './dateValidation-67caec66.js';
|
|
9
|
+
import './_commonjsHelpers-24198af3.js';
|
|
10
|
+
import 'react-dom';
|
|
11
|
+
import './index-6ff23041.js';
|
|
12
|
+
import './Tooltip.js';
|
|
13
|
+
import './Popover-f4d1cac0.js';
|
|
14
|
+
import './useDeviceType-dd51db38.js';
|
|
15
|
+
import './useWindowSize-80369d76.js';
|
|
16
|
+
import './GeneUIProvider.js';
|
|
17
|
+
import './globalStyling-9c60a159.js';
|
|
18
|
+
import './style-inject.es-746bb8ed.js';
|
|
19
|
+
import './checkboxRadioSwitcher-5b69d7bd.js';
|
|
20
|
+
import './guid-8ddf77b3.js';
|
|
21
|
+
|
|
22
|
+
function checkValidation(required, isValid, checked) {
|
|
23
|
+
if (isValid === false) return {
|
|
24
|
+
key: 'customValidation',
|
|
25
|
+
isValid: false
|
|
26
|
+
};
|
|
27
|
+
if (required && !checked) return {
|
|
28
|
+
key: 'required',
|
|
29
|
+
isValid: false
|
|
30
|
+
};
|
|
31
|
+
return {
|
|
32
|
+
key: null,
|
|
33
|
+
isValid: true
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const CheckboxField = /*#__PURE__*/forwardRef((props, ref) => {
|
|
37
|
+
const {
|
|
38
|
+
onChange,
|
|
39
|
+
value,
|
|
40
|
+
isValid,
|
|
41
|
+
required,
|
|
42
|
+
isFieldValid,
|
|
43
|
+
forceAllowValidation,
|
|
44
|
+
...restProps
|
|
45
|
+
} = props;
|
|
46
|
+
const isControlled = 'value' in props && typeof value !== 'undefined';
|
|
47
|
+
const [validationState, setValidationState] = useState(true);
|
|
48
|
+
const [checked, setChecked] = useState(false);
|
|
49
|
+
const [allowValidation, setAllowValidation] = useState(false);
|
|
50
|
+
const validate = useCallback(() => checkValidation(required, isValid, checked).isValid, [checked, required, isValid]);
|
|
51
|
+
const handleChange = useCallback(e => {
|
|
52
|
+
const {
|
|
53
|
+
checked
|
|
54
|
+
} = e.target;
|
|
55
|
+
const {
|
|
56
|
+
isValid: isCheckboxValid,
|
|
57
|
+
key
|
|
58
|
+
} = checkValidation(required, isValid, checked);
|
|
59
|
+
setValidationState(isCheckboxValid);
|
|
60
|
+
setChecked(checked);
|
|
61
|
+
onChange(interceptValue(e, value), isCheckboxValid, key);
|
|
62
|
+
}, [onChange, required, isValid]);
|
|
63
|
+
|
|
64
|
+
// we use this because need to show field validation after onBlur
|
|
65
|
+
const onBlur = useCallback(() => setAllowValidation(true), []);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
isControlled && setValidationState(validate());
|
|
68
|
+
}, [isControlled, validate]);
|
|
69
|
+
|
|
70
|
+
// need this for handling user's `isValid` prop
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setValidationState(isValid);
|
|
73
|
+
}, [isValid]);
|
|
74
|
+
|
|
75
|
+
// call function when validation state changes
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
isFieldValid(validationState);
|
|
78
|
+
}, [validationState]);
|
|
79
|
+
|
|
80
|
+
// set Allow validation true if submit button clicked
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
forceAllowValidation && setAllowValidation(true);
|
|
83
|
+
}, [forceAllowValidation]);
|
|
84
|
+
useMount(() => setValidationState(validate()));
|
|
85
|
+
return /*#__PURE__*/React__default.createElement(Checkbox, _extends({
|
|
86
|
+
required: required,
|
|
87
|
+
ref: ref,
|
|
88
|
+
value: value,
|
|
89
|
+
isValid: !allowValidation || validationState,
|
|
90
|
+
onChange: handleChange,
|
|
91
|
+
onBlur: onBlur
|
|
92
|
+
}, restProps));
|
|
93
|
+
});
|
|
94
|
+
CheckboxField.propTypes = {
|
|
95
|
+
/**
|
|
96
|
+
* Value for checkbox
|
|
97
|
+
*/
|
|
98
|
+
value: propTypesExports.oneOfType([propTypesExports.string, propTypesExports.bool]),
|
|
99
|
+
/**
|
|
100
|
+
* Callback fires when checkbox changes
|
|
101
|
+
*/
|
|
102
|
+
onChange: propTypesExports.func,
|
|
103
|
+
/**
|
|
104
|
+
* Define is field required or no.
|
|
105
|
+
*/
|
|
106
|
+
required: propTypesExports.bool,
|
|
107
|
+
/**
|
|
108
|
+
* Callback fires when field validation state changes
|
|
109
|
+
*/
|
|
110
|
+
isFieldValid: propTypesExports.func,
|
|
111
|
+
/**
|
|
112
|
+
* Additional validation state
|
|
113
|
+
*/
|
|
114
|
+
isValid: propTypesExports.bool,
|
|
115
|
+
/**
|
|
116
|
+
* Allow validation without onBlur, validate field when mount
|
|
117
|
+
*/
|
|
118
|
+
forceAllowValidation: propTypesExports.bool
|
|
119
|
+
};
|
|
120
|
+
CheckboxField.defaultProps = {
|
|
121
|
+
isValid: true,
|
|
122
|
+
isFieldValid: noop,
|
|
123
|
+
onChange: noop
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
export { CheckboxField as default };
|