Skip to content

Commit b2b7d59

Browse files
author
Dmitry Kuzin (DevExpress)
committed
Merge branch 'master' of https://github.com/surveyjs/widgets
2 parents 8606f9c + 07ffaec commit b2b7d59

File tree

5 files changed

+60
-5
lines changed

5 files changed

+60
-5
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
44

5+
<a name="1.1.20"></a>
6+
## [1.1.20](https://github.com/surveyjs/widgets/compare/v1.1.19...v1.1.20) (2019-11-12)
7+
8+
9+
10+
<a name="1.1.19"></a>
11+
## [1.1.19](https://github.com/surveyjs/widgets/compare/v1.1.18...v1.1.19) (2019-11-06)
12+
13+
14+
515
<a name="1.1.18"></a>
616
## [1.1.18](https://github.com/surveyjs/widgets/compare/v1.1.17...v1.1.18) (2019-10-30)
717

examples/jquery/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function init() {
4040

4141
Survey.defaultBootstrapCss.navigationButton = "btn btn-primary";
4242
//Survey.Survey.cssType = "bootstrapmaterial";
43-
Survey.Survey.cssType = "bootstrap";
43+
Survey.Model.cssType = "bootstrap";
4444

4545
var model = new Survey.Model(json);
4646
window.survey = model;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "surveyjs-widgets",
3-
"version": "1.1.18",
3+
"version": "1.1.20",
44
"scripts": {
55
"start": "npm run build && live-server",
66
"watch": "webpack --env.buildType dev --watch",

src/inputmask.js

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ function init(Survey) {
77
numericAutoGroup: true,
88
numericDigits: 2,
99
numericDigitsOptional: false,
10-
numericPrefix: "$",
1110
numericPlaceholder: "0",
1211
autoUnmask: true,
1312
widgetIsLoaded: function() {
@@ -27,8 +26,9 @@ function init(Survey) {
2726
"inputFormat",
2827
{
2928
name: "prefix",
30-
default: "$"
29+
visible: false
3130
},
31+
"currencySymbol",
3232
{
3333
name: "autoUnmask:boolean",
3434
default: true
@@ -79,7 +79,9 @@ function init(Survey) {
7979
if (surveyElement.inputMask == "currency") {
8080
options.digits = rootWidget.numericDigits;
8181
options.digitsOptional = rootWidget.numericDigitsOptional;
82-
options.prefix = surveyElement.prefix || rootWidget.numericPrefix;
82+
options.prefix = surveyElement.currencySymbol || surveyElement.prefix ||
83+
Survey.cultureInfo && Survey.cultureInfo.getCulture(
84+
surveyElement.culture).currencySymbol || "";
8385
options.placeholder = rootWidget.numericPlaceholder;
8486
}
8587
if (surveyElement.inputMask == "datetime") {
@@ -98,6 +100,16 @@ function init(Survey) {
98100
surveyElement.customWidgetData.isNeedRender = true;
99101
};
100102

103+
$(el).on('focusout change', function () {
104+
105+
if ($(el).inputmask('isComplete')) {
106+
surveyElement.value = $(el).val();
107+
} else {
108+
surveyElement.value = null;
109+
}
110+
111+
});
112+
101113
var updateHandler = function() {
102114
el.value =
103115
typeof surveyElement.value === "undefined" ? "" : surveyElement.value;

src/jquery-ui-datepicker.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
function init(Survey, $) {
2+
23
$ = $ || window.$;
34
if (!$.fn.bootstrapDP && !!$.fn.datepicker && !!$.fn.datepicker.noConflict) {
45
$.fn.bootstrapDP = $.fn.datepicker.noConflict();
@@ -35,6 +36,33 @@ function init(Survey, $) {
3536
name: "config",
3637
default: null
3738
});
39+
Survey.JsonObject.metaData.addProperty("datepicker", {
40+
name: "dateSeparator",
41+
choices: function(obj) {
42+
return Survey.cultureInfo && Survey.cultureInfo.getCulture(obj && obj.culture).dateSeparators || [];
43+
},
44+
onSetValue: function(obj, value, jsonConv) {
45+
var newValue = value || "/";
46+
if(!!obj.shortDateFormat) {
47+
var regex = new RegExp(obj.dateSeparator, 'g');
48+
obj.shortDateFormat = obj.shortDateFormat.replace(regex, newValue);
49+
}
50+
obj.setPropertyValue("dateSeparator", newValue);
51+
},
52+
default: "/"
53+
});
54+
Survey.JsonObject.metaData.addProperty("datepicker", {
55+
name: "shortDateFormat",
56+
dependsOn: "dateSeparator",
57+
choices: function(obj) {
58+
return (Survey.cultureInfo && Survey.cultureInfo.getCulture(obj && obj.culture).shortDateFormats || []).map(function(fmt) {
59+
return {
60+
text: fmt.text.replace(/\//g, obj.dateSeparator || "/"),
61+
value: fmt.value.replace(/\//g, obj.dateSeparator || "/")
62+
}
63+
});
64+
}
65+
});
3866
},
3967
afterRender: function(question, el) {
4068
var $el = $(el).is(".widget-datepicker")
@@ -50,6 +78,11 @@ function init(Survey, $) {
5078
config.dateFormat = !!question.dateFormat
5179
? question.dateFormat
5280
: undefined;
81+
if (config.dateFormat === undefined) {
82+
config.dateFormat = !!question.shortDateFormat
83+
? question.shortDateFormat
84+
: undefined;
85+
}
5386
}
5487
if (config.option === undefined) {
5588
config.option = {

0 commit comments

Comments
 (0)