@bigbinary/neeto-fields-frontend 1.1.0 → 1.1.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/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import React, { useContext, useState, useRef, useEffect, useLayoutEffect, useMemo, useCallback, createContext, memo, useReducer } from 'react';
2
2
  import { Switch, TimePicker, DatePicker, Select, Input, Textarea, Typography, Pane, Label, Button as Button$1, Dropdown, NoData, Table, Spinner, Alert } from '@bigbinary/neetoui';
3
- import { toLabelAndValue, capitalize as capitalize$1, filterBy, findBy, isNotEmpty, humanize, countBy, existsBy, noop as noop$2 } from '@bigbinary/neeto-commons-frontend/pure';
4
- import { values, map, isNil, isNotNil, pluck, clone as clone$1, pipe, mergeAll, omit, prop, pick, isEmpty, assoc, any, not, head } from 'ramda';
3
+ import { toLabelAndValue, isNotEmpty, capitalize as capitalize$1, filterBy, findBy, humanize, countBy, existsBy, noop as noop$2 } from '@bigbinary/neeto-commons-frontend/pure';
4
+ import { values, map, isNotNil, isNil, pluck, clone as clone$1, pipe, mergeAll, omit, prop, pick, isEmpty, assoc, any, not, head } from 'ramda';
5
5
  import { useFormikContext, useField, FieldArray } from 'formik';
6
6
  import * as yup from 'yup';
7
7
  import { Check, Delete, MenuHorizontal, Reorder } from '@bigbinary/neeto-icons';
@@ -15,7 +15,7 @@ import { useQuery, useQueryClient, useMutation } from 'react-query';
15
15
  import axios from 'axios';
16
16
  import { buildUrl, getQueryParams } from '@bigbinary/neeto-commons-frontend/utils';
17
17
  import { handleMetaClick } from '@bigbinary/neeto-commons-frontend/react-utils';
18
- import { useHistory } from 'react-router-dom';
18
+ import { Link, useHistory } from 'react-router-dom';
19
19
  import TableWrapper from '@bigbinary/neeto-molecules/TableWrapper';
20
20
  import { unstable_batchedUpdates, createPortal } from 'react-dom';
21
21
  import classnames from 'classnames';
@@ -3714,8 +3714,8 @@ function transformOptions(options) {
3714
3714
  return options;
3715
3715
  }
3716
3716
 
