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/util/Format.spec.ts
CHANGED
|
@@ -47,6 +47,17 @@ describe("Format", function () {
|
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
+
describe("daybefore", function () {
|
|
51
|
+
it("formats the date shifted back by one day", function () {
|
|
52
|
+
assert.equal(Format.value(new Date(2015, 3, 1, 5, 6, 14), "daybefore"), "3/31/2015 05:06");
|
|
53
|
+
assert.equal(Format.value(new Date(2015, 3, 1, 5, 6, 14), "dayBefore"), "3/31/2015 05:06");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("steps back across month and year boundaries", function () {
|
|
57
|
+
assert.equal(Format.value(new Date(2021, 0, 1), "daybefore"), "12/31/2020 00:00");
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
|
|
50
61
|
describe("ellipsis", function () {
|
|
51
62
|
it("can shorten long texts", function () {
|
|
52
63
|
assert.equal(Format.value("This is a very long text.", "ellipsis;7"), "This...");
|
package/src/util/Format.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { isUndefined } from "../util/isUndefined";
|
|
|
5
5
|
import { isArray } from "../util/isArray";
|
|
6
6
|
import { capitalize } from "./capitalize";
|
|
7
7
|
import { parseDateInvariant } from "./date/parseDateInvariant";
|
|
8
|
+
import { dayBefore } from "./date/dayBefore";
|
|
8
9
|
|
|
9
10
|
//Culture dependent formatters are defined in the ui package.
|
|
10
11
|
|
|
@@ -98,6 +99,11 @@ let formatFactory: Record<string, (...args: any[]) => (value: any) => string> =
|
|
|
98
99
|
return (value: any) => date(value) + " " + time(value);
|
|
99
100
|
},
|
|
100
101
|
|
|
102
|
+
dayBefore: function () {
|
|
103
|
+
let datetime = formatFactory.datetime();
|
|
104
|
+
return (value: any) => datetime(dayBefore(parseDateInvariant(value)));
|
|
105
|
+
},
|
|
106
|
+
|
|
101
107
|
ellipsis: function (part0, length, where) {
|
|
102
108
|
length = Number(length);
|
|
103
109
|
if (!(length > 3)) length = 10;
|
|
@@ -168,6 +174,7 @@ formatFactory.ps = formatFactory.percentageSign;
|
|
|
168
174
|
formatFactory.d = formatFactory.date;
|
|
169
175
|
formatFactory.t = formatFactory.time;
|
|
170
176
|
formatFactory.dt = formatFactory.datetime;
|
|
177
|
+
formatFactory.daybefore = formatFactory.dayBefore;
|
|
171
178
|
formatFactory.zeropad = formatFactory.zeroPad;
|
|
172
179
|
formatFactory.leftpad = formatFactory.leftPad;
|
|
173
180
|
formatFactory.capitalize = formatFactory.capitalize;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns a new `Date` representing the calendar day before the given date,
|
|
3
|
+
* keeping the same time of day. Month and year boundaries are handled
|
|
4
|
+
* automatically. The input is not mutated.
|
|
5
|
+
*
|
|
6
|
+
* Useful for displaying the exclusive end of a date range as an inclusive
|
|
7
|
+
* value, e.g. a period ending at `2021-01-01` shown as `Dec 2020`.
|
|
8
|
+
* @param date
|
|
9
|
+
* @returns {Date}
|
|
10
|
+
*/
|
|
11
|
+
export function dayBefore(date: Date): Date {
|
|
12
|
+
let result = new Date(date.getTime());
|
|
13
|
+
result.setDate(result.getDate() - 1);
|
|
14
|
+
return result;
|
|
15
|
+
}
|
package/src/util/date/index.ts
CHANGED
package/src/widgets/Sandbox.ts
CHANGED
|
@@ -1,104 +1,104 @@
|
|
|
1
|
-
import { Widget } from "../ui/Widget";
|
|
2
|
-
import { PureContainerBase, PureContainerConfig } from "../ui/PureContainer";
|
|
3
|
-
import { Binding, BindingInput } from "../data/Binding";
|
|
4
|
-
import { ExposedValueView, ExposedValueViewConfig } from "../data/ExposedValueView";
|
|
5
|
-
import { RenderingContext } from "../ui/RenderingContext";
|
|
6
|
-
import { Instance } from "../ui/Instance";
|
|
7
|
-
import { StringProp, WritableProp } from "../ui/Prop";
|
|
8
|
-
import { AccessorChain } from "../data/createAccessorModelProxy";
|
|
9
|
-
|
|
10
|
-
export interface SandboxConfig extends PureContainerConfig {
|
|
11
|
-
/** Binding to the object that holds sandbox data. */
|
|
12
|
-
storage: WritableProp<Record<string, any>>;
|
|
13
|
-
|
|
14
|
-
/** Key used to identify the sandbox instance within the storage. */
|
|
15
|
-
key?: StringProp;
|
|
16
|
-
|
|
17
|
-
/** Alias for `key`. */
|
|
18
|
-
accessKey?: StringProp;
|
|
19
|
-
|
|
20
|
-
/** Alias used to expose sandbox data. Default is `$page`. */
|
|
21
|
-
recordName?: string | AccessorChain<any>;
|
|
22
|
-
|
|
23
|
-
/** Alias for `recordName`. */
|
|
24
|
-
recordAlias?: string | AccessorChain<any>;
|
|
25
|
-
|
|
26
|
-
/** Indicate that parent store data should not be mutated. */
|
|
27
|
-
immutable?: boolean;
|
|
28
|
-
|
|
29
|
-
/** Indicate that sandbox store data should not be mutated. */
|
|
30
|
-
sealed?: boolean;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface SandboxInstance extends Instance {
|
|
34
|
-
store: ExposedValueView;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export class Sandbox extends PureContainerBase<SandboxConfig, SandboxInstance> {
|
|
38
|
-
declare storage: WritableProp<Record<string, any>>;
|
|
39
|
-
declare key?: StringProp;
|
|
40
|
-
declare recordName?: string;
|
|
41
|
-
declare recordAlias?: string;
|
|
42
|
-
declare accessKey?: StringProp;
|
|
43
|
-
declare immutable?: boolean;
|
|
44
|
-
declare sealed?: boolean;
|
|
45
|
-
declare storageBinding: Binding;
|
|
46
|
-
init(): void {
|
|
47
|
-
if (this.recordAlias) this.recordName = this.recordAlias;
|
|
48
|
-
|
|
49
|
-
if (this.accessKey) this.key = this.accessKey;
|
|
50
|
-
|
|
51
|
-
this.storageBinding = Binding.get(this.storage);
|
|
52
|
-
|
|
53
|
-
super.init();
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
initInstance(context: RenderingContext, instance: SandboxInstance): void {
|
|
57
|
-
instance.store = new ExposedValueView({
|
|
58
|
-
store: instance.parentStore,
|
|
59
|
-
containerBinding: this.storageBinding,
|
|
60
|
-
key: null,
|
|
61
|
-
recordName: this.recordName,
|
|
62
|
-
immutable: this.immutable,
|
|
63
|
-
});
|
|
64
|
-
super.initInstance(context, instance);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
applyParentStore(instance: SandboxInstance): void {
|
|
68
|
-
instance.store.setStore(instance.parentStore);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
declareData(...args: Record<string, unknown>[]): void {
|
|
72
|
-
super.declareData(
|
|
73
|
-
{
|
|
74
|
-
storage: undefined,
|
|
75
|
-
key: undefined,
|
|
76
|
-
},
|
|
77
|
-
...args,
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
prepareData(context: RenderingContext, instance: SandboxInstance): void {
|
|
82
|
-
var { store, data } = instance;
|
|
83
|
-
if (store.getKey() !== data.key) {
|
|
84
|
-
//when navigating to a page using the same widget tree as the previous page
|
|
85
|
-
//everything needs to be reinstantiated, e.g. user/1 => user/2
|
|
86
|
-
instance.store = new ExposedValueView({
|
|
87
|
-
store: store,
|
|
88
|
-
containerBinding: this.storageBinding,
|
|
89
|
-
key: data.key,
|
|
90
|
-
recordName: this.recordName,
|
|
91
|
-
immutable: this.immutable,
|
|
92
|
-
sealed: this.sealed,
|
|
93
|
-
});
|
|
94
|
-
instance.clearChildrenCache();
|
|
95
|
-
}
|
|
96
|
-
super.prepareData(context, instance);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
Sandbox.prototype.recordName = "$page";
|
|
101
|
-
Sandbox.prototype.immutable = false;
|
|
102
|
-
Sandbox.prototype.sealed = false;
|
|
103
|
-
|
|
104
|
-
Widget.alias("sandbox", Sandbox);
|
|
1
|
+
import { Widget } from "../ui/Widget";
|
|
2
|
+
import { PureContainerBase, PureContainerConfig } from "../ui/PureContainer";
|
|
3
|
+
import { Binding, BindingInput } from "../data/Binding";
|
|
4
|
+
import { ExposedValueView, ExposedValueViewConfig } from "../data/ExposedValueView";
|
|
5
|
+
import { RenderingContext } from "../ui/RenderingContext";
|
|
6
|
+
import { Instance } from "../ui/Instance";
|
|
7
|
+
import { StringProp, WritableProp } from "../ui/Prop";
|
|
8
|
+
import { AccessorChain } from "../data/createAccessorModelProxy";
|
|
9
|
+
|
|
10
|
+
export interface SandboxConfig extends PureContainerConfig {
|
|
11
|
+
/** Binding to the object that holds sandbox data. */
|
|
12
|
+
storage: WritableProp<Record<string, any>>;
|
|
13
|
+
|
|
14
|
+
/** Key used to identify the sandbox instance within the storage. */
|
|
15
|
+
key?: StringProp;
|
|
16
|
+
|
|
17
|
+
/** Alias for `key`. */
|
|
18
|
+
accessKey?: StringProp;
|
|
19
|
+
|
|
20
|
+
/** Alias used to expose sandbox data. Default is `$page`. */
|
|
21
|
+
recordName?: string | AccessorChain<any>;
|
|
22
|
+
|
|
23
|
+
/** Alias for `recordName`. */
|
|
24
|
+
recordAlias?: string | AccessorChain<any>;
|
|
25
|
+
|
|
26
|
+
/** Indicate that parent store data should not be mutated. */
|
|
27
|
+
immutable?: boolean;
|
|
28
|
+
|
|
29
|
+
/** Indicate that sandbox store data should not be mutated. */
|
|
30
|
+
sealed?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface SandboxInstance extends Instance {
|
|
34
|
+
store: ExposedValueView;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class Sandbox extends PureContainerBase<SandboxConfig, SandboxInstance> {
|
|
38
|
+
declare storage: WritableProp<Record<string, any>>;
|
|
39
|
+
declare key?: StringProp;
|
|
40
|
+
declare recordName?: string;
|
|
41
|
+
declare recordAlias?: string;
|
|
42
|
+
declare accessKey?: StringProp;
|
|
43
|
+
declare immutable?: boolean;
|
|
44
|
+
declare sealed?: boolean;
|
|
45
|
+
declare storageBinding: Binding;
|
|
46
|
+
init(): void {
|
|
47
|
+
if (this.recordAlias) this.recordName = this.recordAlias;
|
|
48
|
+
|
|
49
|
+
if (this.accessKey) this.key = this.accessKey;
|
|
50
|
+
|
|
51
|
+
this.storageBinding = Binding.get(this.storage);
|
|
52
|
+
|
|
53
|
+
super.init();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
initInstance(context: RenderingContext, instance: SandboxInstance): void {
|
|
57
|
+
instance.store = new ExposedValueView({
|
|
58
|
+
store: instance.parentStore,
|
|
59
|
+
containerBinding: this.storageBinding,
|
|
60
|
+
key: null,
|
|
61
|
+
recordName: this.recordName,
|
|
62
|
+
immutable: this.immutable,
|
|
63
|
+
});
|
|
64
|
+
super.initInstance(context, instance);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
applyParentStore(instance: SandboxInstance): void {
|
|
68
|
+
instance.store.setStore(instance.parentStore);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
declareData(...args: Record<string, unknown>[]): void {
|
|
72
|
+
super.declareData(
|
|
73
|
+
{
|
|
74
|
+
storage: undefined,
|
|
75
|
+
key: undefined,
|
|
76
|
+
},
|
|
77
|
+
...args,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
prepareData(context: RenderingContext, instance: SandboxInstance): void {
|
|
82
|
+
var { store, data } = instance;
|
|
83
|
+
if (store.getKey() !== data.key) {
|
|
84
|
+
//when navigating to a page using the same widget tree as the previous page
|
|
85
|
+
//everything needs to be reinstantiated, e.g. user/1 => user/2
|
|
86
|
+
instance.store = new ExposedValueView({
|
|
87
|
+
store: store,
|
|
88
|
+
containerBinding: this.storageBinding,
|
|
89
|
+
key: data.key,
|
|
90
|
+
recordName: this.recordName,
|
|
91
|
+
immutable: this.immutable,
|
|
92
|
+
sealed: this.sealed,
|
|
93
|
+
});
|
|
94
|
+
instance.clearChildrenCache();
|
|
95
|
+
}
|
|
96
|
+
super.prepareData(context, instance);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
Sandbox.prototype.recordName = "$page";
|
|
101
|
+
Sandbox.prototype.immutable = false;
|
|
102
|
+
Sandbox.prototype.sealed = false;
|
|
103
|
+
|
|
104
|
+
Widget.alias("sandbox", Sandbox);
|
|
@@ -1,112 +1,112 @@
|
|
|
1
|
-
@use "sass:math";
|
|
2
|
-
@use "sass:map";
|
|
3
|
-
@use "../variables" as *;
|
|
4
|
-
@use "../maps" as *;
|
|
5
|
-
@use "../../util/call-once.scss" as *;
|
|
6
|
-
@use "../../util/scss/add-rules.scss" as *;
|
|
7
|
-
@use "../../util/scss/calc.scss" as *;
|
|
8
|
-
@use "../../util/scss/clockwise.scss" as *;
|
|
9
|
-
@use "../../util/scss/deep-merge.scss" as *;
|
|
10
|
-
@use "../../util/scss/besm.scss" as *;
|
|
11
|
-
@use "../../util/scss/include.scss" as *;
|
|
12
|
-
@use "./Field.scss" as *;
|
|
13
|
-
@use "./ColorPicker.scss" as *;
|
|
14
|
-
|
|
15
|
-
@mixin cx-colorfield(
|
|
16
|
-
$name: "colorfield",
|
|
17
|
-
$state-style-map: $cx-std-field-state-style-map,
|
|
18
|
-
$placeholder: $cx-input-placeholder,
|
|
19
|
-
$empty-text: $cx-empty-text,
|
|
20
|
-
$clear-state-style-map: $cx-clear-state-style-map,
|
|
21
|
-
$left-icon-state-style-map: $cx-input-left-icon-state-style-map,
|
|
22
|
-
$right-icon-state-style-map: $cx-input-right-icon-state-style-map,
|
|
23
|
-
$width: $cx-default-input-width,
|
|
24
|
-
$icon-size: $cx-default-icon-size,
|
|
25
|
-
$besm: $cx-besm
|
|
26
|
-
) {
|
|
27
|
-
$block: map.get($besm, block);
|
|
28
|
-
$element: map.get($besm, element);
|
|
29
|
-
$state: map.get($besm, state);
|
|
30
|
-
|
|
31
|
-
.#{$block}#{$name} {
|
|
32
|
-
@include cxb-field($besm, $state-style-map, $width: $width, $input: true);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
$padding: cx-get-state-rule($state-style-map, default, "padding");
|
|
36
|
-
|
|
37
|
-
.#{$element}#{$name}-input {
|
|
38
|
-
@include cxe-field-input(
|
|
39
|
-
$besm,
|
|
40
|
-
$state-style-map,
|
|
41
|
-
$placeholder: $placeholder,
|
|
42
|
-
$overrides: (
|
|
43
|
-
default: (
|
|
44
|
-
font-family: $cx-default-colorfield-font-family,
|
|
45
|
-
font-size: 11px,
|
|
46
|
-
padding: cx-top($padding) cx-calc(cx-top($padding), $cx-default-clear-size, $cx-default-clear-spacing)
|
|
47
|
-
cx-bottom($padding)
|
|
48
|
-
cx-calc(cx-top($padding), $cx-default-input-left-tool-size, $cx-default-input-left-tool-spacing),
|
|
49
|
-
)
|
|
50
|
-
)
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
.#{$element}#{$name}-clear {
|
|
55
|
-
@include cxe-field-button($besm, $clear-state-style-map);
|
|
56
|
-
|
|
57
|
-
.#{$state}focus > & {
|
|
58
|
-
@include cx-add-state-rules($clear-state-style-map, focus);
|
|
59
|
-
}
|
|
60
|
-
.#{$state}error > & {
|
|
61
|
-
@include cx-add-state-rules($clear-state-style-map, error);
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
.#{$element}#{$name}-right-icon {
|
|
66
|
-
@include cxe-field-button($besm, $right-icon-state-style-map);
|
|
67
|
-
|
|
68
|
-
.#{$state}focus > & {
|
|
69
|
-
@include cx-add-state-rules($right-icon-state-style-map, focus);
|
|
70
|
-
}
|
|
71
|
-
.#{$state}error > & {
|
|
72
|
-
@include cx-add-state-rules($right-icon-state-style-map, error);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.#{$element}#{$name}-left-icon {
|
|
77
|
-
box-sizing: border-box;
|
|
78
|
-
|
|
79
|
-
@include cx-checker-background();
|
|
80
|
-
|
|
81
|
-
@include cxe-field-button(
|
|
82
|
-
$besm,
|
|
83
|
-
cx-deep-map-merge(
|
|
84
|
-
$left-icon-state-style-map,
|
|
85
|
-
(
|
|
86
|
-
default: (
|
|
87
|
-
opacity: 1,
|
|
88
|
-
cursor: pointer,
|
|
89
|
-
),
|
|
90
|
-
)
|
|
91
|
-
)
|
|
92
|
-
);
|
|
93
|
-
|
|
94
|
-
div {
|
|
95
|
-
width: 100%;
|
|
96
|
-
height: 100%;
|
|
97
|
-
border-radius: inherit;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
.#{$element}#{$name}-icon {
|
|
102
|
-
@include cxe-field-button-icon($besm, $icon-size);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
.#{$element}#{$name}-empty-text {
|
|
106
|
-
@include cxe-field-empty-text($empty-text);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
@if (cx-should-include("cx/widgets/ColorField")) {
|
|
111
|
-
@include cx-colorfield();
|
|
112
|
-
}
|
|
1
|
+
@use "sass:math";
|
|
2
|
+
@use "sass:map";
|
|
3
|
+
@use "../variables" as *;
|
|
4
|
+
@use "../maps" as *;
|
|
5
|
+
@use "../../util/call-once.scss" as *;
|
|
6
|
+
@use "../../util/scss/add-rules.scss" as *;
|
|
7
|
+
@use "../../util/scss/calc.scss" as *;
|
|
8
|
+
@use "../../util/scss/clockwise.scss" as *;
|
|
9
|
+
@use "../../util/scss/deep-merge.scss" as *;
|
|
10
|
+
@use "../../util/scss/besm.scss" as *;
|
|
11
|
+
@use "../../util/scss/include.scss" as *;
|
|
12
|
+
@use "./Field.scss" as *;
|
|
13
|
+
@use "./ColorPicker.scss" as *;
|
|
14
|
+
|
|
15
|
+
@mixin cx-colorfield(
|
|
16
|
+
$name: "colorfield",
|
|
17
|
+
$state-style-map: $cx-std-field-state-style-map,
|
|
18
|
+
$placeholder: $cx-input-placeholder,
|
|
19
|
+
$empty-text: $cx-empty-text,
|
|
20
|
+
$clear-state-style-map: $cx-clear-state-style-map,
|
|
21
|
+
$left-icon-state-style-map: $cx-input-left-icon-state-style-map,
|
|
22
|
+
$right-icon-state-style-map: $cx-input-right-icon-state-style-map,
|
|
23
|
+
$width: $cx-default-input-width,
|
|
24
|
+
$icon-size: $cx-default-icon-size,
|
|
25
|
+
$besm: $cx-besm
|
|
26
|
+
) {
|
|
27
|
+
$block: map.get($besm, block);
|
|
28
|
+
$element: map.get($besm, element);
|
|
29
|
+
$state: map.get($besm, state);
|
|
30
|
+
|
|
31
|
+
.#{$block}#{$name} {
|
|
32
|
+
@include cxb-field($besm, $state-style-map, $width: $width, $input: true);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
$padding: cx-get-state-rule($state-style-map, default, "padding");
|
|
36
|
+
|
|
37
|
+
.#{$element}#{$name}-input {
|
|
38
|
+
@include cxe-field-input(
|
|
39
|
+
$besm,
|
|
40
|
+
$state-style-map,
|
|
41
|
+
$placeholder: $placeholder,
|
|
42
|
+
$overrides: (
|
|
43
|
+
default: (
|
|
44
|
+
font-family: $cx-default-colorfield-font-family,
|
|
45
|
+
font-size: 11px,
|
|
46
|
+
padding: cx-top($padding) cx-calc(cx-top($padding), $cx-default-clear-size, $cx-default-clear-spacing)
|
|
47
|
+
cx-bottom($padding)
|
|
48
|
+
cx-calc(cx-top($padding), $cx-default-input-left-tool-size, $cx-default-input-left-tool-spacing),
|
|
49
|
+
)
|
|
50
|
+
)
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.#{$element}#{$name}-clear {
|
|
55
|
+
@include cxe-field-button($besm, $clear-state-style-map);
|
|
56
|
+
|
|
57
|
+
.#{$state}focus > & {
|
|
58
|
+
@include cx-add-state-rules($clear-state-style-map, focus);
|
|
59
|
+
}
|
|
60
|
+
.#{$state}error > & {
|
|
61
|
+
@include cx-add-state-rules($clear-state-style-map, error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.#{$element}#{$name}-right-icon {
|
|
66
|
+
@include cxe-field-button($besm, $right-icon-state-style-map);
|
|
67
|
+
|
|
68
|
+
.#{$state}focus > & {
|
|
69
|
+
@include cx-add-state-rules($right-icon-state-style-map, focus);
|
|
70
|
+
}
|
|
71
|
+
.#{$state}error > & {
|
|
72
|
+
@include cx-add-state-rules($right-icon-state-style-map, error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.#{$element}#{$name}-left-icon {
|
|
77
|
+
box-sizing: border-box;
|
|
78
|
+
|
|
79
|
+
@include cx-checker-background();
|
|
80
|
+
|
|
81
|
+
@include cxe-field-button(
|
|
82
|
+
$besm,
|
|
83
|
+
cx-deep-map-merge(
|
|
84
|
+
$left-icon-state-style-map,
|
|
85
|
+
(
|
|
86
|
+
default: (
|
|
87
|
+
opacity: 1,
|
|
88
|
+
cursor: pointer,
|
|
89
|
+
),
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
div {
|
|
95
|
+
width: 100%;
|
|
96
|
+
height: 100%;
|
|
97
|
+
border-radius: inherit;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.#{$element}#{$name}-icon {
|
|
102
|
+
@include cxe-field-button-icon($besm, $icon-size);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.#{$element}#{$name}-empty-text {
|
|
106
|
+
@include cxe-field-empty-text($empty-text);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@if (cx-should-include("cx/widgets/ColorField")) {
|
|
111
|
+
@include cx-colorfield();
|
|
112
|
+
}
|