@bigbinary/neeto-filters-frontend 2.12.6 → 2.12.8
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.cjs.js +370 -54
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +371 -55
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2316,13 +2316,37 @@ instance.reloadResources;
|
|
|
2316
2316
|
instance.use;
|
|
2317
2317
|
instance.changeLanguage;
|
|
2318
2318
|
instance.getFixedT;
|
|
2319
|
-
const t$
|
|
2319
|
+
const t$2 = instance.t;
|
|
2320
2320
|
instance.exists;
|
|
2321
2321
|
instance.setDefaultNamespace;
|
|
2322
2322
|
instance.hasLoadedNamespace;
|
|
2323
2323
|
instance.loadNamespaces;
|
|
2324
2324
|
instance.loadLanguages;
|
|
2325
2325
|
|
|
2326
|
+
/**
|
|
2327
|
+
* This file automatically generated from `pre-publish.js`.
|
|
2328
|
+
* Do not manually edit.
|
|
2329
|
+
*/
|
|
2330
|
+
|
|
2331
|
+
var voidElements = {
|
|
2332
|
+
"area": true,
|
|
2333
|
+
"base": true,
|
|
2334
|
+
"br": true,
|
|
2335
|
+
"col": true,
|
|
2336
|
+
"embed": true,
|
|
2337
|
+
"hr": true,
|
|
2338
|
+
"img": true,
|
|
2339
|
+
"input": true,
|
|
2340
|
+
"link": true,
|
|
2341
|
+
"meta": true,
|
|
2342
|
+
"param": true,
|
|
2343
|
+
"source": true,
|
|
2344
|
+
"track": true,
|
|
2345
|
+
"wbr": true
|
|
2346
|
+
};
|
|
2347
|
+
|
|
2348
|
+
var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(voidElements[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$1),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$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(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)},"")}};
|
|
2349
|
+
|
|
2326
2350
|
function warn() {
|
|
2327
2351
|
if (console && console.warn) {
|
|
2328
2352
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2453,6 +2477,244 @@ function getI18n() {
|
|
|
2453
2477
|
return i18nInstance;
|
|
2454
2478
|
}
|
|
2455
2479
|
|
|
2480
|
+
function hasChildren(node, checkLength) {
|
|
2481
|
+
if (!node) return false;
|
|
2482
|
+
const base = node.props ? node.props.children : node.children;
|
|
2483
|
+
if (checkLength) return base.length > 0;
|
|
2484
|
+
return !!base;
|
|
2485
|
+
}
|
|
2486
|
+
function getChildren(node) {
|
|
2487
|
+
if (!node) return [];
|
|
2488
|
+
return node.props ? node.props.children : node.children;
|
|
2489
|
+
}
|
|
2490
|
+
function hasValidReactChildren(children) {
|
|
2491
|
+
if (Object.prototype.toString.call(children) !== '[object Array]') return false;
|
|
2492
|
+
return children.every(child => React.isValidElement(child));
|
|
2493
|
+
}
|
|
2494
|
+
function getAsArray(data) {
|
|
2495
|
+
return Array.isArray(data) ? data : [data];
|
|
2496
|
+
}
|
|
2497
|
+
function mergeProps(source, target) {
|
|
2498
|
+
const newTarget = {
|
|
2499
|
+
...target
|
|
2500
|
+
};
|
|
2501
|
+
newTarget.props = Object.assign(source.props, target.props);
|
|
2502
|
+
return newTarget;
|
|
2503
|
+
}
|
|
2504
|
+
function nodesToString(children, i18nOptions) {
|
|
2505
|
+
if (!children) return '';
|
|
2506
|
+
let stringNode = '';
|
|
2507
|
+
const childrenArray = getAsArray(children);
|
|
2508
|
+
const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
|
|
2509
|
+
childrenArray.forEach((child, childIndex) => {
|
|
2510
|
+
if (typeof child === 'string') {
|
|
2511
|
+
stringNode += `${child}`;
|
|
2512
|
+
} else if (React.isValidElement(child)) {
|
|
2513
|
+
const childPropsCount = Object.keys(child.props).length;
|
|
2514
|
+
const shouldKeepChild = keepArray.indexOf(child.type) > -1;
|
|
2515
|
+
const childChildren = child.props.children;
|
|
2516
|
+
if (!childChildren && shouldKeepChild && childPropsCount === 0) {
|
|
2517
|
+
stringNode += `<${child.type}/>`;
|
|
2518
|
+
} else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
|
|
2519
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2520
|
+
} else if (child.props.i18nIsDynamicList) {
|
|
2521
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2522
|
+
} else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
|
|
2523
|
+
stringNode += `<${child.type}>${childChildren}</${child.type}>`;
|
|
2524
|
+
} else {
|
|
2525
|
+
const content = nodesToString(childChildren, i18nOptions);
|
|
2526
|
+
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
2527
|
+
}
|
|
2528
|
+
} else if (child === null) {
|
|
2529
|
+
warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
|
|
2530
|
+
} else if (typeof child === 'object') {
|
|
2531
|
+
const {
|
|
2532
|
+
format,
|
|
2533
|
+
...clone
|
|
2534
|
+
} = child;
|
|
2535
|
+
const keys = Object.keys(clone);
|
|
2536
|
+
if (keys.length === 1) {
|
|
2537
|
+
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
2538
|
+
stringNode += `{{${value}}}`;
|
|
2539
|
+
} else {
|
|
2540
|
+
warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
|
|
2541
|
+
}
|
|
2542
|
+
} else {
|
|
2543
|
+
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);
|
|
2544
|
+
}
|
|
2545
|
+
});
|
|
2546
|
+
return stringNode;
|
|
2547
|
+
}
|
|
2548
|
+
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
|
|
2549
|
+
if (targetString === '') return [];
|
|
2550
|
+
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
2551
|
+
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
|
|
2552
|
+
if (!children && !emptyChildrenButNeedsHandling) return [targetString];
|
|
2553
|
+
const data = {};
|
|
2554
|
+
function getData(childs) {
|
|
2555
|
+
const childrenArray = getAsArray(childs);
|
|
2556
|
+
childrenArray.forEach(child => {
|
|
2557
|
+
if (typeof child === 'string') return;
|
|
2558
|
+
if (hasChildren(child)) getData(getChildren(child));else if (typeof child === 'object' && !React.isValidElement(child)) Object.assign(data, child);
|
|
2559
|
+
});
|
|
2560
|
+
}
|
|
2561
|
+
getData(children);
|
|
2562
|
+
const ast = c.parse(`<0>${targetString}</0>`);
|
|
2563
|
+
const opts = {
|
|
2564
|
+
...data,
|
|
2565
|
+
...combinedTOpts
|
|
2566
|
+
};
|
|
2567
|
+
function renderInner(child, node, rootReactNode) {
|
|
2568
|
+
const childs = getChildren(child);
|
|
2569
|
+
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
2570
|
+
return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
|
|
2571
|
+
}
|
|
2572
|
+
function pushTranslatedJSX(child, inner, mem, i, isVoid) {
|
|
2573
|
+
if (child.dummy) child.children = inner;
|
|
2574
|
+
mem.push(React.cloneElement(child, {
|
|
2575
|
+
...child.props,
|
|
2576
|
+
key: i
|
|
2577
|
+
}, isVoid ? undefined : inner));
|
|
2578
|
+
}
|
|
2579
|
+
function mapAST(reactNode, astNode, rootReactNode) {
|
|
2580
|
+
const reactNodes = getAsArray(reactNode);
|
|
2581
|
+
const astNodes = getAsArray(astNode);
|
|
2582
|
+
return astNodes.reduce((mem, node, i) => {
|
|
2583
|
+
const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
2584
|
+
if (node.type === 'tag') {
|
|
2585
|
+
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
2586
|
+
if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
|
|
2587
|
+
if (!tmp) tmp = {};
|
|
2588
|
+
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
2589
|
+
props: node.attrs
|
|
2590
|
+
}, tmp) : tmp;
|
|
2591
|
+
const isElement = React.isValidElement(child);
|
|
2592
|
+
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
2593
|
+
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && typeof child === 'object' && child.dummy && !isElement;
|
|
2594
|
+
const isKnownComponent = typeof children === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
|
|
2595
|
+
if (typeof child === 'string') {
|
|
2596
|
+
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
2597
|
+
mem.push(value);
|
|
2598
|
+
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
2599
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2600
|
+
pushTranslatedJSX(child, inner, mem, i);
|
|
2601
|
+
} else if (isEmptyTransWithHTML) {
|
|
2602
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2603
|
+
mem.push(React.cloneElement(child, {
|
|
2604
|
+
...child.props,
|
|
2605
|
+
key: i
|
|
2606
|
+
}, inner));
|
|
2607
|
+
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
2608
|
+
if (isKnownComponent) {
|
|
2609
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2610
|
+
pushTranslatedJSX(child, inner, mem, i, node.voidElement);
|
|
2611
|
+
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
2612
|
+
if (node.voidElement) {
|
|
2613
|
+
mem.push(React.createElement(node.name, {
|
|
2614
|
+
key: `${node.name}-${i}`
|
|
2615
|
+
}));
|
|
2616
|
+
} else {
|
|
2617
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2618
|
+
mem.push(React.createElement(node.name, {
|
|
2619
|
+
key: `${node.name}-${i}`
|
|
2620
|
+
}, inner));
|
|
2621
|
+
}
|
|
2622
|
+
} else if (node.voidElement) {
|
|
2623
|
+
mem.push(`<${node.name} />`);
|
|
2624
|
+
} else {
|
|
2625
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2626
|
+
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
2627
|
+
}
|
|
2628
|
+
} else if (typeof child === 'object' && !isElement) {
|
|
2629
|
+
const content = node.children[0] ? translationContent : null;
|
|
2630
|
+
if (content) mem.push(content);
|
|
2631
|
+
} else if (node.children.length === 1 && translationContent) {
|
|
2632
|
+
mem.push(React.cloneElement(child, {
|
|
2633
|
+
...child.props,
|
|
2634
|
+
key: i
|
|
2635
|
+
}, translationContent));
|
|
2636
|
+
} else {
|
|
2637
|
+
mem.push(React.cloneElement(child, {
|
|
2638
|
+
...child.props,
|
|
2639
|
+
key: i
|
|
2640
|
+
}));
|
|
2641
|
+
}
|
|
2642
|
+
} else if (node.type === 'text') {
|
|
2643
|
+
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
2644
|
+
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
2645
|
+
if (wrapTextNodes) {
|
|
2646
|
+
mem.push(React.createElement(wrapTextNodes, {
|
|
2647
|
+
key: `${node.name}-${i}`
|
|
2648
|
+
}, content));
|
|
2649
|
+
} else {
|
|
2650
|
+
mem.push(content);
|
|
2651
|
+
}
|
|
2652
|
+
}
|
|
2653
|
+
return mem;
|
|
2654
|
+
}, []);
|
|
2655
|
+
}
|
|
2656
|
+
const result = mapAST([{
|
|
2657
|
+
dummy: true,
|
|
2658
|
+
children: children || []
|
|
2659
|
+
}], ast, getAsArray(children || []));
|
|
2660
|
+
return getChildren(result[0]);
|
|
2661
|
+
}
|
|
2662
|
+
function Trans$1(_ref) {
|
|
2663
|
+
let {
|
|
2664
|
+
children,
|
|
2665
|
+
count,
|
|
2666
|
+
parent,
|
|
2667
|
+
i18nKey,
|
|
2668
|
+
context,
|
|
2669
|
+
tOptions = {},
|
|
2670
|
+
values,
|
|
2671
|
+
defaults,
|
|
2672
|
+
components,
|
|
2673
|
+
ns,
|
|
2674
|
+
i18n: i18nFromProps,
|
|
2675
|
+
t: tFromProps,
|
|
2676
|
+
shouldUnescape,
|
|
2677
|
+
...additionalProps
|
|
2678
|
+
} = _ref;
|
|
2679
|
+
const i18n = i18nFromProps || getI18n();
|
|
2680
|
+
if (!i18n) {
|
|
2681
|
+
warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
|
|
2682
|
+
return children;
|
|
2683
|
+
}
|
|
2684
|
+
const t = tFromProps || i18n.t.bind(i18n) || (k => k);
|
|
2685
|
+
if (context) tOptions.context = context;
|
|
2686
|
+
const reactI18nextOptions = {
|
|
2687
|
+
...getDefaults(),
|
|
2688
|
+
...(i18n.options && i18n.options.react)
|
|
2689
|
+
};
|
|
2690
|
+
let namespaces = ns || t.ns || i18n.options && i18n.options.defaultNS;
|
|
2691
|
+
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
2692
|
+
const defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
2693
|
+
const {
|
|
2694
|
+
hashTransKey
|
|
2695
|
+
} = reactI18nextOptions;
|
|
2696
|
+
const key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
|
|
2697
|
+
const interpolationOverride = values ? tOptions.interpolation : {
|
|
2698
|
+
interpolation: {
|
|
2699
|
+
...tOptions.interpolation,
|
|
2700
|
+
prefix: '#$?',
|
|
2701
|
+
suffix: '?$#'
|
|
2702
|
+
}
|
|
2703
|
+
};
|
|
2704
|
+
const combinedTOpts = {
|
|
2705
|
+
...tOptions,
|
|
2706
|
+
count,
|
|
2707
|
+
...values,
|
|
2708
|
+
...interpolationOverride,
|
|
2709
|
+
defaultValue,
|
|
2710
|
+
ns: namespaces
|
|
2711
|
+
};
|
|
2712
|
+
const translation = key ? t(key, combinedTOpts) : defaultValue;
|
|
2713
|
+
const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
2714
|
+
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
|
|
2715
|
+
return useAsParent ? React.createElement(useAsParent, additionalProps, content) : content;
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2456
2718
|
const initReactI18next = {
|
|
2457
2719
|
type: '3rdParty',
|
|
2458
2720
|
init(instance) {
|
|
@@ -2476,6 +2738,47 @@ class ReportNamespaces {
|
|
|
2476
2738
|
}
|
|
2477
2739
|
}
|
|
2478
2740
|
|
|
2741
|
+
function Trans(_ref) {
|
|
2742
|
+
let {
|
|
2743
|
+
children,
|
|
2744
|
+
count,
|
|
2745
|
+
parent,
|
|
2746
|
+
i18nKey,
|
|
2747
|
+
context,
|
|
2748
|
+
tOptions = {},
|
|
2749
|
+
values,
|
|
2750
|
+
defaults,
|
|
2751
|
+
components,
|
|
2752
|
+
ns,
|
|
2753
|
+
i18n: i18nFromProps,
|
|
2754
|
+
t: tFromProps,
|
|
2755
|
+
shouldUnescape,
|
|
2756
|
+
...additionalProps
|
|
2757
|
+
} = _ref;
|
|
2758
|
+
const {
|
|
2759
|
+
i18n: i18nFromContext,
|
|
2760
|
+
defaultNS: defaultNSFromContext
|
|
2761
|
+
} = React.useContext(I18nContext) || {};
|
|
2762
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2763
|
+
const t = tFromProps || i18n && i18n.t.bind(i18n);
|
|
2764
|
+
return Trans$1({
|
|
2765
|
+
children,
|
|
2766
|
+
count,
|
|
2767
|
+
parent,
|
|
2768
|
+
i18nKey,
|
|
2769
|
+
context,
|
|
2770
|
+
tOptions,
|
|
2771
|
+
values,
|
|
2772
|
+
defaults,
|
|
2773
|
+
components,
|
|
2774
|
+
ns: ns || t && t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
|
|
2775
|
+
i18n,
|
|
2776
|
+
t: tFromProps,
|
|
2777
|
+
shouldUnescape,
|
|
2778
|
+
...additionalProps
|
|
2779
|
+
});
|
|
2780
|
+
}
|
|
2781
|
+
|
|
2479
2782
|
const usePrevious = (value, ignore) => {
|
|
2480
2783
|
const ref = React.useRef();
|
|
2481
2784
|
React.useEffect(() => {
|
|
@@ -2594,7 +2897,8 @@ var common = {
|
|
|
2594
2897
|
rename: "Rename",
|
|
2595
2898
|
segments: "Segments",
|
|
2596
2899
|
userCount: "{{count}} Users",
|
|
2597
|
-
yes: "Yes"
|
|
2900
|
+
yes: "Yes",
|
|
2901
|
+
update: "Update"
|
|
2598
2902
|
};
|
|
2599
2903
|
var messages = {
|
|
2600
2904
|
enterResource: "Enter {{resource}}",
|
|
@@ -2625,8 +2929,8 @@ var shortcuts = {
|
|
|
2625
2929
|
};
|
|
2626
2930
|
var segments = {
|
|
2627
2931
|
addNewSegment: "Add new segment",
|
|
2628
|
-
deleteAlertMessage: "
|
|
2629
|
-
deleteAlertTitle: "Delete
|
|
2932
|
+
deleteAlertMessage: "You are permanently deleting the segment <strong>{{entity}}</strong>. This can't be undone.",
|
|
2933
|
+
deleteAlertTitle: "Delete segment?",
|
|
2630
2934
|
manageSegments: "Manage segments",
|
|
2631
2935
|
name: "Segment name",
|
|
2632
2936
|
noSegmentsFound: "No segments found",
|
|
@@ -2637,8 +2941,8 @@ var segments = {
|
|
|
2637
2941
|
segmentName: "Segment name",
|
|
2638
2942
|
showLess: "See less",
|
|
2639
2943
|
showMoreNumbers: "See {{entity}} more",
|
|
2640
|
-
updateSegment: "Update segment",
|
|
2641
|
-
updateSegmentMessage: "
|
|
2944
|
+
updateSegment: "Update segment?",
|
|
2945
|
+
updateSegmentMessage: "You are trying to update the current segment."
|
|
2642
2946
|
};
|
|
2643
2947
|
var labels = {
|
|
2644
2948
|
keyword: "Keyword"
|
|
@@ -2737,15 +3041,15 @@ function _defineProperty(obj, key, value) {
|
|
|
2737
3041
|
var SHORTCUTS = {
|
|
2738
3042
|
closePane: {
|
|
2739
3043
|
sequence: "escape",
|
|
2740
|
-
description: t$
|
|
3044
|
+
description: t$2("shortcuts.closePane")
|
|
2741
3045
|
},
|
|
2742
3046
|
deleteBlock: {
|
|
2743
3047
|
sequence: "backspace",
|
|
2744
|
-
description: t$
|
|
3048
|
+
description: t$2("shortcuts.deleteBlock")
|
|
2745
3049
|
},
|
|
2746
3050
|
openFilterPane: {
|
|
2747
3051
|
sequence: "enter",
|
|
2748
|
-
description: t$
|
|
3052
|
+
description: t$2("shortcuts.openFilterPane")
|
|
2749
3053
|
}
|
|
2750
3054
|
};
|
|
2751
3055
|
|
|
@@ -2833,48 +3137,48 @@ var DATE_RULES = {
|
|
|
2833
3137
|
};
|
|
2834
3138
|
|
|
2835
3139
|
var NUMBER_RULES = [{
|
|
2836
|
-
label: t$
|
|
3140
|
+
label: t$2("rules.exactly"),
|
|
2837
3141
|
value: "is"
|
|
2838
3142
|
}, {
|
|
2839
|
-
label: t$
|
|
3143
|
+
label: t$2("rules.notExactly"),
|
|
2840
3144
|
value: "is_not"
|
|
2841
3145
|
}, {
|
|
2842
|
-
label: t$
|
|
3146
|
+
label: t$2("rules.greaterThan"),
|
|
2843
3147
|
value: "greater_than"
|
|
2844
3148
|
}, {
|
|
2845
|
-
label: t$
|
|
3149
|
+
label: t$2("rules.lessThan"),
|
|
2846
3150
|
value: "less_than"
|
|
2847
3151
|
}];
|
|
2848
3152
|
var TEXT_RULES = [{
|
|
2849
|
-
label: t$
|
|
3153
|
+
label: t$2("rules.contains"),
|
|
2850
3154
|
value: "contains"
|
|
2851
3155
|
}, {
|
|
2852
|
-
label: t$
|
|
3156
|
+
label: t$2("rules.doesNotContain"),
|
|
2853
3157
|
value: "does_not_contain"
|
|
2854
3158
|
}, {
|
|
2855
|
-
label: t$
|
|
3159
|
+
label: t$2("rules.exactly"),
|
|
2856
3160
|
value: "is"
|
|
2857
3161
|
}, {
|
|
2858
|
-
label: t$
|
|
3162
|
+
label: t$2("rules.notExactly"),
|
|
2859
3163
|
value: "is_not"
|
|
2860
3164
|
}, {
|
|
2861
|
-
label: t$
|
|
3165
|
+
label: t$2("rules.startsWith"),
|
|
2862
3166
|
value: "starts_with"
|
|
2863
3167
|
}, {
|
|
2864
|
-
label: t$
|
|
3168
|
+
label: t$2("rules.doesNotStartWith"),
|
|
2865
3169
|
value: "does_not_start_with"
|
|
2866
3170
|
}, {
|
|
2867
|
-
label: t$
|
|
3171
|
+
label: t$2("rules.endsWith"),
|
|
2868
3172
|
value: "ends_with"
|
|
2869
3173
|
}, {
|
|
2870
|
-
label: t$
|
|
3174
|
+
label: t$2("rules.doesNotEndWith"),
|
|
2871
3175
|
value: "does_not_end_with"
|
|
2872
3176
|
}];
|
|
2873
3177
|
var DEFAULT_BOOLEAN_OPTIONS = [{
|
|
2874
|
-
label: t$
|
|
3178
|
+
label: t$2("common.yes"),
|
|
2875
3179
|
value: "true"
|
|
2876
3180
|
}, {
|
|
2877
|
-
label: t$
|
|
3181
|
+
label: t$2("common.no"),
|
|
2878
3182
|
value: "false"
|
|
2879
3183
|
}];
|
|
2880
3184
|
|
|
@@ -3887,6 +4191,7 @@ var Segment = function Segment(_ref) {
|
|
|
3887
4191
|
isOpen: isUpdateAlertOpen,
|
|
3888
4192
|
isSubmitting: isUpdating,
|
|
3889
4193
|
message: t("segments.updateSegmentMessage"),
|
|
4194
|
+
submitButtonLabel: t("common.update"),
|
|
3890
4195
|
title: t("segments.updateSegment"),
|
|
3891
4196
|
onClose: function onClose() {
|
|
3892
4197
|
return setIsUpdateAlertOpen(false);
|
|
@@ -6995,7 +7300,8 @@ var Text = function Text(_ref) {
|
|
|
6995
7300
|
filter = _ref.filter,
|
|
6996
7301
|
filters = _ref.filters,
|
|
6997
7302
|
handleApplyFilter = _ref.handleApplyFilter,
|
|
6998
|
-
autoFocus = _ref.autoFocus
|
|
7303
|
+
autoFocus = _ref.autoFocus,
|
|
7304
|
+
onClose = _ref.onClose;
|
|
6999
7305
|
var key = column.key,
|
|
7000
7306
|
_column$defaultType = column.defaultType,
|
|
7001
7307
|
defaultType = _column$defaultType === void 0 ? column.type : _column$defaultType,
|
|
@@ -7022,6 +7328,30 @@ var Text = function Text(_ref) {
|
|
|
7022
7328
|
var debouncedInputValue = reactUtils.useDebounce(inputValue);
|
|
7023
7329
|
var _useTranslation = useTranslation(),
|
|
7024
7330
|
t = _useTranslation.t;
|
|
7331
|
+
var handleUpdateAndApplyFilter = function handleUpdateAndApplyFilter() {
|
|
7332
|
+
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : debouncedInputValue;
|
|
7333
|
+
var rule = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : selectedRule;
|
|
7334
|
+
if (ramda.equals(filter === null || filter === void 0 ? void 0 : filter.value, value) && ramda.equals(selectedRule, rule)) return;
|
|
7335
|
+
var updatedFilter = buildUpdatedFilter({
|
|
7336
|
+
column: column,
|
|
7337
|
+
defaultType: defaultType,
|
|
7338
|
+
option: {},
|
|
7339
|
+
rule: rule.value,
|
|
7340
|
+
value: value.trim()
|
|
7341
|
+
});
|
|
7342
|
+
handleApplyFilter(updatedFilter);
|
|
7343
|
+
};
|
|
7344
|
+
var handleKeydown = function handleKeydown(e) {
|
|
7345
|
+
if (e.key === "Enter") {
|
|
7346
|
+
handleUpdateAndApplyFilter(inputValue);
|
|
7347
|
+
onClose();
|
|
7348
|
+
}
|
|
7349
|
+
};
|
|
7350
|
+
var handleRuleChange = function handleRuleChange(ruleOption) {
|
|
7351
|
+
setSelectedRule(ruleOption);
|
|
7352
|
+
if (!debouncedInputValue) return;
|
|
7353
|
+
handleUpdateAndApplyFilter(debouncedInputValue, ruleOption);
|
|
7354
|
+
};
|
|
7025
7355
|
|
|
7026
7356
|
// Reset states when "Clear filters" button is clicked.
|
|
7027
7357
|
React.useEffect(function () {
|
|
@@ -7037,27 +7367,8 @@ var Text = function Text(_ref) {
|
|
|
7037
7367
|
});
|
|
7038
7368
|
return;
|
|
7039
7369
|
}
|
|
7040
|
-
|
|
7041
|
-
column: column,
|
|
7042
|
-
defaultType: defaultType,
|
|
7043
|
-
option: {},
|
|
7044
|
-
rule: selectedRule.value,
|
|
7045
|
-
value: debouncedInputValue.trim()
|
|
7046
|
-
});
|
|
7047
|
-
handleApplyFilter(updatedFilter);
|
|
7370
|
+
handleUpdateAndApplyFilter();
|
|
7048
7371
|
}, [debouncedInputValue]);
|
|
7049
|
-
var handleRuleChange = function handleRuleChange(ruleOption) {
|
|
7050
|
-
setSelectedRule(ruleOption);
|
|
7051
|
-
if (!debouncedInputValue) return;
|
|
7052
|
-
var updatedFilter = buildUpdatedFilter({
|
|
7053
|
-
column: column,
|
|
7054
|
-
defaultType: defaultType,
|
|
7055
|
-
option: {},
|
|
7056
|
-
rule: ruleOption.value,
|
|
7057
|
-
value: debouncedInputValue.trim()
|
|
7058
|
-
});
|
|
7059
|
-
handleApplyFilter(updatedFilter);
|
|
7060
|
-
};
|
|
7061
7372
|
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
7062
7373
|
className: "neeto-filters-pane-filter__item-wrapper"
|
|
7063
7374
|
}, showRuleSelector && /*#__PURE__*/React__default["default"].createElement(neetoui.Select, {
|
|
@@ -7079,7 +7390,8 @@ var Text = function Text(_ref) {
|
|
|
7079
7390
|
}),
|
|
7080
7391
|
onChange: function onChange(event) {
|
|
7081
7392
|
return setInputValue(event.target.value);
|
|
7082
|
-
}
|
|
7393
|
+
},
|
|
7394
|
+
onKeyDown: handleKeydown
|
|
7083
7395
|
}, otherProps)));
|
|
7084
7396
|
};
|
|
7085
7397
|
|
|
@@ -7152,7 +7464,8 @@ var Item = function Item(_ref) {
|
|
|
7152
7464
|
var column = _ref.column,
|
|
7153
7465
|
filters = _ref.filters,
|
|
7154
7466
|
onChange = _ref.onChange,
|
|
7155
|
-
autoFocus = _ref.autoFocus
|
|
7467
|
+
autoFocus = _ref.autoFocus,
|
|
7468
|
+
onClose = _ref.onClose;
|
|
7156
7469
|
var key = column.key,
|
|
7157
7470
|
_column$defaultType = column.defaultType,
|
|
7158
7471
|
defaultType = _column$defaultType === void 0 ? column.type : _column$defaultType;
|
|
@@ -7174,7 +7487,8 @@ var Item = function Item(_ref) {
|
|
|
7174
7487
|
column: column,
|
|
7175
7488
|
filter: filter,
|
|
7176
7489
|
filters: filters,
|
|
7177
|
-
handleApplyFilter: handleApplyFilter
|
|
7490
|
+
handleApplyFilter: handleApplyFilter,
|
|
7491
|
+
onClose: onClose
|
|
7178
7492
|
});
|
|
7179
7493
|
}
|
|
7180
7494
|
if (isDate(defaultType)) {
|
|
@@ -7336,7 +7650,8 @@ var Pane = function Pane(_ref) {
|
|
|
7336
7650
|
column: column,
|
|
7337
7651
|
filters: filters,
|
|
7338
7652
|
key: column.key,
|
|
7339
|
-
onChange: handleChange
|
|
7653
|
+
onChange: handleChange,
|
|
7654
|
+
onClose: onClose
|
|
7340
7655
|
});
|
|
7341
7656
|
}), pure.isPresent(groupedColumns) && /*#__PURE__*/React__default["default"].createElement(neetoui.Accordion, {
|
|
7342
7657
|
defaultActiveKey: groupedColumns.findIndex(function (_ref4) {
|
|
@@ -7470,12 +7785,13 @@ var DeleteAlert = function DeleteAlert(_ref) {
|
|
|
7470
7785
|
return /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
|
|
7471
7786
|
isOpen: isOpen,
|
|
7472
7787
|
isSubmitting: isDeleting,
|
|
7473
|
-
|
|
7474
|
-
|
|
7475
|
-
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7788
|
+
submitButtonLabel: t("common.delete"),
|
|
7789
|
+
title: t("segments.deleteAlertTitle"),
|
|
7790
|
+
message: /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
7791
|
+
i18nKey: "segments.deleteAlertMessage",
|
|
7792
|
+
values: {
|
|
7793
|
+
entity: segment.name
|
|
7794
|
+
}
|
|
7479
7795
|
}),
|
|
7480
7796
|
onClose: onClose,
|
|
7481
7797
|
onSubmit: handleDelete
|