@limetech/lime-crm-building-blocks 1.6.0 → 1.6.2
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/cjs/limebb-currency-picker.cjs.entry.js +1 -1
- package/dist/cjs/limebb-date-picker_2.cjs.entry.js +41 -6
- package/dist/cjs/limebb-example-date-picker-date.cjs.entry.js +4 -4
- package/dist/cjs/limebb-example-date-picker-datetime.cjs.entry.js +3 -3
- package/dist/cjs/limebb-example-date-picker-time.cjs.entry.js +4 -4
- package/dist/cjs/limebb-example-date-picker-week.cjs.entry.js +2 -2
- package/dist/cjs/{platform-31a9e228.js → platform-da6aa193.js} +68 -224
- package/dist/cjs/{types-8bf20167.js → types-172f53c1.js} +50 -0
- package/dist/collection/components/date-picker/date-picker.js +42 -7
- package/dist/collection/components/date-picker/examples/date-picker-date.js +2 -2
- package/dist/collection/components/date-picker/examples/date-picker-datetime.js +1 -1
- package/dist/collection/components/date-picker/examples/date-picker-time.js +2 -2
- package/dist/collection/components/date-picker/examples/platform.js +3 -0
- package/dist/components/date-picker.js +40 -5
- package/dist/components/limebb-example-date-picker-date.js +2 -2
- package/dist/components/limebb-example-date-picker-datetime.js +1 -1
- package/dist/components/limebb-example-date-picker-time.js +2 -2
- package/dist/components/platform.js +67 -223
- package/dist/components/types.js +50 -0
- package/dist/esm/limebb-currency-picker.entry.js +1 -1
- package/dist/esm/limebb-date-picker_2.entry.js +41 -6
- package/dist/esm/limebb-example-date-picker-date.entry.js +4 -4
- package/dist/esm/limebb-example-date-picker-datetime.entry.js +3 -3
- package/dist/esm/limebb-example-date-picker-time.entry.js +4 -4
- package/dist/esm/limebb-example-date-picker-week.entry.js +2 -2
- package/dist/esm/{platform-054cff31.js → platform-3d6784d3.js} +68 -224
- package/dist/esm/{types-48b6ad13.js → types-51ecce09.js} +50 -0
- package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
- package/dist/lime-crm-building-blocks/p-03d64f35.js +1 -0
- package/dist/lime-crm-building-blocks/p-17f28ef7.entry.js +1 -0
- package/dist/lime-crm-building-blocks/{p-20a35850.entry.js → p-1c0609a8.entry.js} +1 -1
- package/dist/lime-crm-building-blocks/p-90d9d53f.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-964fc84e.js +1 -0
- package/dist/lime-crm-building-blocks/p-ad48f51b.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-c952561e.entry.js +1 -0
- package/dist/lime-crm-building-blocks/p-d0e34418.entry.js +1 -0
- package/dist/types/components/date-picker/date-picker.d.ts +6 -2
- package/dist/types/components/date-picker/examples/date-picker-datetime.d.ts +1 -1
- package/dist/types/components.d.ts +1 -1
- package/package.json +10 -10
- package/dist/lime-crm-building-blocks/p-094bcd6e.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-5fbc9f13.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-60ab511d.js +0 -1
- package/dist/lime-crm-building-blocks/p-66287aed.js +0 -1
- package/dist/lime-crm-building-blocks/p-7ee88de5.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-9feebd62.entry.js +0 -1
- package/dist/lime-crm-building-blocks/p-bae72762.entry.js +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const types = require('./types-
|
|
6
|
+
const types = require('./types-172f53c1.js');
|
|
7
7
|
const currencies = require('./currencies-98ac425a.js');
|
|
8
8
|
|
|
9
9
|
const CurrencyPicker = class {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const types = require('./types-
|
|
6
|
+
const types = require('./types-172f53c1.js');
|
|
7
7
|
|
|
8
8
|
const DatePicker = class {
|
|
9
9
|
constructor(hostRef) {
|
|
@@ -35,19 +35,54 @@ const DatePicker = class {
|
|
|
35
35
|
* Type of date picker.
|
|
36
36
|
*/
|
|
37
37
|
this.type = 'datetime';
|
|
38
|
+
this.shouldEmitValueAsString = true;
|
|
38
39
|
this.handleChange = (event) => {
|
|
40
|
+
if (!event.detail) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
39
43
|
event.stopPropagation();
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
const date = this.toServerDate(event.detail);
|
|
45
|
+
if (this.shouldEmitValueAsString) {
|
|
46
|
+
this.change.emit(date.toISOString());
|
|
42
47
|
return;
|
|
43
48
|
}
|
|
44
|
-
this.change.emit(
|
|
49
|
+
this.change.emit(date);
|
|
45
50
|
};
|
|
46
51
|
this.formatter = (value) => this.dateTimeFormatter.format(value, dateTimePropertyTypes[this.type] || this.type);
|
|
47
52
|
}
|
|
48
53
|
render() {
|
|
49
|
-
|
|
50
|
-
|
|
54
|
+
if (this.value) {
|
|
55
|
+
this.shouldEmitValueAsString = typeof this.value === 'string';
|
|
56
|
+
}
|
|
57
|
+
return (index.h("limel-date-picker", { disabled: this.disabled, readonly: this.readonly, invalid: this.invalid, label: this.label, placeholder: this.placeholder, helperText: this.helperText, required: this.required, value: this.parseDateValue(), type: this.type, formatter: this.formatter, onChange: this.handleChange }));
|
|
58
|
+
}
|
|
59
|
+
toServerDate(changedDate) {
|
|
60
|
+
if (this.type === 'datetime' || this.type === 'time') {
|
|
61
|
+
return changedDate;
|
|
62
|
+
}
|
|
63
|
+
return new Date(Date.UTC(changedDate.getFullYear(), changedDate.getMonth(), changedDate.getDate()));
|
|
64
|
+
}
|
|
65
|
+
parseDateValue() {
|
|
66
|
+
let value = this.value;
|
|
67
|
+
if (!value) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (typeof value === 'string') {
|
|
71
|
+
value = new Date(value);
|
|
72
|
+
}
|
|
73
|
+
return this.fromServerDate(value);
|
|
74
|
+
}
|
|
75
|
+
fromServerDate(parsedDate) {
|
|
76
|
+
if (this.type === 'datetime' || this.type === 'time') {
|
|
77
|
+
return parsedDate;
|
|
78
|
+
}
|
|
79
|
+
// Add hours to make sure we don't change the day when parsing server time,
|
|
80
|
+
// for example "00:00:00+02:00" which correponds to "22:00:00Z".
|
|
81
|
+
// We expect server time zone to be Europe/Stockholm, but we also try
|
|
82
|
+
// to account for 00:00 browser local time in most parts of the world,
|
|
83
|
+
// as well as 12:00 UTC without overflowing to the next day.
|
|
84
|
+
const maxServerTimeOffsetHours = 10;
|
|
85
|
+
return new Date(parsedDate.getUTCFullYear(), parsedDate.getUTCMonth(), parsedDate.getUTCDate(), parsedDate.getUTCHours() + maxServerTimeOffsetHours);
|
|
51
86
|
}
|
|
52
87
|
get dateTimeFormatter() {
|
|
53
88
|
return this.platform.get(types.PlatformServiceName.DateTimeFormatter);
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const platform = require('./platform-
|
|
7
|
-
require('./types-
|
|
6
|
+
const platform = require('./platform-da6aa193.js');
|
|
7
|
+
require('./types-172f53c1.js');
|
|
8
8
|
|
|
9
9
|
const DatePickerExampleDate = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
|
-
this.value =
|
|
12
|
+
this.value = '';
|
|
13
13
|
this.handleChange = (event) => {
|
|
14
|
-
this.value = event.detail;
|
|
14
|
+
this.value = event.detail || '';
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const platform = require('./platform-
|
|
7
|
-
require('./types-
|
|
6
|
+
const platform = require('./platform-da6aa193.js');
|
|
7
|
+
require('./types-172f53c1.js');
|
|
8
8
|
|
|
9
9
|
const DatePickerExampleDateTime = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
12
|
this.value = new Date();
|
|
13
13
|
this.handleChange = (event) => {
|
|
14
|
-
this.value = event.detail;
|
|
14
|
+
this.value = event.detail || undefined;
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const platform = require('./platform-
|
|
7
|
-
require('./types-
|
|
6
|
+
const platform = require('./platform-da6aa193.js');
|
|
7
|
+
require('./types-172f53c1.js');
|
|
8
8
|
|
|
9
9
|
const DatePickerExampleTime = class {
|
|
10
10
|
constructor(hostRef) {
|
|
11
11
|
index.registerInstance(this, hostRef);
|
|
12
|
-
this.value =
|
|
12
|
+
this.value = '';
|
|
13
13
|
this.handleChange = (event) => {
|
|
14
|
-
this.value = event.detail;
|
|
14
|
+
this.value = event.detail || '';
|
|
15
15
|
};
|
|
16
16
|
}
|
|
17
17
|
render() {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-c40f4fe5.js');
|
|
6
|
-
const platform = require('./platform-
|
|
7
|
-
require('./types-
|
|
6
|
+
const platform = require('./platform-da6aa193.js');
|
|
7
|
+
require('./types-172f53c1.js');
|
|
8
8
|
|
|
9
9
|
const DatePickerExampleWeek = class {
|
|
10
10
|
constructor(hostRef) {
|