3717
- function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3718
- function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$d(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3717
+ function ownKeys$e(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3718
+ function _objectSpread$e(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$e(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$e(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3719
3719
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
3720
3720
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
3721
3721
  function noop$1() {}
@@ -3775,9 +3775,9 @@ var I18n = function (_EventEmitter) {
3775
3775
  }
3776
3776
  }
3777
3777
  var defOpts = get();
3778
- this.options = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, defOpts), this.options), transformOptions(options));
3778
+ this.options = _objectSpread$e(_objectSpread$e(_objectSpread$e({}, defOpts), this.options), transformOptions(options));
3779
3779
  if (this.options.compatibilityAPI !== 'v1') {
3780
- this.options.interpolation = _objectSpread$d(_objectSpread$d({}, defOpts.interpolation), this.options.interpolation);
3780
+ this.options.interpolation = _objectSpread$e(_objectSpread$e({}, defOpts.interpolation), this.options.interpolation);
3781
3781
  }
3782
3782
  if (options.keySeparator !== undefined) {
3783
3783
  this.options.userDefinedKeySeparator = options.keySeparator;
@@ -4055,7 +4055,7 @@ var I18n = function (_EventEmitter) {
4055
4055
  }
4056
4056
  options = _this5.options.overloadTranslationOptionHandler([key, opts].concat(rest));
4057
4057
  } else {
4058
- options = _objectSpread$d({}, opts);
4058
+ options = _objectSpread$e({}, opts);
4059
4059
  }
4060
4060
  options.lng = options.lng || fixedT.lng;
4061
4061
  options.lngs = options.lngs || fixedT.lngs;
@@ -4182,7 +4182,7 @@ var I18n = function (_EventEmitter) {
4182
4182
  var _this8 = this;
4183
4183
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4184
4184
  var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : noop$1;
4185
- var mergedOptions = _objectSpread$d(_objectSpread$d(_objectSpread$d({}, this.options), options), {
4185
+ var mergedOptions = _objectSpread$e(_objectSpread$e(_objectSpread$e({}, this.options), options), {
4186
4186
  isClone: true
4187
4187
  });
4188
4188
  var clone = new I18n(mergedOptions);
@@ -4193,7 +4193,7 @@ var I18n = function (_EventEmitter) {
4193
4193
  membersToCopy.forEach(function (m) {
4194
4194
  clone[m] = _this8[m];
4195
4195
  });
4196
- clone.services = _objectSpread$d({}, this.services);
4196
+ clone.services = _objectSpread$e({}, this.services);
4197
4197
  clone.services.utils = {
4198
4198
  hasLoadedNamespace: clone.hasLoadedNamespace.bind(clone)
4199
4199
  };
@@ -4241,7 +4241,7 @@ instance.reloadResources;
4241
4241
  instance.use;
4242
4242
  instance.changeLanguage;
4243
4243
  instance.getFixedT;
4244
- var t = instance.t;
4244
+ var t$1 = instance.t;
4245
4245
  instance.exists;
4246
4246
  instance.setDefaultNamespace;
4247
4247
  instance.hasLoadedNamespace;
@@ -4632,9 +4632,79 @@ function getDefaultExportFromCjs (x) {
4632
4632
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
4633
4633
  }
4634
4634
 
4635
- function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4635
+ /**
4636
+ * This file automatically generated from `pre-publish.js`.
4637
+ * Do not manually edit.
4638
+ */
4636
4639
 
4637
- function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4640
+ var voidElements = {
4641
+ "area": true,
4642
+ "base": true,
4643
+ "br": true,
4644
+ "col": true,
4645
+ "embed": true,
4646
+ "hr": true,
4647
+ "img": true,
4648
+ "input": true,
4649
+ "link": true,
4650
+ "meta": true,
4651
+ "param": true,
4652
+ "source": true,
4653
+ "track": true,
4654
+ "wbr": true
4655
+ };
4656
+
4657
+ var e = /*@__PURE__*/getDefaultExportFromCjs(voidElements);
4658
+
4659
+ var t=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c={parse:function(e,t){t||(t={}),t.components||(t.components=s);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};
4660
+
4661
+ /**
4662
+ * Copyright (C) 2017-present by Andrea Giammarchi - @WebReflection
4663
+ *
4664
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
4665
+ * of this software and associated documentation files (the "Software"), to deal
4666
+ * in the Software without restriction, including without limitation the rights
4667
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
4668
+ * copies of the Software, and to permit persons to whom the Software is
4669
+ * furnished to do so, subject to the following conditions:
4670
+ *
4671
+ * The above copyright notice and this permission notice shall be included in
4672
+ * all copies or substantial portions of the Software.
4673
+ *
4674
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
4675
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
4676
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
4677
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
4678
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
4679
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
4680
+ * THE SOFTWARE.
4681
+ */
4682
+
4683
+ var replace = ''.replace;
4684
+ var es = /&(?:amp|#38|lt|#60|gt|#62|apos|#39|quot|#34);/g;
4685
+ var unes = {
4686
+ '&amp;': '&',
4687
+ '&#38;': '&',
4688
+ '&lt;': '<',
4689
+ '&#60;': '<',
4690
+ '&gt;': '>',
4691
+ '&#62;': '>',
4692
+ '&apos;': "'",
4693
+ '&#39;': "'",
4694
+ '&quot;': '"',
4695
+ '&#34;': '"'
4696
+ };
4697
+
4698
+ function unescape(un) {
4699
+ return replace.call(un, es, cape);
4700
+ }
4701
+ function cape(m) {
4702
+ return unes[m];
4703
+ }
4704
+
4705
+ function ownKeys$d(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4706
+
4707
+ function _objectSpread$d(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$d(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$d(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4638
4708
  var defaultOptions$1 = {
4639
4709
  bindI18n: 'languageChanged',
4640
4710
  bindI18nStore: '',
@@ -4648,7 +4718,7 @@ var i18nInstance;
4648
4718
  var I18nContext = React.createContext();
4649
4719
  function setDefaults() {
4650
4720
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
4651
- defaultOptions$1 = _objectSpread$c(_objectSpread$c({}, defaultOptions$1), options);
4721
+ defaultOptions$1 = _objectSpread$d(_objectSpread$d({}, defaultOptions$1), options);
4652
4722
  }
4653
4723
  function getDefaults() {
4654
4724
  return defaultOptions$1;
@@ -4772,6 +4842,274 @@ function hasLoadedNamespace(ns, i18n) {
4772
4842
  });
4773
4843
  }
4774
4844
 
4845
+ var _excluded$4 = ["format"],
4846
+ _excluded2 = ["children", "count", "parent", "i18nKey", "context", "tOptions", "values", "defaults", "components", "ns", "i18n", "t", "shouldUnescape"];
4847
+
4848
+ function ownKeys$c(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
4849
+
4850
+ function _objectSpread$c(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$c(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$c(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4851
+
4852
+ function hasChildren(node, checkLength) {
4853
+ if (!node) return false;
4854
+ var base = node.props ? node.props.children : node.children;
4855
+ if (checkLength) return base.length > 0;
4856
+ return !!base;
4857
+ }
4858
+
4859
+ function getChildren(node) {
4860
+ if (!node) return [];
4861
+ return node && node.children ? node.children : node.props && node.props.children;
4862
+ }
4863
+
4864
+ function hasValidReactChildren(children) {
4865
+ if (Object.prototype.toString.call(children) !== '[object Array]') return false;
4866
+ return children.every(function (child) {
4867
+ return React.isValidElement(child);
4868
+ });
4869
+ }
4870
+
4871
+ function getAsArray(data) {
4872
+ return Array.isArray(data) ? data : [data];
4873
+ }
4874
+
4875
+ function mergeProps(source, target) {
4876
+ var newTarget = _objectSpread$c({}, target);
4877
+
4878
+ newTarget.props = Object.assign(source.props, target.props);
4879
+ return newTarget;
4880
+ }
4881
+
4882
+ function nodesToString(children, i18nOptions) {
4883
+ if (!children) return '';
4884
+ var stringNode = '';
4885
+ var childrenArray = getAsArray(children);
4886
+ var keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
4887
+ childrenArray.forEach(function (child, childIndex) {
4888
+ if (typeof child === 'string') {
4889
+ stringNode += "".concat(child);
4890
+ } else if (React.isValidElement(child)) {
4891
+ var childPropsCount = Object.keys(child.props).length;
4892
+ var shouldKeepChild = keepArray.indexOf(child.type) > -1;
4893
+ var childChildren = child.props.children;
4894
+
4895
+ if (!childChildren && shouldKeepChild && childPropsCount === 0) {
4896
+ stringNode += "<".concat(child.type, "/>");
4897
+ } else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
4898
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
4899
+ } else if (child.props.i18nIsDynamicList) {
4900
+ stringNode += "<".concat(childIndex, "></").concat(childIndex, ">");
4901
+ } else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
4902
+ stringNode += "<".concat(child.type, ">").concat(childChildren, "</").concat(child.type, ">");
4903
+ } else {
4904
+ var content = nodesToString(childChildren, i18nOptions);
4905
+ stringNode += "<".concat(childIndex, ">").concat(content, "</").concat(childIndex, ">");
4906
+ }
4907
+ } else if (child === null) {
4908
+ warn("Trans: the passed in value is invalid - seems you passed in a null child.");
4909
+ } else if (_typeof$1(child) === 'object') {
4910
+ var format = child.format,
4911
+ clone = _objectWithoutProperties(child, _excluded$4);
4912
+
4913
+ var keys = Object.keys(clone);
4914
+
4915
+ if (keys.length === 1) {
4916
+ var value = format ? "".concat(keys[0], ", ").concat(format) : keys[0];
4917
+ stringNode += "{{".concat(value, "}}");
4918
+ } else {
4919
+ warn("react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.", child);
4920
+ }
4921
+ } else {
4922
+ warn("Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.", child);
4923
+ }
4924
+ });
4925
+ return stringNode;
4926
+ }
4927
+
4928
+ function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
4929
+ if (targetString === '') return [];
4930
+ var keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
4931
+ var emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
4932
+ if (!children && !emptyChildrenButNeedsHandling) return [targetString];
4933
+ var data = {};
4934
+
4935
+ function getData(childs) {
4936
+ var childrenArray = getAsArray(childs);
4937
+ childrenArray.forEach(function (child) {
4938
+ if (typeof child === 'string') return;
4939
+ if (hasChildren(child)) getData(getChildren(child));else if (_typeof$1(child) === 'object' && !React.isValidElement(child)) Object.assign(data, child);
4940
+ });
4941
+ }
4942
+
4943
+ getData(children);
4944
+ var ast = c.parse("<0>".concat(targetString, "</0>"));
4945
+
4946
+ var opts = _objectSpread$c(_objectSpread$c({}, data), combinedTOpts);
4947
+
4948
+ function renderInner(child, node, rootReactNode) {
4949
+ var childs = getChildren(child);
4950
+ var mappedChildren = mapAST(childs, node.children, rootReactNode);
4951
+ return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
4952
+ }
4953
+
4954
+ function pushTranslatedJSX(child, inner, mem, i, isVoid) {
4955
+ if (child.dummy) child.children = inner;
4956
+ mem.push(React.cloneElement(child, _objectSpread$c(_objectSpread$c({}, child.props), {}, {
4957
+ key: i
4958
+ }), isVoid ? undefined : inner));
4959
+ }
4960
+
4961
+ function mapAST(reactNode, astNode, rootReactNode) {
4962
+ var reactNodes = getAsArray(reactNode);
4963
+ var astNodes = getAsArray(astNode);
4964
+ return astNodes.reduce(function (mem, node, i) {
4965
+ var translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
4966
+
4967
+ if (node.type === 'tag') {
4968
+ var tmp = reactNodes[parseInt(node.name, 10)];
4969
+ if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
4970
+ if (!tmp) tmp = {};
4971
+ var child = Object.keys(node.attrs).length !== 0 ? mergeProps({
4972
+ props: node.attrs
4973
+ }, tmp) : tmp;
4974
+ var isElement = React.isValidElement(child);
4975
+ var isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
4976
+ var isEmptyTransWithHTML = emptyChildrenButNeedsHandling && _typeof$1(child) === 'object' && child.dummy && !isElement;
4977
+ var isKnownComponent = _typeof$1(children) === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
4978
+
4979
+ if (typeof child === 'string') {
4980
+ var value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
4981
+ mem.push(value);
4982
+ } else if (hasChildren(child) || isValidTranslationWithChildren) {
4983
+ var inner = renderInner(child, node, rootReactNode);
4984
+ pushTranslatedJSX(child, inner, mem, i);
4985
+ } else if (isEmptyTransWithHTML) {
4986
+ var _inner = mapAST(reactNodes, node.children, rootReactNode);
4987
+
4988
+ mem.push(React.cloneElement(child, _objectSpread$c(_objectSpread$c({}, child.props), {}, {
4989
+ key: i
4990
+ }), _inner));
4991
+ } else if (Number.isNaN(parseFloat(node.name))) {
4992
+ if (isKnownComponent) {
4993
+ var _inner2 = renderInner(child, node, rootReactNode);
4994
+
4995
+ pushTranslatedJSX(child, _inner2, mem, i, node.voidElement);
4996
+ } else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
4997
+ if (node.voidElement) {
4998
+ mem.push(React.createElement(node.name, {
4999
+ key: "".concat(node.name, "-").concat(i)
5000
+ }));
5001
+ } else {
5002
+ var _inner3 = mapAST(reactNodes, node.children, rootReactNode);
5003
+
5004
+ mem.push(React.createElement(node.name, {
5005
+ key: "".concat(node.name, "-").concat(i)
5006
+ }, _inner3));
5007
+ }
5008
+ } else if (node.voidElement) {
5009
+ mem.push("<".concat(node.name, " />"));
5010
+ } else {
5011
+ var _inner4 = mapAST(reactNodes, node.children, rootReactNode);
5012
+
5013
+ mem.push("<".concat(node.name, ">").concat(_inner4, "</").concat(node.name, ">"));
5014
+ }
5015
+ } else if (_typeof$1(child) === 'object' && !isElement) {
5016
+ var content = node.children[0] ? translationContent : null;
5017
+ if (content) mem.push(content);
5018
+ } else if (node.children.length === 1 && translationContent) {
5019
+ mem.push(React.cloneElement(child, _objectSpread$c(_objectSpread$c({}, child.props), {}, {
5020
+ key: i
5021
+ }), translationContent));
5022
+ } else {
5023
+ mem.push(React.cloneElement(child, _objectSpread$c(_objectSpread$c({}, child.props), {}, {
5024
+ key: i
5025
+ })));
5026
+ }
5027
+ } else if (node.type === 'text') {
5028
+ var wrapTextNodes = i18nOptions.transWrapTextNodes;
5029
+
5030
+ var _content = shouldUnescape ? unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
5031
+
5032
+ if (wrapTextNodes) {
5033
+ mem.push(React.createElement(wrapTextNodes, {
5034
+ key: "".concat(node.name, "-").concat(i)
5035
+ }, _content));
5036
+ } else {
5037
+ mem.push(_content);
5038
+ }
5039
+ }
5040
+
5041
+ return mem;
5042
+ }, []);
5043
+ }
5044
+
5045
+ var result = mapAST([{
5046
+ dummy: true,
5047
+ children: children || []
5048
+ }], ast, getAsArray(children || []));
5049
+ return getChildren(result[0]);
5050
+ }
5051
+
5052
+ function Trans(_ref) {
5053
+ var children = _ref.children,
5054
+ count = _ref.count,
5055
+ parent = _ref.parent,
5056
+ i18nKey = _ref.i18nKey,
5057
+ context = _ref.context,
5058
+ _ref$tOptions = _ref.tOptions,
5059
+ tOptions = _ref$tOptions === void 0 ? {} : _ref$tOptions,
5060
+ values = _ref.values,
5061
+ defaults = _ref.defaults,
5062
+ components = _ref.components,
5063
+ ns = _ref.ns,
5064
+ i18nFromProps = _ref.i18n,
5065
+ tFromProps = _ref.t,
5066
+ shouldUnescape = _ref.shouldUnescape,
5067
+ additionalProps = _objectWithoutProperties(_ref, _excluded2);
5068
+
5069
+ var _ref2 = useContext(I18nContext) || {},
5070
+ i18nFromContext = _ref2.i18n,
5071
+ defaultNSFromContext = _ref2.defaultNS;
5072
+
5073
+ var i18n = i18nFromProps || i18nFromContext || getI18n();
5074
+
5075
+ if (!i18n) {
5076
+ warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
5077
+ return children;
5078
+ }
5079
+
5080
+ var t = tFromProps || i18n.t.bind(i18n) || function (k) {
5081
+ return k;
5082
+ };
5083
+
5084
+ if (context) tOptions.context = context;
5085
+
5086
+ var reactI18nextOptions = _objectSpread$c(_objectSpread$c({}, getDefaults()), i18n.options && i18n.options.react);
5087
+
5088
+ var namespaces = ns || t.ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
5089
+ namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
5090
+ var defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
5091
+ var hashTransKey = reactI18nextOptions.hashTransKey;
5092
+ var key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
5093
+ var interpolationOverride = values ? tOptions.interpolation : {
5094
+ interpolation: _objectSpread$c(_objectSpread$c({}, tOptions.interpolation), {}, {
5095
+ prefix: '#$?',
5096
+ suffix: '?$#'
5097
+ })
5098
+ };
5099
+
5100
+ var combinedTOpts = _objectSpread$c(_objectSpread$c(_objectSpread$c(_objectSpread$c({}, tOptions), {}, {
5101
+ count: count
5102
+ }, values), interpolationOverride), {}, {
5103
+ defaultValue: defaultValue,
5104
+ ns: namespaces
5105
+ });
5106
+
5107
+ var translation = key ? t(key, combinedTOpts) : defaultValue;
5108
+ var content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
5109
+ var useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
5110
+ return useAsParent ? React.createElement(useAsParent, additionalProps, content) : content;
5111
+ }
5112
+
4775
5113
  function _iterableToArrayLimit(arr, i) {
4776
5114
  var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"];
4777
5115
  if (null != _i) {
@@ -4968,7 +5306,7 @@ var fields = {
4968
5306
  };
4969
5307
  var messages = {
4970
5308
  noFields: "There are no fields to show",
4971
- confirmDelete: "Are you sure want to delete the field ?. This action cannot be undone.",
5309
+ confirmDelete: "Are you sure want to delete the field? This action cannot be undone.",
4972
5310
  manageFieldFor: "Manage fields for {{resource}}",
4973
5311
  invalidKind: "Invalid kind",
4974
5312
  reorderFields: "Fields are displayed from top to bottom."
@@ -4989,6 +5327,9 @@ var validations = {
4989
5327
  var tooltips = {
4990
5328
  reorder: "Fields a are displayed from top to bottom. Re-order them"
4991
5329
  };
5330
+ var helpTexts = {
5331
+ noData: "Here is how you can use <a>fields.</a>"
5332
+ };
4992
5333
  var en = {
4993
5334
  common: common,
4994
5335
  titles: titles,
@@ -4997,7 +5338,8 @@ var en = {
4997
5338
  fields: fields,
4998
5339
  messages: messages,
4999
5340
  validations: validations,
5000
- tooltips: tooltips
5341
+ tooltips: tooltips,
5342
+ helpTexts: helpTexts
5001
5343
  };
5002
5344
 
5003
5345
  instance.use(Browser).use(initReactI18next).init({
@@ -5076,23 +5418,23 @@ var KINDS = {
5076
5418
  datetime: "datetime"
5077
5419
  };
5078
5420
  var DISPLAY_KINDS = {
5079
- text: t("fields.kinds.text"),
5080
- number: t("fields.kinds.number"),
5081
- monetary: t("fields.kinds.monetary"),
5082
- single_option: t("fields.kinds.singleOption"),
5083
- multi_option: t("fields.kinds.multiOption"),
5084
- date: t("fields.kinds.date"),
5085
- time: t("fields.kinds.time"),
5086
- date_range: t("fields.kinds.dateRange"),
5087
- time_range: t("fields.kinds.timeRange"),
5088
- textarea: t("fields.kinds.textarea"),
5089
- text_area: t("fields.kinds.textArea"),
5090
- person: t("fields.kinds.person"),
5091
- checkbox: t("fields.kinds.checkbox"),
5092
- regex: t("fields.kinds.regex"),
5093
- integer: t("fields.kinds.integer"),
5094
- decimal: t("fields.kinds.decimal"),
5095
- datetime: t("fields.kinds.datetime")
5421
+ text: t$1("fields.kinds.text"),
5422
+ number: t$1("fields.kinds.number"),
5423
+ monetary: t$1("fields.kinds.monetary"),
5424
+ single_option: t$1("fields.kinds.singleOption"),
5425
+ multi_option: t$1("fields.kinds.multiOption"),
5426
+ date: t$1("fields.kinds.date"),
5427
+ time: t$1("fields.kinds.time"),
5428
+ date_range: t$1("fields.kinds.dateRange"),
5429
+ time_range: t$1("fields.kinds.timeRange"),
5430
+ textarea: t$1("fields.kinds.textarea"),
5431
+ text_area: t$1("fields.kinds.textArea"),
5432
+ person: t$1("fields.kinds.person"),
5433
+ checkbox: t$1("fields.kinds.checkbox"),
5434
+ regex: t$1("fields.kinds.regex"),
5435
+ integer: t$1("fields.kinds.integer"),
5436
+ decimal: t$1("fields.kinds.decimal"),
5437
+ datetime: t$1("fields.kinds.datetime")
5096
5438
  };
5097
5439
  var FIELD_STATES = {
5098
5440
  active: "active",
@@ -5496,6 +5838,22 @@ var dayjs_minExports = dayjs_min.exports;
5496
5838
  var dayjs = /*@__PURE__*/getDefaultExportFromCjs(dayjs_minExports);
5497
5839
 
5498
5840
  var dateSchema = yup.date().nullable();
5841
+ var buildSchemaAllowingEmptyValue = function buildSchemaAllowingEmptyValue(schema) {
5842
+ return yup.mixed().test({
5843
+ name: "validate-if-not-empty",
5844
+ test: function test(value) {
5845
+ if (isNotEmpty(value) && isNotNil(value)) {
5846
+ try {
5847
+ schema.validateSync(value);
5848
+ return true;
5849
+ } catch (_unused) {
5850
+ return false;
5851
+ }
5852
+ }
5853
+ return true;
5854
+ }
5855
+ });
5856
+ };
5499
5857
  var buildFieldValidationSchema = function buildFieldValidationSchema(_ref) {
5500
5858
  var kind = _ref.kind,
5501
5859
  isRequired = _ref.isRequired,
@@ -5505,33 +5863,36 @@ var buildFieldValidationSchema = function buildFieldValidationSchema(_ref) {
5505
5863
  case KINDS.text:
5506
5864
  {
5507
5865
  var schema = yup.string().trim().nullable();
5508
- return isRequired ? schema.required(t("validations.thisIsRequired")) : schema;
5866
+ return isRequired ? schema.required(t$1("validations.thisIsRequired")) : schema;
5509
5867
  }
5510
5868
  case KINDS.number:
5511
5869
  case KINDS.monetary:
5512
5870
  case KINDS.decimal:
5513
5871
  {
5514
- var _schema = yup.number().nullable().typeError(t("validations.notAValidNumber"));
5515
- return isRequired ? _schema.required(t("validations.thisIsRequired")) : _schema;
5872
+ var _schema = buildSchemaAllowingEmptyValue(yup.number().typeError(t$1("validations.notAValidNumber")));
5873
+ return isRequired ? _schema.required(t$1("validations.thisIsRequired")) : _schema;
5516
5874
  }
5517
5875
  case KINDS.integer:
5518
5876
  {
5519
- var _schema2 = yup.number().nullable().integer().typeError(t("validations.notAValidInteger"));
5520
- return isRequired ? _schema2.required(t("validations.thisIsRequired")) : _schema2;
5877
+ var _schema2 = buildSchemaAllowingEmptyValue(yup.number().nullable().integer().typeError(t$1("validations.notAValidInteger")));
5878
+ return isRequired ? _schema2.required(t$1("validations.thisIsRequired")) : _schema2;
5521
5879
  }
5522
5880
  case KINDS.date:
5523
5881
  case KINDS.time:
5524
- return isRequired ? dateSchema.required(t("validations.thisIsRequired")) : dateSchema;
5882
+ {
5883
+ var _schema3 = buildSchemaAllowingEmptyValue(dateSchema);
5884
+ return isRequired ? _schema3.required(t$1("validations.thisIsRequired")) : _schema3;
5885
+ }
5525
5886
  case KINDS.multiOption:
5526
5887
  {
5527
- var _schema3 = yup.array().of(yup.string()).nullable();
5528
- return isRequired ? _schema3.min(1, t("validations.minOneItem")).required(t("validations.thisIsRequired")) : _schema3;
5888
+ var _schema4 = yup.array().of(yup.string()).nullable();
5889
+ return isRequired ? _schema4.min(1, t$1("validations.minOneItem")).required(t$1("validations.thisIsRequired")) : _schema4;
5529
5890
  }
5530
5891
  case KINDS.dateRange:
5531
5892
  case KINDS.timeRange:
5532
5893
  {
5533
5894
  if (isRequired) {
5534
- return yup.array().of(dateSchema).required(t("validations.thisIsRequired"));
5895
+ return yup.array().of(dateSchema).required(t$1("validations.thisIsRequired"));
5535
5896
  }
5536
5897
  return yup.array().of(dateSchema).nullable();
5537
5898
  }
@@ -5540,8 +5901,8 @@ var buildFieldValidationSchema = function buildFieldValidationSchema(_ref) {
5540
5901
  case KINDS.regex:
5541
5902
  {
5542
5903
  var regexPattern = fieldData === null || fieldData === void 0 ? void 0 : fieldData.condition;
5543
- var _schema4 = yup.string().nullable().matches(cleanedRegex(regexPattern), fieldData === null || fieldData === void 0 ? void 0 : fieldData.helpMessage);
5544
- return isRequired ? _schema4.required(t("validations.thisIsRequired")) : _schema4;
5904
+ var _schema5 = buildSchemaAllowingEmptyValue(yup.string().nullable().matches(cleanedRegex(regexPattern), fieldData === null || fieldData === void 0 ? void 0 : fieldData.helpMessage));
5905
+ return isRequired ? _schema5.required(t$1("validations.thisIsRequired")) : _schema5;
5545
5906
  }
5546
5907
  default:
5547
5908
  return yup.mixed();
@@ -5598,7 +5959,7 @@ var validateField = /*#__PURE__*/function () {
5598
5959
  };
5599
5960
  }();
5600
5961
  var dateTimeToString = function dateTimeToString(dateTime) {
5601
- return dayjs(dateTime).toString();
5962
+ return dateTime && dayjs(dateTime).toString() || "";
5602
5963
  };
5603
5964
 
5604
5965
  var _excluded$3 = ["name", "id", "kind", "data", "individualSubmit", "formRef", "formRefs", "disabled", "isRequiredColumnName"];
@@ -5655,7 +6016,7 @@ var useFormikFields = function useFormikFields(_ref) {
5655
6016
  } else if (kind === KINDS.multiOption) {
5656
6017
  value = buildArrayToLabelAndValues(value);
5657
6018
  }
5658
- return value;
6019
+ return value || "";
5659
6020
  };
5660
6021
  var isDropdown = ["single_option", "multi_option"].includes(kind);
5661
6022
  if (isSubmitting && !meta.touched) {
@@ -6162,7 +6523,7 @@ var renderFormFooter = function renderFormFooter(_ref3) {
6162
6523
  disabled: loading
6163
6524
  },
6164
6525
  submitButtonProps: {
6165
- label: t("labels.saveChanges"),
6526
+ label: t$1("labels.saveChanges"),
6166
6527
  className: "mr-2",
6167
6528
  type: "submit",
6168
6529
  disabled: !dirty,
@@ -6172,97 +6533,97 @@ var renderFormFooter = function renderFormFooter(_ref3) {
6172
6533
  };
6173
6534
 
6174
6535
  var regexValidationSchema = yup.object().shape({
6175
- condition: yup.string().required(t("validations.regexConditionIsRequired")),
6176
- helpMessage: yup.string().required(t("validations.regexHelpMessageIsRequired"))
6536
+ condition: yup.string().required(t$1("validations.regexConditionIsRequired")),
6537
+ helpMessage: yup.string().required(t$1("validations.regexHelpMessageIsRequired"))
6177
6538
  });
6178
6539
  var dropDownOptionsValidationSchema = yup.array().of(yup.object().shape({
6179
- label: yup.string().trim().required(t("validations.fieldOptionIsRequired")),
6540
+ label: yup.string().trim().required(t$1("validations.fieldOptionIsRequired")),
6180
6541
  displayOrder: yup.number()
6181
- })).min(1, t("validations.atLeastFieldOptionIsRequired"));
6542
+ })).min(1, t$1("validations.atLeastFieldOptionIsRequired"));
6182
6543
  var FIELD_KINDS = {
6183
6544
  text: {
6184
6545
  value: "text",
6185
- label: t("fields.kinds.text"),
6546
+ label: t$1("fields.kinds.text"),
6186
6547
  group: 1
6187
6548
  },
6188
6549
  number: {
6189
6550
  value: "number",
6190
- label: t("fields.kinds.number"),
6551
+ label: t$1("fields.kinds.number"),
6191
6552
  group: 2
6192
6553
  },
6193
6554
  monetary: {
6194
6555
  value: "monetary",
6195
- label: t("fields.kinds.monetary"),
6556
+ label: t$1("fields.kinds.monetary"),
6196
6557
  group: 2
6197
6558
  },
6198
6559
  single_option: {
6199
6560
  value: "single_option",
6200
- label: t("fields.kinds.singleOption"),
6561
+ label: t$1("fields.kinds.singleOption"),
6201
6562
  group: 3
6202
6563
  },
6203
6564
  multi_option: {
6204
6565
  value: "multi_option",
6205
- label: t("fields.kinds.multiOption"),
6566
+ label: t$1("fields.kinds.multiOption"),
6206
6567
  group: 3
6207
6568
  },
6208
6569
  date: {
6209
6570
  value: "date",
6210
- label: t("fields.kinds.date"),
6571
+ label: t$1("fields.kinds.date"),
6211
6572
  group: 4
6212
6573
  },
6213
6574
  time: {
6214
6575
  value: "time",
6215
- label: t("fields.kinds.time"),
6576
+ label: t$1("fields.kinds.time"),
6216
6577
  group: 5
6217
6578
  },
6218
6579
  date_range: {
6219
6580
  value: "date_range",
6220
- label: t("fields.kinds.dateRange"),
6581
+ label: t$1("fields.kinds.dateRange"),
6221
6582
  group: 6
6222
6583
  },
6223
6584
  time_range: {
6224
6585
  value: "time_range",
6225
- label: t("fields.kinds.timeRange"),
6586
+ label: t$1("fields.kinds.timeRange"),
6226
6587
  group: 7
6227
6588
  },
6228
6589
  text_area: {
6229
6590
  value: "text_area",
6230
- label: t("fields.kinds.textArea"),
6591
+ label: t$1("fields.kinds.textArea"),
6231
6592
  group: 1
6232
6593
  },
6233
6594
  textarea: {
6234
6595
  value: "textarea",
6235
- label: t("fields.kinds.textarea"),
6596
+ label: t$1("fields.kinds.textarea"),
6236
6597
  group: 1
6237
6598
  },
6238
6599
  person: {
6239
6600
  value: "person",
6240
- label: t("fields.kinds.person"),
6601
+ label: t$1("fields.kinds.person"),
6241
6602
  group: 8
6242
6603
  },
6243
6604
  checkbox: {
6244
6605
  value: "checkbox",
6245
- label: t("fields.kinds.checkbox"),
6606
+ label: t$1("fields.kinds.checkbox"),
6246
6607
  group: 9
6247
6608
  },
6248
6609
  regex: {
6249
6610
  value: "regex",
6250
- label: t("fields.kinds.regex"),
6611
+ label: t$1("fields.kinds.regex"),
6251
6612
  group: 10
6252
6613
  },
6253
6614
  integer: {
6254
6615
  value: "integer",
6255
- label: t("fields.kinds.integer"),
6616
+ label: t$1("fields.kinds.integer"),
6256
6617
  group: 2
6257
6618
  },
6258
6619
  decimal: {
6259
6620
  value: "decimal",
6260
- label: t("fields.kinds.decimal"),
6621
+ label: t$1("fields.kinds.decimal"),
6261
6622
  group: 2
6262
6623
  },
6263
6624
  datetime: {
6264
6625
  value: "datetime",
6265
- label: t("fields.kinds.datetime"),
6626
+ label: t$1("fields.kinds.datetime"),
6266
6627
  group: 11
6267
6628
  }
6268
6629
  };
@@ -6282,11 +6643,11 @@ var DEFAULT_REGEX_DATA = {
6282
6643
  helpMessage: ""
6283
6644
  };
6284
6645
  var BASIC_FIELD_FORM_VALIDATIONS = {
6285
- name: yup.string().trim().required(t("validations.fieldNameIsRequired")),
6646
+ name: yup.string().trim().required(t$1("validations.fieldNameIsRequired")),
6286
6647
  isRequired: yup["boolean"](),
6287
6648
  kind: yup.object().shape({
6288
6649
  value: yup.string().required()
6289
- }).required(t("validations.kindIsRequired")),
6650
+ }).required(t$1("validations.kindIsRequired")),
6290
6651
  data: yup.mixed().when("kind", {
6291
6652
  is: function is(kind) {
6292
6653
  return isRegex(kind === null || kind === void 0 ? void 0 : kind.value);
@@ -6578,7 +6939,7 @@ var buildDefaultColumns = function buildDefaultColumns(_ref) {
6578
6939
  return [{
6579
6940
  key: "name",
6580
6941
  dataIndex: "name",
6581
- title: t("titles.name"),
6942
+ title: t$1("titles.name"),
6582
6943
  render: function render(name, field) {
6583
6944
  return /*#__PURE__*/React.createElement("div", {
6584
6945
  className: "flex items-center justify-between gap-x-3"
@@ -6595,25 +6956,25 @@ var buildDefaultColumns = function buildDefaultColumns(_ref) {
6595
6956
  onClick: function onClick() {
6596
6957
  return onEditClick(field);
6597
6958
  }
6598
- }, t("labels.edit")), !field.isSystem && /*#__PURE__*/React.createElement(MenuItem.Button, {
6959
+ }, t$1("labels.edit")), !field.isSystem && /*#__PURE__*/React.createElement(MenuItem.Button, {
6599
6960
  onClick: function onClick() {
6600
6961
  return onDeleteClick(field);
6601
6962
  }
6602
- }, t("labels.delete")))));
6963
+ }, t$1("labels.delete")))));
6603
6964
  }
6604
6965
  }, {
6605
6966
  key: "kind",
6606
6967
  dataIndex: "kind",
6607
- title: t("titles.kind"),
6968
+ title: t$1("titles.kind"),
6608
6969
  render: function render(kind) {
6609
6970
  return DISPLAY_KINDS[kind];
6610
6971
  }
6611
6972
  }, {
6612
6973
  key: "isRequired",
6613
6974
  dataIndex: "isRequired",
6614
- title: t("titles.required"),
6975
+ title: t$1("titles.required"),
6615
6976
  render: function render(boolVal) {
6616
- return boolVal ? t("common.yes") : t("common.no");
6977
+ return boolVal ? t$1("common.yes") : t$1("common.no");
6617
6978
  }
6618
6979
  }];
6619
6980
  };
@@ -6621,14 +6982,15 @@ var renderMenuBarItems = function renderMenuBarItems(_ref2) {
6621
6982
  var items = _ref2.items,
6622
6983
  isOwnerBased = _ref2.isOwnerBased,
6623
6984
  selectedMenu = _ref2.selectedMenu,
6624
- handleBlockClick = _ref2.handleBlockClick;
6985
+ handleBlockClick = _ref2.handleBlockClick,
6986
+ nameAliases = _ref2.nameAliases;
6625
6987
  if (isOwnerBased) {
6626
6988
  return items.map(function (item) {
6627
6989
  return /*#__PURE__*/React.createElement(MenuBar.Item, {
6628
6990
  active: selectedMenu === item.id,
6629
6991
  key: item.id,
6630
6992
  label: humanize(item.name),
6631
- description: t("messages.manageFieldFor", {
6993
+ description: t$1("messages.manageFieldFor", {
6632
6994
  resource: humanize(item.name).toLocaleLowerCase()
6633
6995
  }),
6634
6996
  onClick: handleBlockClick({
@@ -6641,8 +7003,8 @@ var renderMenuBarItems = function renderMenuBarItems(_ref2) {
6641
7003
  return /*#__PURE__*/React.createElement(MenuBar.Item, {
6642
7004
  active: selectedMenu === item,
6643
7005
  key: item,
6644
- label: humanize(item),
6645
- description: t("messages.manageFieldFor", {
7006
+ label: nameAliases[item] || humanize(item),
7007
+ description: t$1("messages.manageFieldFor", {
6646
7008
  resource: humanize(item).toLocaleLowerCase()
6647
7009
  }),
6648
7010
  onClick: handleBlockClick({
@@ -6661,7 +7023,7 @@ var renderMenuBarFilters = function renderMenuBarFilters(_ref3) {
6661
7023
  style: "h5",
6662
7024
  textTransform: "uppercase",
6663
7025
  weight: "bold"
6664
- }, t("titles.filters"))), /*#__PURE__*/React.createElement(MenuBar.Block, {
7026
+ }, t$1("titles.filters"))), /*#__PURE__*/React.createElement(MenuBar.Block, {
6665
7027
  active: selectedState === FIELD_STATES.active,
6666
7028
  count: activeFieldsCount,
6667
7029
  label: fieldStatesTaxonomy.active,
@@ -6681,11 +7043,26 @@ var getDashBoardTitle = function getDashBoardTitle(_ref4) {
6681
7043
  var _findBy;
6682
7044
  var isOwnerBased = _ref4.isOwnerBased,
6683
7045
  owners = _ref4.owners,
6684
- selectedVal = _ref4.selectedVal;
6685
- return t("messages.manageFieldFor", {
7046
+ selectedVal = _ref4.selectedVal,
7047
+ nameAliases = _ref4.nameAliases;
7048
+ return t$1("messages.manageFieldFor", {
6686
7049
  resource: isOwnerBased ? (_findBy = findBy({
6687
7050
  id: selectedVal
6688
- }, owners)) === null || _findBy === void 0 ? void 0 : _findBy.name : selectedVal
7051
+ }, owners)) === null || _findBy === void 0 ? void 0 : _findBy.name : nameAliases[selectedVal] || selectedVal
7052
+ });
7053
+ };
7054
+ var renderNoDataHelpText = function renderNoDataHelpText(url) {
7055
+ return /*#__PURE__*/React.createElement(Trans, {
7056
+ i18nKey: "helpTexts.noData",
7057
+ components: {
7058
+ a: /*#__PURE__*/React.createElement(Link, {
7059
+ className: "neeto-ui-text-primary-600 underline",
7060
+ target: "_blank",
7061
+ to: {
7062
+ pathname: url
7063
+ }
7064
+ })
7065
+ }
6689
7066
  });
6690
7067
  };
6691
7068
 
@@ -6867,13 +7244,16 @@ var FieldsTable = function FieldsTable(_ref) {
6867
7244
  isLoading = _ref.isLoading,
6868
7245
  rowData = _ref.rowData,
6869
7246
  columnData = _ref.columnData,
6870
- setIsPaneOpen = _ref.setIsPaneOpen;
7247
+ setIsPaneOpen = _ref.setIsPaneOpen,
7248
+ helpDocUrl = _ref.helpDocUrl;
6871
7249
  var _useTranslation = useTranslation(),
6872
7250
  t = _useTranslation.t;
6873
7251
  var showNoDataScreen = !isLoading && isEmpty(rowData);
6874
7252
  return /*#__PURE__*/React.createElement(TableWrapper, null, showNoDataScreen ? /*#__PURE__*/React.createElement("div", {
6875
7253
  className: "flex h-full w-full items-center justify-center"
6876
- }, /*#__PURE__*/React.createElement(NoData, {
7254
+ }, /*#__PURE__*/React.createElement(NoData, _extends({}, helpDocUrl && {
7255
+ helpText: renderNoDataHelpText(helpDocUrl)
7256
+ }, {
6877
7257
  title: t("messages.noFields"),
6878
7258
  primaryButtonProps: {
6879
7259
  label: t("labels.addField"),
@@ -6881,7 +7261,7 @@ var FieldsTable = function FieldsTable(_ref) {
6881
7261
  return setIsPaneOpen(true);
6882
7262
  }
6883
7263
  }
6884
- })) : /*#__PURE__*/React.createElement(Table, {
7264
+ }))) : /*#__PURE__*/React.createElement(Table, {
6885
7265
  fixedHeight: true,
6886
7266
  allowRowClick: false,
6887
7267
  columnData: columnData,
@@ -11263,7 +11643,10 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
11263
11643
  _ref$showStateFilter = _ref.showStateFilter,
11264
11644
  showStateFilter = _ref$showStateFilter === void 0 ? true : _ref$showStateFilter,
11265
11645
  _ref$fieldStatesTaxon = _ref.fieldStatesTaxonomy,
11266
- fieldStatesTaxonomy = _ref$fieldStatesTaxon === void 0 ? DEFAULT_FIELD_STATE_TAXONOMY : _ref$fieldStatesTaxon;
11646
+ fieldStatesTaxonomy = _ref$fieldStatesTaxon === void 0 ? DEFAULT_FIELD_STATE_TAXONOMY : _ref$fieldStatesTaxon,
11647
+ helpDocUrl = _ref.helpDocUrl,
11648
+ _ref$nameAliases = _ref.nameAliases,
11649
+ nameAliases = _ref$nameAliases === void 0 ? {} : _ref$nameAliases;
11267
11650
  var _useTranslation = useTranslation(),
11268
11651
  t = _useTranslation.t;
11269
11652
  var _useFieldsDashboard = useFieldsDashboard({
@@ -11298,7 +11681,8 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
11298
11681
  handleClosePane = _useFieldsDashboard.handleClosePane,
11299
11682
  handleReorderPaneClose = _useFieldsDashboard.handleReorderPaneClose,
11300
11683
  handleBlockClick = _useFieldsDashboard.handleBlockClick;
11301
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MenuBar, {
11684
+ var isMenuBarNeeded = showStateFilter || menuItems.length > 1;
11685
+ return /*#__PURE__*/React.createElement(React.Fragment, null, isMenuBarNeeded && /*#__PURE__*/React.createElement(MenuBar, {
11302
11686
  showMenu: isMenuBarOpen,
11303
11687
  title: t("titles.field", PLURAL)
11304
11688
  }, isConfigsLoading ? /*#__PURE__*/React.createElement("div", {
@@ -11307,7 +11691,8 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
11307
11691
  isOwnerBased: showOwnersInMenu,
11308
11692
  items: menuItems,
11309
11693
  selectedMenu: selectedMenu,
11310
- handleBlockClick: handleBlockClick
11694
+ handleBlockClick: handleBlockClick,
11695
+ nameAliases: nameAliases
11311
11696
  }), showStateFilter && renderMenuBarFilters({
11312
11697
  selectedState: selectedState,
11313
11698
  fieldStatesTaxonomy: fieldStatesTaxonomy,
@@ -11316,11 +11701,13 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
11316
11701
  handleBlockClick: handleBlockClick
11317
11702
  })), isScreenLoading ? /*#__PURE__*/React.createElement("div", {
11318
11703
  className: "flex w-full flex-grow items-center justify-center"
11319
- }, /*#__PURE__*/React.createElement(PageLoader, null)) : /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, {
11320
- breadcrumbs: breadcrumbs,
11704
+ }, /*#__PURE__*/React.createElement(PageLoader, null)) : /*#__PURE__*/React.createElement(Container, null, /*#__PURE__*/React.createElement(Header, _extends({
11705
+ breadcrumbs: breadcrumbs
11706
+ }, isMenuBarNeeded && {
11321
11707
  menuBarToggle: function menuBarToggle() {
11322
11708
  return setIsMenuBarOpen(not);
11323
- },
11709
+ }
11710
+ }, {
11324
11711
  actionBlock: /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Button$1, {
11325
11712
  label: t("labels.reorder"),
11326
11713
  style: "secondary",
@@ -11352,15 +11739,17 @@ var FieldsDashboard = function FieldsDashboard(_ref) {
11352
11739
  title: humanize(getDashBoardTitle({
11353
11740
  isOwnerBased: showOwnersInMenu,
11354
11741
  owners: owners,
11355
- selectedVal: selectedMenu
11742
+ selectedVal: selectedMenu,
11743
+ nameAliases: nameAliases
11356
11744
  }))
11357
- }), showCountSubheader && /*#__PURE__*/React.createElement(SubHeader, {
11745
+ })), showCountSubheader && /*#__PURE__*/React.createElement(SubHeader, {
11358
11746
  leftActionBlock: /*#__PURE__*/React.createElement(Typography, {
11359
11747
  className: "mr-4 font-semibold",
11360
11748
  style: "h4"
11361
11749
  }, "".concat(count, " "), t("titles.field", count > 1 ? PLURAL : SINGULAR).toLocaleLowerCase())
11362
11750
  }), /*#__PURE__*/React.createElement(FieldsTable, {
11363
11751
  columnData: columnData,
11752
+ helpDocUrl: helpDocUrl,
11364
11753
  isLoading: isFieldsFetching || isFieldsLoading,
11365
11754
  rowData: isEmpty(rowData) ? fields : rowData,
11366
11755
  setIsPaneOpen: setIsPaneOpen,
@@ -11391,14 +11780,16 @@ var create = function create(payload) {
11391
11780
  var fetch = function fetch(payload) {
11392
11781
  return axios.get(FIELD_VALUES_URL, payload);
11393
11782
  };
11394
- var destroy = function destroy(id, payload) {
11783
+ var destroy = function destroy(_ref) {
11784
+ var id = _ref.id,
11785
+ payload = _ref.payload;
11395
11786
  return axios["delete"](fieldValueUrl(id), {
11396
11787
  data: payload
11397
11788
  });
11398
11789
  };
11399
- var update = function update(_ref) {
11400
- var id = _ref.id,
11401
- payload = _ref.payload;
11790
+ var update = function update(_ref2) {
11791
+ var id = _ref2.id,
11792
+ payload = _ref2.payload;
11402
11793
  return axios.patch(fieldValueUrl(id), payload);
11403
11794
  };
11404
11795
  var fieldValuesApi = {
@@ -11434,6 +11825,18 @@ var useUpdateFieldValue = function useUpdateFieldValue(options) {
11434
11825
  }
11435
11826
  }));
11436
11827
  };
11828
+ var useDeleteFieldValue = function useDeleteFieldValue(options) {
11829
+ var queryClient = useQueryClient();
11830
+ return useMutation(fieldValuesApi.destroy, _objectSpread$1(_objectSpread$1({}, options), {}, {
11831
+ onSuccess: function onSuccess() {
11832
+ for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
11833
+ args[_key3] = arguments[_key3];
11834
+ }
11835
+ options === null || options === void 0 ? void 0 : options.onSuccess.apply(options, args);
11836
+ queryClient.invalidateQueries([QUERY_KEYS.FIELD_VALUES]);
11837
+ }
11838
+ }));
11839
+ };
11437
11840
 
11438
11841
  var FieldValueInputWrapper = function FieldValueInputWrapper(_ref) {
11439
11842
  var field = _ref.field,
@@ -11452,6 +11855,14 @@ var FieldValueInputWrapper = function FieldValueInputWrapper(_ref) {
11452
11855
  }, children);
11453
11856
  };
11454
11857
 
11858
+ var isFieldValueEmpty = function isFieldValueEmpty(fieldKind, fieldValueData) {
11859
+ if (fieldKind === KINDS.multiOption) return isEmpty(fieldValueData.values);
11860
+ if ([KINDS.timeRange, KINDS.dateRange].includes(fieldKind)) {
11861
+ return isEmpty(fieldValueData.value[0]) && isEmpty(fieldValueData.value[1]);
11862
+ }
11863
+ return isEmpty(fieldValueData.value);
11864
+ };
11865
+
11455
11866
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11456
11867
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
11457
11868
  var FieldValuesContainer = function FieldValuesContainer(_ref) {
@@ -11498,7 +11909,9 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11498
11909
  createFieldValue = _useCreateFieldValue.mutate;
11499
11910
  var _useUpdateFieldValue = useUpdateFieldValue(queryOptions),
11500
11911
  updateFieldValue = _useUpdateFieldValue.mutate;
11501
- var handleSubmit = function handleSubmit(values$1) {
11912
+ var _useDeleteFieldValue = useDeleteFieldValue(queryOptions),
11913
+ deleteFieldValue = _useDeleteFieldValue.mutate;
11914
+ var handleSubmit = function handleSubmit(field, values$1) {
11502
11915
  var fieldValue = head(values(values$1));
11503
11916
  var payload = {
11504
11917
  fieldValue: fieldValue,
@@ -11506,10 +11919,17 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11506
11919
  resourceId: resourceId,
11507
11920
  ownerId: isEmpty(ownerId) ? undefined : ownerId
11508
11921
  };
11509
- fieldValue.id ? updateFieldValue({
11510
- id: fieldValue.id,
11511
- payload: payload
11512
- }) : createFieldValue(payload);
11922
+ if (isFieldValueEmpty(field.kind, fieldValue.data)) {
11923
+ deleteFieldValue({
11924
+ id: fieldValue.id,
11925
+ payload: payload
11926
+ });
11927
+ } else {
11928
+ fieldValue.id ? updateFieldValue({
11929
+ id: fieldValue.id,
11930
+ payload: payload
11931
+ }) : createFieldValue(payload);
11932
+ }
11513
11933
  };
11514
11934
  var fields = propFields || fetchedFields;
11515
11935
  return /*#__PURE__*/React.createElement("div", {
@@ -11532,7 +11952,9 @@ var FieldValuesContainer = function FieldValuesContainer(_ref) {
11532
11952
  style: "h5"
11533
11953
  }, capitalize$1(field.name)), /*#__PURE__*/React.createElement(FieldValueInputWrapper, {
11534
11954
  className: fieldClassName,
11535
- onSubmit: handleSubmit,
11955
+ onSubmit: function onSubmit(values) {
11956
+ return handleSubmit(field, values);
11957
+ },
11536
11958
  field: field,
11537
11959
  fieldValues: fieldValues
11538
11960
  }, /*#__PURE__*/React.createElement("div", {