cx 24.10.1 → 24.10.3

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/util.js CHANGED
@@ -255,6 +255,12 @@ var formatFactory = {
255
255
  return s.padStart(length, "0");
256
256
  };
257
257
  },
258
+ leftPad: function leftPad(part0, length, _char) {
259
+ return function (value) {
260
+ var s = String(value);
261
+ return s.padStart(length, _char != null ? _char : " ");
262
+ };
263
+ },
258
264
  capitalize: function capitalize$1() {
259
265
  return function (value) {
260
266
  var s = String(value);
@@ -279,6 +285,7 @@ formatFactory.d = formatFactory.date;
279
285
  formatFactory.t = formatFactory.time;
280
286
  formatFactory.dt = formatFactory.datetime;
281
287
  formatFactory.zeropad = formatFactory.zeroPad;
288
+ formatFactory.leftpad = formatFactory.leftPad;
282
289
  formatFactory.capitalize = formatFactory.capitalize;
283
290
  formatFactory.titlecase = formatFactory.titleCase;
284
291
  function buildFormatter(format) {
package/dist/widgets.css CHANGED
@@ -4899,54 +4899,57 @@ th.cxe-calendar-display {
4899
4899
  .cxe-grid-group-caption:not(:first-child) td {
4900
4900
  padding-top: 15px;
4901
4901
  }
4902
- .cxe-grid-group-caption.cxs-level-2 {
4903
- font-size: 130%;
4902
+
4903
+ .cxe-grid-group-caption.cxs-level-1 td {
4904
+ font-weight: bold;
4905
+ font-size: 115%;
4904
4906
  }
4907
+
4905
4908
  .cxe-grid-group-caption.cxs-level-2 td {
4909
+ font-weight: bold;
4910
+ font-size: 130%;
4906
4911
  border-bottom: 1px solid grey;
4907
4912
  }
4908
- .cxe-grid-group-caption.cxs-level-3 {
4909
- font-size: 145%;
4910
- }
4913
+
4911
4914
  .cxe-grid-group-caption.cxs-level-3 td {
4915
+ font-weight: bold;
4916
+ font-size: 145%;
4912
4917
  border-bottom: 1px solid grey;
4913
4918
  }
4914
- .cxe-grid-group-caption.cxs-level-4 {
4915
- font-size: 160%;
4916
- }
4919
+
4917
4920
  .cxe-grid-group-caption.cxs-level-4 td {
4921
+ font-weight: bold;
4922
+ font-size: 160%;
4918
4923
  border-bottom: 1px solid grey;
4919
4924
  }
4920
4925
 
4921
- .cxe-grid-group-footer {
4922
- font-weight: bold;
4923
- }
4924
4926
  .cxe-grid-group-footer td {
4925
- border-top: 1px solid #bfbfbf;
4926
4927
  box-sizing: border-box;
4927
4928
  }
4928
4929
  .cxe-grid-group-footer td.cxs-pad {
4929
4930
  padding: 5px;
4930
4931
  }
4931
- .cxe-grid-group-footer.cxs-level-2 {
4932
+
4933
+ .cxe-grid-group-footer.cxs-level-1 td {
4932
4934
  font-weight: bold;
4933
- font-size: 110%;
4935
+ border-top: 1px solid #bfbfbf;
4934
4936
  }
4937
+
4935
4938
  .cxe-grid-group-footer.cxs-level-2 td {
4939
+ font-weight: bold;
4940
+ font-size: 110%;
4936
4941
  border-top: 1px solid grey;
4937
4942
  }
4938
- .cxe-grid-group-footer.cxs-level-3 {
4943
+
4944
+ .cxe-grid-group-footer.cxs-level-3 td {
4939
4945
  font-weight: bold;
4940
4946
  font-size: 120%;
4941
- }
4942
- .cxe-grid-group-footer.cxs-level-3 td {
4943
4947
  border-top: 1px solid grey;
4944
4948
  }
4945
- .cxe-grid-group-footer.cxs-level-4 {
4949
+
4950
+ .cxe-grid-group-footer.cxs-level-4 td {
4946
4951
  font-weight: bold;
4947
4952
  font-size: 130%;
4948
- }
4949
- .cxe-grid-group-footer.cxs-level-4 td {
4950
4953
  border-top: 1px solid grey;
4951
4954
  }
4952
4955
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.10.1",
3
+ "version": "24.10.3",
4
4
  "description": "Advanced JavaScript UI framework for admin and dashboard applications with ready to use grid, form and chart components.",
5
5
  "main": "index.js",
6
6
  "jsnext:main": "src/index.js",
@@ -69,7 +69,15 @@ export class LegendEntry extends Container {
69
69
  let { data } = instance;
70
70
  let content = !isUndefined(this.text) ? data.text : this.renderChildren(context, instance);
71
71
  return (
72
- <div key={key} className={data.classNames} style={data.style}>
72
+ <div
73
+ key={key}
74
+ className={data.classNames}
75
+ style={data.style}
76
+ onMouseDown={stopPropagation}
77
+ onClick={(e) => {
78
+ this.handleClick(e, instance);
79
+ }}
80
+ >
73
81
  {this.renderShape(instance)}
74
82
  {content != null && <div>{content}</div>}
75
83
  </div>
@@ -1,261 +1,269 @@
1
- import { debug } from "./Debug";
2
- import { GlobalCacheIdentifier } from "./GlobalCacheIdentifier";
3
- import { isNumber } from "../util/isNumber";
4
- import { isUndefined } from "../util/isUndefined";
5
- import { isArray } from "../util/isArray";
6
- import { capitalize } from "./capitalize";
7
-
8
- //Culture dependent formatters are defined in the ui package.
9
-
10
- const defaultFormatter = (v) => v.toString();
11
-
12
- let formatFactory = {
13
- string: function () {
14
- return defaultFormatter;
15
- },
16
-
17
- wrap: function (part0, prefix, suffix) {
18
- if (!prefix) prefix = "";
19
-
20
- if (!suffix) suffix = "";
21
-
22
- return (value) => prefix + value.toString() + suffix;
23
- },
24
-
25
- fixed: function (part0, digits) {
26
- return (value) => value.toFixed(digits);
27
- },
28
-
29
- prefix: function (part0, prefix) {
30
- if (!prefix) prefix = "";
31
-
32
- return (value) => prefix + value.toString();
33
- },
34
-
35
- suffix: function (part0, suffix) {
36
- if (!suffix) suffix = "";
37
-
38
- return (value) => value.toString() + suffix;
39
- },
40
-
41
- uppercase: function () {
42
- return (value) => value.toString().toUpperCase();
43
- },
44
-
45
- lowercase: function () {
46
- return (value) => value.toString().toLowerCase();
47
- },
48
-
49
- urlencode: function () {
50
- return (value) => encodeURIComponent(value);
51
- },
52
-
53
- number: function (part0, minFractionDigits, maxFractionDigits) {
54
- let { minimumFractionDigits, maximumFractionDigits } = resolveMinMaxFractionDigits(
55
- minFractionDigits,
56
- maxFractionDigits,
57
- );
58
- let trimmable = maximumFractionDigits - minimumFractionDigits;
59
- if (trimmable > 0) {
60
- if (minimumFractionDigits == 0) ++trimmable;
61
- return (value) => trimFractionZeros(value.toFixed(maximumFractionDigits), trimmable);
62
- }
63
- return (value) => value.toFixed(maximumFractionDigits);
64
- },
65
-
66
- percentage: function (part0, minFractionDigits, maxFractionDigits) {
67
- let numberFormatter = formatFactory.number(part0, minFractionDigits, maxFractionDigits);
68
- return (value) => numberFormatter(value * 100) + "%";
69
- },
70
-
71
- percentageSign: function (part0, minFractionDigits, maxFractionDigits) {
72
- let numberFormatter = formatFactory.number(part0, minFractionDigits, maxFractionDigits);
73
- return (value) => numberFormatter(value) + "%";
74
- },
75
-
76
- date: function () {
77
- return (value) => {
78
- let date = new Date(value);
79
- return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
80
- };
81
- },
82
-
83
- time: function () {
84
- return (value) => {
85
- let date = new Date(value);
86
- let h = date.getHours() >= 10 ? date.getHours() : "0" + date.getHours();
87
- let m = date.getMinutes() >= 10 ? date.getMinutes() : "0" + date.getMinutes();
88
- return `${h}:${m}`;
89
- };
90
- },
91
-
92
- datetime: function () {
93
- let date = formatFactory.date();
94
- let time = formatFactory.time();
95
- return (value) => date(value) + " " + time(value);
96
- },
97
-
98
- ellipsis: function (part0, length, where) {
99
- length = Number(length);
100
- if (!(length > 3)) length = 10;
101
- switch (where) {
102
- default:
103
- case "end":
104
- return (value) => {
105
- let s = String(value);
106
- if (s.length > length) return s.substring(0, length - 3) + "...";
107
- return s;
108
- };
109
-
110
- case "start":
111
- return (value) => {
112
- let s = String(value);
113
- if (s.length > length) return "..." + s.substring(s.length - length + 3);
114
- return s;
115
- };
116
-
117
- case "middle":
118
- return (value) => {
119
- let s = String(value);
120
- if (s.length > length) {
121
- let x = Math.floor(length - 2) / 2;
122
- return s.substring(0, x) + "..." + s.substring(s.length - (length - 3 - x));
123
- }
124
- return s;
125
- };
126
- }
127
- },
128
-
129
- zeroPad: function (part0, length) {
130
- return (value) => {
131
- let s = String(value);
132
- return s.padStart(length, "0");
133
- };
134
- },
135
-
136
- capitalize: function () {
137
- return (value) => {
138
- let s = String(value);
139
- return capitalize(s);
140
- };
141
- },
142
-
143
- titleCase: function () {
144
- return (value) => {
145
- let s = String(value);
146
- return s.replace(/\w\S*/g, function (word) {
147
- return capitalize(word.toLowerCase());
148
- });
149
- };
150
- },
151
- };
152
-
153
- formatFactory.s = formatFactory.str = formatFactory.string;
154
- formatFactory.f = formatFactory.fixed;
155
- formatFactory.n = formatFactory.number;
156
- formatFactory.p = formatFactory.percentage;
157
- formatFactory.ps = formatFactory.percentageSign;
158
- formatFactory.d = formatFactory.date;
159
- formatFactory.t = formatFactory.time;
160
- formatFactory.dt = formatFactory.datetime;
161
- formatFactory.zeropad = formatFactory.zeroPad;
162
- formatFactory.capitalize = formatFactory.capitalize;
163
- formatFactory.titlecase = formatFactory.titleCase;
164
-
165
- function buildFormatter(format) {
166
- let formatter = defaultFormatter,
167
- nullText = "";
168
- if (format) {
169
- let pipeParts = format.split("|");
170
- nullText = pipeParts[1] || "";
171
- let colonSepParts = pipeParts[0].split(":");
172
- for (let i = 0; i < colonSepParts.length; i++) {
173
- let parts = colonSepParts[i].split(";");
174
- let factory = formatFactory[parts[0]];
175
- if (!factory) debug("Unknown string format: " + format);
176
- else if (i == 0) formatter = factory(...parts);
177
- else {
178
- let outerFmt = factory(...parts);
179
- let innerFmt = formatter;
180
- formatter = (v) => outerFmt(innerFmt(v));
181
- }
182
- }
183
- }
184
- return (v) => (v == null || v === "" ? nullText : formatter(v));
185
- }
186
-
187
- let format = {
188
- cache: {},
189
- };
190
-
191
- function getDefaultFormatCache() {
192
- if (format.cacheIdentifier != GlobalCacheIdentifier.get()) {
193
- format = {
194
- cache: {},
195
- cacheIdentifier: GlobalCacheIdentifier.get(),
196
- };
197
- }
198
- return format.cache;
199
- }
200
-
201
- let getFormatCache = getDefaultFormatCache;
202
-
203
- export function setGetFormatCacheCallback(callback) {
204
- getFormatCache = callback;
205
- }
206
-
207
- function getFormatter(format) {
208
- if (!format) format = "";
209
- let formatCache = getFormatCache();
210
- let formatter = formatCache[format];
211
- if (!formatter) formatter = formatCache[format] = buildFormatter(format);
212
-
213
- return formatter;
214
- }
215
-
216
- export class Format {
217
- static value(v, format) {
218
- let formatter = getFormatter(format);
219
- return formatter(v);
220
- }
221
-
222
- static parse(format) {
223
- return getFormatter(format);
224
- }
225
-
226
- static register(format, formatter) {
227
- this.registerFactory(format, () => formatter);
228
- }
229
-
230
- static registerFactory(format, factory) {
231
- if (isArray(format)) format.forEach((f) => this.registerFactory(f, factory));
232
- else formatFactory[format] = factory;
233
- }
234
- }
235
-
236
- export function resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits) {
237
- minimumFractionDigits = minimumFractionDigits != null ? Number(minimumFractionDigits) : minimumFractionDigits;
238
- maximumFractionDigits = maximumFractionDigits != null ? Number(maximumFractionDigits) : maximumFractionDigits;
239
-
240
- if (isNumber(minimumFractionDigits)) {
241
- if (isUndefined(maximumFractionDigits)) maximumFractionDigits = minimumFractionDigits;
242
- else if (isNumber(maximumFractionDigits) && maximumFractionDigits < minimumFractionDigits)
243
- maximumFractionDigits = minimumFractionDigits;
244
- } else if (minimumFractionDigits == null && maximumFractionDigits == null) {
245
- minimumFractionDigits = 0;
246
- maximumFractionDigits = 18;
247
- }
248
-
249
- return {
250
- minimumFractionDigits,
251
- maximumFractionDigits,
252
- };
253
- }
254
-
255
- export function trimFractionZeros(str, max) {
256
- let cnt = 0,
257
- l = str.length;
258
- while (cnt < max && (str[l - 1 - cnt] === "0" || str[l - 1 - cnt] === ".")) cnt++;
259
-
260
- return cnt > 0 ? str.substring(0, l - cnt) : str;
261
- }
1
+ import { debug } from "./Debug";
2
+ import { GlobalCacheIdentifier } from "./GlobalCacheIdentifier";
3
+ import { isNumber } from "../util/isNumber";
4
+ import { isUndefined } from "../util/isUndefined";
5
+ import { isArray } from "../util/isArray";
6
+ import { capitalize } from "./capitalize";
7
+
8
+ //Culture dependent formatters are defined in the ui package.
9
+
10
+ const defaultFormatter = (v) => v.toString();
11
+
12
+ let formatFactory = {
13
+ string: function () {
14
+ return defaultFormatter;
15
+ },
16
+
17
+ wrap: function (part0, prefix, suffix) {
18
+ if (!prefix) prefix = "";
19
+
20
+ if (!suffix) suffix = "";
21
+
22
+ return (value) => prefix + value.toString() + suffix;
23
+ },
24
+
25
+ fixed: function (part0, digits) {
26
+ return (value) => value.toFixed(digits);
27
+ },
28
+
29
+ prefix: function (part0, prefix) {
30
+ if (!prefix) prefix = "";
31
+
32
+ return (value) => prefix + value.toString();
33
+ },
34
+
35
+ suffix: function (part0, suffix) {
36
+ if (!suffix) suffix = "";
37
+
38
+ return (value) => value.toString() + suffix;
39
+ },
40
+
41
+ uppercase: function () {
42
+ return (value) => value.toString().toUpperCase();
43
+ },
44
+
45
+ lowercase: function () {
46
+ return (value) => value.toString().toLowerCase();
47
+ },
48
+
49
+ urlencode: function () {
50
+ return (value) => encodeURIComponent(value);
51
+ },
52
+
53
+ number: function (part0, minFractionDigits, maxFractionDigits) {
54
+ let { minimumFractionDigits, maximumFractionDigits } = resolveMinMaxFractionDigits(
55
+ minFractionDigits,
56
+ maxFractionDigits,
57
+ );
58
+ let trimmable = maximumFractionDigits - minimumFractionDigits;
59
+ if (trimmable > 0) {
60
+ if (minimumFractionDigits == 0) ++trimmable;
61
+ return (value) => trimFractionZeros(value.toFixed(maximumFractionDigits), trimmable);
62
+ }
63
+ return (value) => value.toFixed(maximumFractionDigits);
64
+ },
65
+
66
+ percentage: function (part0, minFractionDigits, maxFractionDigits) {
67
+ let numberFormatter = formatFactory.number(part0, minFractionDigits, maxFractionDigits);
68
+ return (value) => numberFormatter(value * 100) + "%";
69
+ },
70
+
71
+ percentageSign: function (part0, minFractionDigits, maxFractionDigits) {
72
+ let numberFormatter = formatFactory.number(part0, minFractionDigits, maxFractionDigits);
73
+ return (value) => numberFormatter(value) + "%";
74
+ },
75
+
76
+ date: function () {
77
+ return (value) => {
78
+ let date = new Date(value);
79
+ return `${date.getMonth() + 1}/${date.getDate()}/${date.getFullYear()}`;
80
+ };
81
+ },
82
+
83
+ time: function () {
84
+ return (value) => {
85
+ let date = new Date(value);
86
+ let h = date.getHours() >= 10 ? date.getHours() : "0" + date.getHours();
87
+ let m = date.getMinutes() >= 10 ? date.getMinutes() : "0" + date.getMinutes();
88
+ return `${h}:${m}`;
89
+ };
90
+ },
91
+
92
+ datetime: function () {
93
+ let date = formatFactory.date();
94
+ let time = formatFactory.time();
95
+ return (value) => date(value) + " " + time(value);
96
+ },
97
+
98
+ ellipsis: function (part0, length, where) {
99
+ length = Number(length);
100
+ if (!(length > 3)) length = 10;
101
+ switch (where) {
102
+ default:
103
+ case "end":
104
+ return (value) => {
105
+ let s = String(value);
106
+ if (s.length > length) return s.substring(0, length - 3) + "...";
107
+ return s;
108
+ };
109
+
110
+ case "start":
111
+ return (value) => {
112
+ let s = String(value);
113
+ if (s.length > length) return "..." + s.substring(s.length - length + 3);
114
+ return s;
115
+ };
116
+
117
+ case "middle":
118
+ return (value) => {
119
+ let s = String(value);
120
+ if (s.length > length) {
121
+ let x = Math.floor(length - 2) / 2;
122
+ return s.substring(0, x) + "..." + s.substring(s.length - (length - 3 - x));
123
+ }
124
+ return s;
125
+ };
126
+ }
127
+ },
128
+
129
+ zeroPad: function (part0, length) {
130
+ return (value) => {
131
+ let s = String(value);
132
+ return s.padStart(length, "0");
133
+ };
134
+ },
135
+
136
+ leftPad: function (part0, length, char) {
137
+ return (value) => {
138
+ let s = String(value);
139
+ return s.padStart(length, char ?? " ");
140
+ };
141
+ },
142
+
143
+ capitalize: function () {
144
+ return (value) => {
145
+ let s = String(value);
146
+ return capitalize(s);
147
+ };
148
+ },
149
+
150
+ titleCase: function () {
151
+ return (value) => {
152
+ let s = String(value);
153
+ return s.replace(/\w\S*/g, function (word) {
154
+ return capitalize(word.toLowerCase());
155
+ });
156
+ };
157
+ },
158
+ };
159
+
160
+ formatFactory.s = formatFactory.str = formatFactory.string;
161
+ formatFactory.f = formatFactory.fixed;
162
+ formatFactory.n = formatFactory.number;
163
+ formatFactory.p = formatFactory.percentage;
164
+ formatFactory.ps = formatFactory.percentageSign;
165
+ formatFactory.d = formatFactory.date;
166
+ formatFactory.t = formatFactory.time;
167
+ formatFactory.dt = formatFactory.datetime;
168
+ formatFactory.zeropad = formatFactory.zeroPad;
169
+ formatFactory.leftpad = formatFactory.leftPad;
170
+ formatFactory.capitalize = formatFactory.capitalize;
171
+ formatFactory.titlecase = formatFactory.titleCase;
172
+
173
+ function buildFormatter(format) {
174
+ let formatter = defaultFormatter,
175
+ nullText = "";
176
+ if (format) {
177
+ let pipeParts = format.split("|");
178
+ nullText = pipeParts[1] || "";
179
+ let colonSepParts = pipeParts[0].split(":");
180
+ for (let i = 0; i < colonSepParts.length; i++) {
181
+ let parts = colonSepParts[i].split(";");
182
+ let factory = formatFactory[parts[0]];
183
+ if (!factory) debug("Unknown string format: " + format);
184
+ else if (i == 0) formatter = factory(...parts);
185
+ else {
186
+ let outerFmt = factory(...parts);
187
+ let innerFmt = formatter;
188
+ formatter = (v) => outerFmt(innerFmt(v));
189
+ }
190
+ }
191
+ }
192
+ return (v) => (v == null || v === "" ? nullText : formatter(v));
193
+ }
194
+
195
+ let format = {
196
+ cache: {},
197
+ };
198
+
199
+ function getDefaultFormatCache() {
200
+ if (format.cacheIdentifier != GlobalCacheIdentifier.get()) {
201
+ format = {
202
+ cache: {},
203
+ cacheIdentifier: GlobalCacheIdentifier.get(),
204
+ };
205
+ }
206
+ return format.cache;
207
+ }
208
+
209
+ let getFormatCache = getDefaultFormatCache;
210
+
211
+ export function setGetFormatCacheCallback(callback) {
212
+ getFormatCache = callback;
213
+ }
214
+
215
+ function getFormatter(format) {
216
+ if (!format) format = "";
217
+ let formatCache = getFormatCache();
218
+ let formatter = formatCache[format];
219
+ if (!formatter) formatter = formatCache[format] = buildFormatter(format);
220
+
221
+ return formatter;
222
+ }
223
+
224
+ export class Format {
225
+ static value(v, format) {
226
+ let formatter = getFormatter(format);
227
+ return formatter(v);
228
+ }
229
+
230
+ static parse(format) {
231
+ return getFormatter(format);
232
+ }
233
+
234
+ static register(format, formatter) {
235
+ this.registerFactory(format, () => formatter);
236
+ }
237
+
238
+ static registerFactory(format, factory) {
239
+ if (isArray(format)) format.forEach((f) => this.registerFactory(f, factory));
240
+ else formatFactory[format] = factory;
241
+ }
242
+ }
243
+
244
+ export function resolveMinMaxFractionDigits(minimumFractionDigits, maximumFractionDigits) {
245
+ minimumFractionDigits = minimumFractionDigits != null ? Number(minimumFractionDigits) : minimumFractionDigits;
246
+ maximumFractionDigits = maximumFractionDigits != null ? Number(maximumFractionDigits) : maximumFractionDigits;
247
+
248
+ if (isNumber(minimumFractionDigits)) {
249
+ if (isUndefined(maximumFractionDigits)) maximumFractionDigits = minimumFractionDigits;
250
+ else if (isNumber(maximumFractionDigits) && maximumFractionDigits < minimumFractionDigits)
251
+ maximumFractionDigits = minimumFractionDigits;
252
+ } else if (minimumFractionDigits == null && maximumFractionDigits == null) {
253
+ minimumFractionDigits = 0;
254
+ maximumFractionDigits = 18;
255
+ }
256
+
257
+ return {
258
+ minimumFractionDigits,
259
+ maximumFractionDigits,
260
+ };
261
+ }
262
+
263
+ export function trimFractionZeros(str, max) {
264
+ let cnt = 0,
265
+ l = str.length;
266
+ while (cnt < max && (str[l - 1 - cnt] === "0" || str[l - 1 - cnt] === ".")) cnt++;
267
+
268
+ return cnt > 0 ? str.substring(0, l - cnt) : str;
269
+ }