Skip to content

Commit 39b263e

Browse files
author
Zhicheng WANG
committed
docs: 翻译内部 API 文档
1 parent 4f5ef98 commit 39b263e

File tree

103 files changed

+1659
-211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+1659
-211
lines changed

src/cdk/a11y/focus-trap/configurable-focus-trap-factory.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ export class ConfigurableFocusTrapFactory {
6565

6666
/**
6767
* @deprecated Pass a config object instead of the `deferCaptureElements` flag.
68+
*
69+
* 传递一个配置对象,而不是 `deferCaptureElements` 标志。
70+
*
6871
* @breaking-change 11.0.0
6972
*/
7073
create(element: HTMLElement, deferCaptureElements: boolean): ConfigurableFocusTrap;

src/cdk/drag-drop/directives/drop-list.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ let _uniqueIdCounter = 0;
5050
/**
5151
* Internal compile-time-only representation of a `CdkDropList`.
5252
* Used to avoid circular import issues between the `CdkDropList` and the `CdkDrag`.
53+
*
54+
* `CdkDropList` 内部的仅编译时表示法。 用来解决 `CdkDropList` 和 `CdkDrag` 之间的循环导入问题。
55+
*
5356
* @docs-private
5457
*/
5558
export interface CdkDropListInternal extends CdkDropList {}

src/cdk/drag-drop/drag-ref.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,7 +1728,7 @@ export class DragRef<T = any> {
17281728
/**
17291729
* Cleans up any cached element dimensions that we don't need after dragging has stopped.
17301730
*
1731-
* 清理拖动停止后我们不再需要的所有缓存元素尺寸
1731+
* 清理拖动停止后我们不再需要的所有缓存元素规格
17321732
*
17331733
*/
17341734
private _cleanupCachedDimensions() {
@@ -1986,7 +1986,7 @@ function getRootNode(viewRef: EmbeddedViewRef<any>, _document: Document): HTMLEl
19861986
*
19871987
* @param sourceRect Dimensions of the source element.
19881988
*
1989-
* 源元素的尺寸
1989+
* 源元素的规格
19901990
*
19911991
*/
19921992
function matchElementSize(target: HTMLElement, sourceRect: ClientRect): void {

src/cdk/drag-drop/drag-styling.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ export function toggleNativeDragInteractions(element: HTMLElement, enable: boole
7777
/**
7878
* Toggles whether an element is visible while preserving its dimensions.
7979
*
80-
* 在保留元素尺寸的同时,切换元素是否可见。
80+
* 在保留元素规格的同时,切换元素是否可见。
8181
*
8282
* @param element Element whose visibility to toggle
8383
*

src/cdk/drag-drop/drop-list-ref.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ interface CachedItemPosition {
6161
/**
6262
* Dimensions of the item.
6363
*
64-
* 此条目的尺寸
64+
* 此条目的规格
6565
*
6666
*/
6767
clientRect: ClientRect;
@@ -246,7 +246,7 @@ export class DropListRef<T = any> {
246246
/**
247247
* Cache of the dimensions of all the items inside the container.
248248
*
249-
* 缓存容器内所有条目的尺寸
249+
* 缓存容器内所有条目的规格
250250
*
251251
*/
252252
private _itemPositions: CachedItemPosition[] = [];
@@ -1478,7 +1478,7 @@ function incrementHorizontalScroll(node: HTMLElement | Window, amount: number) {
14781478
*
14791479
* @param clientRect Dimensions of the node.
14801480
*
1481-
* 该节点的尺寸
1481+
* 该节点的规格
14821482
*
14831483
* @param pointerY Position of the user's pointer along the y axis.
14841484
*
@@ -1505,7 +1505,7 @@ function getVerticalScrollDirection(clientRect: ClientRect, pointerY: number) {
15051505
*
15061506
* @param clientRect Dimensions of the node.
15071507
*
1508-
* 该节点的尺寸
1508+
* 该节点的规格
15091509
*
15101510
* @param pointerX Position of the user's pointer along the x axis.
15111511
*

src/cdk/drag-drop/parent-position-tracker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ interface ScrollPosition {
2323
/**
2424
* Keeps track of the scroll position and dimensions of the parents of an element.
2525
*
26-
* 跟踪元素父级的滚动位置和尺寸
26+
* 跟踪元素父级的滚动位置和规格
2727
*
2828
*/
2929
export class ParentPositionTracker {

src/cdk/overlay/position/connected-position-strategy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ import {PositionStrategy} from './position-strategy';
3434
* 放置浮层的策略。使用此策略,可以为浮层提供相对于某原点元素的隐式位置。此相对位置是指浮层元素上的点相对于所连接的原点元素上的点。例如,一个基本的下拉列表将其原点的左下角连接到此浮层的左上角。
3535
*
3636
* @deprecated Use `FlexibleConnectedPositionStrategy` instead.
37+
*
38+
* 请改用 `FlexibleConnectedPositionStrategy` 。
39+
*
3740
* @breaking-change 8.0.0
3841
*/
3942
export class ConnectedPositionStrategy implements PositionStrategy {
4043
/**
4144
* Reference to the underlying position strategy to which all the API calls are proxied.
45+
*
46+
* 所有 API 调用所基于的底层定位策略的引用。
47+
*
4248
* @docs-private
4349
*/
4450
_positionStrategy: FlexibleConnectedPositionStrategy;
@@ -131,6 +137,9 @@ export class ConnectedPositionStrategy implements PositionStrategy {
131137
/**
132138
* Updates the position of the overlay element, using whichever preferred position relative
133139
* to the origin fits on-screen.
140+
*
141+
* 使用屏幕上适合于原点的任何首选位置来更新浮层元素的位置。
142+
*
134143
* @docs-private
135144
*/
136145
apply(): void {

src/cdk/overlay/position/connected-position.ts

Lines changed: 36 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export type HorizontalConnectionPos = 'start' | 'center' | 'end';
1313
/**
1414
* Vertical dimension of a connection point on the perimeter of the origin or overlay element.
1515
*
16-
* 在原点周边或浮层元素上的连接点的垂直尺寸
16+
* 在原点周边或浮层元素上的连接点的垂直规格
1717
*
1818
*/
1919
export type VerticalConnectionPos = 'top' | 'center' | 'bottom';
@@ -97,31 +97,32 @@ export class ConnectionPositionPair {
9797
* Set of properties regarding the position of the origin and overlay relative to the viewport
9898
* with respect to the containing Scrollable elements.
9999
*
100+
* 一组属性,表示原点和浮层相对于包含可滚动元素的视口的位置。
101+
*
100102
* The overlay and origin are clipped if any part of their bounding client rectangle exceeds the
101103
* bounds of any one of the strategy's Scrollable's bounding client rectangle.
102104
*
105+
* 如果浮层和原点的边界矩形的任何部分超出了本策略的可滚动边界矩形,则将对其进行裁剪。
106+
*
103107
* The overlay and origin are outside view if there is no overlap between their bounding client
104108
* rectangle and any one of the strategy's Scrollable's bounding client rectangle.
105109
*
106-
* ```
107-
* ----------- -----------
108-
* | outside | | clipped |
109-
* | view | --------------------------
110-
* | | | | | |
111-
* ---------- | ----------- |
112-
* ```
110+
* 如果浮层和原点的边界矩形与本策略的可滚动对象边界矩形中的任何一个都没有重叠,则浮层和原点位于外部视图中。
113111
*
114-
* \-------------------------- \| \|
112+
* ----------- -----------
113+
* | outside | | clipped |
114+
* | view | --------------------------
115+
* | | | | | |
116+
* ---------- | ----------- |
117+
* -------------------------- | |
115118
* | | | Scrollable |
116-
* \| \| \| \|
117-
* \| \| --------------------------
119+
* | | | |
120+
* | | --------------------------
118121
* | Scrollable |
119-
* \| \|
122+
* | |
123+
* --------------------------
120124
*
121-
* \-------------------------- | | | | | Scrollable | | | | | | | -------------------------- | Scrollable | | |
122-
*
123-
* * * *
124-
* @docs-private
125+
* @docs-private
125126
*/
126127
export class ScrollingVisibility {
127128
isOriginClipped: boolean;
@@ -133,7 +134,7 @@ export class ScrollingVisibility {
133134
/**
134135
* The change event emitted by the strategy when a fallback position is used.
135136
*
136-
* 使用后备位置时,本策略发出的更改事件。
137+
* 使用回退位置时,本策略发出的更改事件。
137138
*
138139
*/
139140
export class ConnectedOverlayPositionChange {
@@ -146,8 +147,17 @@ export class ConnectedOverlayPositionChange {
146147

147148
/**
148149
* Validates whether a vertical position property matches the expected values.
150+
*
151+
* 验证垂直位置属性是否与期望值匹配。
152+
*
149153
* @param property Name of the property being validated.
154+
*
155+
* 要验证的属性的名称。
156+
*
150157
* @param value Value of the property being validated.
158+
*
159+
* 待验证属性的值。
160+
*
151161
* @docs-private
152162
*/
153163
export function validateVerticalPosition(property: string, value: VerticalConnectionPos) {
@@ -159,8 +169,17 @@ export function validateVerticalPosition(property: string, value: VerticalConnec
159169

160170
/**
161171
* Validates whether a horizontal position property matches the expected values.
172+
*
173+
* 验证水平位置属性是否与期望值匹配。
174+
*
162175
* @param property Name of the property being validated.
176+
*
177+
* 要验证的属性的名称。
178+
*
163179
* @param value Value of the property being validated.
180+
*
181+
* 待验证属性的值。
182+
*
164183
* @docs-private
165184
*/
166185
export function validateHorizontalPosition(property: string, value: HorizontalConnectionPos) {

src/cdk/overlay/position/flexible-connected-position-strategy.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
139139
/**
140140
* Cached overlay dimensions
141141
*
142-
* 缓存的浮层尺寸
142+
* 缓存的浮层规格
143143
*
144144
*/
145145
private _overlayRect: ClientRect;
146146

147147
/**
148148
* Cached viewport dimensions
149149
*
150-
* 缓存的视口尺寸
150+
* 缓存的视口规格
151151
*
152152
*/
153153
private _viewportRect: ClientRect;
@@ -334,15 +334,31 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
334334
* Updates the position of the overlay element, using whichever preferred position relative
335335
* to the origin best fits on-screen.
336336
*
337+
* 使用相对于屏幕最适合原点的首选位置来更新叠加元素的位置。
338+
*
337339
* The selection of a position goes as follows:
338340
*
341+
* 位置的选择逻辑如下:
342+
*
339343
* - If any positions fit completely within the viewport as-is,
340344
* choose the first position that does so.
345+
*
346+
* 如果任何位置能完全按原样放置在视口中,请选择第一个适合的位置。
347+
*
341348
* - If flexible dimensions are enabled and at least one satifies the given minimum width/height,
342349
* choose the position with the greatest available size modified by the positions' weight.
350+
*
351+
* 如果启用了灵活规格,并且其中至少有一个满足给定的最小宽度/高度,请选择最大的可用规格(根据位置的权重修订)的位置。
352+
*
343353
* - If pushing is enabled, take the position that went off-screen the least and push it
344354
* on-screen.
355+
*
356+
* 如果启用了推入功能,则让离开屏幕的位置尽可能少,然后将其推入屏幕。
357+
*
345358
* - If none of the previous criteria were met, use the position that goes off-screen the least.
359+
*
360+
* 如果没有满足先前的条件,就使用屏幕外部分最少的位置。
361+
*
346362
* @docs-private
347363
*/
348364
apply(): void {
@@ -851,7 +867,7 @@ export class FlexibleConnectedPositionStrategy implements PositionStrategy {
851867
*
852868
* @param overlay Dimensions of the overlay.
853869
*
854-
* 浮层的尺寸
870+
* 浮层的规格
855871
*
856872
* @param scrollPosition Current viewport scroll position.
857873
*
@@ -1587,7 +1603,7 @@ interface BoundingBoxRect {
15871603
/**
15881604
* Record of measures determining how well a given position will fit with flexible dimensions.
15891605
*
1590-
* 确定指定位置与灵活尺寸的适应程度的测量记录
1606+
* 确定指定位置与灵活规格的适应程度的测量记录
15911607
*
15921608
*/
15931609
interface FlexibleFit {

src/cdk/overlay/position/global-position-strategy.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ export class GlobalPositionStrategy implements PositionStrategy {
138138
* @param value New width for the overlay
139139
*
140140
* 浮层的新宽度
141-
*
142141
* @deprecated Pass the `width` through the `OverlayConfig`.
142+
*
143+
* 通过 `OverlayConfig` 传递 `width` 。
144+
*
143145
* @breaking-change 8.0.0
144146
*/
145147
width(value: string = ''): this {
@@ -160,8 +162,10 @@ export class GlobalPositionStrategy implements PositionStrategy {
160162
* @param value New height for the overlay
161163
*
162164
* 浮层的新高度
163-
*
164165
* @deprecated Pass the `height` through the `OverlayConfig`.
166+
*
167+
* 通过 `OverlayConfig` 传递 `height` 。
168+
*
165169
* @breaking-change 8.0.0
166170
*/
167171
height(value: string = ''): this {
@@ -210,6 +214,9 @@ export class GlobalPositionStrategy implements PositionStrategy {
210214

211215
/**
212216
* Apply the position to the element.
217+
*
218+
* 将此位置应用于元素。
219+
*
213220
* @docs-private
214221
*/
215222
apply(): void {
@@ -258,6 +265,9 @@ export class GlobalPositionStrategy implements PositionStrategy {
258265

259266
/**
260267
* Cleans up the DOM changes from the position strategy.
268+
*
269+
* 从定位策略中清除 DOM 更改。
270+
*
261271
* @docs-private
262272
*/
263273
dispose(): void {

0 commit comments

Comments
 (0)