cx 23.9.0 → 23.11.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/charts.js +6 -0
- package/dist/manifest.js +664 -664
- package/dist/svg.js +14 -2
- package/dist/widgets.css +43 -22
- package/dist/widgets.js +59 -12
- 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/UploadButton.d.ts +34 -34
- package/src/widgets/grid/Grid.d.ts +11 -11
- package/src/widgets/grid/Grid.js +3276 -3273
- 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
|
@@ -11338,6 +11338,27 @@ function floor5(x) {
|
|
|
11338
11338
|
return Math.floor(x / 5) * 5;
|
|
11339
11339
|
}
|
|
11340
11340
|
|
|
11341
|
+
var PixelPickerIcon = registerIcon(
|
|
11342
|
+
"pixel-picker",
|
|
11343
|
+
function (props) {
|
|
11344
|
+
return /*#__PURE__*/ jsx(
|
|
11345
|
+
"svg",
|
|
11346
|
+
_objectSpread2(
|
|
11347
|
+
_objectSpread2({}, props),
|
|
11348
|
+
{},
|
|
11349
|
+
{
|
|
11350
|
+
viewBox: "0 0 30 30",
|
|
11351
|
+
children: /*#__PURE__*/ jsx("path", {
|
|
11352
|
+
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",
|
|
11353
|
+
fill: "currentColor",
|
|
11354
|
+
}),
|
|
11355
|
+
}
|
|
11356
|
+
)
|
|
11357
|
+
);
|
|
11358
|
+
},
|
|
11359
|
+
true
|
|
11360
|
+
);
|
|
11361
|
+
|
|
11341
11362
|
var ColorPicker = /*#__PURE__*/ (function (_Field) {
|
|
11342
11363
|
_inheritsLoose(ColorPicker, _Field);
|
|
11343
11364
|
function ColorPicker() {
|
|
@@ -11496,6 +11517,7 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11496
11517
|
var hsla = "hsla(" + h.toFixed(0) + "," + s.toFixed(0) + "%," + l.toFixed(0) + "%," + a + ")";
|
|
11497
11518
|
var rgba = "rgba(" + r.toFixed(0) + "," + g.toFixed(0) + "," + b.toFixed(0) + "," + a + ")";
|
|
11498
11519
|
var hex = rgbToHex(r, g, b);
|
|
11520
|
+
var pixelPicker;
|
|
11499
11521
|
var alphaGradient =
|
|
11500
11522
|
getVendorPrefix("css") +
|
|
11501
11523
|
"linear-gradient(left, hsla(" +
|
|
@@ -11511,6 +11533,21 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11511
11533
|
"%," +
|
|
11512
11534
|
l +
|
|
11513
11535
|
"%,1) 100%)";
|
|
11536
|
+
if (window.EyeDropper) {
|
|
11537
|
+
pixelPicker = /*#__PURE__*/ jsx("div", {
|
|
11538
|
+
className: CSS.element(baseClass, "pixel-picker"),
|
|
11539
|
+
onClick: function onClick(e) {
|
|
11540
|
+
var eyeDropper = new EyeDropper();
|
|
11541
|
+
eyeDropper
|
|
11542
|
+
.open()
|
|
11543
|
+
.then(function (result) {
|
|
11544
|
+
instance.set("value", result.sRGBHex);
|
|
11545
|
+
})
|
|
11546
|
+
["catch"](function (e) {});
|
|
11547
|
+
},
|
|
11548
|
+
children: /*#__PURE__*/ jsx(PixelPickerIcon, {}),
|
|
11549
|
+
});
|
|
11550
|
+
}
|
|
11514
11551
|
return /*#__PURE__*/ jsxs("div", {
|
|
11515
11552
|
className: data.classNames,
|
|
11516
11553
|
style: data.style,
|
|
@@ -11698,6 +11735,23 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11698
11735
|
/*#__PURE__*/ jsxs("div", {
|
|
11699
11736
|
className: CSS.element(baseClass, "preview"),
|
|
11700
11737
|
children: [
|
|
11738
|
+
/*#__PURE__*/ jsx("div", {
|
|
11739
|
+
style: {
|
|
11740
|
+
display: "flex",
|
|
11741
|
+
alignItems: "center",
|
|
11742
|
+
},
|
|
11743
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
11744
|
+
className: CSS.element(baseClass, "color"),
|
|
11745
|
+
onClick: function onClick(e) {
|
|
11746
|
+
_this2.onColorClick(e);
|
|
11747
|
+
},
|
|
11748
|
+
children: /*#__PURE__*/ jsx("div", {
|
|
11749
|
+
style: {
|
|
11750
|
+
backgroundColor: hsla,
|
|
11751
|
+
},
|
|
11752
|
+
}),
|
|
11753
|
+
}),
|
|
11754
|
+
}),
|
|
11701
11755
|
/*#__PURE__*/ jsxs("div", {
|
|
11702
11756
|
className: CSS.element(baseClass, "values"),
|
|
11703
11757
|
children: [
|
|
@@ -11715,17 +11769,7 @@ var ColorPickerComponent = /*#__PURE__*/ (function (_VDOM$Component) {
|
|
|
11715
11769
|
}),
|
|
11716
11770
|
],
|
|
11717
11771
|
}),
|
|
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
|
-
}),
|
|
11772
|
+
pixelPicker,
|
|
11729
11773
|
],
|
|
11730
11774
|
}),
|
|
11731
11775
|
],
|
|
@@ -15503,6 +15547,7 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15503
15547
|
row.hasSortableColumns = false;
|
|
15504
15548
|
row.hasResizableColumns = false;
|
|
15505
15549
|
var aggregates = {};
|
|
15550
|
+
var showFooter = false;
|
|
15506
15551
|
var lines = [];
|
|
15507
15552
|
for (var i = 0; i < 10; i++) {
|
|
15508
15553
|
var l = row["line" + i];
|
|
@@ -15546,12 +15591,14 @@ var Grid = /*#__PURE__*/ (function (_Container) {
|
|
|
15546
15591
|
},
|
|
15547
15592
|
type: c.aggregate,
|
|
15548
15593
|
};
|
|
15594
|
+
} else if (c.footer && !showFooter) {
|
|
15595
|
+
showFooter = true;
|
|
15549
15596
|
}
|
|
15550
15597
|
});
|
|
15551
15598
|
});
|
|
15552
15599
|
|
|
15553
15600
|
//add default footer if some columns have aggregates and grouping is not defined
|
|
15554
|
-
if (!groupingData && (Object.keys(aggregates).length > 0 || this.fixedFooter))
|
|
15601
|
+
if (!groupingData && (Object.keys(aggregates).length > 0 || this.fixedFooter || showFooter))
|
|
15555
15602
|
groupingData = [
|
|
15556
15603
|
{
|
|
15557
15604
|
key: {},
|
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>> {}
|
package/src/widgets/List.d.ts
CHANGED
|
@@ -4,9 +4,8 @@ import {
|
|
|
4
4
|
ClassProp,
|
|
5
5
|
CollatorOptions,
|
|
6
6
|
Config,
|
|
7
|
-
|
|
7
|
+
Prop,
|
|
8
8
|
RecordAlias,
|
|
9
|
-
RecordsProp,
|
|
10
9
|
SortersProp,
|
|
11
10
|
StringProp,
|
|
12
11
|
StructuredProp,
|
|
@@ -20,9 +19,9 @@ type KeyDownPipe = (event: KeyboardEvent) => void;
|
|
|
20
19
|
|
|
21
20
|
type PipeKeyDownCallback = (pipe: KeyDownPipe) => void;
|
|
22
21
|
|
|
23
|
-
interface ListProps extends StyledContainerProps {
|
|
22
|
+
interface ListProps<T = unknown> extends StyledContainerProps {
|
|
24
23
|
/** An array of records to be displayed in the list. */
|
|
25
|
-
records?:
|
|
24
|
+
records?: Prop<T[]>;
|
|
26
25
|
|
|
27
26
|
/** Used for sorting the list. */
|
|
28
27
|
sorters?: SortersProp;
|
|
@@ -65,7 +64,7 @@ interface ListProps extends StyledContainerProps {
|
|
|
65
64
|
filterParams?: StructuredProp;
|
|
66
65
|
|
|
67
66
|
/** Callback to create a filter function for given filter params. */
|
|
68
|
-
onCreateFilter?: (filterParams: any, instance: Instance) => (record:
|
|
67
|
+
onCreateFilter?: (filterParams: any, instance: Instance) => (record: T) => boolean;
|
|
69
68
|
|
|
70
69
|
/** Scrolls selection into the view. Default value is false. */
|
|
71
70
|
scrollSelectionIntoView?: boolean;
|
|
@@ -92,4 +91,4 @@ interface ListProps extends StyledContainerProps {
|
|
|
92
91
|
keyField?: string;
|
|
93
92
|
}
|
|
94
93
|
|
|
95
|
-
export class List extends Widget<ListProps
|
|
94
|
+
export class List<T = unknown> extends Widget<ListProps<T>> {}
|