@bigbinary/neeto-commons-frontend 2.0.11 → 2.0.13

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.
@@ -152,9 +152,57 @@ function _typeof$3(obj) {
152
152
  }, _typeof$3(obj);
153
153
  }
154
154
 
155
+ /**
156
+ * @template {Function} T
157
+ * @param {T} func
158
+ * @returns {T}
159
+ */
160
+
161
+ var nullSafe = function nullSafe(func) {
162
+ return (// @ts-ignore
163
+ ramda.curryN(func.length, function () {
164
+ var _ref;
165
+
166
+ var dataArg = (_ref = func.length - 1, _ref < 0 || arguments.length <= _ref ? undefined : arguments[_ref]);
167
+ return ramda.isNil(dataArg) ? dataArg : func.apply(void 0, arguments);
168
+ })
169
+ );
170
+ };
171
+ var noop$2 = function noop() {};
172
+ var isNotEmpty = /*#__PURE__*/ramda.complement(ramda.isEmpty);
173
+
174
+ var slugify = function slugify(string) {
175
+ return string.toString().toLowerCase().replace(/\s+/g, "-") // Replace spaces with -
176
+ .replace(/&/g, "-and-") // Replace & with 'and'
177
+ .replace(/[^\w-]+/g, "") // Remove all non-word characters
178
+ .replace(/--+/g, "-") // Replace multiple - with single -
179
+ .replace(/^-+/, "") // Trim - from start of text
180
+ .replace(/-+$/, "");
181
+ }; // Trim - from end of text
182
+
183
+ var humanize = function humanize(string) {
184
+ string = string.replace(/[_-]+/g, " ").replace(/\s{2,}/g, " ").replace(/([a-z\d])([A-Z])/g, "$1" + " " + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + " " + "$2").toLowerCase().trim();
185
+ string = string.charAt(0).toUpperCase() + string.slice(1);
186
+ return string;
187
+ };
188
+ var snakeToCamelCase = function snakeToCamelCase(string) {
189
+ return string.replace(/(_\w)/g, function (letter) {
190
+ return letter[1].toUpperCase();
191
+ });
192
+ };
193
+ var camelToSnakeCase = function camelToSnakeCase(string) {
194
+ return string.replace(/[A-Z]/g, function (letter) {
195
+ return "_".concat(letter.toLowerCase());
196
+ });
197
+ };
155
198
  var capitalize = function capitalize(string) {
156
199
  return string.charAt(0).toUpperCase() + string.slice(1);
157
200
  };
201
+ nullSafe(slugify);
202
+ nullSafe(humanize);
203
+ nullSafe(snakeToCamelCase);
204
+ nullSafe(camelToSnakeCase);
205
+ nullSafe(capitalize);
158
206
 
