@bigbinary/neeto-filters-frontend 2.12.5 → 2.12.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/dist/index.cjs.js +359 -42
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +360 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { createContext, useContext, useState, useRef, useEffect, useMemo } from 'react';
|
|
1
|
+
import React, { createElement, isValidElement, cloneElement, createContext, useContext, useState, useRef, useEffect, useMemo } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
3
|
import { capitalize as capitalize$1, removeBy, findBy, isNotEmpty, humanize, noop as noop$2, toLabelAndValue, replaceBy, isPresent, existsBy, filterBy } from '@bigbinary/neeto-commons-frontend/pure';
|
|
4
4
|
import { Tooltip, Typography, Dropdown as Dropdown$2, Button, Pane as Pane$1, Alert, Select, DatePicker, TimePicker, Input as Input$1, Accordion, Spinner } from '@bigbinary/neetoui';
|
|
@@ -2281,13 +2281,37 @@ instance.reloadResources;
|
|
|
2281
2281
|
instance.use;
|
|
2282
2282
|
instance.changeLanguage;
|
|
2283
2283
|
instance.getFixedT;
|
|
2284
|
-
const t$
|
|
2284
|
+
const t$2 = instance.t;
|
|
2285
2285
|
instance.exists;
|
|
2286
2286
|
instance.setDefaultNamespace;
|
|
2287
2287
|
instance.hasLoadedNamespace;
|
|
2288
2288
|
instance.loadNamespaces;
|
|
2289
2289
|
instance.loadLanguages;
|
|
2290
2290
|
|
|
2291
|
+
/**
|
|
2292
|
+
* This file automatically generated from `pre-publish.js`.
|
|
2293
|
+
* Do not manually edit.
|
|
2294
|
+
*/
|
|
2295
|
+
|
|
2296
|
+
var voidElements = {
|
|
2297
|
+
"area": true,
|
|
2298
|
+
"base": true,
|
|
2299
|
+
"br": true,
|
|
2300
|
+
"col": true,
|
|
2301
|
+
"embed": true,
|
|
2302
|
+
"hr": true,
|
|
2303
|
+
"img": true,
|
|
2304
|
+
"input": true,
|
|
2305
|
+
"link": true,
|
|
2306
|
+
"meta": true,
|
|
2307
|
+
"param": true,
|
|
2308
|
+
"source": true,
|
|
2309
|
+
"track": true,
|
|
2310
|
+
"wbr": true
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
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)},"")}};
|
|
2314
|
+
|
|
2291
2315
|
function warn() {
|
|
2292
2316
|
if (console && console.warn) {
|
|
2293
2317
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2418,6 +2442,244 @@ function getI18n() {
|
|
|
2418
2442
|
return i18nInstance;
|
|
2419
2443
|
}
|
|
2420
2444
|
|
|
2445
|
+
function hasChildren(node, checkLength) {
|
|
2446
|
+
if (!node) return false;
|
|
2447
|
+
const base = node.props ? node.props.children : node.children;
|
|
2448
|
+
if (checkLength) return base.length > 0;
|
|
2449
|
+
return !!base;
|
|
2450
|
+
}
|
|
2451
|
+
function getChildren(node) {
|
|
2452
|
+
if (!node) return [];
|
|
2453
|
+
return node.props ? node.props.children : node.children;
|
|
2454
|
+
}
|
|
2455
|
+
function hasValidReactChildren(children) {
|
|
2456
|
+
if (Object.prototype.toString.call(children) !== '[object Array]') return false;
|
|
2457
|
+
return children.every(child => isValidElement(child));
|
|
2458
|
+
}
|
|
2459
|
+
function getAsArray(data) {
|
|
2460
|
+
return Array.isArray(data) ? data : [data];
|
|
2461
|
+
}
|
|
2462
|
+
function mergeProps(source, target) {
|
|
2463
|
+
const newTarget = {
|
|
2464
|
+
...target
|
|
2465
|
+
};
|
|
2466
|
+
newTarget.props = Object.assign(source.props, target.props);
|
|
2467
|
+
return newTarget;
|
|
2468
|
+
}
|
|
2469
|
+
function nodesToString(children, i18nOptions) {
|
|
2470
|
+
if (!children) return '';
|
|
2471
|
+
let stringNode = '';
|
|
2472
|
+
const childrenArray = getAsArray(children);
|
|
2473
|
+
const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
|
|
2474
|
+
childrenArray.forEach((child, childIndex) => {
|
|
2475
|
+
if (typeof child === 'string') {
|
|
2476
|
+
stringNode += `${child}`;
|
|
2477
|
+
} else if (isValidElement(child)) {
|
|
2478
|
+
const childPropsCount = Object.keys(child.props).length;
|
|
2479
|
+
const shouldKeepChild = keepArray.indexOf(child.type) > -1;
|
|
2480
|
+
const childChildren = child.props.children;
|
|
2481
|
+
if (!childChildren && shouldKeepChild && childPropsCount === 0) {
|
|
2482
|
+
stringNode += `<${child.type}/>`;
|
|
2483
|
+
} else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
|
|
2484
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2485
|
+
} else if (child.props.i18nIsDynamicList) {
|
|
2486
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2487
|
+
} else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
|
|
2488
|
+
stringNode += `<${child.type}>${childChildren}</${child.type}>`;
|
|
2489
|
+
} else {
|
|
2490
|
+
const content = nodesToString(childChildren, i18nOptions);
|
|
2491
|
+
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
2492
|
+
}
|
|
2493
|
+
} else if (child === null) {
|
|
2494
|
+
warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
|
|
2495
|
+
} else if (typeof child === 'object') {
|
|
2496
|
+
const {
|
|
2497
|
+
format,
|
|
2498
|
+
...clone
|
|
2499
|
+
} = child;
|
|
2500
|
+
const keys = Object.keys(clone);
|
|
2501
|
+
if (keys.length === 1) {
|
|
2502
|
+
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
2503
|
+
stringNode += `{{${value}}}`;
|
|
2504
|
+
} else {
|
|
2505
|
+
warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
|
|
2506
|
+
}
|
|
2507
|
+
} else {
|
|
2508
|
+
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);
|
|
2509
|
+
}
|
|
2510
|
+
});
|
|
2511
|
+
return stringNode;
|
|
2512
|
+
}
|
|
2513
|
+
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
|
|
2514
|
+
if (targetString === '') return [];
|
|
2515
|
+
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
2516
|
+
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
|
|
2517
|
+
if (!children && !emptyChildrenButNeedsHandling) return [targetString];
|
|
2518
|
+
const data = {};
|
|
2519
|
+
function getData(childs) {
|
|
2520
|
+
const childrenArray = getAsArray(childs);
|
|
2521
|
+
childrenArray.forEach(child => {
|
|
2522
|
+
if (typeof child === 'string') return;
|
|
2523
|
+
if (hasChildren(child)) getData(getChildren(child));else if (typeof child === 'object' && !isValidElement(child)) Object.assign(data, child);
|
|
2524
|
+
});
|
|
2525
|
+
}
|
|
2526
|
+
getData(children);
|
|
2527
|
+
const ast = c.parse(`<0>${targetString}</0>`);
|
|
2528
|
+
const opts = {
|
|
2529
|
+
...data,
|
|
2530
|
+
...combinedTOpts
|
|
2531
|
+
};
|
|
2532
|
+
function renderInner(child, node, rootReactNode) {
|
|
2533
|
+
const childs = getChildren(child);
|
|
2534
|
+
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
2535
|
+
return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
|
|
2536
|
+
}
|
|
2537
|
+
function pushTranslatedJSX(child, inner, mem, i, isVoid) {
|
|
2538
|
+
if (child.dummy) child.children = inner;
|
|
2539
|
+
mem.push(cloneElement(child, {
|
|
2540
|
+
...child.props,
|
|
2541
|
+
key: i
|
|
2542
|
+
}, isVoid ? undefined : inner));
|
|
2543
|
+
}
|
|
2544
|
+
function mapAST(reactNode, astNode, rootReactNode) {
|
|
2545
|
+
const reactNodes = getAsArray(reactNode);
|
|
2546
|
+
const astNodes = getAsArray(astNode);
|
|
2547
|
+
return astNodes.reduce((mem, node, i) => {
|
|
2548
|
+
const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
2549
|
+
if (node.type === 'tag') {
|
|
2550
|
+
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
2551
|
+
if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
|
|
2552
|
+
if (!tmp) tmp = {};
|
|
2553
|
+
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
2554
|
+
props: node.attrs
|
|
2555
|
+
}, tmp) : tmp;
|
|
2556
|
+
const isElement = isValidElement(child);
|
|
2557
|
+
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
2558
|
+
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && typeof child === 'object' && child.dummy && !isElement;
|
|
2559
|
+
const isKnownComponent = typeof children === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
|
|
2560
|
+
if (typeof child === 'string') {
|
|
2561
|
+
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
2562
|
+
mem.push(value);
|
|
2563
|
+
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
2564
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2565
|
+
pushTranslatedJSX(child, inner, mem, i);
|
|
2566
|
+
} else if (isEmptyTransWithHTML) {
|
|
2567
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2568
|
+
mem.push(cloneElement(child, {
|
|
2569
|
+
...child.props,
|
|
2570
|
+
key: i
|
|
2571
|
+
}, inner));
|
|
2572
|
+
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
2573
|
+
if (isKnownComponent) {
|
|
2574
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2575
|
+
pushTranslatedJSX(child, inner, mem, i, node.voidElement);
|
|
2576
|
+
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
2577
|
+
if (node.voidElement) {
|
|
2578
|
+
mem.push(createElement(node.name, {
|
|
2579
|
+
key: `${node.name}-${i}`
|
|
2580
|
+
}));
|
|
2581
|
+
} else {
|
|
2582
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2583
|
+
mem.push(createElement(node.name, {
|
|
2584
|
+
key: `${node.name}-${i}`
|
|
2585
|
+
}, inner));
|
|
2586
|
+
}
|
|
2587
|
+
} else if (node.voidElement) {
|
|
2588
|
+
mem.push(`<${node.name} />`);
|
|
2589
|
+
} else {
|
|
2590
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2591
|
+
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
2592
|
+
}
|
|
2593
|
+
} else if (typeof child === 'object' && !isElement) {
|
|
2594
|
+
const content = node.children[0] ? translationContent : null;
|
|
2595
|
+
if (content) mem.push(content);
|
|
2596
|
+
} else if (node.children.length === 1 && translationContent) {
|
|
2597
|
+
mem.push(cloneElement(child, {
|
|
2598
|
+
...child.props,
|
|
2599
|
+
key: i
|
|
2600
|
+
}, translationContent));
|
|
2601
|
+
} else {
|
|
2602
|
+
mem.push(cloneElement(child, {
|
|
2603
|
+
...child.props,
|
|
2604
|
+
key: i
|
|
2605
|
+
}));
|
|
2606
|
+
}
|
|
2607
|
+
} else if (node.type === 'text') {
|
|
2608
|
+
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
2609
|
+
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
2610
|
+
if (wrapTextNodes) {
|
|
2611
|
+
mem.push(createElement(wrapTextNodes, {
|
|
2612
|
+
key: `${node.name}-${i}`
|
|
2613
|
+
}, content));
|
|
2614
|
+
} else {
|
|
2615
|
+
mem.push(content);
|
|
2616
|
+
}
|
|
2617
|
+
}
|
|
2618
|
+
return mem;
|
|
2619
|
+
}, []);
|
|
2620
|
+
}
|
|
2621
|
+
const result = mapAST([{
|
|
2622
|
+
dummy: true,
|
|
2623
|
+
children: children || []
|
|
2624
|
+
}], ast, getAsArray(children || []));
|
|
2625
|
+
return getChildren(result[0]);
|
|
2626
|
+
}
|
|
2627
|
+
function Trans$1(_ref) {
|
|
2628
|
+
let {
|
|
2629
|
+
children,
|
|
2630
|
+
count,
|
|
2631
|
+
parent,
|
|
2632
|
+
i18nKey,
|
|
2633
|
+
context,
|
|
2634
|
+
tOptions = {},
|
|
2635
|
+
values,
|
|
2636
|
+
defaults,
|
|
2637
|
+
components,
|
|
2638
|
+
ns,
|
|
2639
|
+
i18n: i18nFromProps,
|
|
2640
|
+
t: tFromProps,
|
|
2641
|
+
shouldUnescape,
|
|
2642
|
+
...additionalProps
|
|
2643
|
+
} = _ref;
|
|
2644
|
+
const i18n = i18nFromProps || getI18n();
|
|
2645
|
+
if (!i18n) {
|
|
2646
|
+
warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
|
|
2647
|
+
return children;
|
|
2648
|
+
}
|
|
2649
|
+
const t = tFromProps || i18n.t.bind(i18n) || (k => k);
|
|
2650
|
+
if (context) tOptions.context = context;
|
|
2651
|
+
const reactI18nextOptions = {
|
|
2652
|
+
...getDefaults(),
|
|
2653
|
+
...(i18n.options && i18n.options.react)
|
|
2654
|
+
};
|
|
2655
|
+
let namespaces = ns || t.ns || i18n.options && i18n.options.defaultNS;
|
|
2656
|
+
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
2657
|
+
const defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
2658
|
+
const {
|
|
2659
|
+
hashTransKey
|
|
2660
|
+
} = reactI18nextOptions;
|
|
2661
|
+
const key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
|
|
2662
|
+
const interpolationOverride = values ? tOptions.interpolation : {
|
|
2663
|
+
interpolation: {
|
|
2664
|
+
...tOptions.interpolation,
|
|
2665
|
+
prefix: '#$?',
|
|
2666
|
+
suffix: '?$#'
|
|
2667
|
+
}
|
|
2668
|
+
};
|
|
2669
|
+
const combinedTOpts = {
|
|
2670
|
+
...tOptions,
|
|
2671
|
+
count,
|
|
2672
|
+
...values,
|
|
2673
|
+
...interpolationOverride,
|
|
2674
|
+
defaultValue,
|
|
2675
|
+
ns: namespaces
|
|
2676
|
+
};
|
|
2677
|
+
const translation = key ? t(key, combinedTOpts) : defaultValue;
|
|
2678
|
+
const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
2679
|
+
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
|
|
2680
|
+
return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
|
|
2681
|
+
}
|
|
2682
|
+
|
|
2421
2683
|
const initReactI18next = {
|
|
2422
2684
|
type: '3rdParty',
|
|
2423
2685
|
init(instance) {
|
|
@@ -2441,6 +2703,47 @@ class ReportNamespaces {
|
|
|
2441
2703
|
}
|
|
2442
2704
|
}
|
|
2443
2705
|
|
|
2706
|
+
function Trans(_ref) {
|
|
2707
|
+
let {
|
|
2708
|
+
children,
|
|
2709
|
+
count,
|
|
2710
|
+
parent,
|
|
2711
|
+
i18nKey,
|
|
2712
|
+
context,
|
|
2713
|
+
tOptions = {},
|
|
2714
|
+
values,
|
|
2715
|
+
defaults,
|
|
2716
|
+
components,
|
|
2717
|
+
ns,
|
|
2718
|
+
i18n: i18nFromProps,
|
|
2719
|
+
t: tFromProps,
|
|
2720
|
+
shouldUnescape,
|
|
2721
|
+
...additionalProps
|
|
2722
|
+
} = _ref;
|
|
2723
|
+
const {
|
|
2724
|
+
i18n: i18nFromContext,
|
|
2725
|
+
defaultNS: defaultNSFromContext
|
|
2726
|
+
} = useContext(I18nContext) || {};
|
|
2727
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2728
|
+
const t = tFromProps || i18n && i18n.t.bind(i18n);
|
|
2729
|
+
return Trans$1({
|
|
2730
|
+
children,
|
|
2731
|
+
count,
|
|
2732
|
+
parent,
|
|
2733
|
+
i18nKey,
|
|
2734
|
+
context,
|
|
2735
|
+
tOptions,
|
|
2736
|
+
values,
|
|
2737
|
+
defaults,
|
|
2738
|
+
components,
|
|
2739
|
+
ns: ns || t && t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
|
|
2740
|
+
i18n,
|
|
2741
|
+
t: tFromProps,
|
|
2742
|
+
shouldUnescape,
|
|
2743
|
+
...additionalProps
|
|
2744
|
+
});
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2444
2747
|
const usePrevious = (value, ignore) => {
|
|
2445
2748
|
const ref = useRef();
|
|
2446
2749
|
useEffect(() => {
|
|
@@ -2559,7 +2862,8 @@ var common = {
|
|
|
2559
2862
|
rename: "Rename",
|
|
2560
2863
|
segments: "Segments",
|
|
2561
2864
|
userCount: "{{count}} Users",
|
|
2562
|
-
yes: "Yes"
|
|
2865
|
+
yes: "Yes",
|
|
2866
|
+
update: "Update"
|
|
2563
2867
|
};
|
|
2564
2868
|
var messages = {
|
|
2565
2869
|
enterResource: "Enter {{resource}}",
|
|
@@ -2590,8 +2894,8 @@ var shortcuts = {
|
|
|
2590
2894
|
};
|
|
2591
2895
|
var segments = {
|
|
2592
2896
|
addNewSegment: "Add new segment",
|
|
2593
|
-
deleteAlertMessage: "
|
|
2594
|
-
deleteAlertTitle: "Delete
|
|
2897
|
+
deleteAlertMessage: "You are permanently deleting the segment <strong>{{entity}}</strong>. This can't be undone.",
|
|
2898
|
+
deleteAlertTitle: "Delete segment?",
|
|
2595
2899
|
manageSegments: "Manage segments",
|
|
2596
2900
|
name: "Segment name",
|
|
2597
2901
|
noSegmentsFound: "No segments found",
|
|
@@ -2602,8 +2906,8 @@ var segments = {
|
|
|
2602
2906
|
segmentName: "Segment name",
|
|
2603
2907
|
showLess: "See less",
|
|
2604
2908
|
showMoreNumbers: "See {{entity}} more",
|
|
2605
|
-
updateSegment: "Update segment",
|
|
2606
|
-
updateSegmentMessage: "
|
|
2909
|
+
updateSegment: "Update segment?",
|
|
2910
|
+
updateSegmentMessage: "You are trying to update the current segment."
|
|
2607
2911
|
};
|
|
2608
2912
|
var labels = {
|
|
2609
2913
|
keyword: "Keyword"
|
|
@@ -2702,15 +3006,15 @@ function _defineProperty(obj, key, value) {
|
|
|
2702
3006
|
var SHORTCUTS = {
|
|
2703
3007
|
closePane: {
|
|
2704
3008
|
sequence: "escape",
|
|
2705
|
-
description: t$
|
|
3009
|
+
description: t$2("shortcuts.closePane")
|
|
2706
3010
|
},
|
|
2707
3011
|
deleteBlock: {
|
|
2708
3012
|
sequence: "backspace",
|
|
2709
|
-
description: t$
|
|
3013
|
+
description: t$2("shortcuts.deleteBlock")
|
|
2710
3014
|
},
|
|
2711
3015
|
openFilterPane: {
|
|
2712
3016
|
sequence: "enter",
|
|
2713
|
-
description: t$
|
|
3017
|
+
description: t$2("shortcuts.openFilterPane")
|
|
2714
3018
|
}
|
|
2715
3019
|
};
|
|
2716
3020
|
|
|
@@ -2798,48 +3102,48 @@ var DATE_RULES = {
|
|
|
2798
3102
|
};
|
|
2799
3103
|
|
|
2800
3104
|
var NUMBER_RULES = [{
|
|
2801
|
-
label: t$
|
|
3105
|
+
label: t$2("rules.exactly"),
|
|
2802
3106
|
value: "is"
|
|
2803
3107
|
}, {
|
|
2804
|
-
label: t$
|
|
3108
|
+
label: t$2("rules.notExactly"),
|
|
2805
3109
|
value: "is_not"
|
|
2806
3110
|
}, {
|
|
2807
|
-
label: t$
|
|
3111
|
+
label: t$2("rules.greaterThan"),
|
|
2808
3112
|
value: "greater_than"
|
|
2809
3113
|
}, {
|
|
2810
|
-
label: t$
|
|
3114
|
+
label: t$2("rules.lessThan"),
|
|
2811
3115
|
value: "less_than"
|
|
2812
3116
|
}];
|
|
2813
3117
|
var TEXT_RULES = [{
|
|
2814
|
-
label: t$
|
|
3118
|
+
label: t$2("rules.contains"),
|
|
2815
3119
|
value: "contains"
|
|
2816
3120
|
}, {
|
|
2817
|
-
label: t$
|
|
3121
|
+
label: t$2("rules.doesNotContain"),
|
|
2818
3122
|
value: "does_not_contain"
|
|
2819
3123
|
}, {
|
|
2820
|
-
label: t$
|
|
3124
|
+
label: t$2("rules.exactly"),
|
|
2821
3125
|
value: "is"
|
|
2822
3126
|
}, {
|
|
2823
|
-
label: t$
|
|
3127
|
+
label: t$2("rules.notExactly"),
|
|
2824
3128
|
value: "is_not"
|
|
2825
3129
|
}, {
|
|
2826
|
-
label: t$
|
|
3130
|
+
label: t$2("rules.startsWith"),
|
|
2827
3131
|
value: "starts_with"
|
|
2828
3132
|
}, {
|
|
2829
|
-
label: t$
|
|
3133
|
+
label: t$2("rules.doesNotStartWith"),
|
|
2830
3134
|
value: "does_not_start_with"
|
|
2831
3135
|
}, {
|
|
2832
|
-
label: t$
|
|
3136
|
+
label: t$2("rules.endsWith"),
|
|
2833
3137
|
value: "ends_with"
|
|
2834
3138
|
}, {
|
|
2835
|
-
label: t$
|
|
3139
|
+
label: t$2("rules.doesNotEndWith"),
|
|
2836
3140
|
value: "does_not_end_with"
|
|
2837
3141
|
}];
|
|
2838
3142
|
var DEFAULT_BOOLEAN_OPTIONS = [{
|
|
2839
|
-
label: t$
|
|
3143
|
+
label: t$2("common.yes"),
|
|
2840
3144
|
value: "true"
|
|
2841
3145
|
}, {
|
|
2842
|
-
label: t$
|
|
3146
|
+
label: t$2("common.no"),
|
|
2843
3147
|
value: "false"
|
|
2844
3148
|
}];
|
|
2845
3149
|
|
|
@@ -3852,6 +4156,7 @@ var Segment = function Segment(_ref) {
|
|
|
3852
4156
|
isOpen: isUpdateAlertOpen,
|
|
3853
4157
|
isSubmitting: isUpdating,
|
|
3854
4158
|
message: t("segments.updateSegmentMessage"),
|
|
4159
|
+
submitButtonLabel: t("common.update"),
|
|
3855
4160
|
title: t("segments.updateSegment"),
|
|
3856
4161
|
onClose: function onClose() {
|
|
3857
4162
|
return setIsUpdateAlertOpen(false);
|
|
@@ -6469,6 +6774,15 @@ var useFilters = function useFilters(_ref) {
|
|
|
6469
6774
|
rule: "contains",
|
|
6470
6775
|
label: "Keyword"
|
|
6471
6776
|
}, keyword);
|
|
6777
|
+
var handlePrecenseOfDefaultFilters = function handlePrecenseOfDefaultFilters(defaultFilters) {
|
|
6778
|
+
var params = buildUrlFromFilters({
|
|
6779
|
+
columns: columns,
|
|
6780
|
+
filters: keyword.value !== "" ? [].concat(_toConsumableArray(defaultFilters), [keywordFilter]) : defaultFilters
|
|
6781
|
+
});
|
|
6782
|
+
history.replace({
|
|
6783
|
+
search: params
|
|
6784
|
+
});
|
|
6785
|
+
};
|
|
6472
6786
|
|
|
6473
6787
|
//This function sends the updated filters to host via callbacks.
|
|
6474
6788
|
var sendUpdatedFilters = function sendUpdatedFilters() {
|
|
@@ -6504,6 +6818,8 @@ var useFilters = function useFilters(_ref) {
|
|
|
6504
6818
|
initialRender.current = false;
|
|
6505
6819
|
var keywordValue = getKeywordValueFromUrl();
|
|
6506
6820
|
keyword.setValue(keywordValue);
|
|
6821
|
+
var defaultFilters = buildDefaultFilters(columns, filters);
|
|
6822
|
+
isNotEmpty(defaultFilters) && handlePrecenseOfDefaultFilters(defaultFilters);
|
|
6507
6823
|
} else {
|
|
6508
6824
|
handleChangesInURL();
|
|
6509
6825
|
sendUpdatedFilters();
|
|
@@ -7213,6 +7529,19 @@ var Pane = function Pane(_ref) {
|
|
|
7213
7529
|
groupedColumns = _buildFilteredColumns2 === void 0 ? [] : _buildFilteredColumns2,
|
|
7214
7530
|
_buildFilteredColumns3 = _buildFilteredColumns.ungroupedColumns,
|
|
7215
7531
|
ungroupedColumns = _buildFilteredColumns3 === void 0 ? [] : _buildFilteredColumns3;
|
|
7532
|
+
var handleChange = function handleChange(newFilters) {
|
|
7533
|
+
var isClearAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7534
|
+
var params = buildUrlFromFilters(_objectSpread({
|
|
7535
|
+
columns: columns,
|
|
7536
|
+
filters: keyword.value !== "" ? [].concat(_toConsumableArray(newFilters), [keywordFilter]) : newFilters
|
|
7537
|
+
}, isClearAll && {
|
|
7538
|
+
isClearAll: true,
|
|
7539
|
+
childrenKeys: childrenKeys
|
|
7540
|
+
}));
|
|
7541
|
+
history.push({
|
|
7542
|
+
search: params
|
|
7543
|
+
});
|
|
7544
|
+
};
|
|
7216
7545
|
var filters = useFilters({
|
|
7217
7546
|
onFiltersChange: onChange,
|
|
7218
7547
|
columns: columns,
|
|
@@ -7240,19 +7569,6 @@ var Pane = function Pane(_ref) {
|
|
|
7240
7569
|
});
|
|
7241
7570
|
onClose();
|
|
7242
7571
|
};
|
|
7243
|
-
var handleChange = function handleChange(newFilters) {
|
|
7244
|
-
var isClearAll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
7245
|
-
var params = buildUrlFromFilters(_objectSpread({
|
|
7246
|
-
columns: columns,
|
|
7247
|
-
filters: keyword.value !== "" ? [].concat(_toConsumableArray(newFilters), [keywordFilter]) : newFilters
|
|
7248
|
-
}, isClearAll && {
|
|
7249
|
-
isClearAll: true,
|
|
7250
|
-
childrenKeys: childrenKeys
|
|
7251
|
-
}));
|
|
7252
|
-
history.push({
|
|
7253
|
-
search: params
|
|
7254
|
-
});
|
|
7255
|
-
};
|
|
7256
7572
|
var isClearFiltersDisabled = !filters.some(function (_ref3) {
|
|
7257
7573
|
var value = _ref3.value,
|
|
7258
7574
|
defaultValue = _ref3.defaultValue;
|
|
@@ -7424,12 +7740,13 @@ var DeleteAlert = function DeleteAlert(_ref) {
|
|
|
7424
7740
|
return /*#__PURE__*/React.createElement(Alert, {
|
|
7425
7741
|
isOpen: isOpen,
|
|
7426
7742
|
isSubmitting: isDeleting,
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7430
|
-
|
|
7431
|
-
|
|
7432
|
-
|
|
7743
|
+
submitButtonLabel: t("common.delete"),
|
|
7744
|
+
title: t("segments.deleteAlertTitle"),
|
|
7745
|
+
message: /*#__PURE__*/React.createElement(Trans, {
|
|
7746
|
+
i18nKey: "segments.deleteAlertMessage",
|
|
7747
|
+
values: {
|
|
7748
|
+
entity: segment.name
|
|
7749
|
+
}
|
|
7433
7750
|
}),
|
|
7434
7751
|
onClose: onClose,
|
|
7435
7752
|
onSubmit: handleDelete
|