cx 23.9.1 → 23.11.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 +6 -0
- package/dist/manifest.js +854 -854
- package/dist/svg.js +14 -2
- package/dist/widgets.css +43 -22
- package/dist/widgets.js +76 -18
- package/package.json +1 -1
- package/src/charts/PieLabel.js +7 -0
- package/src/svg/Text.d.ts +20 -19
- package/src/svg/Text.js +49 -33
- package/src/ui/Repeater.d.ts +60 -61
- package/src/widgets/List.d.ts +5 -6
- package/src/widgets/form/ColorPicker.js +43 -14
- package/src/widgets/form/ColorPicker.scss +275 -185
- package/src/widgets/form/ColorPicker.variables.scss +22 -21
- package/src/widgets/form/LookupField.d.ts +174 -171
- package/src/widgets/form/LookupField.js +8 -3
- package/src/widgets/form/UploadButton.d.ts +34 -34
- package/src/widgets/grid/Grid.d.ts +11 -11
- package/src/widgets/icons/pixel-picker.js +17 -0
- package/src/widgets/overlay/Tooltip.d.ts +1 -1
package/dist/svg.js
CHANGED
|
@@ -303,18 +303,28 @@ var Text = /*#__PURE__*/ (function (_BoundedObject) {
|
|
|
303
303
|
}
|
|
304
304
|
_BoundedObject.prototype.init.call(this);
|
|
305
305
|
};
|
|
306
|
+
_proto.prepare = function prepare(context, instance) {
|
|
307
|
+
if (this.autoTextAnchor) {
|
|
308
|
+
instance.textAnchor =
|
|
309
|
+
context.textDirection == "right" ? "start" : context.textDirection == "left" ? "end" : this.textAnchor;
|
|
310
|
+
var changed = instance.cache("textAnchor", instance.textAnchor);
|
|
311
|
+
if (changed) instance.markShouldUpdate(context);
|
|
312
|
+
}
|
|
313
|
+
_BoundedObject.prototype.prepare.call(this, context, instance);
|
|
314
|
+
};
|
|
306
315
|
_proto.render = function render(context, instance, key) {
|
|
307
316
|
var data = instance.data;
|
|
308
317
|
var bounds = data.bounds;
|
|
318
|
+
var textAnchor = this.autoTextAnchor ? instance.textAnchor : data.textAnchor;
|
|
309
319
|
return /*#__PURE__*/ jsxs(
|
|
310
320
|
"text",
|
|
311
321
|
{
|
|
312
322
|
className: data.classNames,
|
|
313
|
-
x: bounds.l,
|
|
323
|
+
x: this.autoTextAnchor && textAnchor == "end" ? bounds.r : bounds.l,
|
|
314
324
|
y: bounds.t,
|
|
315
325
|
dx: data.dx,
|
|
316
326
|
dy: data.dy,
|
|
317
|
-
textAnchor:
|
|
327
|
+
textAnchor: textAnchor,
|
|
318
328
|
style: data.style,
|
|
319
329
|
fill: data.fill,
|
|
320
330
|
stroke: data.stroke,
|
|
@@ -327,6 +337,8 @@ var Text = /*#__PURE__*/ (function (_BoundedObject) {
|
|
|
327
337
|
})(BoundedObject);
|
|
328
338
|
Text.prototype.anchors = "0.5 0.5 0.5 0.5";
|
|
329
339
|
Text.prototype.baseClass = "text";
|
|
340
|
+
Text.prototype.autoTextAnchor = false;
|
|
341
|
+
Text.prototype.autoAnchor = false;
|
|
330
342
|
Widget.alias("svg.text", Text);
|
|
331
343
|
|
|
332
344
|
var TextualBoundedObject = /*#__PURE__*/ (function (_BoundedObject) {
|
package/dist/widgets.css
CHANGED
|
@@ -2083,7 +2083,7 @@ th.cxe-calendar-display {
|
|
|
2083
2083
|
|
|
2084
2084
|
.cxb-colorpicker {
|
|
2085
2085
|
line-height: 16px;
|
|
2086
|
-
padding:
|
|
2086
|
+
padding: 4px;
|
|
2087
2087
|
border-width: 1px;
|
|
2088
2088
|
font-size: 11px;
|
|
2089
2089
|
font-family: "Consolas", monospace;
|
|
@@ -2108,7 +2108,7 @@ th.cxe-calendar-display {
|
|
|
2108
2108
|
}
|
|
2109
2109
|
.cxb-colorpicker input {
|
|
2110
2110
|
box-sizing: border-box;
|
|
2111
|
-
line-height:
|
|
2111
|
+
line-height: 14px;
|
|
2112
2112
|
padding: 2px;
|
|
2113
2113
|
border-width: 1px;
|
|
2114
2114
|
font-size: 11px;
|
|
@@ -2143,10 +2143,9 @@ th.cxe-calendar-display {
|
|
|
2143
2143
|
}
|
|
2144
2144
|
|
|
2145
2145
|
.cxe-colorpicker-picker {
|
|
2146
|
-
width:
|
|
2147
|
-
height:
|
|
2148
|
-
margin:
|
|
2149
|
-
float: left;
|
|
2146
|
+
width: 220px;
|
|
2147
|
+
height: 220px;
|
|
2148
|
+
margin: 4px;
|
|
2150
2149
|
position: relative;
|
|
2151
2150
|
touch-action: none;
|
|
2152
2151
|
background: -webkit-linear-gradient(top, hsl(0, 0%, 100%) 0%, hsla(0, 0%, 100%, 0) 50%, hsla(0, 0%, 0%, 0) 50%, hsl(0, 0%, 0%) 100%), -webkit-linear-gradient(left, hsl(0, 0%, 50%) 0%, hsla(0, 0%, 50%, 0) 100%);
|
|
@@ -2169,10 +2168,10 @@ th.cxe-calendar-display {
|
|
|
2169
2168
|
.cxe-colorpicker-hue {
|
|
2170
2169
|
height: 15px;
|
|
2171
2170
|
position: relative;
|
|
2172
|
-
background: -moz-linear-gradient(left, #
|
|
2173
|
-
background: -webkit-linear-gradient(left, #
|
|
2174
|
-
background: -ms-linear-gradient(left, #
|
|
2175
|
-
background: -o-linear-gradient(left, #
|
|
2171
|
+
background: -moz-linear-gradient(left, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
|
|
2172
|
+
background: -webkit-linear-gradient(left, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
|
|
2173
|
+
background: -ms-linear-gradient(left, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
|
|
2174
|
+
background: -o-linear-gradient(left, #f00 0%, #ff0 16.66%, #0f0 33.33%, #0ff 50%, #00f 66.66%, #f0f 83.33%, #f00 100%);
|
|
2176
2175
|
touch-action: none;
|
|
2177
2176
|
}
|
|
2178
2177
|
.cxe-colorpicker-hue .cxe-colorpicker-indicator {
|
|
@@ -2204,10 +2203,9 @@ th.cxe-calendar-display {
|
|
|
2204
2203
|
}
|
|
2205
2204
|
|
|
2206
2205
|
.cxe-colorpicker-details {
|
|
2207
|
-
width:
|
|
2206
|
+
width: 220px;
|
|
2208
2207
|
min-height: 170px;
|
|
2209
|
-
|
|
2210
|
-
margin: 5px;
|
|
2208
|
+
margin: 4px;
|
|
2211
2209
|
display: flex;
|
|
2212
2210
|
flex-direction: column;
|
|
2213
2211
|
justify-content: space-between;
|
|
@@ -2217,20 +2215,44 @@ th.cxe-calendar-display {
|
|
|
2217
2215
|
width: 25%;
|
|
2218
2216
|
display: inline-block;
|
|
2219
2217
|
text-align: right;
|
|
2220
|
-
font-size: 12px;
|
|
2221
2218
|
}
|
|
2222
2219
|
.cxe-colorpicker-inputs label input {
|
|
2220
|
+
margin-left: 2px;
|
|
2223
2221
|
width: 60%;
|
|
2224
2222
|
text-align: center;
|
|
2225
2223
|
}
|
|
2226
2224
|
|
|
2225
|
+
.cxe-colorpicker-pixel-picker {
|
|
2226
|
+
display: flex;
|
|
2227
|
+
width: 20px;
|
|
2228
|
+
height: 20px;
|
|
2229
|
+
flex-shrink: 0;
|
|
2230
|
+
align-items: center;
|
|
2231
|
+
margin-top: 4px;
|
|
2232
|
+
}
|
|
2233
|
+
.cxe-colorpicker-pixel-picker svg path {
|
|
2234
|
+
fill: currentColor;
|
|
2235
|
+
}
|
|
2236
|
+
.cxe-colorpicker-pixel-picker:hover {
|
|
2237
|
+
cursor: pointer;
|
|
2238
|
+
}
|
|
2239
|
+
.cxe-colorpicker-pixel-picker:hover svg path {
|
|
2240
|
+
fill: currentColor;
|
|
2241
|
+
opacity: 0.5;
|
|
2242
|
+
}
|
|
2243
|
+
|
|
2244
|
+
.cxe-colorpicker-preview {
|
|
2245
|
+
display: flex;
|
|
2246
|
+
}
|
|
2247
|
+
|
|
2227
2248
|
.cxe-colorpicker-color {
|
|
2228
2249
|
background-image: linear-gradient(45deg, rgba(128, 128, 128, 0.5) 25%, transparent 25%), linear-gradient(-45deg, rgba(128, 128, 128, 0.5) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(128, 128, 128, 0.5) 75%), linear-gradient(-45deg, transparent 75%, rgba(128, 128, 128, 0.5) 75%);
|
|
2229
2250
|
background-size: 8px 8px;
|
|
2230
2251
|
background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
|
|
2231
|
-
height:
|
|
2232
|
-
width:
|
|
2233
|
-
|
|
2252
|
+
height: 64px;
|
|
2253
|
+
width: 64px;
|
|
2254
|
+
border-radius: 4px;
|
|
2255
|
+
align-self: flex-end;
|
|
2234
2256
|
}
|
|
2235
2257
|
.cxe-colorpicker-color > div {
|
|
2236
2258
|
width: 100%;
|
|
@@ -2238,16 +2260,15 @@ th.cxe-calendar-display {
|
|
|
2238
2260
|
}
|
|
2239
2261
|
|
|
2240
2262
|
.cxe-colorpicker-values {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
margin-right: 5px;
|
|
2263
|
+
flex-grow: 1;
|
|
2264
|
+
margin: 0 8px;
|
|
2244
2265
|
}
|
|
2245
2266
|
.cxe-colorpicker-values input {
|
|
2246
|
-
width:
|
|
2267
|
+
width: 100%;
|
|
2247
2268
|
display: block;
|
|
2248
2269
|
}
|
|
2249
2270
|
.cxe-colorpicker-values input:not(:last-child) {
|
|
2250
|
-
margin: 0 0
|
|
2271
|
+
margin: 0 0 4px 0;
|
|
2251
2272
|
}
|
|
2252
2273
|
|
|
2253
2274
|
.cxb-colorfield {
|
package/dist/widgets.js
CHANGED
|
@@ -8808,12 +8808,18 @@ var LookupField = /*#__PURE__*/ (function (_Field) {
|
|
|
8808
8808
|
records = _instance$data.records,
|
|
8809
8809
|
values = _instance$data.values,
|
|
8810
8810
|
options = _instance$data.options;
|
|
8811
|
-
if (isArray(records))
|
|
8812
|
-
|
|
8813
|
-
|
|
8814
|
-
|
|
8815
|
-
|
|
8816
|
-
|
|
8811
|
+
if (isArray(records)) {
|
|
8812
|
+
var _this$onGetRecordDisp;
|
|
8813
|
+
var valueTextFormatter =
|
|
8814
|
+
(_this$onGetRecordDisp = this.onGetRecordDisplayText) != null
|
|
8815
|
+
? _this$onGetRecordDisp
|
|
8816
|
+
: function (record) {
|
|
8817
|
+
return record[_this3.valueTextField] || record[_this3.valueIdField];
|
|
8818
|
+
};
|
|
8819
|
+
return records.map(function (record) {
|
|
8820
|
+
return valueTextFormatter(record, instance);
|
|
8821
|
+
});
|
|
8822
|
+
}
|
|
8817
8823
|
if (isArray(values)) {
|
|
8818
8824
|
if (isArray(options))
|
|
8819
8825
|
return values
|
|
@@ -8861,6 +8867,7 @@ LookupField.prototype.submitOnDropdownEnterKey = false;
|
|
|
8861
8867
|
LookupField.prototype.pageSize = 100;
|
|
8862
8868
|
LookupField.prototype.infinite = false;
|
|
8863
8869
|
LookupField.prototype.quickSelectAll = false;
|
|
8870
|
+
LookupField.prototype.onGetRecordDisplayText = null;
|
|
8864
8871
|
Localization.registerPrototype("cx/widgets/LookupField", LookupField);
|
|
8865
8872
|
Widget.alias("lookupfield", LookupField);
|
|
8866
8873
|
function getOptionKey(bindings, data) {
|
|
@@ -9294,6 +9301,13 @@ var LookupComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
9294
9301
|
if (this.props.multiple) {
|
|
9295
9302
|
var readOnly = data.disabled || data.readOnly;
|
|
9296
9303
|
if (isNonEmptyArray(data.records)) {
|
|
9304
|
+
var _this$onGetRecordDisp2;
|
|
9305
|
+
var valueTextFormatter =
|
|
9306
|
+
(_this$onGetRecordDisp2 = this.onGetRecordDisplayText) != null
|
|
9307
|
+
? _this$onGetRecordDisp2
|
|
9308
|
+
: function (record) {
|
|
9309
|
+
return record[_this9.valueTextField];
|
|
9310
|
+
};
|
|
9297
9311
|
text = data.records.map(function (v, i) {
|
|
9298
9312
|
return /*#__PURE__*/ jsxs(
|
|
9299
9313
|
"div",
|
|
@@ -9304,7 +9318,7 @@ var LookupComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
9304
9318
|
children: [
|
|
9305
9319
|
/*#__PURE__*/ jsx("span", {
|
|
9306
9320
|
className: CSS.element(baseClass, "tag-value"),
|
|
9307
|
-
children: v
|
|
9321
|
+
children: valueTextFormatter(v, instance),
|
|
9308
9322
|
}),
|
|
9309
9323
|
!readOnly &&
|
|
9310
9324
|
/*#__PURE__*/ jsx("div", {
|
|
@@ -11338,6 +11352,27 @@ function floor5(x) {
|
|
|
11338
11352
|
return Math.floor(x / 5) * 5;
|
|
11339
11353
|
}
|
|
11340
11354
|
|
|
11355
|
+
var PixelPickerIcon = registerIcon(
|
|
11356
|
+
"pixel-picker",
|
|
11357
|
+
function (props) {
|
|
11358
|
+
return /*#__PURE__*/ jsx(
|
|
11359
|
+
"svg",
|
|
11360
|
+
_objectSpread2(
|
|
11361
|
+
_objectSpread2({}, props),
|
|
11362
|
+
{},
|
|
11363
|
+
{
|
|
11364
|
+
viewBox: "0 0 30 30",
|
|
11365
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11366
|
+
d: "M27.7,3.3c-1.5-1.5-3.9-1.5-5.4,0L17,8.6l-1.3-1.3c-0.4-0.4-1-0.4-1.4,0s-0.4,1,0,1.4l1.3,1.3L5,20.6 c-0.6,0.6-1,1.4-1.1,2.3C3.3,23.4,3,24.2,3,25c0,1.7,1.3,3,3,3c0.8,0,1.6-0.3,2.2-0.9C9,27,9.8,26.6,10.4,26L21,15.4l1.3,1.3 c0.2,0.2,0.5,0.3,0.7,0.3s0.5-0.1,0.7-0.3c0.4-0.4,0.4-1,0-1.4L22.4,14l5.3-5.3C29.2,7.2,29.2,4.8,27.7,3.3z M9,24.6 c-0.4,0.4-0.8,0.6-1.3,0.5c-0.4,0-0.7,0.2-0.9,0.5C6.7,25.8,6.3,26,6,26c-0.6,0-1-0.4-1-1c0-0.3,0.2-0.7,0.5-0.8 c0.3-0.2,0.5-0.5,0.5-0.9c0-0.5,0.2-1,0.5-1.3L17,11.4l2.6,2.6L9,24.6z",
|
|
11367
|
+
fill: "currentColor",
|
|
11368
|
+
}),
|
|
11369
|
+
}
|
|
11370
|
+
)
|
|
11371
|
+
);
|
|
11372
|
+
},
|
|
11373
|
+
true
|
|
11374
|
+
);
|
|
11375
|
+
|
|
11341
11376
|
var ColorPicker = /*#__PURE__*/ (function (_Field) {
|
|
11342
11377
|
_inheritsLoose(ColorPicker, _Field);
|
|
11343
11378
|
function ColorPicker() {
|
|
@@ -11496,6 +11531,7 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11496
11531
|
var hsla = "hsla(" + h.toFixed(0) + "," + s.toFixed(0) + "%," + l.toFixed(0) + "%," + a + ")";
|
|
11497
11532
|
var rgba = "rgba(" + r.toFixed(0) + "," + g.toFixed(0) + "," + b.toFixed(0) + "," + a + ")";
|
|
11498
11533
|
var hex = rgbToHex(r, g, b);
|
|
11534
|
+
var pixelPicker;
|
|
11499
11535
|
var alphaGradient =
|
|
11500
11536
|
getVendorPrefix("css") +
|
|
11501
11537
|
"linear-gradient(left, hsla(" +
|
|
@@ -11511,6 +11547,21 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11511
11547
|
"%," +
|
|
11512
11548
|
l +
|
|
11513
11549
|
"%,1) 100%)";
|
|
11550
|
+
if (window.EyeDropper) {
|
|
11551
|
+
pixelPicker = /*#__PURE__*/ jsx("div", {
|
|
11552
|
+
className: CSS.element(baseClass, "pixel-picker"),
|
|
11553
|
+
onClick: function onClick(e) {
|
|
11554
|
+
var eyeDropper = new EyeDropper();
|
|
11555
|
+
eyeDropper
|
|
11556
|
+
.open()
|
|
11557
|
+
.then(function (result) {
|
|
11558
|
+
instance.set("value", result.sRGBHex);
|
|
11559
|
+
})
|
|
11560
|
+
["catch"](function (e) {});
|
|
11561
|
+
},
|
|
11562
|
+
children: /*#__PURE__*/ jsx(PixelPickerIcon, {}),
|
|
11563
|
+
});
|
|
11564
|
+
}
|
|
11514
11565
|
return /*#__PURE__*/ jsxs("div", {
|
|
11515
11566
|
className: data.classNames,
|
|
11516
11567
|
style: data.style,
|
|
@@ -11698,6 +11749,23 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11698
11749
|
/*#__PURE__*/ jsxs("div", {
|
|
11699
11750
|
className: CSS.element(baseClass, "preview"),
|
|
11700
11751
|
children: [
|
|
11752
|
+
/*#__PURE__*/ jsx("div", {
|
|
11753
|
+
style: {
|
|
11754
|
+
display: "flex",
|
|
11755
|
+
alignItems: "center",
|
|
11756
|
+
},
|
|
11757
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
11758
|
+
className: CSS.element(baseClass, "color"),
|
|
11759
|
+
onClick: function onClick(e) {
|
|
11760
|
+
_this2.onColorClick(e);
|
|
11761
|
+
},
|
|
11762
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
11763
|
+
style: {
|
|
11764
|
+
backgroundColor: hsla,
|
|
11765
|
+
},
|
|
11766
|
+
}),
|
|
11767
|
+
}),
|
|
11768
|
+
}),
|
|
11701
11769
|
/*#__PURE__*/ jsxs("div", {
|
|
11702
11770
|
className: CSS.element(baseClass, "values"),
|
|
11703
11771
|
children: [
|
|
@@ -11715,17 +11783,7 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11715
11783
|
}),
|
|
11716
11784
|
],
|
|
11717
11785
|
}),
|
|
11718
|
-
|
|
11719
|
-
className: CSS.element(baseClass, "color"),
|
|
11720
|
-
onClick: function onClick(e) {
|
|
11721
|
-
_this2.onColorClick(e);
|
|
11722
|
-
},
|
|
11723
|
-
children: /*#__PURE__*/ jsx("div", {
|
|
11724
|
-
style: {
|
|
11725
|
-
backgroundColor: hsla,
|
|
11726
|
-
},
|
|
11727
|
-
}),
|
|
11728
|
-
}),
|
|
11786
|
+
pixelPicker,
|
|
11729
11787
|
],
|
|
11730
11788
|
}),
|
|
11731
11789
|
],
|
package/package.json
CHANGED
package/src/charts/PieLabel.js
CHANGED
|
@@ -31,9 +31,16 @@ export class PieLabel extends BoundedObject {
|
|
|
31
31
|
super.prepare(context, instance);
|
|
32
32
|
if (!context.registerPieLabel)
|
|
33
33
|
throw new Error("PieLabel components are allowed only within PieLabelsContainer components.");
|
|
34
|
+
console.log(instance.actualBounds, instance.originalBounds, instance.parentRect);
|
|
35
|
+
let right = instance.parentRect.r > instance.parentRect.l;
|
|
36
|
+
context.push("textDirection", right ? "right" : "left");
|
|
34
37
|
context.registerPieLabel(instance);
|
|
35
38
|
}
|
|
36
39
|
|
|
40
|
+
prepareCleanup(context, instance) {
|
|
41
|
+
context.pop("textDirection");
|
|
42
|
+
}
|
|
43
|
+
|
|
37
44
|
render(context, instance, key) {
|
|
38
45
|
let { originalBounds, actualBounds, data } = instance;
|
|
39
46
|
|
package/src/svg/Text.d.ts
CHANGED
|
@@ -1,39 +1,40 @@
|
|
|
1
|
-
import * as Cx from
|
|
2
|
-
import {BoundedObject, BoundedObjectProps} from
|
|
1
|
+
import * as Cx from "../core";
|
|
2
|
+
import { BoundedObject, BoundedObjectProps } from "./BoundedObject";
|
|
3
3
|
|
|
4
4
|
interface TextProps extends BoundedObjectProps {
|
|
5
|
-
|
|
6
5
|
/** Text to be displayed. */
|
|
7
|
-
value?: Cx.StringProp
|
|
6
|
+
value?: Cx.StringProp;
|
|
8
7
|
|
|
9
|
-
bind?: string
|
|
10
|
-
tpl?: string
|
|
11
|
-
expr?: string
|
|
8
|
+
bind?: string;
|
|
9
|
+
tpl?: string;
|
|
10
|
+
expr?: string;
|
|
12
11
|
|
|
13
12
|
/** Offset along the x-axis. */
|
|
14
|
-
dx?: Cx.Prop<string | number
|
|
13
|
+
dx?: Cx.Prop<string | number>;
|
|
15
14
|
|
|
16
|
-
/**
|
|
17
|
-
* Offset along the y-axis. This property is commonly used for vertical text alignment.
|
|
18
|
-
* Set dy="0.8em" to align the text with the top and dy="0.4em" to center it vertically.
|
|
15
|
+
/**
|
|
16
|
+
* Offset along the y-axis. This property is commonly used for vertical text alignment.
|
|
17
|
+
* Set dy="0.8em" to align the text with the top and dy="0.4em" to center it vertically.
|
|
19
18
|
*/
|
|
20
|
-
dy?: Cx.Prop<string | number
|
|
19
|
+
dy?: Cx.Prop<string | number>;
|
|
21
20
|
|
|
22
21
|
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
23
|
-
textAnchor?: Cx.StringProp
|
|
22
|
+
textAnchor?: Cx.StringProp;
|
|
24
23
|
|
|
25
24
|
/** Used for horizontal text alignment. Accepted values are `start`, `middle` and `end`. */
|
|
26
|
-
ta?: Cx.StringProp
|
|
25
|
+
ta?: Cx.StringProp;
|
|
27
26
|
|
|
28
27
|
/** Sets text-body color. */
|
|
29
|
-
fill?: Cx.StringProp
|
|
28
|
+
fill?: Cx.StringProp;
|
|
30
29
|
|
|
31
30
|
/** Sets text-outline color. */
|
|
32
|
-
stroke?: Cx.StringProp
|
|
31
|
+
stroke?: Cx.StringProp;
|
|
33
32
|
|
|
34
33
|
/** Base CSS class to be applied to the element. Defaults to `text`. */
|
|
35
|
-
baseClass?: string
|
|
36
|
-
|
|
34
|
+
baseClass?: string;
|
|
35
|
+
|
|
36
|
+
/** Set to true for the text to set the text anchor based on the direction of the parent element. See PieLabels example. */
|
|
37
|
+
autoTextAnchor?: boolean;
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
export class Text extends Cx.Widget<TextProps> {}
|
|
40
|
+
export class Text extends Cx.Widget<TextProps> {}
|
package/src/svg/Text.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {Widget, VDOM} from
|
|
2
|
-
import {BoundedObject} from
|
|
1
|
+
import { Widget, VDOM } from "../ui/Widget";
|
|
2
|
+
import { BoundedObject } from "./BoundedObject";
|
|
3
3
|
|
|
4
4
|
export class Text extends BoundedObject {
|
|
5
|
-
|
|
6
5
|
declareData() {
|
|
7
6
|
return super.declareData(...arguments, {
|
|
8
7
|
value: undefined,
|
|
@@ -10,53 +9,70 @@ export class Text extends BoundedObject {
|
|
|
10
9
|
dy: undefined,
|
|
11
10
|
textAnchor: undefined,
|
|
12
11
|
fill: undefined,
|
|
13
|
-
stroke: undefined
|
|
14
|
-
})
|
|
12
|
+
stroke: undefined,
|
|
13
|
+
});
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
init() {
|
|
18
|
-
|
|
19
|
-
if (this.ta)
|
|
20
|
-
this.textAnchor = this.ta;
|
|
17
|
+
if (this.ta) this.textAnchor = this.ta;
|
|
21
18
|
|
|
22
19
|
if (this.bind) {
|
|
23
20
|
this.value = {
|
|
24
|
-
bind: this.bind
|
|
21
|
+
bind: this.bind,
|
|
25
22
|
};
|
|
26
23
|
} else if (this.tpl) {
|
|
27
24
|
this.value = {
|
|
28
|
-
tpl: this.tpl
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
else if (this.expr) {
|
|
25
|
+
tpl: this.tpl,
|
|
26
|
+
};
|
|
27
|
+
} else if (this.expr) {
|
|
32
28
|
this.value = {
|
|
33
|
-
expr: this.expr
|
|
34
|
-
}
|
|
29
|
+
expr: this.expr,
|
|
30
|
+
};
|
|
35
31
|
}
|
|
36
32
|
|
|
37
33
|
super.init();
|
|
38
34
|
}
|
|
39
35
|
|
|
36
|
+
prepare(context, instance) {
|
|
37
|
+
if (this.autoTextAnchor) {
|
|
38
|
+
instance.textAnchor =
|
|
39
|
+
context.textDirection == "right" ? "start" : context.textDirection == "left" ? "end" : this.textAnchor;
|
|
40
|
+
let changed = instance.cache("textAnchor", instance.textAnchor);
|
|
41
|
+
if (changed) instance.markShouldUpdate(context);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
super.prepare(context, instance);
|
|
45
|
+
}
|
|
46
|
+
|
|
40
47
|
render(context, instance, key) {
|
|
41
|
-
var {data} = instance;
|
|
42
|
-
var {bounds} = data;
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
48
|
+
var { data } = instance;
|
|
49
|
+
var { bounds } = data;
|
|
50
|
+
|
|
51
|
+
let textAnchor = this.autoTextAnchor ? instance.textAnchor : data.textAnchor;
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<text
|
|
55
|
+
key={key}
|
|
56
|
+
className={data.classNames}
|
|
57
|
+
x={this.autoTextAnchor && textAnchor == "end" ? bounds.r : bounds.l}
|
|
58
|
+
y={bounds.t}
|
|
59
|
+
dx={data.dx}
|
|
60
|
+
dy={data.dy}
|
|
61
|
+
textAnchor={textAnchor}
|
|
62
|
+
style={data.style}
|
|
63
|
+
fill={data.fill}
|
|
64
|
+
stroke={data.stroke}
|
|
65
|
+
>
|
|
66
|
+
{data.value}
|
|
67
|
+
{this.renderChildren(context, instance)}
|
|
68
|
+
</text>
|
|
69
|
+
);
|
|
56
70
|
}
|
|
57
71
|
}
|
|
58
72
|
|
|
59
|
-
Text.prototype.anchors =
|
|
60
|
-
Text.prototype.baseClass =
|
|
73
|
+
Text.prototype.anchors = "0.5 0.5 0.5 0.5";
|
|
74
|
+
Text.prototype.baseClass = "text";
|
|
75
|
+
Text.prototype.autoTextAnchor = false;
|
|
76
|
+
Text.prototype.autoAnchor = false;
|
|
61
77
|
|
|
62
|
-
Widget.alias(
|
|
78
|
+
Widget.alias("svg.text", Text);
|
package/src/ui/Repeater.d.ts
CHANGED
|
@@ -1,61 +1,60 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RecordsProp,
|
|
3
|
-
RecordAlias,
|
|
4
|
-
StringProp,
|
|
5
|
-
SortersProp,
|
|
6
|
-
StructuredProp,
|
|
7
|
-
CollatorOptions,
|
|
8
|
-
Widget,
|
|
9
|
-
PureContainerProps,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from "
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
export class Repeater extends Widget<RepeaterProps> {}
|
|
1
|
+
import {
|
|
2
|
+
RecordsProp,
|
|
3
|
+
RecordAlias,
|
|
4
|
+
StringProp,
|
|
5
|
+
SortersProp,
|
|
6
|
+
StructuredProp,
|
|
7
|
+
CollatorOptions,
|
|
8
|
+
Widget,
|
|
9
|
+
PureContainerProps,
|
|
10
|
+
Prop,
|
|
11
|
+
SortDirection,
|
|
12
|
+
} from "../core";
|
|
13
|
+
import { Instance } from "./Instance";
|
|
14
|
+
|
|
15
|
+
interface RepeaterProps<T = unknown> extends PureContainerProps {
|
|
16
|
+
records: Prop<T[]>;
|
|
17
|
+
recordName?: RecordAlias;
|
|
18
|
+
recordAlias?: RecordAlias;
|
|
19
|
+
indexName?: RecordAlias;
|
|
20
|
+
indexAlias?: RecordAlias;
|
|
21
|
+
cached?: boolean;
|
|
22
|
+
|
|
23
|
+
/** Indicate that parent store data should not be mutated. */
|
|
24
|
+
immutable?: boolean;
|
|
25
|
+
|
|
26
|
+
/** Indicate that record stores should not be mutated. */
|
|
27
|
+
sealed?: boolean;
|
|
28
|
+
|
|
29
|
+
sorters?: SortersProp;
|
|
30
|
+
|
|
31
|
+
/** A binding used to store the name of the field used for sorting the collection. Available only if `sorters` are not used. */
|
|
32
|
+
sortField?: StringProp;
|
|
33
|
+
|
|
34
|
+
/** A binding used to store the sort direction. Available only if `sorters` are not used. Possible values are `"ASC"` and `"DESC"`. Defaults to `"ASC"`. */
|
|
35
|
+
sortDirection?: Prop<SortDirection>;
|
|
36
|
+
|
|
37
|
+
/** Parameters that affect filtering */
|
|
38
|
+
filterParams?: StructuredProp;
|
|
39
|
+
|
|
40
|
+
/** Callback to create a filter function for given filter params. */
|
|
41
|
+
onCreateFilter?: (filterParams: any, instance: Instance) => (record: T) => boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Callback function to track and retrieve displayed records.
|
|
45
|
+
* Accepts new records as a first argument.
|
|
46
|
+
* If onCreateFilter callback is defined, filtered records can be retrieved using this callback.
|
|
47
|
+
*/
|
|
48
|
+
onTrackMappedRecords?: string | ((records: T[], instance: Instance) => void);
|
|
49
|
+
|
|
50
|
+
/** Options for data sorting. See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Collator */
|
|
51
|
+
sortOptions?: CollatorOptions;
|
|
52
|
+
|
|
53
|
+
/** A field used to get the unique identifier of the record. Setting keyField improves performance on sort operations as the widget is able to movement of records inside the collection. */
|
|
54
|
+
keyField?: StringProp;
|
|
55
|
+
|
|
56
|
+
/** Data adapter used to convert data in the list of records. Used for manipulation of records, e.g flattening the tree records. */
|
|
57
|
+
dataAdapter?: any;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class Repeater<T = unknown> extends Widget<RepeaterProps<T>> {}
|