159
207
  var matchesImpl = function matchesImpl(pattern, object) {
160
208
  var __parent = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : object;
@@ -174,6 +222,21 @@ var matchesImpl = function matchesImpl(pattern, object) {
174
222
  var matches = /*#__PURE__*/ramda.curry(function (pattern, object) {
175
223
  return matchesImpl(pattern, object);
176
224
  });
225
+ var filterNonNull = function filterNonNull(object) {
226
+ return Object.fromEntries(Object.entries(object).filter(function (_ref5) {
227
+ var _ref6 = _slicedToArray(_ref5, 2),
228
+ v = _ref6[1];
229
+
230
+ return !ramda.isNil(v);
231
+ }).map(function (_ref7) {
232
+ var _ref8 = _slicedToArray(_ref7, 2),
233
+ k = _ref8[0],
234
+ v = _ref8[1];
235
+
236
+ return [k, _typeof$3(v) === "object" && !Array.isArray(v) ? filterNonNull(v) : v];
237
+ }));
238
+ };
239
+ nullSafe(filterNonNull);
177
240
 
178
241
  function _defineProperty$1(obj, key, value) {
179
242
  if (key in obj) {
@@ -194,9 +257,6 @@ var removeBy = /*#__PURE__*/ramda.curry(function (pattern, array) {
194
257
  return array.filter(ramda.complement(matches(pattern)));
195
258
  });
196
259
 
197
- var noop$2 = function noop() {};
198
- var isNotEmpty = /*#__PURE__*/ramda.complement(ramda.isEmpty);
199
-
200
260
  var getStorageValue = function getStorageValue(key, defaultValue) {
201
261
  var saved = localStorage.getItem(key);
202
262
  return JSON.parse(saved) || defaultValue;
@@ -51486,7 +51546,7 @@ var languageLoaders = {
51486
51546
  return Promise.resolve().then(function () { return agda$1; });
51487
51547
  }),
51488
51548
  al: createLanguageAsyncLoader("al", function () {
51489
- return Promise.resolve().then(function () { return al; });
51549
+ return Promise.resolve().then(function () { return al$1; });
51490
51550
  }),
51491
51551
  antlr4: createLanguageAsyncLoader("antlr4", function () {
51492
51552
  return Promise.resolve().then(function () { return antlr4$1; });
@@ -51498,7 +51558,7 @@ var languageLoaders = {
51498
51558
  return Promise.resolve().then(function () { return apex$1; });
51499
51559
  }),
51500
51560
  apl: createLanguageAsyncLoader("apl", function () {
51501
- return Promise.resolve().then(function () { return apl$1; });
51561
+ return Promise.resolve().then(function () { return apl; });
51502
51562
  }),
51503
51563
  applescript: createLanguageAsyncLoader("applescript", function () {
51504
51564
  return Promise.resolve().then(function () { return applescript$2; });
@@ -61006,47 +61066,43 @@ var agda$1 = /*#__PURE__*/_mergeNamespaces({
61006
61066
  'default': agda_1
61007
61067
  }, [agda_1]);
61008
61068
 
61009
- var al_1;
61010
- var hasRequiredAl;
61011
-
61012
- function requireAl () {
61013
- if (hasRequiredAl) return al_1;
61014
- hasRequiredAl = 1;
61015
-
61016
- al_1 = al;
61017
- al.displayName = 'al';
61018
- al.aliases = [];
61019
- function al(Prism) {
61020
- // based on https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage
61021
- Prism.languages.al = {
61022
- comment: /\/\/.*|\/\*[\s\S]*?\*\//,
61023
- string: {
61024
- pattern: /'(?:''|[^'\r\n])*'(?!')|"(?:""|[^"\r\n])*"(?!")/,
61025
- greedy: true
61026
- },
61027
- function: {
61028
- pattern:
61029
- /(\b(?:event|procedure|trigger)\s+|(?:^|[^.])\.\s*)[a-z_]\w*(?=\s*\()/i,
61030
- lookbehind: true
61031
- },
61032
- keyword: [
61033
- // keywords
61034
- /\b(?:array|asserterror|begin|break|case|do|downto|else|end|event|exit|for|foreach|function|if|implements|in|indataset|interface|internal|local|of|procedure|program|protected|repeat|runonclient|securityfiltering|suppressdispose|temporary|then|to|trigger|until|var|while|with|withevents)\b/i, // objects and metadata that are used like keywords
61035
- /\b(?:action|actions|addafter|addbefore|addfirst|addlast|area|assembly|chartpart|codeunit|column|controladdin|cuegroup|customizes|dataitem|dataset|dotnet|elements|enum|enumextension|extends|field|fieldattribute|fieldelement|fieldgroup|fieldgroups|fields|filter|fixed|grid|group|key|keys|label|labels|layout|modify|moveafter|movebefore|movefirst|movelast|page|pagecustomization|pageextension|part|profile|query|repeater|report|requestpage|schema|separator|systempart|table|tableelement|tableextension|textattribute|textelement|type|usercontrol|value|xmlport)\b/i
61036
- ],
61037
- number:
61038
- /\b(?:0x[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(?:F|LL?|U(?:LL?)?)?\b/i,
61039
- boolean: /\b(?:false|true)\b/i,
61040
- variable: /\b(?:Curr(?:FieldNo|Page|Report)|x?Rec|RequestOptionsPage)\b/,
61041
- 'class-name':
61042
- /\b(?:automation|biginteger|bigtext|blob|boolean|byte|char|clienttype|code|completiontriggererrorlevel|connectiontype|database|dataclassification|datascope|date|dateformula|datetime|decimal|defaultlayout|dialog|dictionary|dotnetassembly|dotnettypedeclaration|duration|errorinfo|errortype|executioncontext|executionmode|fieldclass|fieldref|fieldtype|file|filterpagebuilder|guid|httpclient|httpcontent|httpheaders|httprequestmessage|httpresponsemessage|instream|integer|joker|jsonarray|jsonobject|jsontoken|jsonvalue|keyref|list|moduledependencyinfo|moduleinfo|none|notification|notificationscope|objecttype|option|outstream|pageresult|record|recordid|recordref|reportformat|securityfilter|sessionsettings|tableconnectiontype|tablefilter|testaction|testfield|testfilterfield|testpage|testpermissions|testrequestpage|text|textbuilder|textconst|textencoding|time|transactionmodel|transactiontype|variant|verbosity|version|view|views|webserviceactioncontext|webserviceactionresultcode|xmlattribute|xmlattributecollection|xmlcdata|xmlcomment|xmldeclaration|xmldocument|xmldocumenttype|xmlelement|xmlnamespacemanager|xmlnametable|xmlnode|xmlnodelist|xmlprocessinginstruction|xmlreadoptions|xmltext|xmlwriteoptions)\b/i,
61043
- operator: /\.\.|:[=:]|[-+*/]=?|<>|[<>]=?|=|\b(?:and|div|mod|not|or|xor)\b/i,
61044
- punctuation: /[()\[\]{}:.;,]/
61045
- };
61046
- }
61047
- return al_1;
61069
+ var al_1 = al;
61070
+ al.displayName = 'al';
61071
+ al.aliases = [];
61072
+ function al(Prism) {
61073
+ // based on https://github.com/microsoft/AL/blob/master/grammar/alsyntax.tmlanguage
61074
+ Prism.languages.al = {
61075
+ comment: /\/\/.*|\/\*[\s\S]*?\*\//,
61076
+ string: {
61077
+ pattern: /'(?:''|[^'\r\n])*'(?!')|"(?:""|[^"\r\n])*"(?!")/,
61078
+ greedy: true
61079
+ },
61080
+ function: {
61081
+ pattern:
61082
+ /(\b(?:event|procedure|trigger)\s+|(?:^|[^.])\.\s*)[a-z_]\w*(?=\s*\()/i,
61083
+ lookbehind: true
61084
+ },
61085
+ keyword: [
61086
+ // keywords
61087
+ /\b(?:array|asserterror|begin|break|case|do|downto|else|end|event|exit|for|foreach|function|if|implements|in|indataset|interface|internal|local|of|procedure|program|protected|repeat|runonclient|securityfiltering|suppressdispose|temporary|then|to|trigger|until|var|while|with|withevents)\b/i, // objects and metadata that are used like keywords
61088
+ /\b(?:action|actions|addafter|addbefore|addfirst|addlast|area|assembly|chartpart|codeunit|column|controladdin|cuegroup|customizes|dataitem|dataset|dotnet|elements|enum|enumextension|extends|field|fieldattribute|fieldelement|fieldgroup|fieldgroups|fields|filter|fixed|grid|group|key|keys|label|labels|layout|modify|moveafter|movebefore|movefirst|movelast|page|pagecustomization|pageextension|part|profile|query|repeater|report|requestpage|schema|separator|systempart|table|tableelement|tableextension|textattribute|textelement|type|usercontrol|value|xmlport)\b/i
61089
+ ],
61090
+ number:
61091
+ /\b(?:0x[\da-f]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?)(?:F|LL?|U(?:LL?)?)?\b/i,
61092
+ boolean: /\b(?:false|true)\b/i,
61093
+ variable: /\b(?:Curr(?:FieldNo|Page|Report)|x?Rec|RequestOptionsPage)\b/,
61094
+ 'class-name':
61095
+ /\b(?:automation|biginteger|bigtext|blob|boolean|byte|char|clienttype|code|completiontriggererrorlevel|connectiontype|database|dataclassification|datascope|date|dateformula|datetime|decimal|defaultlayout|dialog|dictionary|dotnetassembly|dotnettypedeclaration|duration|errorinfo|errortype|executioncontext|executionmode|fieldclass|fieldref|fieldtype|file|filterpagebuilder|guid|httpclient|httpcontent|httpheaders|httprequestmessage|httpresponsemessage|instream|integer|joker|jsonarray|jsonobject|jsontoken|jsonvalue|keyref|list|moduledependencyinfo|moduleinfo|none|notification|notificationscope|objecttype|option|outstream|pageresult|record|recordid|recordref|reportformat|securityfilter|sessionsettings|tableconnectiontype|tablefilter|testaction|testfield|testfilterfield|testpage|testpermissions|testrequestpage|text|textbuilder|textconst|textencoding|time|transactionmodel|transactiontype|variant|verbosity|version|view|views|webserviceactioncontext|webserviceactionresultcode|xmlattribute|xmlattributecollection|xmlcdata|xmlcomment|xmldeclaration|xmldocument|xmldocumenttype|xmlelement|xmlnamespacemanager|xmlnametable|xmlnode|xmlnodelist|xmlprocessinginstruction|xmlreadoptions|xmltext|xmlwriteoptions)\b/i,
61096
+ operator: /\.\.|:[=:]|[-+*/]=?|<>|[<>]=?|=|\b(?:and|div|mod|not|or|xor)\b/i,
61097
+ punctuation: /[()\[\]{}:.;,]/
61098
+ };
61048
61099
  }
