Skip to content

Commit

Permalink
Merge branch 'master' into bug/C4484-memory-leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
tsv2013 committed Aug 31, 2023
2 parents a688529 + a596a88 commit c677f7a
Show file tree
Hide file tree
Showing 50 changed files with 293 additions and 60 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.105](https://github.com/surveyjs/survey-library/compare/v1.9.104...v1.9.105) (2023-08-30)

## [1.9.104](https://github.com/surveyjs/survey-library/compare/v1.9.103...v1.9.104) (2023-08-22)

## [1.9.103](https://github.com/surveyjs/survey-library/compare/v1.9.102...v1.9.103) (2023-08-15)
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"testcafe:ci:angular": "testcafe -c 4 -q attemptLimit=5,successThreshold=1 chrome:headless testCafe/ --app \"http-server ./packages/survey-angular-ui/example/dist --proxy http://localhost:8080? -p 8080\" --selector-timeout 1500 --reporter minimal --env=angular",
"prepare": "husky install"
},
"version": "1.9.104",
"version": "1.9.105",
"name": "survey-library",
"private": true,
"devDependencies": {
Expand Down
2 changes: 2 additions & 0 deletions packages/survey-angular-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.105](https://github.com/surveyjs/surveyjs/compare/v1.9.104...v1.9.105) (2023-08-30)

## [1.9.104](https://github.com/surveyjs/surveyjs/compare/v1.9.103...v1.9.104) (2023-08-22)

## [1.9.103](https://github.com/surveyjs/surveyjs/compare/v1.9.102...v1.9.103) (2023-08-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-angular-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-angular-ui",
"version": "1.9.104",
"version": "1.9.105",
"description": "survey.js is a JavaScript Survey Library. It is a modern way to add a survey to your website. It uses JSON for survey metadata and results.",
"keywords": [
"Survey",
Expand Down
2 changes: 2 additions & 0 deletions packages/survey-vue3-ui/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

All notable changes to this project will be documented in this file. See [commit-and-tag-version](https://github.com/absolute-version/commit-and-tag-version) for commit guidelines.

## [1.9.105](https://github.com/surveyjs/survey-library/compare/v1.9.104...v1.9.105) (2023-08-30)

## [1.9.104](https://github.com/surveyjs/survey-library/compare/v1.9.103...v1.9.104) (2023-08-22)

## [1.9.103](https://github.com/surveyjs/survey-library/compare/v1.9.102...v1.9.103) (2023-08-15)
Expand Down
2 changes: 1 addition & 1 deletion packages/survey-vue3-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "survey-vue3-ui",
"version": "1.9.104",
"version": "1.9.105",
"scripts": {
"dev": "vite",
"preview": "vite preview",
Expand Down
23 changes: 17 additions & 6 deletions src/actions/adaptive-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,30 @@ export class AdaptiveActionContainer<T extends Action = Action> extends ActionCo
public isResponsivenessDisabled = false;

private hideItemsGreaterN(visibleItemsCount: number) {
const actionsToHide = this.visibleActions.filter(action => !action.disableHide);
const actionsToHide = this.getActionsToHide();
visibleItemsCount = Math.max(visibleItemsCount, this.minVisibleItemsCount - (this.visibleActions.length - actionsToHide.length));
const hiddenItems: IAction[] = [];
actionsToHide.forEach((item) => {
if (visibleItemsCount <= 0) {
item.mode = "popup";
hiddenItems.push(item.innerItem);
if(item.removePriority) {
item.mode = "removed";
} else {
item.mode = "popup";
hiddenItems.push(item.innerItem);
}
}
visibleItemsCount--;
});
this.hiddenItemsListModel.setItems(hiddenItems);
}

private getActionsToHide() {
return this.visibleActions.filter(action => !action.disableHide).sort((a, b) => a.removePriority || 0 - b.removePriority || 0);
}

private getVisibleItemsCount(availableSize: number): number {
this.visibleActions.filter((action) => action.disableHide).forEach(action => availableSize -= action.minDimension);
const itemsSizes: number[] = this.visibleActions.filter(action => !action.disableHide).map((item) => item.minDimension);
const itemsSizes: number[] = this.getActionsToHide().map((item) => item.minDimension);
let currSize: number = 0;
for (var i = 0; i < itemsSizes.length; i++) {
currSize += itemsSizes[i];
Expand Down Expand Up @@ -127,7 +135,7 @@ export class AdaptiveActionContainer<T extends Action = Action> extends ActionCo
} else if (dimension < minSize) {
this.setActionsMode("small");
this.hideItemsGreaterN(this.getVisibleItemsCount(dimension - dotsItemSize));
this.dotsItem.visible = true;
this.dotsItem.visible = !!this.hiddenItemsListModel.actions.length;
} else {
this.updateItemMode(dimension, maxSize);
}
Expand All @@ -145,7 +153,10 @@ export class AdaptiveActionContainer<T extends Action = Action> extends ActionCo
}
}
public setActionsMode(mode: actionModeType) {
this.actions.forEach((action) => (action.mode = mode));
this.actions.forEach((action) => {
if(mode == "small" && action.disableShrink) return;
action.mode = mode;
});
}
public dispose(): void {
super.dispose();
Expand Down
1 change: 1 addition & 0 deletions src/actions/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export let defaultActionBarCss = {
defaultSizeMode: "sv-action-bar--default-size-mode",
smallSizeMode: "sv-action-bar--small-size-mode",
item: "sv-action-bar-item",
itemAsIcon: "sv-action-bar-item--icon",
itemActive: "sv-action-bar-item--active",
itemPressed: "sv-action-bar-item--pressed",
itemIcon: "sv-action-bar-item__icon",
Expand Down
1 change: 1 addition & 0 deletions src/defaultCss/defaultV2Css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export var defaultV2Css = {
rootMobile: "sd-root-modern--mobile",
rootReadOnly: "sd-root--readonly",
rootCompact: "sd-root--compact",
rootFitToContainer: "sd-root-modern--full-container",
rootBackgroundImage: "sd-root_background-image",
container: "sd-container-modern",
header: "sd-title sd-container-modern__title",
Expand Down
20 changes: 9 additions & 11 deletions src/defaultV2-theme/blocks/sd-table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
text-align: center;

&:not(.sd-table__cell--empty):not(.sd-table__cell--actions):not(:empty) {
min-width: calcSize(14);
min-width: calcSize(15);
}
}

Expand Down Expand Up @@ -149,33 +149,29 @@
padding: calcSize(1.5) calcSize(1);

&:not(.sd-table__cell--empty) {
min-width: calcSize(14);
min-width: calcSize(15);
}
}

.sd-matrixdropdown .sd-table__cell--header.sd-table__cell--empty {
min-width: calcSize(14);
width: calcSize(14);
min-width: calcSize(15);
}

.sd-matrixdropdown .sd-table__cell--header.sd-table__cell--action {
min-width: calcSize(2);
width: calcSize(2);
min-width: calcSize(3);
width: calcSize(3);
}

.sd-matrixdropdown .sd-table__cell--header:not(.sd-table__cell--empty) {
min-width: calcSize(14);
width: calcSize(14);
min-width: calcSize(15);

&.sd-table__cell--dropdown,
&.sd-table__cell--rating {
min-width: calcSize(22);
width: calcSize(22);
}

&.sd-table__cell--boolean {
min-width: calcSize(18);
width: calcSize(18);
}
}

Expand All @@ -197,6 +193,8 @@

&:not(.sd-table__cell--drag):first-of-type {
padding-left: 0;
width: calcSize(4);
min-width: calcSize(4);
}
}

Expand Down Expand Up @@ -359,7 +357,7 @@
}

.sd-matrixdropdown.sd-table {
table-layout: fixed;
//table-layout: fixed;
}

@mixin table_responsive {
Expand Down
33 changes: 33 additions & 0 deletions src/defaultV2-theme/defaultV2.fontless.scss
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,39 @@ body {
}
}

.sd-root-modern.sd-root-modern--full-container {
width: 100%;
height: 100%;
overflow: auto;

* {
scrollbar-width: thin;
scrollbar-color: $border transparent;
}

&::-webkit-scrollbar {
width: 12px;
height: 12px;
background-color: transparent;
}

&::-webkit-scrollbar-thumb {
border: 4px solid rgba(0, 0, 0, 0);
background-clip: padding-box;
border-radius: 32px;
background-color: $border;
}

&::-webkit-scrollbar-track {
background: transparent;
}

&::-webkit-scrollbar-thumb:hover {
border: 2px solid rgba(0, 0, 0, 0);
background-color: $foreground-light;
}
}

.sd-root-modern--mobile {
--sd-timer-size: calc(9 * #{$base-unit});
}
Expand Down
33 changes: 17 additions & 16 deletions src/question_matrixdropdownbase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,16 @@ import { IElement, IQuestion, ISurveyData, ISurvey, ISurveyImpl, ITextProcessor,
import { SurveyElement } from "./survey-element";
import { TextPreProcessorValue, QuestionTextProcessor } from "./textPreProcessor";
import { ItemValue } from "./itemvalue";
import { surveyLocalization } from "./surveyStrings";
import { QuestionFactory } from "./questionfactory";
import { ILocalizableOwner, LocalizableString } from "./localizablestring";
import { getCurrecyCodes } from "./question_expression";
import { FunctionFactory } from "./functionsfactory";
import { PanelModel } from "./panel";
import { settings } from "./settings";
import { KeyDuplicationError } from "./error";
import { SurveyModel } from "./survey";
import { SurveyError } from "./survey-error";
import { CssClassBuilder } from "./utils/cssClassBuilder";
import { MatrixDropdownColumn } from "./question_matrixdropdowncolumn";
import { IMatrixColumnOwner, MatrixDropdownColumn } from "./question_matrixdropdowncolumn";
import { QuestionMatrixDropdownRenderedCell, QuestionMatrixDropdownRenderedRow, QuestionMatrixDropdownRenderedTable } from "./question_matrixdropdownrendered";

export interface IMatrixDropdownData {
Expand Down Expand Up @@ -681,7 +679,6 @@ implements ISurveyData, ISurveyImpl, ILocalizableOwner {
var columns = this.data.columns;
for (var i = 0; i < columns.length; i++) {
var column = columns[i];
if (!column.isVisible) continue;
var cell = this.createCell(column);
this.cells.push(cell);
var cellValue = this.getCellValue(value, column.name);
Expand Down Expand Up @@ -783,7 +780,7 @@ export class MatrixDropdownTotalRowModel extends MatrixDropdownRowModelBase {
/**
* A base class for the [QuestionMatrixDropdownModel](https://surveyjs.io/form-library/documentation/questionmatrixdropdownmodel) and [QuestionMatrixDynamicModel](https://surveyjs.io/form-library/documentation/questionmatrixdynamicmodel) classes.
*/
export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<MatrixDropdownRowModelBase, MatrixDropdownColumn> implements IMatrixDropdownData {
export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<MatrixDropdownRowModelBase, MatrixDropdownColumn> implements IMatrixDropdownData, IMatrixColumnOwner {
public static get defaultCellType() {
return settings.matrix.defaultCellType;
}
Expand Down Expand Up @@ -1258,11 +1255,16 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
}
}

onShowInMultipleColumnsChanged(column: MatrixDropdownColumn) {
this.clearGeneratedRows();
this.resetRenderedTable();
onShowInMultipleColumnsChanged(column: MatrixDropdownColumn): void {
this.resetTableAndRows();
}
onColumnVisibilityChanged(column: MatrixDropdownColumn): void {
this.resetTableAndRows();
}
onColumnCellTypeChanged(column: MatrixDropdownColumn): void {
this.resetTableAndRows();
}
onColumnCellTypeChanged(column: MatrixDropdownColumn) {
private resetTableAndRows(): void {
this.clearGeneratedRows();
this.resetRenderedTable();
}
Expand Down Expand Up @@ -1365,7 +1367,7 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
protected runCellsCondition(
values: HashTable<any>,
properties: HashTable<any>
) {
): void {
if (!this.generatedVisibleRows) return;
var newValues = this.getRowConditionValues(values);
var rows = this.generatedVisibleRows;
Expand All @@ -1375,7 +1377,8 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
this.checkColumnsVisibility();
this.checkColumnsRenderedRequired();
}
private checkColumnsVisibility() {
private checkColumnsVisibility(): void {
if(this.isDesignMode) return;
var hasChanged = false;
for (var i = 0; i < this.visibleColumns.length; i++) {
const column = this.visibleColumns[i];
Expand All @@ -1402,7 +1405,7 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
}
}
private isColumnVisibilityChanged(column: MatrixDropdownColumn): boolean {
const curVis = column.hasVisibleCell;
const curVis = column.isColumnVisible;
const isMultipleColumnsVisibility = column.isFilteredMultipleColumns;
const curVisibleChoices = isMultipleColumnsVisibility ? column.getVisibleChoicesInCell : [];
const newVisibleChoices = new Array<any>();
Expand All @@ -1418,14 +1421,12 @@ export class QuestionMatrixDropdownModelBase extends QuestionMatrixBaseModel<Mat
} else break;
}
}
if (curVis != hasVisCell) {
column.hasVisibleCell = hasVisCell;
}
column.hasVisibleCell = hasVisCell;
if(isMultipleColumnsVisibility) {
column.setVisibleChoicesInCell(newVisibleChoices);
if(!Helpers.isArraysEqual(curVisibleChoices, newVisibleChoices, true, false, false)) return true;
}
return curVis != hasVisCell;
return curVis != column.isVisible;
}
private updateNewVisibleChoices(q: Question, dest: Array<any>): void {
const choices = q.visibleChoices;
Expand Down
Loading

0 comments on commit c677f7a

Please sign in to comment.