cx 25.4.1 → 25.5.1
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/charts.js +2 -2
- package/dist/data.js +17 -3
- package/dist/manifest.js +732 -732
- package/dist/ui.js +94 -61
- package/dist/widgets.js +25 -13
- package/package.json +1 -1
- package/src/charts/Legend.d.ts +45 -45
- package/src/charts/LegendEntry.js +128 -128
- package/src/charts/LegendEntry.scss +27 -27
- package/src/charts/PieChart.d.ts +92 -92
- package/src/charts/RangeMarker.js +6 -2
- package/src/charts/axis/Axis.d.ts +113 -113
- package/src/charts/axis/Axis.js +280 -280
- package/src/charts/axis/CategoryAxis.d.ts +30 -30
- package/src/charts/axis/CategoryAxis.js +241 -241
- package/src/charts/axis/NumericAxis.d.ts +46 -46
- package/src/charts/axis/NumericAxis.js +351 -351
- package/src/charts/axis/Stack.js +55 -55
- package/src/charts/axis/TimeAxis.d.ts +31 -28
- package/src/charts/axis/TimeAxis.js +611 -611
- package/src/charts/helpers/PointReducer.js +47 -47
- package/src/charts/helpers/SnapPointFinder.js +69 -69
- package/src/data/AugmentedViewBase.js +77 -75
- package/src/data/Binding.spec.js +69 -69
- package/src/data/ExposedRecordView.js +75 -70
- package/src/data/ExposedValueView.js +73 -72
- package/src/data/Expression.js +229 -229
- package/src/data/Expression.spec.js +229 -229
- package/src/data/Ref.d.ts +24 -24
- package/src/data/Ref.spec.js +79 -79
- package/src/data/StoreRef.spec.js +24 -24
- package/src/data/StringTemplate.js +92 -92
- package/src/data/StringTemplate.spec.js +132 -132
- package/src/data/StructuredDataAccessor.d.ts +7 -7
- package/src/data/StructuredSelector.js +132 -132
- package/src/data/SubscribableView.js +54 -54
- package/src/data/getAccessor.spec.js +11 -11
- package/src/data/getSelector.js +49 -49
- package/src/hooks/createLocalStorageRef.d.ts +3 -3
- package/src/hooks/createLocalStorageRef.js +20 -20
- package/src/index.scss +6 -6
- package/src/ui/Container.js +154 -183
- package/src/ui/Culture.d.ts +57 -57
- package/src/ui/Culture.js +139 -139
- package/src/ui/Cx.js +3 -3
- package/src/ui/DataProxy.js +45 -44
- package/src/ui/DetachedScope.js +98 -94
- package/src/ui/FocusManager.js +171 -171
- package/src/ui/Format.js +108 -108
- package/src/ui/HoverSync.js +147 -147
- package/src/ui/Instance.d.ts +1 -1
- package/src/ui/Instance.js +25 -16
- package/src/ui/IsolatedScope.js +30 -30
- package/src/ui/Repeater.d.ts +61 -61
- package/src/ui/Repeater.js +109 -102
- package/src/ui/Rescope.js +35 -31
- package/src/ui/Restate.js +167 -163
- package/src/ui/Widget.js +184 -200
- package/src/ui/adapter/ArrayAdapter.js +152 -142
- package/src/ui/adapter/TreeAdapter.js +101 -100
- package/src/ui/createFunctionalComponent.d.ts +1 -1
- package/src/ui/createFunctionalComponent.js +31 -36
- package/src/ui/layout/ContentPlaceholder.d.ts +19 -19
- package/src/ui/layout/ContentPlaceholder.js +105 -105
- package/src/ui/layout/ContentPlaceholder.spec.js +579 -579
- package/src/ui/layout/LabelsTopLayout.js +134 -134
- package/src/ui/layout/exploreChildren.d.ts +12 -15
- package/src/ui/layout/exploreChildren.js +27 -40
- package/src/util/Format.js +270 -270
- package/src/util/date/encodeDate.d.ts +1 -1
- package/src/util/date/encodeDate.js +8 -8
- package/src/util/date/encodeDateWithTimezoneOffset.d.ts +1 -1
- package/src/util/date/index.d.ts +11 -11
- package/src/util/date/index.js +11 -11
- package/src/util/date/parseDateInvariant.d.ts +3 -3
- package/src/util/date/parseDateInvariant.js +20 -20
- package/src/util/debounce.js +18 -18
- package/src/util/getSearchQueryPredicate.js +59 -59
- package/src/util/index.d.ts +51 -51
- package/src/util/index.js +54 -54
- package/src/util/isValidIdentifierName.d.ts +1 -1
- package/src/util/isValidIdentifierName.js +5 -5
- package/src/util/isValidIdentifierName.spec.js +33 -33
- package/src/util/scss/add-rules.scss +38 -38
- package/src/util/validatedDebounce.js +19 -19
- package/src/widgets/Button.js +118 -118
- package/src/widgets/CxCredit.scss +37 -37
- package/src/widgets/HighlightedSearchText.js +36 -36
- package/src/widgets/HighlightedSearchText.scss +18 -18
- package/src/widgets/List.js +594 -587
- package/src/widgets/List.scss +91 -91
- package/src/widgets/Sandbox.js +9 -8
- package/src/widgets/drag-drop/DropZone.js +214 -214
- package/src/widgets/form/Calendar.d.ts +86 -86
- package/src/widgets/form/Calendar.js +618 -618
- package/src/widgets/form/Calendar.scss +196 -196
- package/src/widgets/form/Checkbox.scss +127 -127
- package/src/widgets/form/ColorField.js +397 -397
- package/src/widgets/form/ColorField.scss +96 -96
- package/src/widgets/form/ColorPicker.scss +283 -283
- package/src/widgets/form/DateTimeField.js +576 -576
- package/src/widgets/form/DateTimePicker.js +392 -392
- package/src/widgets/form/LookupField.d.ts +179 -179
- package/src/widgets/form/LookupField.scss +219 -219
- package/src/widgets/form/MonthField.d.ts +99 -99
- package/src/widgets/form/MonthField.js +523 -523
- package/src/widgets/form/MonthPicker.d.ts +76 -76
- package/src/widgets/form/MonthPicker.js +641 -641
- package/src/widgets/form/MonthPicker.scss +118 -118
- package/src/widgets/form/NumberField.js +459 -459
- package/src/widgets/form/NumberField.scss +61 -61
- package/src/widgets/form/Radio.scss +121 -121
- package/src/widgets/form/Select.scss +99 -99
- package/src/widgets/form/Slider.scss +118 -118
- package/src/widgets/form/Switch.scss +140 -140
- package/src/widgets/form/TextArea.scss +43 -43
- package/src/widgets/form/TextField.js +290 -290
- package/src/widgets/form/TextField.scss +55 -55
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/form/variables.scss +353 -353
- package/src/widgets/grid/Grid.d.ts +442 -442
- package/src/widgets/grid/Grid.js +7 -0
- package/src/widgets/grid/GridRow.js +228 -228
- package/src/widgets/grid/TreeNode.d.ts +23 -23
- package/src/widgets/grid/TreeNode.scss +88 -88
- package/src/widgets/grid/variables.scss +133 -133
- package/src/widgets/nav/LinkButton.js +128 -128
- package/src/widgets/nav/Menu.scss +74 -74
- package/src/widgets/nav/Route.js +102 -106
- package/src/widgets/overlay/Dropdown.js +612 -612
- package/src/widgets/overlay/FlyweightTooltipTracker.js +39 -39
- package/src/widgets/overlay/Overlay.d.ts +73 -73
- package/src/widgets/overlay/Tooltip.js +1 -1
- package/src/widgets/overlay/Window.js +202 -202
- package/src/widgets/overlay/captureMouse.js +124 -124
- package/src/widgets/overlay/createHotPromiseWindowFactory.d.ts +18 -18
- package/src/widgets/overlay/createHotPromiseWindowFactory.js +56 -56
- package/src/widgets/overlay/index.d.ts +11 -11
- package/src/widgets/overlay/index.js +11 -11
- package/src/widgets/variables.scss +144 -144
package/dist/ui.js
CHANGED
|
@@ -430,9 +430,7 @@ var Widget = /*#__PURE__*/ (function (_Component) {
|
|
|
430
430
|
_proto.prepareData = function prepareData(context, instance) {
|
|
431
431
|
if (this.styled) this.prepareCSS(context, instance);
|
|
432
432
|
};
|
|
433
|
-
_proto.initInstance = function initInstance(context, instance) {
|
|
434
|
-
if (this.onInit) this.onInit(context, instance);
|
|
435
|
-
};
|
|
433
|
+
_proto.initInstance = function initInstance(context, instance) {};
|
|
436
434
|
_proto.initState = function initState(context, instance) {};
|
|
437
435
|
_proto.checkVisible = function checkVisible(context, instance, data) {
|
|
438
436
|
return data.visible;
|
|
@@ -453,6 +451,12 @@ var Widget = /*#__PURE__*/ (function (_Component) {
|
|
|
453
451
|
_proto.update = function update() {
|
|
454
452
|
this.version = (this.version || 0) + 1;
|
|
455
453
|
};
|
|
454
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
455
|
+
instance.store = instance.parentStore;
|
|
456
|
+
|
|
457
|
+
// check when this is actually needed, perhaps this is needed only for tables and repeated elements
|
|
458
|
+
// if (instance.cached) delete instance.cached.rawData; // force prepareData to execute again
|
|
459
|
+
};
|
|
456
460
|
Widget.resetCounter = function resetCounter() {
|
|
457
461
|
widgetId = 100;
|
|
458
462
|
};
|
|
@@ -540,20 +544,12 @@ var Text = /*#__PURE__*/ (function (_Widget) {
|
|
|
540
544
|
})(Widget);
|
|
541
545
|
Widget.alias("text", Text);
|
|
542
546
|
|
|
543
|
-
function exploreChildren(context, instance, children, previousResult, key, store
|
|
547
|
+
function exploreChildren(context, instance, children, previousResult, key, store) {
|
|
544
548
|
var newChildren = previousResult || [];
|
|
545
549
|
var oldChildren = previousResult || newChildren;
|
|
546
550
|
var identical = previousResult ? 0 : -1;
|
|
547
|
-
|
|
548
|
-
// if (children.length)
|
|
549
|
-
// context.exploreStack.hop();
|
|
550
|
-
|
|
551
551
|
for (var c = 0; c < children.length; c++) {
|
|
552
552
|
var cell = instance.getChild(context, children[c], key, store);
|
|
553
|
-
|
|
554
|
-
// if (beforeCallback)
|
|
555
|
-
// beforeCallback(cell);
|
|
556
|
-
|
|
557
553
|
if (cell.checkVisible(context)) {
|
|
558
554
|
if (identical >= 0) {
|
|
559
555
|
if (cell == oldChildren[identical]) identical++;
|
|
@@ -603,7 +599,7 @@ var Container = /*#__PURE__*/ (function (_Widget) {
|
|
|
603
599
|
_Widget.prototype.init.call(this, context);
|
|
604
600
|
};
|
|
605
601
|
_proto.exploreItems = function exploreItems(context, instance, items) {
|
|
606
|
-
instance.children = exploreChildren(context, instance, items, instance.cached.children);
|
|
602
|
+
instance.children = exploreChildren(context, instance, items, instance.cached.children, null, instance.store);
|
|
607
603
|
if (instance.cache("children", instance.children)) instance.markShouldUpdate(context);
|
|
608
604
|
};
|
|
609
605
|
_proto.explore = function explore(context, instance) {
|
|
@@ -959,7 +955,10 @@ var ArrayAdapter = /*#__PURE__*/ (function (_DataAdapter) {
|
|
|
959
955
|
this.indexName = this.indexName.toString();
|
|
960
956
|
};
|
|
961
957
|
_proto.initInstance = function initInstance(context, instance) {
|
|
962
|
-
if (!instance.recordStoreCache)
|
|
958
|
+
if (!instance.recordStoreCache) {
|
|
959
|
+
instance.recordStoreCache = new WeakMap();
|
|
960
|
+
instance.cacheByKey = {};
|
|
961
|
+
}
|
|
963
962
|
if (!instance.recordsAccessor && this.recordsAccessor) {
|
|
964
963
|
instance.recordsAccessor = this.recordsAccessor.bindInstance
|
|
965
964
|
? this.recordsAccessor.bindInstance(instance)
|
|
@@ -984,7 +983,8 @@ var ArrayAdapter = /*#__PURE__*/ (function (_DataAdapter) {
|
|
|
984
983
|
return result;
|
|
985
984
|
};
|
|
986
985
|
_proto.mapRecord = function mapRecord(context, instance, data, parentStore, recordsAccessor, index) {
|
|
987
|
-
var
|
|
986
|
+
var key = this.cacheByKeyField && this.keyField ? data[this.keyField] : null;
|
|
987
|
+
var recordStore = key != null ? instance.cacheByKey[key] : instance.recordStoreCache.get(data);
|
|
988
988
|
if (recordsAccessor) {
|
|
989
989
|
if (!recordStore)
|
|
990
990
|
recordStore = new ArrayElementView({
|
|
@@ -1011,9 +1011,13 @@ var ArrayAdapter = /*#__PURE__*/ (function (_DataAdapter) {
|
|
|
1011
1011
|
});
|
|
1012
1012
|
else {
|
|
1013
1013
|
recordStore.setStore(parentStore);
|
|
1014
|
+
recordStore.setData(data);
|
|
1014
1015
|
}
|
|
1015
1016
|
}
|
|
1016
|
-
|
|
1017
|
+
|
|
1018
|
+
// cache by the key or by data reference
|
|
1019
|
+
if (key != null) instance.cacheByKey[key] = recordStore;
|
|
1020
|
+
else if (isObject(data)) instance.recordStoreCache.set(data, recordStore);
|
|
1017
1021
|
return {
|
|
1018
1022
|
store: recordStore,
|
|
1019
1023
|
index: index,
|
|
@@ -1079,6 +1083,8 @@ var ArrayAdapter = /*#__PURE__*/ (function (_DataAdapter) {
|
|
|
1079
1083
|
})(DataAdapter);
|
|
1080
1084
|
ArrayAdapter.prototype.immutable = false;
|
|
1081
1085
|
ArrayAdapter.prototype.sealed = false;
|
|
1086
|
+
ArrayAdapter.prototype.keyField = null;
|
|
1087
|
+
ArrayAdapter.prototype.cacheByKeyField = true;
|
|
1082
1088
|
ArrayAdapter.autoInit = true;
|
|
1083
1089
|
|
|
1084
1090
|
var UseParentLayout = /*#__PURE__*/ (function (_PureContainer) {
|
|
@@ -1141,6 +1147,12 @@ var Repeater = /*#__PURE__*/ (function (_Container) {
|
|
|
1141
1147
|
_proto.initInstance = function initInstance(context, instance) {
|
|
1142
1148
|
this.dataAdapter.initInstance(context, instance);
|
|
1143
1149
|
};
|
|
1150
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1151
|
+
_Container.prototype.applyParentStore.call(this, instance);
|
|
1152
|
+
|
|
1153
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
1154
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
1155
|
+
};
|
|
1144
1156
|
_proto.prepareData = function prepareData(context, instance) {
|
|
1145
1157
|
var _this = this;
|
|
1146
1158
|
var data = instance.data;
|
|
@@ -1229,7 +1241,7 @@ var Rescope = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
1229
1241
|
};
|
|
1230
1242
|
_proto.initInstance = function initInstance(context, instance) {
|
|
1231
1243
|
instance.store = new ZoomIntoPropertyView({
|
|
1232
|
-
store: instance.
|
|
1244
|
+
store: instance.parentStore,
|
|
1233
1245
|
binding: this.binding,
|
|
1234
1246
|
rootName: this.rootName,
|
|
1235
1247
|
nestedData: isObject(this.data)
|
|
@@ -1240,9 +1252,10 @@ var Rescope = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
1240
1252
|
})
|
|
1241
1253
|
: null,
|
|
1242
1254
|
});
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1255
|
+
_PureContainer.prototype.initInstance.call(this, context, instance);
|
|
1256
|
+
};
|
|
1257
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1258
|
+
instance.store.setStore(instance.parentStore);
|
|
1246
1259
|
};
|
|
1247
1260
|
return Rescope;
|
|
1248
1261
|
})(PureContainer);
|
|
@@ -1635,31 +1648,39 @@ function enableCultureSensitiveFormatting() {
|
|
|
1635
1648
|
|
|
1636
1649
|
var instanceId = 1000;
|
|
1637
1650
|
var Instance = /*#__PURE__*/ (function () {
|
|
1638
|
-
function Instance(widget, key, parent,
|
|
1651
|
+
function Instance(widget, key, parent, parentStore) {
|
|
1639
1652
|
this.widget = widget;
|
|
1640
1653
|
this.key = key;
|
|
1641
1654
|
this.id = String(++instanceId);
|
|
1642
1655
|
this.cached = {};
|
|
1643
1656
|
this.parent = parent;
|
|
1644
|
-
this.
|
|
1657
|
+
this.parentStore = parentStore != null ? parentStore : parent == null ? void 0 : parent.store;
|
|
1658
|
+
if (this.parentStore == null) throw new Error("Cannot create instance without a parent store.");
|
|
1645
1659
|
}
|
|
1646
1660
|
var _proto = Instance.prototype;
|
|
1647
|
-
_proto.
|
|
1648
|
-
this.
|
|
1661
|
+
_proto.setParentStore = function setParentStore(parentStore) {
|
|
1662
|
+
this.parentStore = parentStore;
|
|
1663
|
+
this.widget.applyParentStore(this);
|
|
1649
1664
|
};
|
|
1650
1665
|
_proto.init = function init(context) {
|
|
1651
|
-
//widget is initialized when first instance is initialized
|
|
1666
|
+
// widget is initialized when the first instance is initialized
|
|
1652
1667
|
if (!this.widget.initialized) {
|
|
1653
1668
|
this.widget.init(context);
|
|
1669
|
+
|
|
1670
|
+
// init default values
|
|
1671
|
+
this.widget.selector.init(this.parentStore);
|
|
1654
1672
|
this.widget.initialized = true;
|
|
1655
1673
|
}
|
|
1656
1674
|
if (!this.dataSelector) {
|
|
1657
|
-
this.widget.selector.init(this.store);
|
|
1658
1675
|
this.dataSelector = this.widget.selector.createStoreSelector();
|
|
1659
1676
|
}
|
|
1660
1677
|
|
|
1661
|
-
//init instance might change the store, so
|
|
1678
|
+
// init instance might change the store, so this must go before the controller initialization
|
|
1662
1679
|
this.widget.initInstance(context, this);
|
|
1680
|
+
|
|
1681
|
+
// initInstance can set the store, otherwise use parent store
|
|
1682
|
+
if (!this.store) this.store = this.parentStore;
|
|
1683
|
+
if (this.widget.onInit) this.widget.onInit(context, this);
|
|
1663
1684
|
this.widget.initState(context, this);
|
|
1664
1685
|
if (this.widget.controller)
|
|
1665
1686
|
this.controller = Controller.create(this.widget.controller, {
|
|
@@ -2040,15 +2061,15 @@ var Instance = /*#__PURE__*/ (function () {
|
|
|
2040
2061
|
if (this.instanceCache) this.instanceCache.destroy();
|
|
2041
2062
|
};
|
|
2042
2063
|
_proto.getChild = function getChild(context, widget, key, store) {
|
|
2043
|
-
return this.getInstanceCache().getChild(widget, store
|
|
2064
|
+
return this.getInstanceCache().getChild(widget, store != null ? store : this.store, key);
|
|
2044
2065
|
};
|
|
2045
2066
|
_proto.getDetachedChild = function getDetachedChild(widget, key, store) {
|
|
2046
|
-
var child = new Instance(widget, key, this, store
|
|
2067
|
+
var child = new Instance(widget, key, this, store != null ? store : this.store);
|
|
2047
2068
|
child.detached = true;
|
|
2048
2069
|
return child;
|
|
2049
2070
|
};
|
|
2050
2071
|
_proto.prepareRenderCleanupChild = function prepareRenderCleanupChild(widget, store, keyPrefix, options) {
|
|
2051
|
-
return widget.prepareRenderCleanup(store
|
|
2072
|
+
return widget.prepareRenderCleanup(store != null ? store : this.store, options, keyPrefix, this);
|
|
2052
2073
|
};
|
|
2053
2074
|
_proto.getJsxEventProps = function getJsxEventProps() {
|
|
2054
2075
|
var _this5 = this;
|
|
@@ -2116,7 +2137,7 @@ var InstanceCache = /*#__PURE__*/ (function () {
|
|
|
2116
2137
|
this.keyPrefix = keyPrefix != null ? keyPrefix + "-" : "";
|
|
2117
2138
|
}
|
|
2118
2139
|
var _proto2 = InstanceCache.prototype;
|
|
2119
|
-
_proto2.getChild = function getChild(widget,
|
|
2140
|
+
_proto2.getChild = function getChild(widget, parentStore, key) {
|
|
2120
2141
|
var k = this.keyPrefix + (key != null ? key : widget.vdomKey || widget.widgetId);
|
|
2121
2142
|
var instance = this.children[k];
|
|
2122
2143
|
if (
|
|
@@ -2124,12 +2145,10 @@ var InstanceCache = /*#__PURE__*/ (function () {
|
|
|
2124
2145
|
instance.widget !== widget ||
|
|
2125
2146
|
(!instance.visible && (instance.widget.controller || instance.widget.onInit))
|
|
2126
2147
|
) {
|
|
2127
|
-
instance = new Instance(widget, k, this.parent);
|
|
2148
|
+
instance = new Instance(widget, k, this.parent, parentStore);
|
|
2128
2149
|
this.children[k] = instance;
|
|
2129
|
-
}
|
|
2130
|
-
|
|
2131
|
-
instance.setStore(store);
|
|
2132
|
-
if (instance.cached) delete instance.cached.rawData; // force prepareData to execute again
|
|
2150
|
+
} else if (instance.parentStore !== parentStore) {
|
|
2151
|
+
instance.setParentStore(parentStore);
|
|
2133
2152
|
}
|
|
2134
2153
|
return instance;
|
|
2135
2154
|
};
|
|
@@ -2257,10 +2276,10 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
2257
2276
|
_this.parentInstance = props.parentInstance;
|
|
2258
2277
|
_this.store = props.store || _this.parentInstance.store;
|
|
2259
2278
|
} else {
|
|
2260
|
-
_this.parentInstance = new Instance(_this.widget, 0);
|
|
2279
|
+
_this.parentInstance = new Instance(_this.widget, 0, null, props.store);
|
|
2261
2280
|
_this.store = props.store;
|
|
2262
2281
|
}
|
|
2263
|
-
if (!_this.store) throw new Error("Cx component requires store.");
|
|
2282
|
+
if (!_this.store) throw new Error("Cx component requires a store.");
|
|
2264
2283
|
}
|
|
2265
2284
|
_this.state = {
|
|
2266
2285
|
deferToken: 0,
|
|
@@ -2299,7 +2318,7 @@ var Cx = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
2299
2318
|
_proto.getInstance = function getInstance() {
|
|
2300
2319
|
if (this.props.instance) return this.props.instance;
|
|
2301
2320
|
if (this.instance && this.instance.widget === this.widget) {
|
|
2302
|
-
if (this.instance.
|
|
2321
|
+
if (this.instance.parentStore != this.store) this.instance.setParentStore(this.store);
|
|
2303
2322
|
return this.instance;
|
|
2304
2323
|
}
|
|
2305
2324
|
if (this.widget && this.parentInstance)
|
|
@@ -2661,6 +2680,9 @@ var IsolatedScope = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2661
2680
|
_proto.explore = function explore(context, instance) {
|
|
2662
2681
|
if (instance.shouldUpdate) {
|
|
2663
2682
|
_PureContainer.prototype.explore.call(this, context, instance);
|
|
2683
|
+
} else if (instance.children) {
|
|
2684
|
+
// mark children to prevent sweeping them away
|
|
2685
|
+
for (var i = 0; i < instance.children.length; i++) instance.instanceCache.addChild(instance.children[i]);
|
|
2664
2686
|
}
|
|
2665
2687
|
};
|
|
2666
2688
|
return IsolatedScope;
|
|
@@ -2717,6 +2739,10 @@ var DetachedScope = /*#__PURE__*/ (function (_IsolatedScope) {
|
|
|
2717
2739
|
selector: getSelector(this.exclusiveData || this.data),
|
|
2718
2740
|
});
|
|
2719
2741
|
};
|
|
2742
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
2743
|
+
instance.store = instance.parentStore;
|
|
2744
|
+
instance.subStore.setStore(instance.parentStore);
|
|
2745
|
+
};
|
|
2720
2746
|
_proto.render = function render(context, instance, key) {
|
|
2721
2747
|
return /*#__PURE__*/ jsx(
|
|
2722
2748
|
Cx,
|
|
@@ -2835,16 +2861,15 @@ var Restate = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2835
2861
|
return instance.nestedDataSet(path, value, _this.data);
|
|
2836
2862
|
},
|
|
2837
2863
|
});
|
|
2838
|
-
instance.setStore = function (store) {
|
|
2839
|
-
instance.store = store;
|
|
2840
|
-
instance.subStore.setStore(store);
|
|
2841
|
-
};
|
|
2842
2864
|
if (cacheKey) {
|
|
2843
2865
|
instance.subscribeOnDestroy(function () {
|
|
2844
2866
|
persistenceCache[cacheKey] = instance.subStore.getData();
|
|
2845
2867
|
});
|
|
2846
2868
|
}
|
|
2847
2869
|
};
|
|
2870
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
2871
|
+
if (instance.subStore) instance.subStore.setStore(instance.parentStore);
|
|
2872
|
+
};
|
|
2848
2873
|
_proto.explore = function explore(context, instance) {
|
|
2849
2874
|
var _this$culture;
|
|
2850
2875
|
if (!instance.subStore) this.initSubStore(context, instance);
|
|
@@ -2939,6 +2964,11 @@ var RestateStore = /*#__PURE__*/ (function (_Store) {
|
|
|
2939
2964
|
if (!this.detached) this.store.notify();
|
|
2940
2965
|
_Store.prototype.doNotify.call(this);
|
|
2941
2966
|
};
|
|
2967
|
+
|
|
2968
|
+
// override the default implementation to avoid meta overwrites
|
|
2969
|
+
_proto2.setStore = function setStore(store) {
|
|
2970
|
+
this.store = store;
|
|
2971
|
+
};
|
|
2942
2972
|
return RestateStore;
|
|
2943
2973
|
})(Store);
|
|
2944
2974
|
|
|
@@ -2952,25 +2982,25 @@ var DataProxy = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2952
2982
|
if (!this.data) this.data = {};
|
|
2953
2983
|
if (this.alias) this.data[this.alias] = this.value;
|
|
2954
2984
|
|
|
2955
|
-
//
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
|
|
2985
|
+
// nesting is required to avoid resetting the store on every render and recalculating the data
|
|
2986
|
+
this.container = PureContainer.create({
|
|
2987
|
+
type: PureContainer,
|
|
2988
|
+
items: this.children || this.items,
|
|
2989
|
+
layout: this.layout,
|
|
2990
|
+
controller: this.controller,
|
|
2991
|
+
outerLayout: this.outerLayout,
|
|
2992
|
+
ws: this.ws,
|
|
2993
|
+
});
|
|
2994
|
+
this.children = [this.container];
|
|
2995
|
+
delete this.items;
|
|
2996
|
+
delete this.controller;
|
|
2997
|
+
delete this.outerLayout;
|
|
2998
|
+
this.layout = UseParentLayout;
|
|
2969
2999
|
_PureContainer.prototype.init.call(this);
|
|
2970
3000
|
};
|
|
2971
3001
|
_proto.initInstance = function initInstance(context, instance) {
|
|
2972
3002
|
instance.store = new NestedDataView({
|
|
2973
|
-
store: instance.
|
|
3003
|
+
store: instance.parentStore,
|
|
2974
3004
|
nestedData: new StructuredInstanceDataAccessor({
|
|
2975
3005
|
instance: instance,
|
|
2976
3006
|
data: this.data,
|
|
@@ -2979,9 +3009,10 @@ var DataProxy = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
2979
3009
|
immutable: this.immutable,
|
|
2980
3010
|
sealed: this.sealed,
|
|
2981
3011
|
});
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3012
|
+
_PureContainer.prototype.initInstance.call(this, context, instance);
|
|
3013
|
+
};
|
|
3014
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
3015
|
+
instance.store.setStore(instance.parentStore);
|
|
2985
3016
|
};
|
|
2986
3017
|
return DataProxy;
|
|
2987
3018
|
})(PureContainer);
|
|
@@ -3215,6 +3246,7 @@ var FunctionalComponent = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
3215
3246
|
_inheritsLoose(FunctionalComponent, _PureContainer);
|
|
3216
3247
|
var _proto = FunctionalComponent.prototype;
|
|
3217
3248
|
_proto.initInstance = function initInstance(context, instance) {
|
|
3249
|
+
instance.store = instance.parentStore;
|
|
3218
3250
|
this.clear();
|
|
3219
3251
|
currentInstance = instance;
|
|
3220
3252
|
this.add(this.childrenFactory(this.props));
|
|
@@ -4483,6 +4515,7 @@ TreeAdapter.prototype.loadedField = "$loaded";
|
|
|
4483
4515
|
TreeAdapter.prototype.foldersFirst = true;
|
|
4484
4516
|
TreeAdapter.prototype.isTreeAdapter = true;
|
|
4485
4517
|
TreeAdapter.prototype.hideRootNodes = false;
|
|
4518
|
+
TreeAdapter.prototype.cacheByKeyField = false;
|
|
4486
4519
|
|
|
4487
4520
|
function bind(path, defaultValue) {
|
|
4488
4521
|
return {
|
package/dist/widgets.js
CHANGED
|
@@ -1272,6 +1272,12 @@ var List = /*#__PURE__*/ (function (_Widget) {
|
|
|
1272
1272
|
});
|
|
1273
1273
|
_Widget.prototype.prepareData.call(this, context, instance);
|
|
1274
1274
|
};
|
|
1275
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1276
|
+
_Widget.prototype.applyParentStore.call(this, instance);
|
|
1277
|
+
|
|
1278
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
1279
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
1280
|
+
};
|
|
1275
1281
|
_proto.explore = function explore(context, instance, data) {
|
|
1276
1282
|
var _this2 = this;
|
|
1277
1283
|
var instances = [];
|
|
@@ -1771,15 +1777,16 @@ var Sandbox = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
1771
1777
|
};
|
|
1772
1778
|
_proto.initInstance = function initInstance(context, instance) {
|
|
1773
1779
|
instance.store = new ExposedValueView({
|
|
1774
|
-
store: instance.
|
|
1780
|
+
store: instance.parentStore,
|
|
1775
1781
|
containerBinding: this.storageBinding,
|
|
1776
1782
|
key: null,
|
|
1777
1783
|
recordName: this.recordName,
|
|
1778
1784
|
immutable: this.immutable,
|
|
1779
1785
|
});
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1786
|
+
_PureContainer.prototype.initInstance.call(this, context, instance);
|
|
1787
|
+
};
|
|
1788
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
1789
|
+
instance.store.setStore(instance.parentStore);
|
|
1783
1790
|
};
|
|
1784
1791
|
_proto.declareData = function declareData() {
|
|
1785
1792
|
var _PureContainer$protot;
|
|
@@ -1798,6 +1805,8 @@ var Sandbox = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
1798
1805
|
var store = instance.store,
|
|
1799
1806
|
data = instance.data;
|
|
1800
1807
|
if (store.getKey() !== data.key) {
|
|
1808
|
+
//when navigating to a page using the same widget tree as the previous page
|
|
1809
|
+
//everything needs to be reinstantiated, e.g. user/1 => user/2
|
|
1801
1810
|
instance.store = new ExposedValueView({
|
|
1802
1811
|
store: store,
|
|
1803
1812
|
containerBinding: this.storageBinding,
|
|
@@ -1805,9 +1814,6 @@ var Sandbox = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
1805
1814
|
recordName: this.recordName,
|
|
1806
1815
|
immutable: this.immutable,
|
|
1807
1816
|
});
|
|
1808
|
-
|
|
1809
|
-
//when navigating to a page using the same widget tree as the previous page
|
|
1810
|
-
//everything needs to be reinstantiated, e.g. user/1 => user/2
|
|
1811
1817
|
instance.clearChildrenCache();
|
|
1812
1818
|
}
|
|
1813
1819
|
_PureContainer.prototype.prepareData.call(this, context, instance);
|
|
@@ -4245,8 +4251,8 @@ function getTooltipInstance(e, parentInstance, tooltip, options) {
|
|
|
4245
4251
|
tooltipInstance = parentInstance.tooltips[name] = parentInstance.getDetachedChild(tooltipWidget, name, store);
|
|
4246
4252
|
tooltipInstance.config = tooltip;
|
|
4247
4253
|
tooltipInstance.tooltipName = name;
|
|
4254
|
+
tooltipInstance.init(new RenderingContext());
|
|
4248
4255
|
if (tooltip.alwaysVisible || tooltip.trackMouse || tooltip.trackMouseX || tooltip.trackMouseY) {
|
|
4249
|
-
tooltipInstance.init(new RenderingContext());
|
|
4250
4256
|
tooltipInstance.data = tooltipInstance.dataSelector(store);
|
|
4251
4257
|
}
|
|
4252
4258
|
}
|
|
@@ -4986,13 +4992,13 @@ var Route = /*#__PURE__*/ (function (_PureContainer) {
|
|
|
4986
4992
|
this.matcher = new RouteMatcher(this.route + (this.prefix ? "(*remainder)" : ""));
|
|
4987
4993
|
};
|
|
4988
4994
|
_proto.initInstance = function initInstance(context, instance) {
|
|
4989
|
-
_PureContainer.prototype.initInstance.call(this, context, instance);
|
|
4990
4995
|
instance.store = new ReadOnlyDataView({
|
|
4991
|
-
store: instance.
|
|
4996
|
+
store: instance.parentStore,
|
|
4992
4997
|
});
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4998
|
+
_PureContainer.prototype.initInstance.call(this, context, instance);
|
|
4999
|
+
};
|
|
5000
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
5001
|
+
instance.store.setStore(instance.parentStore);
|
|
4996
5002
|
};
|
|
4997
5003
|
_proto.declareData = function declareData() {
|
|
4998
5004
|
var _PureContainer$protot;
|
|
@@ -15644,6 +15650,12 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15644
15650
|
page: 1,
|
|
15645
15651
|
};
|
|
15646
15652
|
};
|
|
15653
|
+
_proto.applyParentStore = function applyParentStore(instance) {
|
|
15654
|
+
_Container.prototype.applyParentStore.call(this, instance);
|
|
15655
|
+
|
|
15656
|
+
// force prepareData to execute again and propagate the store change to the records
|
|
15657
|
+
if (instance.cached) delete instance.cached.rawData;
|
|
15658
|
+
};
|
|
15647
15659
|
_proto.createRowTemplate = function createRowTemplate(context, columnParams, instance, groupingData) {
|
|
15648
15660
|
var _this = this;
|
|
15649
15661
|
var row = this.row || {};
|
package/package.json
CHANGED
package/src/charts/Legend.d.ts
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import * as Cx from "../core";
|
|
2
|
-
|
|
3
|
-
interface LegendProps extends Cx.HtmlElementProps {
|
|
4
|
-
/** Name of the legend. Default is `legend`. */
|
|
5
|
-
name?: string;
|
|
6
|
-
|
|
7
|
-
/** Base CSS class to be applied to the element. Defaults to `legend`. */
|
|
8
|
-
baseClass?: string;
|
|
9
|
-
|
|
10
|
-
/** Switch to vertical mode. */
|
|
11
|
-
vertical?: boolean;
|
|
12
|
-
|
|
13
|
-
/** Size of the svg shape container in pixels. Default value is 20. */
|
|
14
|
-
svgSize?: number;
|
|
15
|
-
|
|
16
|
-
/** Shape size in pixels. Default value is 18. */
|
|
17
|
-
shapeSize?: number;
|
|
18
|
-
|
|
19
|
-
/** Default shape that will be applied to the all legend items. */
|
|
20
|
-
shape?: Cx.StringProp;
|
|
21
|
-
|
|
22
|
-
/** CSS style that will be applied to the legend entry. */
|
|
23
|
-
entryStyle?: Cx.StyleProp;
|
|
24
|
-
|
|
25
|
-
/** CSS class that will be applied to the legend entry. */
|
|
26
|
-
entryClass?: Cx.ClassProp;
|
|
27
|
-
|
|
28
|
-
/** CSS style that will be applied to the legend entry value segment. */
|
|
29
|
-
valueStyle?: Cx.StyleProp;
|
|
30
|
-
|
|
31
|
-
/** CSS class that will be applied to the legend entry value segment. */
|
|
32
|
-
valueClass?: Cx.ClassProp;
|
|
33
|
-
|
|
34
|
-
/** Set to true to show values. Mostly used for PieChart legends. */
|
|
35
|
-
showValues?: Cx.BooleanProp;
|
|
36
|
-
|
|
37
|
-
/** Format used for values, i.e. n;2 or currency. The default value is s.*/
|
|
38
|
-
valueFormat?: string;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export class Legend extends Cx.Widget<LegendProps> {
|
|
42
|
-
static Scope(): any;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class LegendScope extends Cx.Widget<Cx.PureContainerProps> {}
|
|
1
|
+
import * as Cx from "../core";
|
|
2
|
+
|
|
3
|
+
interface LegendProps extends Cx.HtmlElementProps {
|
|
4
|
+
/** Name of the legend. Default is `legend`. */
|
|
5
|
+
name?: string;
|
|
6
|
+
|
|
7
|
+
/** Base CSS class to be applied to the element. Defaults to `legend`. */
|
|
8
|
+
baseClass?: string;
|
|
9
|
+
|
|
10
|
+
/** Switch to vertical mode. */
|
|
11
|
+
vertical?: boolean;
|
|
12
|
+
|
|
13
|
+
/** Size of the svg shape container in pixels. Default value is 20. */
|
|
14
|
+
svgSize?: number;
|
|
15
|
+
|
|
16
|
+
/** Shape size in pixels. Default value is 18. */
|
|
17
|
+
shapeSize?: number;
|
|
18
|
+
|
|
19
|
+
/** Default shape that will be applied to the all legend items. */
|
|
20
|
+
shape?: Cx.StringProp;
|
|
21
|
+
|
|
22
|
+
/** CSS style that will be applied to the legend entry. */
|
|
23
|
+
entryStyle?: Cx.StyleProp;
|
|
24
|
+
|
|
25
|
+
/** CSS class that will be applied to the legend entry. */
|
|
26
|
+
entryClass?: Cx.ClassProp;
|
|
27
|
+
|
|
28
|
+
/** CSS style that will be applied to the legend entry value segment. */
|
|
29
|
+
valueStyle?: Cx.StyleProp;
|
|
30
|
+
|
|
31
|
+
/** CSS class that will be applied to the legend entry value segment. */
|
|
32
|
+
valueClass?: Cx.ClassProp;
|
|
33
|
+
|
|
34
|
+
/** Set to true to show values. Mostly used for PieChart legends. */
|
|
35
|
+
showValues?: Cx.BooleanProp;
|
|
36
|
+
|
|
37
|
+
/** Format used for values, i.e. n;2 or currency. The default value is s.*/
|
|
38
|
+
valueFormat?: string;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export class Legend extends Cx.Widget<LegendProps> {
|
|
42
|
+
static Scope(): any;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export class LegendScope extends Cx.Widget<Cx.PureContainerProps> {}
|