61049
61100
 
61101
+ var al$1 = /*#__PURE__*/_mergeNamespaces({
61102
+ __proto__: null,
61103
+ 'default': al_1
61104
+ }, [al_1]);
61105
+
61050
61106
  var antlr4_1 = antlr4;
61051
61107
  antlr4.displayName = 'antlr4';
61052
61108
  antlr4.aliases = ['g4'];
@@ -61319,49 +61375,53 @@ var apex$1 = /*#__PURE__*/_mergeNamespaces({
61319
61375
  'default': apex_1
61320
61376
  }, [apex_1]);
61321
61377
 
61322
- var apl_1 = apl;
61323
- apl.displayName = 'apl';
61324
- apl.aliases = [];
61325
- function apl(Prism) {
61326
- Prism.languages.apl = {
61327
- comment: /(?:⍝|#[! ]).*$/m,
61328
- string: {
61329
- pattern: /'(?:[^'\r\n]|'')*'/,
61330
- greedy: true
61331
- },
61332
- number:
61333
- /¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+)?|¯|∞))?/i,
61334
- statement: /:[A-Z][a-z][A-Za-z]*\b/,
61335
- 'system-function': {
61336
- pattern: /⎕[A-Z]+/i,
61337
- alias: 'function'
61338
- },
61339
- constant: /[⍬⌾#⎕⍞]/,
61340
- function: /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,
61341
- 'monadic-operator': {
61342
- pattern: /[\\\/⌿⍀¨⍨⌶&∥]/,
61343
- alias: 'operator'
61344
- },
61345
- 'dyadic-operator': {
61346
- pattern: /[.⍣⍠⍤∘⌸@⌺⍥]/,
61347
- alias: 'operator'
61348
- },
61349
- assignment: {
61350
- pattern: /←/,
61351
- alias: 'keyword'
61352
- },
61353
- punctuation: /[\[;\]()◇⋄]/,
61354
- dfn: {
61355
- pattern: /[{}⍺⍵⍶⍹∇⍫:]/,
61356
- alias: 'builtin'
61357
- }
61358
- };
61359
- }
61378
+ var apl_1;
61379
+ var hasRequiredApl;
61360
61380
 
