-
+
+
@@ -48,6 +52,7 @@
[content]="rowItem.$checkBoxTips"
[position]="['top', 'right', 'bottom', 'left']"
[showAnimation]="false"
+ (mouseup)="$event.stopPropagation()"
>
- |
diff --git a/devui/data-table/data-table-row.component.scss b/devui/data-table/data-table-row.component.scss
index da678b7a..31c114f4 100755
--- a/devui/data-table/data-table-row.component.scss
+++ b/devui/data-table/data-table-row.component.scss
@@ -83,3 +83,12 @@ svg.svg-icon-arrow > g > polygon {
background: $devui-list-item-hover-bg;
}
}
+
+.expand-icon-wrapper {
+ display: flex;
+ justify-content: left;
+
+ polygon {
+ fill: $devui-icon-fill;
+ }
+}
diff --git a/devui/data-table/data-table.component.html b/devui/data-table/data-table.component.html
index a80a92fa..d3fb3dac 100755
--- a/devui/data-table/data-table.component.html
+++ b/devui/data-table/data-table.component.html
@@ -1,5 +1,12 @@
|||||||||||||||||||||||||||||||||||||
{{ rowIndex + 1 }} | -+ | {{ colOption.fieldType === 'date' ? (rowItem[colOption.field] | i18nDate: 'short':false) : rowItem[colOption.field] }} | |||||||||||||||||||||||||||||||||||
{{ colOption.header }} | +|||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
+ {{ colOption.fieldType === 'date' ? (rowItem[colOption.field] | i18nDate: 'short':false) : rowItem[colOption.field] }} + | +|||||||||||||||||||||||||||||||||||||
-
- Create new data
+
@@ -37,9 +38,9 @@
| |||||||||||||||||||||||||||||||||||||
-
-
-
+
+
|
{{ rowIndex + 1 }} | diff --git a/devui/data-table/demo/interaction-column/interaction-column.component.ts b/devui/data-table/demo/interaction-column/interaction-column.component.ts index 2ca21550..eb8308f7 100644 --- a/devui/data-table/demo/interaction-column/interaction-column.component.ts +++ b/devui/data-table/demo/interaction-column/interaction-column.component.ts @@ -93,7 +93,7 @@ export class InteractionColumnComponent implements OnInit { } const filterList = $event.name; const dataDisplay = []; - JSON.parse(JSON.stringify(originSource.slice(0, 6))).map(item => { + JSON.parse(JSON.stringify(originSource.slice(0, 6))).forEach(item => { if (filterList.includes(item.gender)) { dataDisplay.push(item); } @@ -104,7 +104,7 @@ export class InteractionColumnComponent implements OnInit { filterChangeMultiple($event) { const filterList = $event.map(item => item.name); const dataDisplay = []; - JSON.parse(JSON.stringify(originSource.slice(0, 6))).map(item => { + JSON.parse(JSON.stringify(originSource.slice(0, 6))).forEach(item => { if (filterList.includes(item.firstName)) { dataDisplay.push(item); } diff --git a/devui/data-table/demo/interaction/interaction.component.ts b/devui/data-table/demo/interaction/interaction.component.ts index 0cb81e9d..a44d63a7 100644 --- a/devui/data-table/demo/interaction/interaction.component.ts +++ b/devui/data-table/demo/interaction/interaction.component.ts @@ -1,5 +1,5 @@ import { ChangeDetectorRef, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; -import { DataTableComponent, SortDirection, SortEventArg, TableWidthConfig } from 'ng-devui/data-table'; +import { DataTableComponent, SortDirection, SortEventArg, tableResizeFunc, TableWidthConfig } from 'ng-devui/data-table'; import { originSource, SourceType } from '../mock-data'; @Component({ @@ -83,10 +83,6 @@ export class InteractionComponent implements OnInit { } ]; - _totalWidth = 0; - lastWidth = 0; - firstResize = true; - lastNameSortDirection = SortDirection.ASC; genderSortDirection = SortDirection.default; sortParams = {field: 'lastName', direction: this.lastNameSortDirection}; @@ -111,38 +107,7 @@ export class InteractionComponent implements OnInit { }; } - onResize({ width, beforeWidth }, field) { - const index = this.tableWidthConfig.findIndex((config) => { - return config.field === field; - }); - if (index > -1) { - if (this.firstResize) { - this.firstResize = false; - const ratio = beforeWidth / parseInt(this.tableWidthConfig[index].width, 10); - this.tableWidthConfig.forEach(t => { - t.width = parseInt(t.width, 10) * ratio + 'px'; - }); - this._totalWidth = this.ele.nativeElement.querySelector('.table-wrap').offsetWidth; - this.lastWidth = parseInt(this.tableWidthConfig.slice(-1)[0].width); - } - this.tableWidthConfig[index].width = width + 'px'; - - let newWidthTotal = 0; - this.tableWidthConfig.forEach(t => { - newWidthTotal += parseInt(t.width, 10); - }); - - const lastCol = this.tableWidthConfig[this.tableWidthConfig.length - 1]; - const lastColWidth = parseInt(lastCol.width, 10); - const changeValue = newWidthTotal - this._totalWidth; - if (changeValue < 0) { - lastCol.width = lastColWidth + this._totalWidth - newWidthTotal + 'px'; - } else if (lastColWidth > this.lastWidth) { - const lastChange = (lastColWidth - this.lastWidth) > changeValue ? changeValue : (lastColWidth - this.lastWidth); - lastCol.width = lastColWidth - lastChange + 'px'; - } - } - } + onResize = tableResizeFunc(this.tableWidthConfig, this.ele); filterChangeRadio($event) { if ($event.name === 'Clear') { @@ -151,7 +116,7 @@ export class InteractionComponent implements OnInit { } const filterList = $event.name; const dataDisplay = []; - JSON.parse(JSON.stringify(originSource.slice(0, 6))).map(item => { + JSON.parse(JSON.stringify(originSource.slice(0, 6))).forEach(item => { if (filterList.includes(item.gender)) { dataDisplay.push(item); } @@ -162,7 +127,7 @@ export class InteractionComponent implements OnInit { onFirstFilterChange($event) { const filterList = $event.map(item => item.name); const dataDisplay = []; - JSON.parse(JSON.stringify(originSource.slice(0, 6))).map(item => { + JSON.parse(JSON.stringify(originSource.slice(0, 6))).forEach(item => { if (filterList.includes(item.firstName)) { dataDisplay.push(item); } diff --git a/devui/data-table/demo/muti-drag-row/muti-drag-row.component.html b/devui/data-table/demo/muti-drag-row/muti-drag-row.component.html index 8224acda..b48ee2c8 100644 --- a/devui/data-table/demo/muti-drag-row/muti-drag-row.component.html +++ b/devui/data-table/demo/muti-drag-row/muti-drag-row.component.html @@ -6,7 +6,6 @@ [switchWhileCrossEdge]="true" [dropScope]="'mutiple-group'" (dropEvent)="onDrop($event)" - [tableOverflowType]="'overlay'" >||||||||||||||||||||||||||||||||||||
- | {{ 'components.design-color.colorDemo.instance.defaultTable.colorVar' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.themeValue' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.description' | translate }} | -||||||||||||||||||||||||||||||||||
-
-
-
-
- |
- {{ rowItem?.name }} | -
-
- {{ rowItem?.themeValue }}
-
-
- |
- {{ rowItem?.description }} | -||||||||||||||||||||||||||||||||||
{{ 'components.design-color.colorDemo.instance.defaultTable.colorVar' | translate }} | +{{ 'components.design-color.colorDemo.instance.defaultTable.themeValue' | translate }} | +{{ 'components.design-color.colorDemo.instance.defaultTable.description' | translate }} | +|||||||||||||||||||||||||||||||||||
{{ rowItem?.name }} | +
+
+ {{ rowItem?.value }}
-
-
+
+ |
+ {{ rowItem?.description }} | +|||||||||||||||||||||||||||||||||||
- | {{ 'components.design-color.colorDemo.instance.defaultTable.colorVar' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.normalColor' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.darkColor' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.themeValue' | translate }} | -{{ 'components.design-color.colorDemo.instance.defaultTable.description' | translate }} | -||||||||||||||||||||||||||||||||
-
-
-
-
- |
- {{ rowItem?.name }} | -
-
- {{ rowItem?.light }}
-
-
- |
-
-
- {{ rowItem?.dark }}
-
-
- |
-
-
- {{ rowItem?.themeValue }}
-
-
- |
- {{ rowItem?.description }} | -||||||||||||||||||||||||||||||||
{{ 'components.design-shadow.shadowDemo.instance.colorTable.colorVar' | translate }} | -{{ 'components.design-shadow.shadowDemo.instance.colorTable.normalColor' | translate }} | -{{ 'components.design-shadow.shadowDemo.instance.colorTable.darkColor' | translate }} | {{ 'components.design-shadow.shadowDemo.instance.colorTable.themeValue' | translate }} | {{ 'components.design-shadow.shadowDemo.instance.colorTable.description' | translate }} | {{ rowItem?.name }} |
- {{ rowItem?.light }}
-
-
- |
-
-
- {{ rowItem?.dark }}
-
-
- |
-
-
- {{ rowItem?.themeValue }}
+ {{ rowItem?.value }}
-
+
|
{{ rowItem?.description }} | diff --git a/devui/design-token/shadow/demo/shadow/shadow.component.ts b/devui/design-token/shadow/demo/shadow/shadow.component.ts index be3bf90e..5e15f688 100644 --- a/devui/design-token/shadow/demo/shadow/shadow.component.ts +++ b/devui/design-token/shadow/demo/shadow/shadow.component.ts @@ -1,7 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; -import { devuiDarkTheme, devuiLightTheme, ThemeService } from 'ng-devui/theme'; +import { ThemeService } from 'ng-devui/theme'; import { TranslateService, TranslationChangeEvent } from '@ngx-translate/core'; -import { cloneDeep } from 'lodash-es'; import { Subscription } from 'rxjs'; @Component({ @@ -13,211 +12,64 @@ export class ShadowComponent implements OnInit, OnDestroy { themeService: ThemeService; subs: Subscription = new Subscription(); shadows = []; - oldShadows = []; shadowColor = []; + shadowKey = ['devui-shadow-length']; + shadowColorKey = ['shadow']; + i18nText: any; - activeTab: string | number = 'curShadow'; - - constructor(private translate: TranslateService) {} + constructor(private translate: TranslateService) { this.setI18n(); } ngOnInit() { if (typeof window !== undefined) { this.themeService = window['devuiThemeService']; + this.changeValueInTable(); if (this.themeService.eventBus) { this.themeService.eventBus.add('themeChanged', this.changeValueInTable); } - this.setI18n(); + } } changeValueInTable = () => { - this.changeValue('shadows'); - this.changeValue('shadowColor'); - }; - - changeValue(type) { const theme = this.themeService.currentTheme; - this[type].map((obj) => { - const nameArr = obj.name.split('$'); - if (nameArr.length === 2) { - const match = theme.data[nameArr[1]]; - if (match) { - obj.themeValue = match; - } else { - obj.themeValue = obj.value; + for (const key in theme.data) { + if (Object.prototype.hasOwnProperty.call(theme.data, key)) { + if (this.shadowKey.some(item => key.includes(item))) { + const obj = { + name: '$' + key, + value: theme.data[key], + description: this.i18nText ? this.i18nText['shadows'][key] : '' + }; + this.shadows.push(obj); + } + if (this.shadowColorKey.some(item => key.includes(item)) && theme.data[key].startsWith('rgba')) { + const obj = { + name: '$' + key, + value: theme.data[key], + description: this.i18nText ? this.i18nText['shadowColor'][key] : '' + }; + this.shadowColor.push(obj); } } - }); - this[type] = cloneDeep(this[type]); - } + + } + }; setI18n() { this.subs.add( this.translate.get('components.design-shadow.shadowDemo.instance').subscribe((res) => { - this.setValues(res); + this.i18nText = res; }) ); this.subs.add( this.translate.onLangChange.subscribe((event: TranslationChangeEvent) => { const values = this.translate.instant('components.design-shadow.shadowDemo.instance'); - this.setValues(values); + this.i18nText = values; }) ); } - setValues(values) { - this.shadows = [ - { - name: '$devui-shadow-length-base', - value: devuiLightTheme.data['devui-shadow-length-base'], - description: values.shadows['devui-shadow-length-base'] - }, - { - name: '$devui-shadow-length-slide-left', - value: devuiLightTheme.data['devui-shadow-length-slide-left'], - description: values.shadows['devui-shadow-length-slide-left'] - }, - { - name: '$devui-shadow-length-slide-right', - value: devuiLightTheme.data['devui-shadow-length-slide-right'], - description: values.shadows['devui-shadow-length-slide-right'] - }, - { - name: '$devui-shadow-length-connected-overlay', - value: devuiLightTheme.data['devui-shadow-length-connected-overlay'], - description: values.shadows['devui-shadow-length-connected-overlay'], - }, - { - name: '$devui-shadow-length-hover', - value: devuiLightTheme.data['devui-shadow-length-hover'], - description: values.shadows['devui-shadow-length-hover'] - }, - { - name: '$devui-shadow-length-feedback-overlay', - value: devuiLightTheme.data['devui-shadow-length-feedback-overlay'], - description: values.shadows['devui-shadow-length-feedback-overlay'], - }, - { - name: '$devui-shadow-length-fullscreen-overlay', - value: devuiLightTheme.data['devui-shadow-length-fullscreen-overlay'], - description: values.shadows['devui-shadow-length-fullscreen-overlay'], - }, - ]; - - this.oldShadows = [ - { - name: '$hwc-shadow-1', - newName: '$devui-shadow-length-base $devui-light-shadow', - value: '0 1px 3px 0 rbga(0, 0, 0, 0.1)', - description: values.oldShadows['hwc-shadow-1'], - }, - { - name: '$hwc-shadow-2', - newName: '$devui-shadow-length-connected-overlay $devui-shadow', - value: '0 2px 5px 0 rgba(0, 0, 0, 0.2)', - description: values.oldShadows['hwc-shadow-2'], - }, - { - name: '$hwc-shadow-3', - newName: '$devui-shadow-length-feedback-overlay $devui-shadow', - value: '0 4px 8px 0 rgba(0, 0, 0, 0.2)', - description: values.oldShadows['hwc-shadow-3'], - }, - { - name: '$hwc-shadow-4', - newName: '$devui-shadow-length-hover $devui-shadow', - value: '0 2px 8px 0 rgba(94, 124, 224, 0.3)', - description: values.oldShadows['hwc-shadow-4'], - }, - { - name: '$hwc-shadow-5', - newName: '$devui-shadow-length-connected-overlay $devui-light-shadow', - value: '0 0 6px 0 rgba(0, 0, 0, 0.1)', - description: values.oldShadows['hwc-shadow-5'], - }, - { - name: '$hwc-shadow-6', - newName: '$devui-shadow-length-base $devui-light-shadow', - value: '0 8px 6px -4px rgba(199, 54, 54, 0.4)', - description: values.oldShadows['hwc-shadow-6'], - }, - { - name: '$hwc-shadow-7', - newName: '$devui-shadow-length-fullscreen-overlay $devui-light-shadow', - value: '0 10px 40px 0 rgba(0, 0, 0, 0.1)', - description: values.oldShadows['hwc-shadow-7'], - }, - { - name: '$hwc-shadow-8', - newName: '$devui-shadow-length-base $devui-light-shadow', - value: '0 1px 2px 0 rgba(57, 71, 166, 0.5)', - description: values.oldShadows['hwc-shadow-8'], - }, - { - name: '$hwc-shadow-error', - newName: '$devui-shadow-length-base $devui-danger', - value: '0 1px 3px 0 rgba(199, 54, 54, 0.25)', - description: values.oldShadows['hwc-shadow-error'], - }, - { - name: '$hwc-shadow-warn', - newName: '$devui-shadow-length-base $devui-warning', - value: ' 0 1px 3px 0 rgba(204, 100, 20, 0.25)', - description: values.oldShadows['hwc-shadow-warn'], - }, - { - name: '$hwc-shadow-prompt', - newName: '$devui-shadow-length-base $devui-info', - value: '0 1px 3px 0 rgba(70, 94, 184, 0.25)', - description: values.oldShadows['hwc-shadow-prompt'], - }, - { - name: '$hwc-shadow-success', - newName: '$devui-shadow-length-base $devui-success', - value: '0 1px 3px 0 rgba(39, 176, 128, 0.25)', - description: values.oldShadows['hwc-shadow-success'], - }, - { - name: '$hwc-shadow-dark', - newName: '$devui-shadow-length-feedback-overlay $devui-shadow', - value: '0 5px 8px 0 rgba(70, 77, 110, 0.25)', - description: values.oldShadows['hwc-shadow-dark'], - }, - ]; - - this.shadowColor = [ - { - name: '$devui-shadow', - light: devuiLightTheme.data['devui-shadow'], - dark: devuiDarkTheme.data['devui-shadow'], - description: values.shadowColor['devui-shadow'], - }, - { - name: '$devui-light-shadow', - light: devuiLightTheme.data['devui-light-shadow'], - dark: devuiDarkTheme.data['devui-light-shadow'], - description: values.shadowColor['devui-light-shadow'], - }, - { - name: '$devui-connected-overlay-shadow', - light: devuiLightTheme.data['devui-connected-overlay-shadow'], - dark: devuiDarkTheme.data['devui-connected-overlay-shadow'], - description: values.shadowColor['devui-connected-overlay-shadow'], - }, - { - name: '$devui-feedback-overlay-shadow', - light: devuiLightTheme.data['devui-feedback-overlay-shadow'], - dark: devuiDarkTheme.data['devui-feedback-overlay-shadow'], - description: values.shadowColor['devui-feedback-overlay-shadow'], - } - ]; - - if (this.themeService) { - this.changeValueInTable(); - } - } - ngOnDestroy() { if (this.subs) { this.subs.unsubscribe(); diff --git a/devui/design-token/z-index/demo/z-index/z-index.component.ts b/devui/design-token/z-index/demo/z-index/z-index.component.ts index 2310cf46..08a87d21 100644 --- a/devui/design-token/z-index/demo/z-index/z-index.component.ts +++ b/devui/design-token/z-index/demo/z-index/z-index.component.ts @@ -11,40 +11,49 @@ export class ZIndexComponent implements OnInit, OnDestroy { themeService: ThemeService; subs: Subscription = new Subscription(); zIndex = []; + i18nText: any; - constructor(private translate: TranslateService) { } + constructor(private translate: TranslateService) { this.setI18n(); } ngOnInit() { if (typeof window !== undefined) { - this.setI18n(); + if (typeof window !== undefined) { + this.themeService = window['devuiThemeService']; + this.changeValueInTable(); + if (this.themeService.eventBus) { + this.themeService.eventBus.add('themeChanged', this.changeValueInTable); + } + } } } setI18n() { this.subs.add( this.translate.get('components.design-z-index.ZIndexDemo.instance').subscribe((res) => { - this.setValues(res); + this.i18nText = res['zIndex']; }) ); this.subs.add( this.translate.onLangChange.subscribe((event: TranslationChangeEvent) => { const values = this.translate.instant('components.design-z-index.ZIndexDemo.instance'); - this.setValues(values); + this.i18nText = values['zIndex']; }) ); } - - setValues(values) { - this.zIndex = [ - { name: '$devui-z-index-full-page-overlay', value: '1080', description: values.zIndex['devui-z-index-full-page-overlay'] }, - { name: '$devui-z-index-pop-up', value: '1060', description: values.zIndex['devui-z-index-pop-up'] }, - { name: '$devui-z-index-dropdown', value: '1052', description: values.zIndex['devui-z-index-dropdown'] }, - { name: '$devui-z-index-modal', value: '1050', description: values.zIndex['devui-z-index-modal'] }, - { name: '$devui-z-index-drawer', value: '1040', description: values.zIndex['devui-z-index-drawer'] }, - { name: '$devui-z-index-framework', value: '1000', description: values.zIndex['devui-z-index-framework'] }, - ]; - } + changeValueInTable = () => { + const theme = this.themeService.currentTheme; + for (const key in theme.data) { + if (key.includes('devui-z-index')) { + const obj = { + name: '$' + key, + value: theme.data[key], + description: this.i18nText ? this.i18nText[key] : '' + }; + this.zIndex.push(obj); + } + } + }; ngOnDestroy() { if (this.subs) { diff --git a/devui/devui.module.ts b/devui/devui.module.ts index 577ce9c4..7dd02f2d 100755 --- a/devui/devui.module.ts +++ b/devui/devui.module.ts @@ -62,6 +62,7 @@ import { TransferModule } from 'ng-devui/transfer'; import { TreeModule } from 'ng-devui/tree'; import { TreeSelectModule } from 'ng-devui/tree-select'; import { UploadModule } from 'ng-devui/upload'; +import { UserGuideModule } from 'ng-devui/user-guide'; import { WindowRefModule } from 'ng-devui/window-ref'; export * from 'ng-devui/accordion'; export * from 'ng-devui/alert'; @@ -126,6 +127,7 @@ export * from 'ng-devui/transfer'; export * from 'ng-devui/tree'; export * from 'ng-devui/tree-select'; export * from 'ng-devui/upload'; +export * from 'ng-devui/user-guide'; export * from 'ng-devui/window-ref'; export * from './version'; @@ -178,6 +180,7 @@ export * from './version'; TimeAxisModule, TreeModule, UploadModule, + UserGuideModule, InputNumberModule, SliderModule, SplitterModule, diff --git a/devui/dragdrop/directives/drop-scroll-enhance.directive.ts b/devui/dragdrop/directives/drop-scroll-enhance.directive.ts index 3bcaaef6..d9d3bb26 100644 --- a/devui/dragdrop/directives/drop-scroll-enhance.directive.ts +++ b/devui/dragdrop/directives/drop-scroll-enhance.directive.ts @@ -193,7 +193,7 @@ export class DropScrollEnhancedDirective implements AfterViewInit, OnDestroy { createScrollArea(direction: DropScrollDirection, orientation: DropScrollOrientation) { const area = this.document.createElement('div'); - area.className = 'dropover-scroll-area ' + 'dropover-scroll-area-' + this.getCriticalEdge(direction, orientation); + area.className = `dropover-scroll-area dropover-scroll-area-${this.getCriticalEdge(direction, orientation)}`; // 处理大小 area.classList.add('active'); this.setAreaSize(area, direction, orientation); diff --git a/devui/dragdrop/directives/droppable.directive.ts b/devui/dragdrop/directives/droppable.directive.ts index 16d189dd..f323f8a1 100755 --- a/devui/dragdrop/directives/droppable.directive.ts +++ b/devui/dragdrop/directives/droppable.directive.ts @@ -613,7 +613,8 @@ export class DroppableDirective implements OnInit, AfterViewInit, OnDestroy { } private calcPositionOutside(event: any, targetElement: any) { - const rect = this.getBoundingRectAndRealPosition(targetElement); // targetElement.getBoundingClientRect(); + // targetElement 获取 getBoundingClientRect + const rect = this.getBoundingRectAndRealPosition(targetElement); const relY = event.clientY - (rect.y || rect.top); const relX = event.clientX - (rect.x || rect.left); diff --git a/devui/editable-select/demo/custom-area/custom-area.component.html b/devui/editable-select/demo/custom-area/custom-area.component.html new file mode 100644 index 00000000..4d1ec595 --- /dev/null +++ b/devui/editable-select/demo/custom-area/custom-area.component.html @@ -0,0 +1,18 @@ +