cx 24.3.10 → 24.4.0

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/ui.js CHANGED
@@ -814,13 +814,6 @@ var Localization = /*#__PURE__*/ (function () {
814
814
  return Localization;
815
815
  })();
816
816
 
817
- // let culture = "en";
818
- // let numberCulture = null;
819
- // let dateTimeCulture = null;
820
- // let cache = {};
821
- // let defaultCurrency = "USD";
822
- // let dateEncoding = (date) => date.toISOString();
823
-
824
817
  var stack = [
825
818
  {
826
819
  culture: "en",
@@ -833,20 +826,20 @@ var stack = [
833
826
  },
834
827
  },
835
828
  ];
836
- function getRootCultureSpecs() {
829
+ function getDefaultCulture() {
837
830
  return stack[0];
838
831
  }
839
- function getCurrentCultureSpecs() {
832
+ function getCurrentCulture() {
840
833
  return stack[stack.length - 1];
841
834
  }
842
835
  function getCurrentCultureCache() {
843
- return getCurrentCultureSpecs().cache;
836
+ return getCurrentCulture().cache;
844
837
  }
845
838
  function pushCulture(cultureInfo) {
846
839
  stack.push(cultureInfo);
847
840
  }
848
841
  function createCulture(cultureSpecs) {
849
- var current = getCurrentCultureSpecs();
842
+ var current = getCurrentCulture();
850
843
  var info = {
851
844
  culture: current.culture,
852
845
  dateEncoding: current.dateEncoding,
@@ -859,38 +852,41 @@ function createCulture(cultureSpecs) {
859
852
  }
860
853
  return info;
861
854
  }
862
- function popCulture() {
855
+ function popCulture(cultureSpecs) {
863
856
  if (stack.length == 1) throw new Error("Cannot pop the last culture object.");
857
+ if (cultureSpecs && stack[stack.length - 1] !== cultureSpecs) {
858
+ Console.warn("Popped culture object does not match the current one.");
859
+ }
864
860
  return stack.pop();
865
861
  }
866
862
  var Culture = /*#__PURE__*/ (function () {
867
863
  function Culture() {}
868
864
  Culture.setCulture = function setCulture(cultureCode) {
869
- var cultureSpecs = getRootCultureSpecs();
865
+ var cultureSpecs = getDefaultCulture();
870
866
  cultureSpecs.culture = cultureCode;
871
867
  cultureSpecs.cache = {};
872
868
  Localization.setCulture(cultureCode);
873
869
  this.invalidateCache();
874
870
  };
875
871
  Culture.setNumberCulture = function setNumberCulture(cultureCode) {
876
- var cultureSpecs = getRootCultureSpecs();
872
+ var cultureSpecs = getDefaultCulture();
877
873
  cultureSpecs.numberCulture = cultureCode;
878
874
  delete cultureSpecs.cache.numberCulture;
879
875
  this.invalidateCache();
880
876
  };
881
877
  Culture.setDateTimeCulture = function setDateTimeCulture(cultureCode) {
882
- var cultureSpecs = getRootCultureSpecs();
878
+ var cultureSpecs = getDefaultCulture();
883
879
  cultureSpecs.dateTimeCulture = cultureCode;
884
880
  delete cultureSpecs.cache.dateTimeCulture;
885
881
  this.invalidateCache();
886
882
  };
887
883
  Culture.setDefaultCurrency = function setDefaultCurrency(currencyCode) {
888
- var cultureSpecs = getRootCultureSpecs();
884
+ var cultureSpecs = getDefaultCulture();
889
885
  cultureSpecs.defaultCurrency = currencyCode;
890
886
  this.invalidateCache();
891
887
  };
892
888
  Culture.setDefaultDateEncoding = function setDefaultDateEncoding(encoding) {
893
- var cultureSpecs = getRootCultureSpecs();
889
+ var cultureSpecs = getDefaultCulture();
894
890
  cultureSpecs.dateEncoding = encoding;
895
891
  this.invalidateCache();
896
892
  };
@@ -900,28 +896,28 @@ var Culture = /*#__PURE__*/ (function () {
900
896
  invalidateStringTemplateCache();
901
897
  };
902
898
  Culture.getNumberCulture = function getNumberCulture() {
903
- var _getCurrentCultureSpe = getCurrentCultureSpecs(),
904
- cache = _getCurrentCultureSpe.cache,
905
- numberCulture = _getCurrentCultureSpe.numberCulture,
906
- culture = _getCurrentCultureSpe.culture;
899
+ var _getCurrentCulture = getCurrentCulture(),
900
+ cache = _getCurrentCulture.cache,
901
+ numberCulture = _getCurrentCulture.numberCulture,
902
+ culture = _getCurrentCulture.culture;
907
903
  if (!cache.numberCulture) cache.numberCulture = new NumberCulture(numberCulture != null ? numberCulture : culture);
908
904
  return cache.numberCulture;
909
905
  };
910
906
  Culture.getDateTimeCulture = function getDateTimeCulture() {
911
- var _getCurrentCultureSpe2 = getCurrentCultureSpecs(),
912
- cache = _getCurrentCultureSpe2.cache,
913
- dateTimeCulture = _getCurrentCultureSpe2.dateTimeCulture,
914
- culture = _getCurrentCultureSpe2.culture;
907
+ var _getCurrentCulture2 = getCurrentCulture(),
908
+ cache = _getCurrentCulture2.cache,
909
+ dateTimeCulture = _getCurrentCulture2.dateTimeCulture,
910
+ culture = _getCurrentCulture2.culture;
915
911
  if (!cache.dateTimeCulture)
916
912
  cache.dateTimeCulture = new DateTimeCulture(dateTimeCulture != null ? dateTimeCulture : culture);
917
913
  return cache.dateTimeCulture;
918
914
  };
919
915
  Culture.getDefaultDateEncoding = function getDefaultDateEncoding() {
920
- return getCurrentCultureSpecs().dateEncoding;
916
+ return getCurrentCulture().dateEncoding;
921
917
  };
922
918
  Culture.getComparer = function getComparer(options) {
923
- var _getCurrentCultureSpe3 = getCurrentCultureSpecs(),
924
- culture = _getCurrentCultureSpe3.culture;
919
+ var _getCurrentCulture3 = getCurrentCulture(),
920
+ culture = _getCurrentCulture3.culture;
925
921
  if (typeof Intl.Collator != "undefined") return new Intl.Collator(culture, options).compare;
926
922
  return defaultCompare;
927
923
  };
@@ -929,13 +925,13 @@ var Culture = /*#__PURE__*/ (function () {
929
925
  {
930
926
  key: "defaultCurrency",
931
927
  get: function get() {
932
- return getCurrentCultureSpecs().defaultCurrency;
928
+ return getCurrentCulture().defaultCurrency;
933
929
  },
934
930
  },
935
931
  {
936
932
  key: "culture",
937
933
  get: function get() {
938
- return getCurrentCultureSpecs().culture;
934
+ return getCurrentCulture().culture;
939
935
  },
940
936
  },
941
937
  ]);
@@ -2296,7 +2292,10 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
2296
2292
  throw new Error("Could not resolve a widget instance in the Cx component.");
2297
2293
  };
2298
2294
  _proto.render = function render() {
2295
+ var _this$props$cultureIn;
2299
2296
  if (this.props.deferredUntilIdle && this.state.deferToken < this.deferCounter) return null;
2297
+ var cultureInfo =
2298
+ (_this$props$cultureIn = this.props.cultureInfo) != null ? _this$props$cultureIn : getCurrentCulture();
2300
2299
  return /*#__PURE__*/ jsx(CxContext, {
2301
2300
  instance: this.getInstance(),
2302
2301
  flags: this.flags,
@@ -2304,7 +2303,7 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
2304
2303
  buster: ++this.renderCount,
2305
2304
  contentFactory: this.props.contentFactory,
2306
2305
  forceUpdate: this.forceUpdateCallback,
2307
- cultureInfo: this.props.cultureInfo,
2306
+ cultureInfo: cultureInfo,
2308
2307
  });
2309
2308
  };
2310
2309
  _proto.componentDidMount = function componentDidMount() {
@@ -2431,32 +2430,32 @@ var CxContext = /*#__PURE__*/ (function (_VDOM$Component2) {
2431
2430
  break;
2432
2431
  }
2433
2432
  } while (this.props.flags.dirty && ++count <= 3 && Widget.optimizePrepare && now() - this.timings.start < 8);
2434
- } finally {
2435
- if (this.props.cultureInfo) popCulture();
2436
- }
2437
- if (visible) {
2438
- this.timings.afterExplore = now();
2439
- for (var i = 0; i < context.prepareList.length; i++) context.prepareList[i].prepare(context);
2440
- this.timings.afterPrepare = now();
2433
+ if (visible) {
2434
+ this.timings.afterExplore = now();
2435
+ for (var i = 0; i < context.prepareList.length; i++) context.prepareList[i].prepare(context);
2436
+ this.timings.afterPrepare = now();
2441
2437
 
2442
- //walk in reverse order so children get rendered first
2443
- var renderList = context.getRootRenderList();
2444
- while (renderList) {
2445
- for (var _i = renderList.data.length - 1; _i >= 0; _i--) {
2446
- renderList.data[_i].render(context);
2438
+ //walk in reverse order so children get rendered first
2439
+ var renderList = context.getRootRenderList();
2440
+ while (renderList) {
2441
+ for (var _i = renderList.data.length - 1; _i >= 0; _i--) {
2442
+ renderList.data[_i].render(context);
2443
+ }
2444
+ renderList = renderList.right;
2447
2445
  }
2448
- renderList = renderList.right;
2446
+ this.content = getContent(instance.vdom);
2447
+ if (contentFactory)
2448
+ this.content = contentFactory({
2449
+ children: this.content,
2450
+ });
2451
+ this.timings.afterRender = now();
2452
+ for (var _i2 = 0; _i2 < context.cleanupList.length; _i2++) context.cleanupList[_i2].cleanup(context);
2453
+ } else {
2454
+ this.content = null;
2455
+ this.timings.afterExplore = this.timings.afterPrepare = this.timings.afterRender = now();
2449
2456
  }
2450
- this.content = getContent(instance.vdom);
2451
- if (contentFactory)
2452
- this.content = contentFactory({
2453
- children: this.content,
2454
- });
2455
- this.timings.afterRender = now();
2456
- for (var _i2 = 0; _i2 < context.cleanupList.length; _i2++) context.cleanupList[_i2].cleanup(context);
2457
- } else {
2458
- this.content = null;
2459
- this.timings.afterExplore = this.timings.afterPrepare = this.timings.afterRender = now();
2457
+ } finally {
2458
+ if (this.props.cultureInfo) popCulture(this.props.cultureInfo);
2460
2459
  }
2461
2460
  this.timings.beforeVDOMRender = now();
2462
2461
  this.props.flags.preparing = false;
@@ -2822,9 +2821,10 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2822
2821
  }
2823
2822
  };
2824
2823
  _proto.explore = function explore(context, instance) {
2824
+ var _this$culture;
2825
2825
  if (!instance.subStore) this.initSubStore(context, instance);
2826
2826
  if (instance.subStore.parentDataCheck()) instance.markShouldUpdate();
2827
- instance.cultureInfo = context.cultureInfo;
2827
+ instance.cultureInfo = (_this$culture = this.culture) != null ? _this$culture : getCurrentCulture();
2828
2828
  if (instance.cache("cultureInfo", instance.culture)) instance.markShouldUpdate();
2829
2829
  _PureContainer.prototype.explore.call(this, context, instance);
2830
2830
  };
@@ -2859,6 +2859,7 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
2859
2859
  Restate.prototype.detached = false;
2860
2860
  Restate.prototype.waitForIdle = false;
2861
2861
  Restate.prototype.immediate = false;
2862
+ Restate.prototype.culture = null;
2862
2863
  var PrivateStore = Restate;
2863
2864
  var RestateStore = /*#__PURE__*/ (function (_Store) {
2864
2865
  function RestateStore(config) {
@@ -3161,69 +3162,6 @@ HoverSyncElement.prototype.baseClass = "hoversyncelement";
3161
3162
  HoverSyncElement.prototype.styled = true;
3162
3163
  HoverSyncElement.prototype.hoverChannel = "default";
3163
3164
 
3164
- var CultureScope = /*#__PURE__*/ (function (_PureContainer) {
3165
- function CultureScope() {
3166
- return _PureContainer.apply(this, arguments) || this;
3167
- }
3168
- _inheritsLoose(CultureScope, _PureContainer);
3169
- var _proto = CultureScope.prototype;
3170
- _proto.init = function init() {
3171
- var _this$items;
3172
- this.initialItems = (_this$items = this.items) != null ? _this$items : this.children;
3173
- delete this.items;
3174
- delete this.children;
3175
- _PureContainer.prototype.init.call(this);
3176
- };
3177
- _proto.declareData = function declareData() {
3178
- var _PureContainer$protot;
3179
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
3180
- args[_key] = arguments[_key];
3181
- }
3182
- (_PureContainer$protot = _PureContainer.prototype.declareData).call.apply(
3183
- _PureContainer$protot,
3184
- [this].concat(args, [
3185
- {
3186
- culture: undefined,
3187
- numberCulture: undefined,
3188
- dateTimeCulture: undefined,
3189
- defaultCurrency: undefined,
3190
- },
3191
- ]),
3192
- );
3193
- };
3194
- _proto.prepareData = function prepareData(context, instance) {
3195
- _PureContainer.prototype.prepareData.call(this, context, instance);
3196
- this.clear();
3197
- var data = instance.data;
3198
- if (this.onCreateCulture) instance.culture = instance.invoke("onCreateCulture", data, instance);
3199
- else
3200
- instance.culture = createCulture({
3201
- culture: data.culture,
3202
- numberCulture: data.numberCulture,
3203
- dateTimeCulture: data.dateTimeCulture,
3204
- defaultCurrency: data.defaultCurrency,
3205
- dateEncoding: this.dateEncoding,
3206
- });
3207
- };
3208
- _proto.explore = function explore(context, instance) {
3209
- var culture = instance.culture;
3210
- pushCulture(culture);
3211
- if (this.items.length == 0 && this.initialItems) this.add(this.initialItems);
3212
- context.push("cultureInfo", culture);
3213
- _PureContainer.prototype.explore.call(this, context, instance);
3214
- };
3215
- _proto.exploreCleanup = function exploreCleanup(context, instance) {
3216
- context.pop("cultureInfo");
3217
- popCulture();
3218
- };
3219
- return CultureScope;
3220
- })(PureContainer);
3221
- CultureScope.prototype.culture = null;
3222
- CultureScope.prototype.numberCulture = null;
3223
- CultureScope.prototype.dateTimeCulture = null;
3224
- CultureScope.prototype.defaultCurrency = null;
3225
- CultureScope.prototype.dateEncoding = null;
3226
-
3227
3165
  var flattenProps = function flattenProps(props) {
3228
3166
  if (!props) return {};
3229
3167
  if (props.jsxSpread) {
@@ -4524,7 +4462,6 @@ export {
4524
4462
  ContentResolver,
4525
4463
  Controller,
4526
4464
  Culture,
4527
- CultureScope,
4528
4465
  Cx,
4529
4466
  DataAdapter,
4530
4467
  DataProxy,
@@ -4576,8 +4513,10 @@ export {
4576
4513
  flattenProps,
4577
4514
  getContent,
4578
4515
  getContentArray,
4516
+ getCurrentCulture,
4579
4517
  getCurrentCultureCache,
4580
4518
  getCurrentInstance,
4519
+ getDefaultCulture,
4581
4520
  isBatchingUpdates,
4582
4521
  notifyBatchedUpdateCompleted,
4583
4522
  notifyBatchedUpdateStarting,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cx",
3
- "version": "24.3.10",
3
+ "version": "24.4.0",
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",
@@ -1,17 +1,15 @@
1
- import * as Cx from '../core';
2
- import { ColumnBarGraphBaseProps } from './ColumnBarGraphBase';
1
+ import * as Cx from "../core";
2
+ import { ColumnBarGraphBaseProps } from "./ColumnBarGraphBase";
3
3
 
4
4
  interface BarGraphProps extends ColumnBarGraphBaseProps {
5
-
6
5
  /** Base CSS class to be applied to the element. Defaults to `bargraph`. */
7
- baseClass?: string,
6
+ baseClass?: string;
8
7
 
9
- /**
10
- * Name of the property which holds the base value.
8
+ /**
9
+ * Name of the property which holds the base value.
11
10
  * Default value is `false`, which means x0 value is not read from the data array.
12
11
  */
13
- x0Field?: string,
14
-
12
+ x0Field?: string | false;
15
13
  }
16
14
 
17
- export class BarGraph extends Cx.Widget<BarGraphProps> {}
15
+ export class BarGraph extends Cx.Widget<BarGraphProps> {}
@@ -1,20 +1,18 @@
1
- import * as Cx from '../core';
2
- import { ColumnBarGraphBaseProps } from './ColumnBarGraphBase';
1
+ import * as Cx from "../core";
2
+ import { ColumnBarGraphBaseProps } from "./ColumnBarGraphBase";
3
3
 
4
4
  interface ColumnGraphProps extends ColumnBarGraphBaseProps {
5
-
6
5
  /** Base CSS class to be applied to the element. Defaults to `columngraph`. */
7
- baseClass?: string,
8
-
9
- /**
10
- * Name of the property which holds the base value.
11
- * Default value is `false`, which means y0 value is not read from the data array.
6
+ baseClass?: string;
7
+
8
+ /**
9
+ * Name of the property which holds the base value.
10
+ * Default value is `false`, which means y0 value is not read from the data array.
12
11
  */
13
- y0Field?: string,
12
+ y0Field?: string | false;
14
13
 
15
14
  /** Column base value. Default value is `0`. */
16
- y0?: Cx.NumberProp,
17
-
15
+ y0?: Cx.NumberProp;
18
16
  }
19
17
 
20
- export class ColumnGraph extends Cx.Widget<ColumnGraphProps> {}
18
+ export class ColumnGraph extends Cx.Widget<ColumnGraphProps> {}
@@ -77,7 +77,7 @@ interface LineGraphProps extends Cx.WidgetProps {
77
77
  baseClass?: string;
78
78
 
79
79
  /** Name of the property which holds the y0 value. Default value is `false`, which means y0 value is not read from the data array. */
80
- y0Field?: string;
80
+ y0Field?: string | false;
81
81
 
82
82
  /** Name of the legend to be used. Default is `legend`. */
83
83
  legend?: string;
@@ -11,6 +11,9 @@ interface PieChartProps extends BoundedObjectProps {
11
11
 
12
12
  /** When set to `true`, stacks are rendered in clock wise direction. */
13
13
  clockwise?: Cx.BooleanProp;
14
+
15
+ /** Gap between slices in pixels. Default is `0` which means there is no gap. */
16
+ gap?: Cx.NumberProp;
14
17
  }
15
18
 
16
19
  export class PieChart extends Cx.Widget<PieChartProps> {}
@@ -78,6 +81,9 @@ interface PieSliceProps extends Cx.StyledContainerProps {
78
81
 
79
82
  /** Border radius of the slice. Default is 0. */
80
83
  borderRadius?: Cx.NumberProp;
84
+
85
+ /** Border radius of the slice. Default is 0. */
86
+ br?: Cx.NumberProp;
81
87
  }
82
88
 
83
89
  export class PieSlice extends Cx.Widget<PieSliceProps> {}