61361
- var apl$1 = /*#__PURE__*/_mergeNamespaces({
61362
- __proto__: null,
61363
- 'default': apl_1
61364
- }, [apl_1]);
61381
+ function requireApl () {
61382
+ if (hasRequiredApl) return apl_1;
61383
+ hasRequiredApl = 1;
61384
+
61385
+ apl_1 = apl;
61386
+ apl.displayName = 'apl';
61387
+ apl.aliases = [];
61388
+ function apl(Prism) {
61389
+ Prism.languages.apl = {
61390
+ comment: /(?:⍝|#[! ]).*$/m,
61391
+ string: {
61392
+ pattern: /'(?:[^'\r\n]|'')*'/,
61393
+ greedy: true
61394
+ },
61395
+ number:
61396
+ /¯?(?:\d*\.?\b\d+(?:e[+¯]?\d+)?|¯|∞)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+)?|¯|∞))?/i,
61397
+ statement: /:[A-Z][a-z][A-Za-z]*\b/,
61398
+ 'system-function': {
61399
+ pattern: /⎕[A-Z]+/i,
61400
+ alias: 'function'
61401
+ },
61402
+ constant: /[⍬⌾#⎕⍞]/,
61403
+ function: /[-+×÷⌈⌊∣|⍳⍸?*⍟○!⌹<≤=>≥≠≡≢∊⍷∪∩~∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⊆⊇⌷⍋⍒⊤⊥⍕⍎⊣⊢⍁⍂≈⍯↗¤→]/,
61404
+ 'monadic-operator': {
61405
+ pattern: /[\\\/⌿⍀¨⍨⌶&∥]/,
61406
+ alias: 'operator'
61407
+ },
61408
+ 'dyadic-operator': {
61409
+ pattern: /[.⍣⍠⍤∘⌸@⌺⍥]/,
61410
+ alias: 'operator'
61411
+ },
61412
+ assignment: {
61413
+ pattern: /←/,
61414
+ alias: 'keyword'
61415
+ },
61416
+ punctuation: /[\[;\]()◇⋄]/,
61417
+ dfn: {
61418
+ pattern: /[{}⍺⍵⍶⍹∇⍫:]/,
61419
+ alias: 'builtin'
61420
+ }
61421
+ };
61422
+ }
61423
+ return apl_1;
61424
+ }
61365
61425
 
