@limetech/lime-elements 37.58.0 → 37.59.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/CHANGELOG.md +21 -0
- package/dist/cjs/limel-form.cjs.entry.js +106 -59
- package/dist/cjs/limel-form.cjs.entry.js.map +1 -1
- package/dist/cjs/limel-snackbar.cjs.entry.js +4 -7
- package/dist/cjs/limel-snackbar.cjs.entry.js.map +1 -1
- package/dist/collection/components/form/fields/schema-field.js +4 -0
- package/dist/collection/components/form/fields/schema-field.js.map +1 -1
- package/dist/collection/components/form/widgets/date-only-picker.js +24 -0
- package/dist/collection/components/form/widgets/date-only-picker.js.map +1 -0
- package/dist/collection/components/form/widgets/date-picker.js +15 -11
- package/dist/collection/components/form/widgets/date-picker.js.map +1 -1
- package/dist/collection/components/form/widgets/index.js +2 -1
- package/dist/collection/components/form/widgets/index.js.map +1 -1
- package/dist/collection/components/form/widgets/time-picker.js +23 -0
- package/dist/collection/components/form/widgets/time-picker.js.map +1 -0
- package/dist/collection/components/snackbar/snackbar.js +4 -7
- package/dist/collection/components/snackbar/snackbar.js.map +1 -1
- package/dist/esm/limel-form.entry.js +106 -59
- package/dist/esm/limel-form.entry.js.map +1 -1
- package/dist/esm/limel-snackbar.entry.js +4 -7
- package/dist/esm/limel-snackbar.entry.js.map +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-25ff5385.entry.js → p-48c62d9d.entry.js} +2 -2
- package/dist/lime-elements/p-48c62d9d.entry.js.map +1 -0
- package/dist/lime-elements/{p-b3b87ff5.entry.js → p-5de66206.entry.js} +5 -5
- package/dist/lime-elements/p-5de66206.entry.js.map +1 -0
- package/dist/types/components/form/widgets/date-only-picker.d.ts +4 -0
- package/dist/types/components/form/widgets/time-picker.d.ts +4 -0
- package/dist/types/components/snackbar/snackbar.d.ts +1 -2
- package/package.json +2 -2
- package/dist/lime-elements/p-25ff5385.entry.js.map +0 -1
- package/dist/lime-elements/p-b3b87ff5.entry.js.map +0 -1
|
@@ -28851,6 +28851,87 @@ function isAdditionalProperty(schema) {
|
|
|
28851
28851
|
return schema[ADDITIONAL_PROPERTY_FLAG] === true;
|
|
28852
28852
|
}
|
|
28853
28853
|
|
|
28854
|
+
var __rest$2 = (undefined && undefined.__rest) || function (s, e) {
|
|
28855
|
+
var t = {};
|
|
28856
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28857
|
+
t[p] = s[p];
|
|
28858
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
28859
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28860
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28861
|
+
t[p[i]] = s[p[i]];
|
|
28862
|
+
}
|
|
28863
|
+
return t;
|
|
28864
|
+
};
|
|
28865
|
+
class DatePicker extends react.Component {
|
|
28866
|
+
constructor(props) {
|
|
28867
|
+
super(props);
|
|
28868
|
+
this.props = props;
|
|
28869
|
+
this.state = {
|
|
28870
|
+
modified: false,
|
|
28871
|
+
};
|
|
28872
|
+
this.handleChange = this.handleChange.bind(this);
|
|
28873
|
+
}
|
|
28874
|
+
render() {
|
|
28875
|
+
var _a, _b;
|
|
28876
|
+
const _c = this.props, { type = 'datetime' } = _c, props = __rest$2(_c, ["type"]);
|
|
28877
|
+
return react.createElement(LimeElementsWidgetAdapter, {
|
|
28878
|
+
name: 'limel-date-picker',
|
|
28879
|
+
value: this.getValue(),
|
|
28880
|
+
events: {
|
|
28881
|
+
change: this.handleChange,
|
|
28882
|
+
},
|
|
28883
|
+
widgetProps: props,
|
|
28884
|
+
extraProps: Object.assign({ type: type }, (_b = (_a = props.schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props),
|
|
28885
|
+
});
|
|
28886
|
+
}
|
|
28887
|
+
getValue() {
|
|
28888
|
+
if (typeof this.props.value === 'string') {
|
|
28889
|
+
return new Date(this.props.value);
|
|
28890
|
+
}
|
|
28891
|
+
else {
|
|
28892
|
+
return this.props.value;
|
|
28893
|
+
}
|
|
28894
|
+
}
|
|
28895
|
+
handleChange(event) {
|
|
28896
|
+
const props = this.props;
|
|
28897
|
+
event.stopPropagation();
|
|
28898
|
+
if (!props.onChange) {
|
|
28899
|
+
return;
|
|
28900
|
+
}
|
|
28901
|
+
if (!event.detail) {
|
|
28902
|
+
props.onChange(null);
|
|
28903
|
+
return;
|
|
28904
|
+
}
|
|
28905
|
+
const formatMapping = {
|
|
28906
|
+
'date-time': 'YYYY-MM-DDTHH:mm:ssZ',
|
|
28907
|
+
date: 'YYYY-MM-DD',
|
|
28908
|
+
time: 'HH:mm:ss',
|
|
28909
|
+
};
|
|
28910
|
+
const dateString = moment(event.detail).format(formatMapping[props.schema.format]);
|
|
28911
|
+
props.onChange(dateString);
|
|
28912
|
+
}
|
|
28913
|
+
}
|
|
28914
|
+
|
|
28915
|
+
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
28916
|
+
var t = {};
|
|
28917
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
28918
|
+
t[p] = s[p];
|
|
28919
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
28920
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
28921
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
28922
|
+
t[p[i]] = s[p[i]];
|
|
28923
|
+
}
|
|
28924
|
+
return t;
|
|
28925
|
+
};
|
|
28926
|
+
const TimePicker = (_a) => {
|
|
28927
|
+
var { value } = _a, props = __rest$1(_a, ["value"]);
|
|
28928
|
+
if (typeof value === 'string' && timeStringPattern.test(value)) {
|
|
28929
|
+
value = new Date('2000-01-01T' + value);
|
|
28930
|
+
}
|
|
28931
|
+
return react.createElement(DatePicker, Object.assign({ type: 'time', value: value }, props));
|
|
28932
|
+
};
|
|
28933
|
+
const timeStringPattern = /^\d\d:\d\d/;
|
|
28934
|
+
|
|
28854
28935
|
/**
|
|
28855
28936
|
* If given a value and schema, check if the value should be translated
|
|
28856
28937
|
* from null to undefined to avoid issues with validation
|
|
@@ -29025,6 +29106,9 @@ class SchemaField extends react.Component {
|
|
|
29025
29106
|
return this.renderCustomComponent(this.props);
|
|
29026
29107
|
}
|
|
29027
29108
|
const fieldProps = Object.assign(Object.assign({}, this.props), { onChange: this.handleChange });
|
|
29109
|
+
if (this.props.schema.format === 'time') {
|
|
29110
|
+
fieldProps.uiSchema = Object.assign({ 'ui:widget': TimePicker }, fieldProps.uiSchema);
|
|
29111
|
+
}
|
|
29028
29112
|
return react.createElement(SchemaField$1, fieldProps);
|
|
29029
29113
|
}
|
|
29030
29114
|
/**
|
|
@@ -29198,7 +29282,7 @@ class Checkbox extends react.Component {
|
|
|
29198
29282
|
}
|
|
29199
29283
|
render() {
|
|
29200
29284
|
const props = this.props;
|
|
29201
|
-
const additionalProps = getAdditionalProps$
|
|
29285
|
+
const additionalProps = getAdditionalProps$2(props.schema);
|
|
29202
29286
|
return react.createElement(LimeElementsWidgetAdapter, {
|
|
29203
29287
|
name: 'limel-checkbox',
|
|
29204
29288
|
value: props.value,
|
|
@@ -29218,68 +29302,31 @@ class Checkbox extends react.Component {
|
|
|
29218
29302
|
props.onChange(event.detail);
|
|
29219
29303
|
}
|
|
29220
29304
|
}
|
|
29221
|
-
function getAdditionalProps$
|
|
29305
|
+
function getAdditionalProps$2(schema) {
|
|
29222
29306
|
var _a, _b, _c;
|
|
29223
29307
|
return (_c = (_b = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) !== null && _c !== void 0 ? _c : {};
|
|
29224
29308
|
}
|
|
29225
29309
|
|
|
29226
|
-
|
|
29227
|
-
|
|
29228
|
-
|
|
29229
|
-
|
|
29230
|
-
|
|
29231
|
-
|
|
29232
|
-
|
|
29233
|
-
|
|
29234
|
-
}
|
|
29235
|
-
render() {
|
|
29236
|
-
const props = this.props;
|
|
29237
|
-
const additionalProps = getAdditionalProps$2(props.schema);
|
|
29238
|
-
return react.createElement(LimeElementsWidgetAdapter, {
|
|
29239
|
-
name: 'limel-date-picker',
|
|
29240
|
-
value: this.getValue(),
|
|
29241
|
-
events: {
|
|
29242
|
-
change: this.handleChange,
|
|
29243
|
-
},
|
|
29244
|
-
widgetProps: props,
|
|
29245
|
-
extraProps: Object.assign({}, additionalProps),
|
|
29246
|
-
});
|
|
29247
|
-
}
|
|
29248
|
-
getValue() {
|
|
29249
|
-
if (typeof this.props.value === 'string') {
|
|
29250
|
-
return new Date(this.props.value);
|
|
29251
|
-
}
|
|
29252
|
-
else {
|
|
29253
|
-
return this.props.value;
|
|
29254
|
-
}
|
|
29255
|
-
}
|
|
29256
|
-
handleChange(event) {
|
|
29257
|
-
const props = this.props;
|
|
29258
|
-
event.stopPropagation();
|
|
29259
|
-
if (!props.onChange) {
|
|
29260
|
-
return;
|
|
29261
|
-
}
|
|
29262
|
-
if (!event.detail) {
|
|
29263
|
-
props.onChange(null);
|
|
29264
|
-
return;
|
|
29310
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
29311
|
+
var t = {};
|
|
29312
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
29313
|
+
t[p] = s[p];
|
|
29314
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
29315
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
29316
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
29317
|
+
t[p[i]] = s[p[i]];
|
|
29265
29318
|
}
|
|
29266
|
-
|
|
29267
|
-
|
|
29268
|
-
|
|
29269
|
-
|
|
29270
|
-
|
|
29271
|
-
|
|
29272
|
-
|
|
29273
|
-
|
|
29274
|
-
}
|
|
29275
|
-
|
|
29276
|
-
|
|
29277
|
-
let props = {};
|
|
29278
|
-
if ((_b = (_a = schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) {
|
|
29279
|
-
props = schema.lime.component.props;
|
|
29280
|
-
}
|
|
29281
|
-
return props;
|
|
29282
|
-
}
|
|
29319
|
+
return t;
|
|
29320
|
+
};
|
|
29321
|
+
const DateOnlyPicker = (_a) => {
|
|
29322
|
+
var { value } = _a, props = __rest(_a, ["value"]);
|
|
29323
|
+
// A date-only string is treated as UTC by the Date constructor,
|
|
29324
|
+
// but we want to parse it as local date
|
|
29325
|
+
if (typeof value === 'string' && /-\d\d$/.test(value)) {
|
|
29326
|
+
value += 'T00:00';
|
|
29327
|
+
}
|
|
29328
|
+
return react.createElement(DatePicker, Object.assign({ type: 'date', value: value }, props));
|
|
29329
|
+
};
|
|
29283
29330
|
|
|
29284
29331
|
class Slider extends react.Component {
|
|
29285
29332
|
constructor(props) {
|
|
@@ -29480,7 +29527,7 @@ function findValues(value, options) {
|
|
|
29480
29527
|
const widgets = {
|
|
29481
29528
|
CheckboxWidget: Checkbox,
|
|
29482
29529
|
DateTimeWidget: DatePicker,
|
|
29483
|
-
DateWidget:
|
|
29530
|
+
DateWidget: DateOnlyPicker,
|
|
29484
29531
|
EmailWidget: InputField,
|
|
29485
29532
|
TextWidget: InputField,
|
|
29486
29533
|
SelectWidget: Select,
|