kui-utils 0.0.5 → 0.0.7

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/cjs/index.js CHANGED
@@ -2043,7 +2043,8 @@ function setCookie(name, value, options) {
2043
2043
  if (options === void 0) { options = {}; }
2044
2044
  var cookieOptions = __assign({ path: "/" }, options);
2045
2045
  var updatedCookie = "".concat(encodeURIComponent(name), "=").concat(encodeURIComponent(value));
2046
- ___default["default"].forIn(cookieOptions, function (val, key) {
2046
+ Object.keys(cookieOptions).forEach(function (key) {
2047
+ var val = cookieOptions[key];
2047
2048
  updatedCookie += "; ".concat(key);
2048
2049
  updatedCookie += "=".concat(val);
2049
2050
  });
@@ -2127,7 +2128,7 @@ var Paginator = /** @class */ (function () {
2127
2128
  }());
2128
2129
 
2129
2130
  var SortingFilter = /** @class */ (function () {
2130
- function SortingFilter() {
2131
+ function SortingFilter(orderBy, filterQuery) {
2131
2132
  var _this = this;
2132
2133
  this.updateSearchQuery = function (newQuery) {
2133
2134
  _this.searchQuery = newQuery;
@@ -2142,9 +2143,9 @@ var SortingFilter = /** @class */ (function () {
2142
2143
  _this.orderBy = orderBy;
2143
2144
  };
2144
2145
  this.searchQuery = "";
2145
- this.filterQuery = "";
2146
+ this.filterQuery = filterQuery || "";
2146
2147
  this.order = "asc";
2147
- this.orderBy = "";
2148
+ this.orderBy = orderBy || "";
2148
2149
  mobx.makeAutoObservable(this);
2149
2150
  }
2150
2151
  Object.defineProperty(SortingFilter.prototype, "searchParams", {
@@ -2158,7 +2159,11 @@ var SortingFilter = /** @class */ (function () {
2158
2159
  });
2159
2160
  Object.defineProperty(SortingFilter.prototype, "orderParams", {
2160
2161
  get: function () {
2161
- return this.orderBy ? "&ordering=".concat(this.orderBy) : "";
2162
+ if (this.orderBy) {
2163
+ var order = this.order === "desc" ? "-" : "";
2164
+ return "&ordering=".concat(order).concat(this.orderBy);
2165
+ }
2166
+ return "";
2162
2167
  },
2163
2168
  enumerable: false,
2164
2169
  configurable: true
@@ -2253,6 +2258,30 @@ var MultistepForm = /** @class */ (function () {
2253
2258
  return MultistepForm;
2254
2259
  }());
2255
2260
 
2261
+ var Editor = /** @class */ (function () {
2262
+ function Editor() {
2263
+ var _this = this;
2264
+ this.startEditing = function () {
2265
+ _this.isEditing = true;
2266
+ _this.blockToSendForm();
2267
+ };
2268
+ this.endEditing = function () {
2269
+ _this.isEditing = false;
2270
+ _this.blockToSendForm();
2271
+ };
2272
+ this.allowToSendForm = function () {
2273
+ _this.isAllowedToSendForm = true;
2274
+ };
2275
+ this.blockToSendForm = function () {
2276
+ _this.isAllowedToSendForm = false;
2277
+ };
2278
+ this.isEditing = false;
2279
+ this.isAllowedToSendForm = false;
2280
+ mobx.makeAutoObservable(this);
2281
+ }
2282
+ return Editor;
2283
+ }());
2284
+
2256
2285
  var phoneRegExp = /^((\\+[1-9]{1,4}[ \\-]*)|(\\([0-9]{2,3}\\)[ \\-]*)|([0-9]{2,4})[ \\-]*)*?[0-9]{3,4}?[ \\-]*[0-9]{3,4}?$/;
2257
2286
  var isValidWithMaskExp = /^[^_]+$/;
2258
2287
  var dateRegExp = /(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.](19|20)\d\d/;
@@ -2268,6 +2297,7 @@ var simplePasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{10,
2268
2297
  var mediumPasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{12,}$/;
2269
2298
  var strongPasswordRegExp = /^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*]).{14,}$/;
2270
2299
 
2300
+ exports.Editor = Editor;
2271
2301
  exports.Loader = Loader;
2272
2302
  exports.MultistepForm = MultistepForm;
2273
2303
  exports.Paginator = Paginator;