61366
61426
  var applescript_1 = applescript$1;
61367
61427
  applescript$1.displayName = 'applescript';
@@ -84085,11 +84145,11 @@ refractor.register(abnf_1);
84085
84145
  refractor.register(actionscript_1);
84086
84146
  refractor.register(ada_1);
84087
84147
  refractor.register(agda_1);
84088
- refractor.register(requireAl());
84148
+ refractor.register(al_1);
84089
84149
  refractor.register(antlr4_1);
84090
84150
  refractor.register(apacheconf_1);
84091
84151
  refractor.register(apex_1);
84092
- refractor.register(apl_1);
84152
+ refractor.register(requireApl());
84093
84153
  refractor.register(applescript_1);
84094
84154
  refractor.register(aql_1);
84095
84155
  refractor.register(arduino_1);
@@ -86388,6 +86448,33 @@ var createContext = function createContext(initialValue) {
86388
86448
  }), _ref3;
86389
86449
  };
86390
86450
 
86451
+ var setWithoutModifyingActions = function setWithoutModifyingActions(set) {
86452
+ return function (partial) {
86453
+ return set(function (previous) {
86454
+ if (typeof partial === "function") partial = partial(previous);
86455
+ var isOverwritingActions = ramda.toPairs(partial).some(function (_ref) {
86456
+ var _ref2 = _slicedToArray(_ref, 2),
86457
+ key = _ref2[0],
86458
+ value = _ref2[1];
86459
+
86460
+ return typeof (previous === null || previous === void 0 ? void 0 : previous[key]) === "function" && value !== previous[key];
86461
+ });
86462
+
86463
+ if (isOverwritingActions) {
86464
+ throw new Error("Actions should not be modified");
86465
+ }
86466
+
86467
+ return partial;
86468
+ }, false);
86469
+ };
86470
+ };
86471
+
86472
+ var withImmutableActions = function withImmutableActions(config) {
86473
+ return function (set, get, api) {
86474
+ return config(setWithoutModifyingActions(set), get, api);
86475
+ };
86476
+ };
86477
+
86391
86478
  var _path$1, _path2, _path3, _path4, _path5, _path6, _path7;
