cx 26.4.3 → 26.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/build/charts/axis/Axis.d.ts +8 -0
- package/build/charts/axis/Axis.d.ts.map +1 -1
- package/build/charts/axis/Axis.js +18 -1
- package/build/charts/axis/TimeAxis.js +1 -0
- package/build/data/AugmentedViewBase.d.ts.map +1 -1
- package/build/data/AugmentedViewBase.js +5 -4
- package/build/data/View.d.ts +0 -1
- package/build/data/View.d.ts.map +1 -1
- package/build/data/View.js +1 -3
- package/build/ui/Format.d.ts.map +1 -1
- package/build/ui/Format.js +26 -2
- package/build/util/Format.d.ts.map +1 -1
- package/build/util/Format.js +6 -0
- package/build/util/date/dateQuarter.d.ts +7 -0
- package/build/util/date/dateQuarter.d.ts.map +1 -0
- package/build/util/date/dateQuarter.js +8 -0
- package/build/util/date/dayBefore.d.ts +12 -0
- package/build/util/date/dayBefore.d.ts.map +1 -0
- package/build/util/date/dayBefore.js +15 -0
- package/build/util/date/index.d.ts +2 -0
- package/build/util/date/index.d.ts.map +1 -1
- package/build/util/date/index.js +2 -0
- package/build/widgets/form/DateTimePicker.d.ts.map +1 -1
- package/build/widgets/form/DateTimePicker.js +53 -31
- package/build/widgets/form/Field.d.ts.map +1 -1
- package/build/widgets/form/Field.js +2 -1
- package/build/widgets/form/LookupField.js +2 -1
- package/build/widgets/form/Wheel.d.ts +8 -0
- package/build/widgets/form/Wheel.d.ts.map +1 -1
- package/build/widgets/form/Wheel.js +30 -7
- package/build/widgets/grid/Grid.d.ts +1 -1
- package/build/widgets/grid/Grid.d.ts.map +1 -1
- package/dist/charts.css +6 -0
- package/dist/charts.js +18 -1
- package/dist/data.js +5 -4
- package/dist/manifest.js +772 -763
- package/dist/ui.js +33 -1
- package/dist/util.js +32 -0
- package/dist/widgets.css +9 -3
- package/dist/widgets.js +230 -174
- package/package.json +1 -1
- package/src/charts/RangeMarker.scss +3 -0
- package/src/charts/axis/Axis.tsx +31 -1
- package/src/charts/axis/TimeAxis.tsx +1 -0
- package/src/charts/index.scss +1 -0
- package/src/data/AugmentedViewBase.ts +5 -4
- package/src/data/View.ts +16 -61
- package/src/ui/DataProxy.ts +55 -55
- package/src/ui/Format.spec.ts +32 -0
- package/src/ui/Format.ts +27 -2
- package/src/ui/Rescope.ts +50 -50
- package/src/ui/adapter/ArrayAdapter.ts +229 -229
- package/src/ui/exprHelpers.ts +96 -96
- package/src/util/Format.spec.ts +11 -0
- package/src/util/Format.ts +7 -0
- package/src/util/date/dateQuarter.ts +8 -0
- package/src/util/date/dayBefore.ts +15 -0
- package/src/util/date/index.ts +2 -0
- package/src/widgets/Sandbox.ts +104 -104
- package/src/widgets/form/ColorField.scss +112 -112
- package/src/widgets/form/DateTimeField.scss +111 -111
- package/src/widgets/form/DateTimePicker.tsx +453 -392
- package/src/widgets/form/Field.tsx +2 -1
- package/src/widgets/form/LookupField.maps.scss +26 -26
- package/src/widgets/form/LookupField.scss +10 -3
- package/src/widgets/form/LookupField.tsx +4 -1
- package/src/widgets/form/MonthField.scss +113 -113
- package/src/widgets/form/NumberField.scss +72 -72
- package/src/widgets/form/Select.scss +104 -104
- package/src/widgets/form/TextField.scss +66 -66
- package/src/widgets/form/ValidationGroup.spec.tsx +30 -1
- package/src/widgets/form/Wheel.tsx +36 -7
- package/src/widgets/grid/Grid.tsx +1 -1
- package/src/widgets/nav/MenuItem.tsx +525 -525
package/src/data/View.ts
CHANGED
|
@@ -42,9 +42,7 @@ export interface ViewMethods<D = Record<string, any>> {
|
|
|
42
42
|
delete(paths: Path[]): boolean;
|
|
43
43
|
delete(...paths: Path[]): boolean;
|
|
44
44
|
delete<V>(path: AccessorChain<V>): boolean;
|
|
45
|
-
delete<T extends any[]>(
|
|
46
|
-
...paths: { [K in keyof T]: AccessorChain<T[K]> }
|
|
47
|
-
): boolean;
|
|
45
|
+
delete<T extends any[]>(...paths: { [K in keyof T]: AccessorChain<T[K]> }): boolean;
|
|
48
46
|
delete<T extends any[]>(paths: {
|
|
49
47
|
[K in keyof T]: AccessorChain<T[K]>;
|
|
50
48
|
}): boolean;
|
|
@@ -58,28 +56,14 @@ export interface ViewMethods<D = Record<string, any>> {
|
|
|
58
56
|
updateFn: (currentValue: V, ...args: A) => V,
|
|
59
57
|
...args: A
|
|
60
58
|
): boolean;
|
|
61
|
-
update<A extends any[]>(
|
|
62
|
-
|
|
63
|
-
...args: any
|
|
64
|
-
): boolean;
|
|
65
|
-
update<A extends any[]>(
|
|
66
|
-
path: Path,
|
|
67
|
-
updateFn: (currentValue: any, ...args: A) => any,
|
|
68
|
-
...args: A
|
|
69
|
-
): boolean;
|
|
59
|
+
update<A extends any[]>(updateFn: (currentValue: D, ...args: A) => D, ...args: any): boolean;
|
|
60
|
+
update<A extends any[]>(path: Path, updateFn: (currentValue: any, ...args: A) => any, ...args: A): boolean;
|
|
70
61
|
|
|
71
62
|
/**
|
|
72
63
|
* Mutates the content of the store using Immer
|
|
73
64
|
*/
|
|
74
|
-
mutate(
|
|
75
|
-
|
|
76
|
-
...args: any[]
|
|
77
|
-
): boolean;
|
|
78
|
-
mutate<A extends any[]>(
|
|
79
|
-
path: Path,
|
|
80
|
-
updateFn: (currentValue: any, ...args: A) => void,
|
|
81
|
-
...args: A
|
|
82
|
-
): boolean;
|
|
65
|
+
mutate(updateFn: (currentValue: D, ...args: any[]) => void, ...args: any[]): boolean;
|
|
66
|
+
mutate<A extends any[]>(path: Path, updateFn: (currentValue: any, ...args: A) => void, ...args: A): boolean;
|
|
83
67
|
mutate<V, A extends any[]>(
|
|
84
68
|
path: AccessorChain<V>,
|
|
85
69
|
updateFn: (currentValue: V, ...args: A) => void,
|
|
@@ -99,7 +83,6 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
99
83
|
result?: any;
|
|
100
84
|
itemIndex?: number;
|
|
101
85
|
key?: string;
|
|
102
|
-
parentStoreData?: any;
|
|
103
86
|
};
|
|
104
87
|
notificationsSuspended: number = 0;
|
|
105
88
|
dirty: boolean = false;
|
|
@@ -123,17 +106,11 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
123
106
|
if (typeof path == "object" && path != null) {
|
|
124
107
|
let changed = false;
|
|
125
108
|
for (let key in path)
|
|
126
|
-
if (
|
|
127
|
-
path.hasOwnProperty(key) &&
|
|
128
|
-
this.get(key) === undefined &&
|
|
129
|
-
this.setItem(key, path[key])
|
|
130
|
-
)
|
|
131
|
-
changed = true;
|
|
109
|
+
if (path.hasOwnProperty(key) && this.get(key) === undefined && this.setItem(key, path[key])) changed = true;
|
|
132
110
|
return changed;
|
|
133
111
|
}
|
|
134
112
|
let binding = Binding.get(path);
|
|
135
|
-
if (this.get(binding.path) === undefined)
|
|
136
|
-
return this.setItem(binding.path, value);
|
|
113
|
+
if (this.get(binding.path) === undefined) return this.setItem(binding.path, value);
|
|
137
114
|
return false;
|
|
138
115
|
}
|
|
139
116
|
|
|
@@ -143,9 +120,7 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
143
120
|
set(path: any, value?: any): boolean {
|
|
144
121
|
if (typeof path == "object" && path != null) {
|
|
145
122
|
let changed = false;
|
|
146
|
-
for (let key in path)
|
|
147
|
-
if (path.hasOwnProperty(key) && this.setItem(key, path[key]))
|
|
148
|
-
changed = true;
|
|
123
|
+
for (let key in path) if (path.hasOwnProperty(key) && this.setItem(key, path[key])) changed = true;
|
|
149
124
|
return changed;
|
|
150
125
|
}
|
|
151
126
|
let binding = Binding.get(path);
|
|
@@ -178,16 +153,13 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
178
153
|
delete(paths: Path[]): boolean;
|
|
179
154
|
delete(...paths: Path[]): boolean;
|
|
180
155
|
delete<V>(path: AccessorChain<V>): boolean;
|
|
181
|
-
delete<T extends any[]>(
|
|
182
|
-
...paths: { [K in keyof T]: AccessorChain<T[K]> }
|
|
183
|
-
): boolean;
|
|
156
|
+
delete<T extends any[]>(...paths: { [K in keyof T]: AccessorChain<T[K]> }): boolean;
|
|
184
157
|
delete<T extends any[]>(paths: {
|
|
185
158
|
[K in keyof T]: AccessorChain<T[K]>;
|
|
186
159
|
}): boolean;
|
|
187
160
|
delete(path?: any): boolean {
|
|
188
161
|
if (arguments.length > 1) path = Array.from(arguments);
|
|
189
|
-
if (isArray(path))
|
|
190
|
-
return path.map((arg) => this.delete(arg as Path)).some(Boolean);
|
|
162
|
+
if (isArray(path)) return path.map((arg) => this.delete(arg as Path)).some(Boolean);
|
|
191
163
|
|
|
192
164
|
let binding = Binding.get(path);
|
|
193
165
|
return this.deleteItem(binding.path);
|
|
@@ -217,8 +189,7 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
217
189
|
|
|
218
190
|
if (arguments.length > 1) path = Array.from(arguments);
|
|
219
191
|
|
|
220
|
-
if (isArray(path))
|
|
221
|
-
return path.map((arg) => Binding.get(arg as any).value(storeData));
|
|
192
|
+
if (isArray(path)) return path.map((arg) => Binding.get(arg as any).value(storeData));
|
|
222
193
|
|
|
223
194
|
return Binding.get(path).value(storeData);
|
|
224
195
|
}
|
|
@@ -235,32 +206,16 @@ export class View<D = any> implements ViewMethods<D> {
|
|
|
235
206
|
updateFn: (currentValue: V, ...args: A) => V,
|
|
236
207
|
...args: A
|
|
237
208
|
): boolean;
|
|
238
|
-
update(
|
|
239
|
-
|
|
240
|
-
...args: any
|
|
241
|
-
): boolean;
|
|
242
|
-
update<A extends any[]>(
|
|
243
|
-
path: Path,
|
|
244
|
-
updateFn: (currentValue: any, ...args: A) => any,
|
|
245
|
-
...args: A
|
|
246
|
-
): boolean;
|
|
209
|
+
update(updateFn: (currentValue: D, ...args: any[]) => any, ...args: any): boolean;
|
|
210
|
+
update<A extends any[]>(path: Path, updateFn: (currentValue: any, ...args: A) => any, ...args: A): boolean;
|
|
247
211
|
update(path: any, updateFn?: any, ...args: any[]): boolean {
|
|
248
212
|
if (arguments.length == 1 && isFunction(path))
|
|
249
|
-
return this.load(
|
|
250
|
-
path.apply(null, [this.getData(), updateFn, ...args]),
|
|
251
|
-
);
|
|
213
|
+
return this.load(path.apply(null, [this.getData(), updateFn, ...args]));
|
|
252
214
|
return this.set(path, updateFn.apply(null, [this.get(path), ...args]));
|
|
253
215
|
}
|
|
254
216
|
|
|
255
|
-
mutate(
|
|
256
|
-
|
|
257
|
-
...args: any[]
|
|
258
|
-
): boolean;
|
|
259
|
-
mutate<A extends any[]>(
|
|
260
|
-
path: Path,
|
|
261
|
-
updateFn: (currentValue: any, ...args: A) => void,
|
|
262
|
-
...args: A
|
|
263
|
-
): boolean;
|
|
217
|
+
mutate(updateFn: (currentValue: D, ...args: any[]) => void, ...args: any[]): boolean;
|
|
218
|
+
mutate<A extends any[]>(path: Path, updateFn: (currentValue: any, ...args: A) => void, ...args: A): boolean;
|
|
264
219
|
mutate<V, A extends any[]>(
|
|
265
220
|
path: AccessorChain<V>,
|
|
266
221
|
updateFn: (currentValue: V, ...args: A) => void,
|
package/src/ui/DataProxy.ts
CHANGED
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import { AccessorChain } from "../data";
|
|
2
|
-
import { NestedDataView } from "../data/NestedDataView";
|
|
3
|
-
import { StructuredProp, WritableProp } from "./Prop";
|
|
4
|
-
import { PureContainerBase, PureContainerConfig } from "./PureContainer";
|
|
5
|
-
import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
|
|
6
|
-
|
|
7
|
-
export interface DataProxyConfig extends PureContainerConfig {
|
|
8
|
-
/** Data object with computed values to be exposed in the local store. */
|
|
9
|
-
data?: StructuredProp;
|
|
10
|
-
|
|
11
|
-
/** Binding to a value to be exposed under the `alias` name. */
|
|
12
|
-
value?: WritableProp<any>;
|
|
13
|
-
|
|
14
|
-
/** Alias name under which `value` is exposed in the local store. */
|
|
15
|
-
alias?: string | AccessorChain<any>;
|
|
16
|
-
|
|
17
|
-
/** Indicate that parent store data should not be mutated. */
|
|
18
|
-
immutable?: boolean;
|
|
19
|
-
|
|
20
|
-
/** Indicate that local store data should not be mutated. */
|
|
21
|
-
sealed?: boolean;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export class DataProxy extends PureContainerBase<DataProxyConfig> {
|
|
25
|
-
declare data?: any;
|
|
26
|
-
declare alias?: string;
|
|
27
|
-
declare value?: any;
|
|
28
|
-
declare immutable: boolean;
|
|
29
|
-
declare sealed: boolean;
|
|
30
|
-
|
|
31
|
-
init() {
|
|
32
|
-
if (!this.data) this.data = {};
|
|
33
|
-
|
|
34
|
-
if (this.alias) this.data[this.alias] = this.value;
|
|
35
|
-
|
|
36
|
-
super.init();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
initInstance(context: any, instance: any) {
|
|
40
|
-
instance.store = new NestedDataView({
|
|
41
|
-
store: instance.parentStore,
|
|
42
|
-
nestedData: new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true }),
|
|
43
|
-
immutable: this.immutable,
|
|
44
|
-
sealed: this.sealed,
|
|
45
|
-
});
|
|
46
|
-
super.initInstance(context, instance);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
applyParentStore(instance: any) {
|
|
50
|
-
instance.store.setStore(instance.parentStore);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
DataProxy.prototype.immutable = false;
|
|
55
|
-
DataProxy.prototype.sealed = false;
|
|
1
|
+
import { AccessorChain } from "../data";
|
|
2
|
+
import { NestedDataView } from "../data/NestedDataView";
|
|
3
|
+
import { StructuredProp, WritableProp } from "./Prop";
|
|
4
|
+
import { PureContainerBase, PureContainerConfig } from "./PureContainer";
|
|
5
|
+
import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
|
|
6
|
+
|
|
7
|
+
export interface DataProxyConfig extends PureContainerConfig {
|
|
8
|
+
/** Data object with computed values to be exposed in the local store. */
|
|
9
|
+
data?: StructuredProp;
|
|
10
|
+
|
|
11
|
+
/** Binding to a value to be exposed under the `alias` name. */
|
|
12
|
+
value?: WritableProp<any>;
|
|
13
|
+
|
|
14
|
+
/** Alias name under which `value` is exposed in the local store. */
|
|
15
|
+
alias?: string | AccessorChain<any>;
|
|
16
|
+
|
|
17
|
+
/** Indicate that parent store data should not be mutated. */
|
|
18
|
+
immutable?: boolean;
|
|
19
|
+
|
|
20
|
+
/** Indicate that local store data should not be mutated. */
|
|
21
|
+
sealed?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export class DataProxy extends PureContainerBase<DataProxyConfig> {
|
|
25
|
+
declare data?: any;
|
|
26
|
+
declare alias?: string;
|
|
27
|
+
declare value?: any;
|
|
28
|
+
declare immutable: boolean;
|
|
29
|
+
declare sealed: boolean;
|
|
30
|
+
|
|
31
|
+
init() {
|
|
32
|
+
if (!this.data) this.data = {};
|
|
33
|
+
|
|
34
|
+
if (this.alias) this.data[this.alias] = this.value;
|
|
35
|
+
|
|
36
|
+
super.init();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
initInstance(context: any, instance: any) {
|
|
40
|
+
instance.store = new NestedDataView({
|
|
41
|
+
store: instance.parentStore,
|
|
42
|
+
nestedData: new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true }),
|
|
43
|
+
immutable: this.immutable,
|
|
44
|
+
sealed: this.sealed,
|
|
45
|
+
});
|
|
46
|
+
super.initInstance(context, instance);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
applyParentStore(instance: any) {
|
|
50
|
+
instance.store.setStore(instance.parentStore);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
DataProxy.prototype.immutable = false;
|
|
55
|
+
DataProxy.prototype.sealed = false;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import assert from "assert";
|
|
2
|
+
import { Format } from "./Format";
|
|
3
|
+
|
|
4
|
+
// The `quarter` formatter is registered eagerly when ui/Format is imported,
|
|
5
|
+
// so these tests do not need enableCultureSensitiveFormatting().
|
|
6
|
+
describe("Format - quarter", function () {
|
|
7
|
+
it("renders the calendar quarter with the default pattern", function () {
|
|
8
|
+
assert.equal(Format.value(new Date(2020, 0, 15), "quarter"), "Q1 2020");
|
|
9
|
+
assert.equal(Format.value(new Date(2020, 5, 1), "quarter"), "Q2 2020");
|
|
10
|
+
assert.equal(Format.value(new Date(2020, 11, 31), "quarter"), "Q4 2020");
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("supports custom patterns and the {yy} token", function () {
|
|
14
|
+
assert.equal(Format.value(new Date(2020, 0, 1), "quarter;{yy}Q{q}"), "20Q1");
|
|
15
|
+
assert.equal(Format.value(new Date(2020, 8, 1), "quarter;{q}Q{yyyy}"), "3Q2020");
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
it("accepts both lowercase and uppercase placeholders", function () {
|
|
19
|
+
assert.equal(Format.value(new Date(2020, 0, 1), "quarter;{YY}Q{Q}"), "20Q1");
|
|
20
|
+
assert.equal(Format.value(new Date(2020, 0, 1), "quarter;Q{Q} {YYYY}"), "Q1 2020");
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it("treats the input as an exclusive range end with the exclusive flag", function () {
|
|
24
|
+
assert.equal(Format.value(new Date(2021, 0, 1), "quarter;{yy}Q{q};exclusive"), "20Q4");
|
|
25
|
+
assert.equal(Format.value(new Date(2021, 0, 1), "quarter;{yy}Q{q};ex"), "20Q4");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("falls back to the default pattern when the pattern argument is empty (quarter;;e)", function () {
|
|
29
|
+
assert.equal(Format.value(new Date(2021, 0, 1), "quarter;;e"), "Q4 2020");
|
|
30
|
+
assert.equal(Format.value(new Date(2020, 0, 1), "quarter;;e"), "Q4 2019");
|
|
31
|
+
});
|
|
32
|
+
});
|
package/src/ui/Format.ts
CHANGED
|
@@ -1,12 +1,31 @@
|
|
|
1
1
|
import { Culture, getCurrentCultureCache } from "./Culture";
|
|
2
2
|
import { Format as Fmt, resolveMinMaxFractionDigits, setGetFormatCacheCallback } from "../util/Format";
|
|
3
3
|
import { setGetExpressionCacheCallback } from "../data/Expression";
|
|
4
|
-
import { setGetStringTemplateCacheCallback } from "../data/StringTemplate";
|
|
5
|
-
import { parseDateInvariant } from "../util";
|
|
4
|
+
import { setGetStringTemplateCacheCallback, StringTemplate } from "../data/StringTemplate";
|
|
5
|
+
import { dateQuarter, dayBefore, parseDateInvariant } from "../util";
|
|
6
6
|
import { GlobalCacheIdentifier } from "../util/GlobalCacheIdentifier";
|
|
7
7
|
|
|
8
8
|
export const Format = Fmt;
|
|
9
9
|
|
|
10
|
+
// The `quarter` formatter renders a calendar quarter via a string-template
|
|
11
|
+
// pattern with `{q}` (quarter number), `{yyyy}` and `{yy}` (year) placeholders.
|
|
12
|
+
// Placeholders are case-insensitive (`{Q}`, `{YYYY}`, `{YY}` work too). It lives
|
|
13
|
+
// here rather than in util/Format because it depends on StringTemplate from the
|
|
14
|
+
// data layer, which util/ cannot import. It is registered eagerly since it does
|
|
15
|
+
// not depend on culture settings.
|
|
16
|
+
Fmt.registerFactory("quarter", (fmt: any, pattern?: string, mode?: string) => {
|
|
17
|
+
let exclusive = mode === "exclusive" || mode === "ex" || mode === "e";
|
|
18
|
+
let template = StringTemplate.get(pattern || "Q{q} {yyyy}");
|
|
19
|
+
return (value: any) => {
|
|
20
|
+
let date = parseDateInvariant(value);
|
|
21
|
+
if (exclusive) date = dayBefore(date);
|
|
22
|
+
let q = dateQuarter(date);
|
|
23
|
+
let yyyy = date.getFullYear();
|
|
24
|
+
let yy = String(yyyy % 100).padStart(2, "0");
|
|
25
|
+
return template({ q, Q: q, yyyy, YYYY: yyyy, yy, YY: yy });
|
|
26
|
+
};
|
|
27
|
+
});
|
|
28
|
+
|
|
10
29
|
let cultureSensitiveFormatsRegistered = false;
|
|
11
30
|
|
|
12
31
|
export function resolveNumberFormattingFlags(flags?: string): any {
|
|
@@ -86,6 +105,12 @@ export function enableCultureSensitiveFormatting() {
|
|
|
86
105
|
return (value: any) => formatter.format(parseDateInvariant(value));
|
|
87
106
|
});
|
|
88
107
|
|
|
108
|
+
Fmt.registerFactory(["dayBefore", "daybefore"], (fmt: any, format = "yyyyMd hhmm") => {
|
|
109
|
+
let culture = Culture.getDateTimeCulture();
|
|
110
|
+
let formatter = culture.getFormatter(format);
|
|
111
|
+
return (value: any) => formatter.format(dayBefore(parseDateInvariant(value)));
|
|
112
|
+
});
|
|
113
|
+
|
|
89
114
|
setGetFormatCacheCallback(() => {
|
|
90
115
|
let cache = getCurrentCultureCache();
|
|
91
116
|
if (!cache.formatCache) cache.formatCache = {};
|
package/src/ui/Rescope.ts
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { Widget } from "./Widget";
|
|
2
|
-
import { PureContainerBase, PureContainerConfig } from "./PureContainer";
|
|
3
|
-
import { Binding } from "../data/Binding";
|
|
4
|
-
import { ZoomIntoPropertyView } from "../data/ZoomIntoPropertyView";
|
|
5
|
-
import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
|
|
6
|
-
import { isObject } from "../util/isObject";
|
|
7
|
-
import { StructuredProp } from "./Prop";
|
|
8
|
-
import { AccessorChain } from "../data/createAccessorModelProxy";
|
|
9
|
-
|
|
10
|
-
export interface RescopeConfig extends PureContainerConfig {
|
|
11
|
-
bind: string | AccessorChain<any>;
|
|
12
|
-
rootName?: string | AccessorChain<any>;
|
|
13
|
-
rootAlias?: string | AccessorChain<any>;
|
|
14
|
-
data?: StructuredProp;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class Rescope extends PureContainerBase<RescopeConfig> {
|
|
18
|
-
declare bind: string;
|
|
19
|
-
declare binding: any;
|
|
20
|
-
declare rootAlias?: string;
|
|
21
|
-
declare rootName: string;
|
|
22
|
-
declare data?: any;
|
|
23
|
-
|
|
24
|
-
init() {
|
|
25
|
-
this.binding = Binding.get(this.bind);
|
|
26
|
-
if (this.rootAlias) this.rootName = this.rootAlias;
|
|
27
|
-
super.init();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
initInstance(context: any, instance: any) {
|
|
31
|
-
instance.store = new ZoomIntoPropertyView({
|
|
32
|
-
store: instance.parentStore,
|
|
33
|
-
binding: this.binding,
|
|
34
|
-
rootName: this.rootName,
|
|
35
|
-
nestedData: isObject(this.data)
|
|
36
|
-
? new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true })
|
|
37
|
-
: undefined,
|
|
38
|
-
});
|
|
39
|
-
super.initInstance(context, instance);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
applyParentStore(instance: any) {
|
|
43
|
-
instance.store.setStore(instance.parentStore);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
Rescope.prototype.bind = "$page";
|
|
48
|
-
Rescope.prototype.rootName = "$root";
|
|
49
|
-
|
|
50
|
-
Widget.alias("rescope", Rescope);
|
|
1
|
+
import { Widget } from "./Widget";
|
|
2
|
+
import { PureContainerBase, PureContainerConfig } from "./PureContainer";
|
|
3
|
+
import { Binding } from "../data/Binding";
|
|
4
|
+
import { ZoomIntoPropertyView } from "../data/ZoomIntoPropertyView";
|
|
5
|
+
import { StructuredInstanceDataAccessor } from "./StructuredInstanceDataAccessor";
|
|
6
|
+
import { isObject } from "../util/isObject";
|
|
7
|
+
import { StructuredProp } from "./Prop";
|
|
8
|
+
import { AccessorChain } from "../data/createAccessorModelProxy";
|
|
9
|
+
|
|
10
|
+
export interface RescopeConfig extends PureContainerConfig {
|
|
11
|
+
bind: string | AccessorChain<any>;
|
|
12
|
+
rootName?: string | AccessorChain<any>;
|
|
13
|
+
rootAlias?: string | AccessorChain<any>;
|
|
14
|
+
data?: StructuredProp;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class Rescope extends PureContainerBase<RescopeConfig> {
|
|
18
|
+
declare bind: string;
|
|
19
|
+
declare binding: any;
|
|
20
|
+
declare rootAlias?: string;
|
|
21
|
+
declare rootName: string;
|
|
22
|
+
declare data?: any;
|
|
23
|
+
|
|
24
|
+
init() {
|
|
25
|
+
this.binding = Binding.get(this.bind);
|
|
26
|
+
if (this.rootAlias) this.rootName = this.rootAlias;
|
|
27
|
+
super.init();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
initInstance(context: any, instance: any) {
|
|
31
|
+
instance.store = new ZoomIntoPropertyView({
|
|
32
|
+
store: instance.parentStore,
|
|
33
|
+
binding: this.binding,
|
|
34
|
+
rootName: this.rootName,
|
|
35
|
+
nestedData: isObject(this.data)
|
|
36
|
+
? new StructuredInstanceDataAccessor({ instance, data: this.data, useParentStore: true })
|
|
37
|
+
: undefined,
|
|
38
|
+
});
|
|
39
|
+
super.initInstance(context, instance);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
applyParentStore(instance: any) {
|
|
43
|
+
instance.store.setStore(instance.parentStore);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
Rescope.prototype.bind = "$page";
|
|
48
|
+
Rescope.prototype.rootName = "$root";
|
|
49
|
+
|
|
50
|
+
Widget.alias("rescope", Rescope);
|