@carbon/ibm-products 2.43.2-canary.172 → 2.43.2-canary.174
Sign up to get free protection for your applications and to get access to all the features.
- package/css/index-full-carbon.css +13 -1
- package/css/index-full-carbon.css.map +1 -1
- package/css/index-full-carbon.min.css +1 -1
- package/css/index-full-carbon.min.css.map +1 -1
- package/css/index-without-carbon-released-only.css +4 -0
- package/css/index-without-carbon-released-only.css.map +1 -1
- package/css/index-without-carbon-released-only.min.css +1 -1
- package/css/index-without-carbon-released-only.min.css.map +1 -1
- package/css/index-without-carbon.css +13 -1
- package/css/index-without-carbon.css.map +1 -1
- package/css/index-without-carbon.min.css +1 -1
- package/css/index-without-carbon.min.css.map +1 -1
- package/css/index.css +13 -1
- package/css/index.css.map +1 -1
- package/css/index.min.css +1 -1
- package/css/index.min.css.map +1 -1
- package/es/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +7 -3
- package/es/components/ConditionBuilder/ConditionBuilder.js +2 -1
- package/es/components/ConditionBuilder/ConditionBuilder.types.d.ts +2 -1
- package/es/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +4 -2
- package/es/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +4 -1
- package/es/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +2 -2
- package/es/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +5 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -0
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +9 -3
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +1 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +3 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +11 -5
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +1 -1
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -2
- package/es/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +1 -1
- package/es/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +7 -4
- package/es/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +1 -1
- package/es/components/ConditionBuilder/utils/handleKeyboardEvents.js +1 -2
- package/es/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/es/components/ConditionBuilder/utils/useDataConfigs.js +120 -0
- package/es/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/es/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/es/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/es/components/ConditionBuilder/utils/util.js +48 -2
- package/es/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/es/components/Datagrid/types/index.d.ts +1 -0
- package/lib/components/ConditionBuilder/ConditionBlock/ConditionBlock.js +17 -13
- package/lib/components/ConditionBuilder/ConditionBuilder.js +5 -4
- package/lib/components/ConditionBuilder/ConditionBuilder.types.d.ts +2 -1
- package/lib/components/ConditionBuilder/ConditionBuilderActions/ConditionBuilderActions.js +9 -9
- package/lib/components/ConditionBuilder/ConditionBuilderAdd/ConditionBuilderAdd.js +6 -6
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderButton/ConditionBuilderButton.js +3 -3
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/ConditionConnector.js +7 -5
- package/lib/components/ConditionBuilder/ConditionBuilderConnector/GroupConnector.js +8 -5
- package/lib/components/ConditionBuilder/ConditionBuilderContent/ConditionBuilderContent.js +11 -11
- package/lib/components/ConditionBuilder/ConditionBuilderContext/ConditionBuilderProvider.js +1 -1
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.d.ts +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilderContext/translationObject.js +5 -0
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItem.js +13 -7
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemDate/ConditionBuilderItemDate.js +2 -3
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemNumber/ConditionBuilderItemNumber.js +2 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.d.ts +3 -1
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOption.js +17 -11
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemOption/ItemOptionForValueField.js +12 -12
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemText/ConditionBuilderItemText.js +1 -2
- package/lib/components/ConditionBuilder/ConditionBuilderItem/ConditionBuilderItemTime/ConditionBuilderItemTime.js +2 -2
- package/lib/components/ConditionBuilder/ConditionGroupBuilder/ConditionGroupBuilder.js +20 -17
- package/lib/components/ConditionBuilder/ConditionPreview/ConditionPreview.js +17 -17
- package/lib/components/ConditionBuilder/utils/handleKeyboardEvents.js +8 -9
- package/lib/components/ConditionBuilder/utils/useDataConfigs.d.ts +18 -0
- package/lib/components/ConditionBuilder/utils/useDataConfigs.js +124 -0
- package/lib/components/ConditionBuilder/utils/useTranslations.d.ts +1 -1
- package/lib/components/ConditionBuilder/utils/useTranslations.js +4 -1
- package/lib/components/ConditionBuilder/utils/util.d.ts +12 -0
- package/lib/components/ConditionBuilder/utils/util.js +53 -3
- package/lib/components/Datagrid/Datagrid/DatagridToolbar.js +8 -3
- package/lib/components/Datagrid/types/index.d.ts +1 -0
- package/package.json +3 -3
- package/scss/components/ConditionBuilder/styles/_conditionBuilderItem.scss +10 -1
- package/scss/components/Datagrid/styles/_datagrid.scss +6 -0
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -30
- package/es/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -125
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.d.ts +0 -30
- package/lib/components/ConditionBuilder/ConditionBuilderContext/DataConfigs.js +0 -135
@@ -1,125 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
import { pkg } from '../../../settings.js';
|
9
|
-
|
10
|
-
var statementConfig = [{
|
11
|
-
label: 'if',
|
12
|
-
id: 'if',
|
13
|
-
connector: 'and'
|
14
|
-
}, {
|
15
|
-
label: 'excl.if',
|
16
|
-
id: 'excl_if',
|
17
|
-
connector: 'or'
|
18
|
-
}];
|
19
|
-
var connectorConfig = [{
|
20
|
-
label: 'and',
|
21
|
-
id: 'and'
|
22
|
-
}, {
|
23
|
-
label: 'or',
|
24
|
-
id: 'or'
|
25
|
-
}];
|
26
|
-
var operatorConfig = [{
|
27
|
-
label: 'is',
|
28
|
-
id: 'is',
|
29
|
-
type: 'all'
|
30
|
-
}, {
|
31
|
-
label: 'is greater than',
|
32
|
-
id: 'greater',
|
33
|
-
type: 'number'
|
34
|
-
}, {
|
35
|
-
label: 'is greater than or equal to',
|
36
|
-
id: 'greaterEqual',
|
37
|
-
type: 'number'
|
38
|
-
}, {
|
39
|
-
label: 'is lower than',
|
40
|
-
id: 'lower',
|
41
|
-
type: 'number'
|
42
|
-
}, {
|
43
|
-
label: 'is lower than or equal to',
|
44
|
-
id: 'lowerEqual',
|
45
|
-
type: 'number'
|
46
|
-
}, {
|
47
|
-
label: 'starts with',
|
48
|
-
id: 'startsWith',
|
49
|
-
type: 'text,textarea'
|
50
|
-
}, {
|
51
|
-
label: 'ends with',
|
52
|
-
id: 'endsWith',
|
53
|
-
type: 'text,textarea'
|
54
|
-
}, {
|
55
|
-
label: 'contains',
|
56
|
-
id: 'contains',
|
57
|
-
type: 'text,textarea'
|
58
|
-
}, {
|
59
|
-
label: 'is one of',
|
60
|
-
id: 'oneOf',
|
61
|
-
type: 'option'
|
62
|
-
}, {
|
63
|
-
label: 'is before',
|
64
|
-
id: 'before',
|
65
|
-
type: 'date,time'
|
66
|
-
}, {
|
67
|
-
label: 'is after',
|
68
|
-
id: 'after',
|
69
|
-
type: 'date,time'
|
70
|
-
}, {
|
71
|
-
label: 'is between',
|
72
|
-
id: 'between',
|
73
|
-
type: 'date'
|
74
|
-
}];
|
75
|
-
var NON_HIERARCHICAL_VARIANT = 'Non-Hierarchical';
|
76
|
-
var HIERARCHICAL_VARIANT = 'Hierarchical';
|
77
|
-
// The block part of our conventional BEM class names (blockClass__E--M).
|
78
|
-
var blockClass = "".concat(pkg.prefix, "--condition-builder");
|
79
|
-
var formatDate = function formatDate(date) {
|
80
|
-
var day = String(date.getDate()).padStart(2, '0');
|
81
|
-
var month = String(date.getMonth() + 1).padStart(2, '0');
|
82
|
-
var year = date.getFullYear();
|
83
|
-
return "".concat(day, "/").concat(month, "/").concat(year);
|
84
|
-
};
|
85
|
-
//const translationsObjectCurrent = translationsObject['en']; // TO DO: need to discuss if language is to be passed as prop
|
86
|
-
|
87
|
-
var valueRenderers = {
|
88
|
-
text: function text(val) {
|
89
|
-
return val;
|
90
|
-
},
|
91
|
-
textarea: function textarea(val) {
|
92
|
-
return val;
|
93
|
-
},
|
94
|
-
time: function time(val) {
|
95
|
-
return val;
|
96
|
-
},
|
97
|
-
number: function number(val) {
|
98
|
-
return val;
|
99
|
-
},
|
100
|
-
option: function option(value) {
|
101
|
-
if (value && typeof value !== 'string') {
|
102
|
-
var selectedValues = Array.isArray(value) ? value : [value];
|
103
|
-
return selectedValues.map(function (option) {
|
104
|
-
return option.label;
|
105
|
-
}).join(', ');
|
106
|
-
}
|
107
|
-
return value;
|
108
|
-
},
|
109
|
-
date: function date(value) {
|
110
|
-
if (Array.isArray(value) && value.length > 1) {
|
111
|
-
var start = value !== null && value !== void 0 && value[0] && !isNaN(new Date(value[0])) ? formatDate(new Date(value[0])) : '';
|
112
|
-
var end = value !== null && value !== void 0 && value[1] && !isNaN(new Date(value[1])) ? formatDate(new Date(value[1])) : '';
|
113
|
-
return "".concat(start, " To ").concat(end);
|
114
|
-
} else if (Array.isArray(value) && !isNaN(new Date(value[0]))) {
|
115
|
-
return formatDate(new Date(value[0]));
|
116
|
-
} else {
|
117
|
-
return value;
|
118
|
-
}
|
119
|
-
},
|
120
|
-
custom: function custom(value) {
|
121
|
-
return value;
|
122
|
-
}
|
123
|
-
};
|
124
|
-
|
125
|
-
export { HIERARCHICAL_VARIANT, NON_HIERARCHICAL_VARIANT, blockClass, connectorConfig, operatorConfig, statementConfig, valueRenderers };
|
@@ -1,30 +0,0 @@
|
|
1
|
-
export const statementConfig: {
|
2
|
-
label: string;
|
3
|
-
id: string;
|
4
|
-
connector: string;
|
5
|
-
}[];
|
6
|
-
export const connectorConfig: {
|
7
|
-
label: string;
|
8
|
-
id: string;
|
9
|
-
}[];
|
10
|
-
export const actionConfig: {
|
11
|
-
label: string;
|
12
|
-
id: string;
|
13
|
-
}[];
|
14
|
-
export const operatorConfig: {
|
15
|
-
label: string;
|
16
|
-
id: string;
|
17
|
-
type: string;
|
18
|
-
}[];
|
19
|
-
export const NON_HIERARCHICAL_VARIANT: "Non-Hierarchical";
|
20
|
-
export const HIERARCHICAL_VARIANT: "Hierarchical";
|
21
|
-
export const blockClass: string;
|
22
|
-
export namespace valueRenderers {
|
23
|
-
function text(val: any): any;
|
24
|
-
function textarea(val: any): any;
|
25
|
-
function time(val: any): any;
|
26
|
-
function number(val: any): any;
|
27
|
-
function option(value: any): any;
|
28
|
-
function date(value: any): any;
|
29
|
-
function custom(value: any): any;
|
30
|
-
}
|
@@ -1,135 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Copyright IBM Corp. 2020, 2024
|
3
|
-
*
|
4
|
-
* This source code is licensed under the Apache-2.0 license found in the
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
6
|
-
*/
|
7
|
-
|
8
|
-
'use strict';
|
9
|
-
|
10
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
11
|
-
|
12
|
-
var settings = require('../../../settings.js');
|
13
|
-
|
14
|
-
var statementConfig = [{
|
15
|
-
label: 'if',
|
16
|
-
id: 'if',
|
17
|
-
connector: 'and'
|
18
|
-
}, {
|
19
|
-
label: 'excl.if',
|
20
|
-
id: 'excl_if',
|
21
|
-
connector: 'or'
|
22
|
-
}];
|
23
|
-
var connectorConfig = [{
|
24
|
-
label: 'and',
|
25
|
-
id: 'and'
|
26
|
-
}, {
|
27
|
-
label: 'or',
|
28
|
-
id: 'or'
|
29
|
-
}];
|
30
|
-
var operatorConfig = [{
|
31
|
-
label: 'is',
|
32
|
-
id: 'is',
|
33
|
-
type: 'all'
|
34
|
-
}, {
|
35
|
-
label: 'is greater than',
|
36
|
-
id: 'greater',
|
37
|
-
type: 'number'
|
38
|
-
}, {
|
39
|
-
label: 'is greater than or equal to',
|
40
|
-
id: 'greaterEqual',
|
41
|
-
type: 'number'
|
42
|
-
}, {
|
43
|
-
label: 'is lower than',
|
44
|
-
id: 'lower',
|
45
|
-
type: 'number'
|
46
|
-
}, {
|
47
|
-
label: 'is lower than or equal to',
|
48
|
-
id: 'lowerEqual',
|
49
|
-
type: 'number'
|
50
|
-
}, {
|
51
|
-
label: 'starts with',
|
52
|
-
id: 'startsWith',
|
53
|
-
type: 'text,textarea'
|
54
|
-
}, {
|
55
|
-
label: 'ends with',
|
56
|
-
id: 'endsWith',
|
57
|
-
type: 'text,textarea'
|
58
|
-
}, {
|
59
|
-
label: 'contains',
|
60
|
-
id: 'contains',
|
61
|
-
type: 'text,textarea'
|
62
|
-
}, {
|
63
|
-
label: 'is one of',
|
64
|
-
id: 'oneOf',
|
65
|
-
type: 'option'
|
66
|
-
}, {
|
67
|
-
label: 'is before',
|
68
|
-
id: 'before',
|
69
|
-
type: 'date,time'
|
70
|
-
}, {
|
71
|
-
label: 'is after',
|
72
|
-
id: 'after',
|
73
|
-
type: 'date,time'
|
74
|
-
}, {
|
75
|
-
label: 'is between',
|
76
|
-
id: 'between',
|
77
|
-
type: 'date'
|
78
|
-
}];
|
79
|
-
var NON_HIERARCHICAL_VARIANT = 'Non-Hierarchical';
|
80
|
-
var HIERARCHICAL_VARIANT = 'Hierarchical';
|
81
|
-
// The block part of our conventional BEM class names (blockClass__E--M).
|
82
|
-
var blockClass = "".concat(settings.pkg.prefix, "--condition-builder");
|
83
|
-
var formatDate = function formatDate(date) {
|
84
|
-
var day = String(date.getDate()).padStart(2, '0');
|
85
|
-
var month = String(date.getMonth() + 1).padStart(2, '0');
|
86
|
-
var year = date.getFullYear();
|
87
|
-
return "".concat(day, "/").concat(month, "/").concat(year);
|
88
|
-
};
|
89
|
-
//const translationsObjectCurrent = translationsObject['en']; // TO DO: need to discuss if language is to be passed as prop
|
90
|
-
|
91
|
-
var valueRenderers = {
|
92
|
-
text: function text(val) {
|
93
|
-
return val;
|
94
|
-
},
|
95
|
-
textarea: function textarea(val) {
|
96
|
-
return val;
|
97
|
-
},
|
98
|
-
time: function time(val) {
|
99
|
-
return val;
|
100
|
-
},
|
101
|
-
number: function number(val) {
|
102
|
-
return val;
|
103
|
-
},
|
104
|
-
option: function option(value) {
|
105
|
-
if (value && typeof value !== 'string') {
|
106
|
-
var selectedValues = Array.isArray(value) ? value : [value];
|
107
|
-
return selectedValues.map(function (option) {
|
108
|
-
return option.label;
|
109
|
-
}).join(', ');
|
110
|
-
}
|
111
|
-
return value;
|
112
|
-
},
|
113
|
-
date: function date(value) {
|
114
|
-
if (Array.isArray(value) && value.length > 1) {
|
115
|
-
var start = value !== null && value !== void 0 && value[0] && !isNaN(new Date(value[0])) ? formatDate(new Date(value[0])) : '';
|
116
|
-
var end = value !== null && value !== void 0 && value[1] && !isNaN(new Date(value[1])) ? formatDate(new Date(value[1])) : '';
|
117
|
-
return "".concat(start, " To ").concat(end);
|
118
|
-
} else if (Array.isArray(value) && !isNaN(new Date(value[0]))) {
|
119
|
-
return formatDate(new Date(value[0]));
|
120
|
-
} else {
|
121
|
-
return value;
|
122
|
-
}
|
123
|
-
},
|
124
|
-
custom: function custom(value) {
|
125
|
-
return value;
|
126
|
-
}
|
127
|
-
};
|
128
|
-
|
129
|
-
exports.HIERARCHICAL_VARIANT = HIERARCHICAL_VARIANT;
|
130
|
-
exports.NON_HIERARCHICAL_VARIANT = NON_HIERARCHICAL_VARIANT;
|
131
|
-
exports.blockClass = blockClass;
|
132
|
-
exports.connectorConfig = connectorConfig;
|
133
|
-
exports.operatorConfig = operatorConfig;
|
134
|
-
exports.statementConfig = statementConfig;
|
135
|
-
exports.valueRenderers = valueRenderers;
|