86392
86479
 
86393
86480
  function _extends$1() { _extends$1 = 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$1.apply(this, arguments); }
@@ -87985,12 +88072,12 @@ var zephir = /*#__PURE__*/_mergeNamespaces({
87985
88072
  'default': zephirExports
87986
88073
  }, [zephirExports]);
87987
88074
 
87988
- var alExports = requireAl();
88075
+ var aplExports = requireApl();
87989
88076
 
87990
- var al = /*#__PURE__*/_mergeNamespaces({
88077
+ var apl = /*#__PURE__*/_mergeNamespaces({
87991
88078
  __proto__: null,
87992
- 'default': alExports
87993
- }, [alExports]);
88079
+ 'default': aplExports
88080
+ }, [aplExports]);
87994
88081
 
87995
88082
  var avroIdlExports = requireAvroIdl();
87996
88083
 
@@ -89766,3 +89853,4 @@ exports.useLocalStorage = useLocalStorage;
89766
89853
  exports.useOnClickOutside = useOnClickOutside;
89767
89854
  exports.usePrevious = usePrevious;
89768
89855
  exports.useUpdateEffect = useUpdateEffect;
89856
+ exports.withImmutableActions = withImmutableActions;
package/react-utils.d.ts CHANGED
@@ -6,7 +6,7 @@ import {
6
6
  DropdownProps,
7
7
  InputProps,
8
8
  TooltipProps,
9
- TypographyProps
9
+ TypographyProps,
10
10
  } from "@bigbinary/neetoui";
11
11
  import { LinkType, NavLinkItemType } from "@bigbinary/neetoui/layouts";
12
12
  import { RouteProps } from "react-router-dom";
@@ -121,7 +121,7 @@ export interface ColumnsProps {
121
121
  actionBlock?: React.ReactNode;
122
122
  checkboxProps?: CheckboxProps;
123
123
  columnData: Object[];
124
- dropdownProps?: DropdownProps,
124
+ dropdownProps?: DropdownProps;
125
125
  fixedColumns?: string[];
126
126
  isSearchable?: boolean;
127
127
  localStorageKey: string;
@@ -129,3 +129,21 @@ export interface ColumnsProps {
129
129
  onChange: (columns: any[]) => any[];
130
130
  searchProps?: InputProps;
131
131
  }
132
+
133
+ type ZustandConfigType = (
134
+ set: (data: any) => void,
135
+ get: () => any,
136
+ api: any
137
+ ) => any;
138
+
139
+ export function withImmutableActions(
140
+ config: ZustandConfigType
141
+ ): ZustandConfigType;
142
+
143
+ export declare type ZustandStoreHook = {
144
+ (
145
+ selector: (state: any) => any,
146
+ comparator?: (a: any, b: any) => boolean
147
+ ): any;
148
+ (): any;
149
+ };