Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtelnov committed Aug 21, 2023
2 parents 35eeb0b + 7575cbf commit 47eade3
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/defaultV2-theme/blocks/sd-dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
}

.sd-dropdown--empty:not(.sd-input--disabled) .sd-dropdown__filter-string-input::placeholder {
color: $foreground-light;
color: $font-editorfont-placeholdercolor;
}

.sd-dropdown__filter-string-input::placeholder {
Expand All @@ -127,7 +127,7 @@
}

.sd-dropdown__hint-prefix {
color: $foreground-light;
color: $font-editorfont-placeholdercolor;

span {
white-space: pre;
Expand All @@ -136,7 +136,7 @@

.sd-dropdown__hint-suffix {
display: flex;
color: $foreground-light;
color: $font-editorfont-placeholdercolor;

span {
white-space: pre;
Expand Down
2 changes: 1 addition & 1 deletion src/defaultV2-theme/blocks/sd-input.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

.sd-input::placeholder {
color: $foreground-light;
color: $font-editorfont-placeholdercolor;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
Expand Down
1 change: 1 addition & 0 deletions src/defaultV2-theme/variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ $font-questiondescription-size: var(--sjs-font-questiondescription-size, calc(1
$font-editorfont-family: var(--sjs-font-editorfont-family, var(--font-family));
$font-editorfont-weight: var(--sjs-font-editorfont-weight, 400);
$font-editorfont-color: var(--sjs-font-editorfont-color, var(--sjs-general-forecolor, rgba(0, 0, 0, 0.91)));
$font-editorfont-placeholdercolor: var(--sjs-font-editorfont-placeholdercolor, var(--sjs-general-forecolor-light, var(--foreground-light, #909090)));
$font-editorfont-size: var(--sjs-font-editorfont-size, calc(1 * var(--sjs-font-size, $font-size)));
$base-unit: var(--sjs-base-unit, var(--base-unit, 8px));

Expand Down
4 changes: 4 additions & 0 deletions src/question_text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@ export class QuestionTextModel extends QuestionTextBase {
this.step = undefined;
}
}
public getMaxLength(): any {
if(this.inputType !== "text") return null;
return super.getMaxLength();
}
public runCondition(values: HashTable<any>, properties: HashTable<any>) {
super.runCondition(values, properties);
if (!!this.minValueExpression || !!this.maxValueExpression) {
Expand Down
14 changes: 8 additions & 6 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,20 +482,22 @@ export var settings = {
*/
tagboxCloseOnSelect: false,
/**
* A property that allows you to display a custom confirm dialog instead of the standard browser dialog. Set this property to a function that renders your custom dialog window.
* A property that allows you to display a custom confirm dialog instead of the standard browser dialog.
*
* Set this property to a function that renders your custom dialog window. This function should return `true` if a user confirms an action or `false` otherwise.
* @param message A message to be displayed in the confirm dialog window.
*/
confirmActionFunc: function (message: string): boolean {
return confirm(message);
},
/**
* A property that allows you to display a custom confirm dialog in async mode instead of the standard browser dialog. Set this property to a function that renders your custom dialog window in async mode.
* A property that allows you to display a custom confirm dialog instead of the standard browser dialog in async mode.
*
* Set this property to a function that renders your custom dialog window. This function should return `true` to be enabled; otherwise, a survey executes the [`confirmActionFunc`](#confirmActionFunc) function. Pass the dialog result as the `callback` parameter: `true` if a user confirms an action, `false` otherwise.
* @param message A message to be displayed in the confirm dialog window.
* @param callback A callback function that should be called with res paramter equals to true if action is confirmed and equals to false otherwise.
* @param callback A callback function that should be called with `true` if a user confirms an action or `false` otherwise.
*/
confirmActionAsyncFunc: function (message: string, resFunc: (res: boolean) => void): boolean {
//when you finish with displaying your dialog, call the resFunc as resFunc(true) or resFunc(false).
//You should return true to tell that you use this function
confirmActionAsyncFunc: function (message: string, callback: (res: boolean) => void): boolean {
return false;
},
/**
Expand Down
12 changes: 11 additions & 1 deletion tests/surveyquestiontests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2435,7 +2435,7 @@ QUnit.test("question.clearIncorrectValues and choicesByUrl", function (assert) {
);
});

QUnit.test("questiontext.maxLength", function (assert) {
QUnit.test("questiontext.maxLength & make it works for text input type only, #6750", function (assert) {
var survey = new SurveyModel();
var page = survey.addNewPage("p1");
var qText = new QuestionTextModel("q1");
Expand All @@ -2447,6 +2447,16 @@ QUnit.test("questiontext.maxLength", function (assert) {
assert.equal(qText.getMaxLength(), null, "makes it undefined");
qText.maxLength = 5;
assert.equal(qText.getMaxLength(), 5, "gets 5 from question");
qText.maxLength = -1;
assert.equal(qText.getMaxLength(), 10, "get from survey again");
qText.inputType = "date";
assert.equal(qText.getMaxLength(), null, "input type is 'date'");
qText.inputType = "number";
assert.equal(qText.getMaxLength(), null, "input type is 'number'");
qText.inputType = "color";
assert.equal(qText.getMaxLength(), null, "input type is 'color'");
qText.inputType = "text";
assert.equal(qText.getMaxLength(), 10, "input type is 'text'");
});

QUnit.test("Display Current/Maximum Allowed Characters when a maximum length is defined for input fields", function (assert) {
Expand Down

0 comments on commit 47eade3

Please sign in to comment.