@hailin-zheng/editor-core 1.0.6 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/{lib/doc-ruler.js → src/med_editor/doc-ruler.ts} +101 -74
- package/src/med_editor/framework/common-util.ts +200 -0
- package/{lib/framework/document-change.js → src/med_editor/framework/document-change.ts} +308 -259
- package/{lib/framework/document-combine.js → src/med_editor/framework/document-combine.ts} +15 -11
- package/{lib/framework/document-comment.js → src/med_editor/framework/document-comment.ts} +52 -37
- package/{lib/framework/document-context.js → src/med_editor/framework/document-context.ts} +181 -101
- package/{lib/framework/document-eval-func.js → src/med_editor/framework/document-eval-func.ts} +16 -11
- package/{lib/framework/document-event.js → src/med_editor/framework/document-event.ts} +244 -216
- package/{lib/framework/document-history.js → src/med_editor/framework/document-history.ts} +25 -14
- package/{lib/framework/document-images-loader.js → src/med_editor/framework/document-images-loader.ts} +25 -17
- package/{lib/framework/document-input-cursor.js → src/med_editor/framework/document-input-cursor.ts} +76 -71
- package/{lib/framework/document-paint.js → src/med_editor/framework/document-paint.ts} +35 -28
- package/{lib/framework/document-print-offscreen.js → src/med_editor/framework/document-print-offscreen.ts} +25 -19
- package/{lib/framework/document-print.js → src/med_editor/framework/document-print.ts} +57 -41
- package/src/med_editor/framework/document-segmenter.ts +211 -0
- package/{lib/framework/document-selection.js → src/med_editor/framework/document-selection.ts} +116 -85
- package/{lib/framework/document-template.js → src/med_editor/framework/document-template.ts} +3 -3
- package/src/med_editor/framework/document-textline-mode.ts +34 -0
- package/{lib/framework/element-define.js → src/med_editor/framework/element-define.ts} +301 -206
- package/src/med_editor/framework/element-event-define.ts +141 -0
- package/{lib/framework/element-measure.js → src/med_editor/framework/element-measure.ts} +143 -121
- package/{lib/framework/element-paint.js → src/med_editor/framework/element-paint.ts} +44 -38
- package/{lib/framework/element-props.js → src/med_editor/framework/element-props.ts} +331 -202
- package/{lib/framework/element-reader.js → src/med_editor/framework/element-reader.ts} +39 -31
- package/{lib/framework/element-render-cut.js → src/med_editor/framework/element-render-cut.ts} +113 -106
- package/{lib/framework/element-serialize.js → src/med_editor/framework/element-serialize.ts} +37 -24
- package/{lib/framework/element-util.js → src/med_editor/framework/element-util.ts} +317 -216
- package/{lib/framework/impl/checkbox/checkbox-impl.js → src/med_editor/framework/impl/checkbox/checkbox-impl.ts} +27 -20
- package/{lib/framework/impl/comments/comment-content-impl.js → src/med_editor/framework/impl/comments/comment-content-impl.ts} +45 -31
- package/{lib/framework/impl/comments/comment-element-impl.js → src/med_editor/framework/impl/comments/comment-element-impl.ts} +23 -20
- package/{lib/framework/impl/comments/comments-container-impl.js → src/med_editor/framework/impl/comments/comments-container-impl.ts} +22 -16
- package/{lib/framework/impl/comments/comments-util.js → src/med_editor/framework/impl/comments/comments-util.ts} +34 -17
- package/{lib/framework/impl/comments/validate-msg-impl.js → src/med_editor/framework/impl/comments/validate-msg-impl.ts} +28 -17
- package/{lib/framework/impl/data-element/data-decorate-impl.js → src/med_editor/framework/impl/data-element/data-decorate-impl.ts} +26 -22
- package/{lib/framework/impl/data-element/data-element-barcode.js → src/med_editor/framework/impl/data-element/data-element-barcode.ts} +41 -29
- package/{lib/framework/impl/data-element/data-element-base-impl.js → src/med_editor/framework/impl/data-element/data-element-base-impl.ts} +73 -44
- package/{lib/framework/impl/data-element/data-element-check-impl.js → src/med_editor/framework/impl/data-element/data-element-check-impl.ts} +48 -35
- package/{lib/framework/impl/data-element/data-element-date-impl.js → src/med_editor/framework/impl/data-element/data-element-date-impl.ts} +41 -24
- package/{lib/framework/impl/data-element/data-element-group-impl.js → src/med_editor/framework/impl/data-element/data-element-group-impl.ts} +52 -32
- package/{lib/framework/impl/data-element/data-element-image-impl.js → src/med_editor/framework/impl/data-element/data-element-image-impl.ts} +38 -28
- package/{lib/framework/impl/data-element/data-element-list-impl.js → src/med_editor/framework/impl/data-element/data-element-list-impl.ts} +42 -31
- package/{lib/framework/impl/data-element/data-element-text-impl.js → src/med_editor/framework/impl/data-element/data-element-text-impl.ts} +36 -22
- package/{lib/framework/impl/decorate/fill-null-space-imple.js → src/med_editor/framework/impl/decorate/fill-null-space-imple.ts} +15 -10
- package/{lib/framework/impl/document/doc-body-impl.js → src/med_editor/framework/impl/document/doc-body-impl.ts} +32 -16
- package/{lib/framework/impl/document/doc-body-part-impl.js → src/med_editor/framework/impl/document/doc-body-part-impl.ts} +27 -17
- package/src/med_editor/framework/impl/document/doc-container-impl.ts +24 -0
- package/{lib/framework/impl/document/doc-footer-impl.js → src/med_editor/framework/impl/document/doc-footer-impl.ts} +30 -19
- package/{lib/framework/impl/document/doc-header-impl.js → src/med_editor/framework/impl/document/doc-header-impl.ts} +34 -17
- package/{lib/framework/impl/document/doc-impl.js → src/med_editor/framework/impl/document/doc-impl.ts} +62 -45
- package/{lib/framework/impl/media-formula/menstrual-history.js → src/med_editor/framework/impl/media-formula/menstrual-history.ts} +58 -36
- package/{lib/framework/impl/paragraph/p-impl.js → src/med_editor/framework/impl/paragraph/p-impl.ts} +64 -30
- package/{lib/framework/impl/picture/image-impl.js → src/med_editor/framework/impl/picture/image-impl.ts} +37 -25
- package/{lib/framework/impl/radio/radio-impl.js → src/med_editor/framework/impl/radio/radio-impl.ts} +28 -21
- package/{lib/framework/impl/symbol/br-symbol-impl.js → src/med_editor/framework/impl/symbol/br-symbol-impl.ts} +21 -15
- package/{lib/framework/impl/symbol/p-symbol-impl.js → src/med_editor/framework/impl/symbol/p-symbol-impl.ts} +15 -12
- package/{lib/framework/impl/table/table-cell-impl.js → src/med_editor/framework/impl/table/table-cell-impl.ts} +41 -30
- package/{lib/framework/impl/table/table-impl.js → src/med_editor/framework/impl/table/table-impl.ts} +122 -84
- package/{lib/framework/impl/table/table-row-impl.js → src/med_editor/framework/impl/table/table-row-impl.ts} +26 -18
- package/{lib/framework/impl/table/table-split-cell-patch.js → src/med_editor/framework/impl/table/table-split-cell-patch.ts} +31 -22
- package/{lib/framework/impl/table/table-split-cell.js → src/med_editor/framework/impl/table/table-split-cell.ts} +105 -94
- package/{lib/framework/impl/table/table-util.js → src/med_editor/framework/impl/table/table-util.ts} +197 -159
- package/{lib/framework/impl/text/text-impl.js → src/med_editor/framework/impl/text/text-impl.ts} +49 -35
- package/{lib/framework/impl/text/track-run-impl.js → src/med_editor/framework/impl/text/track-run-impl.ts} +53 -30
- package/{lib/framework/notify.js → src/med_editor/framework/notify.ts} +50 -36
- package/{lib/framework/range-util.js → src/med_editor/framework/range-util.ts} +80 -71
- package/{lib/framework/render-context.js → src/med_editor/framework/render-context.ts} +111 -64
- package/{lib/framework/render-define.js → src/med_editor/framework/render-define.ts} +90 -61
- package/{lib/framework/selection-overlays.js → src/med_editor/framework/selection-overlays.ts} +25 -16
- package/{lib/texteditor.js → src/med_editor/texteditor.ts} +288 -191
- package/src/med_editor/util/subject.ts +118 -0
- package/{lib/util/table-bind.js → src/med_editor/util/table-bind.ts} +2 -2
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225.json +3573 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225bug.json +315 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/211/271/346/263/250.json +122 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/346/226/207/346/241/243/351/252/214/350/257/201.json +3599 -0
- package/src/med_editor//345/205/245/351/231/242/350/256/260/345/275/225/346/265/213/350/257/225/351/225/277/346/226/207/346/234/254.json +24586 -0
- package/src/med_editor//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225.json +2874 -0
- package/src/med_editor//346/211/213/346/234/257/350/256/260/345/275/225.json +341 -0
- package/src/med_editor//346/231/256/351/200/232doc/347/261/273/346/226/207/346/241/243.json +2201 -0
- package/src/med_editor//346/243/200/351/252/214/347/224/263/350/257/267/345/215/225.json +1069 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/206/205/351/225/234/344/270/213/346/262/273/347/226/227/350/256/260/345/275/225.json +125 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//345/220/210/345/271/266/347/227/205/347/250/213/345/275/225/346/250/241/346/235/277.json +86 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/227/245/345/270/270/347/227/205/347/250/213/350/256/260/345/275/225.json +115 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//346/237/245/346/210/277/350/256/260/345/275/2251.json +108 -0
- package/src/med_editor//347/227/205/347/250/213/345/275/225//351/246/226/346/254/241/344/270/212/347/272/247/345/214/273/345/270/210/346/237/245/346/210/277/350/256/260/345/275/225.json +272 -0
- package/src/med_editor//351/225/277/346/234/237/345/214/273/345/230/261/345/215/225.json +1070 -0
- package/lib/doc-ruler.d.ts +0 -51
- package/lib/doc-ruler.js.map +0 -1
- package/lib/framework/common-util.d.ts +0 -63
- package/lib/framework/common-util.js +0 -178
- package/lib/framework/common-util.js.map +0 -1
- package/lib/framework/document-change.d.ts +0 -265
- package/lib/framework/document-change.js.map +0 -1
- package/lib/framework/document-combine.d.ts +0 -24
- package/lib/framework/document-combine.js.map +0 -1
- package/lib/framework/document-comment.d.ts +0 -46
- package/lib/framework/document-comment.js.map +0 -1
- package/lib/framework/document-context.d.ts +0 -149
- package/lib/framework/document-context.js.map +0 -1
- package/lib/framework/document-eval-func.d.ts +0 -18
- package/lib/framework/document-eval-func.js.map +0 -1
- package/lib/framework/document-event.d.ts +0 -213
- package/lib/framework/document-event.js.map +0 -1
- package/lib/framework/document-history.d.ts +0 -26
- package/lib/framework/document-history.js.map +0 -1
- package/lib/framework/document-images-loader.d.ts +0 -16
- package/lib/framework/document-images-loader.js.map +0 -1
- package/lib/framework/document-input-cursor.d.ts +0 -78
- package/lib/framework/document-input-cursor.js.map +0 -1
- package/lib/framework/document-paint.d.ts +0 -34
- package/lib/framework/document-paint.js.map +0 -1
- package/lib/framework/document-print-offscreen.d.ts +0 -38
- package/lib/framework/document-print-offscreen.js.map +0 -1
- package/lib/framework/document-print.d.ts +0 -60
- package/lib/framework/document-print.js.map +0 -1
- package/lib/framework/document-segmenter.d.ts +0 -2
- package/lib/framework/document-segmenter.js +0 -106
- package/lib/framework/document-segmenter.js.map +0 -1
- package/lib/framework/document-selection.d.ts +0 -89
- package/lib/framework/document-selection.js.map +0 -1
- package/lib/framework/document-template.d.ts +0 -4
- package/lib/framework/document-template.js.map +0 -1
- package/lib/framework/document-textline-mode.d.ts +0 -7
- package/lib/framework/document-textline-mode.js +0 -30
- package/lib/framework/document-textline-mode.js.map +0 -1
- package/lib/framework/element-define.d.ts +0 -319
- package/lib/framework/element-define.js.map +0 -1
- package/lib/framework/element-event-define.d.ts +0 -99
- package/lib/framework/element-event-define.js +0 -108
- package/lib/framework/element-event-define.js.map +0 -1
- package/lib/framework/element-measure.d.ts +0 -97
- package/lib/framework/element-measure.js.map +0 -1
- package/lib/framework/element-paint.d.ts +0 -42
- package/lib/framework/element-paint.js.map +0 -1
- package/lib/framework/element-props.d.ts +0 -301
- package/lib/framework/element-props.js.map +0 -1
- package/lib/framework/element-reader.d.ts +0 -19
- package/lib/framework/element-reader.js.map +0 -1
- package/lib/framework/element-render-cut.d.ts +0 -55
- package/lib/framework/element-render-cut.js.map +0 -1
- package/lib/framework/element-serialize.d.ts +0 -30
- package/lib/framework/element-serialize.js.map +0 -1
- package/lib/framework/element-util.d.ts +0 -369
- package/lib/framework/element-util.js.map +0 -1
- package/lib/framework/impl/checkbox/checkbox-impl.d.ts +0 -24
- package/lib/framework/impl/checkbox/checkbox-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-content-impl.d.ts +0 -40
- package/lib/framework/impl/comments/comment-content-impl.js.map +0 -1
- package/lib/framework/impl/comments/comment-element-impl.d.ts +0 -21
- package/lib/framework/impl/comments/comment-element-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-container-impl.d.ts +0 -22
- package/lib/framework/impl/comments/comments-container-impl.js.map +0 -1
- package/lib/framework/impl/comments/comments-util.d.ts +0 -12
- package/lib/framework/impl/comments/comments-util.js.map +0 -1
- package/lib/framework/impl/comments/validate-msg-impl.d.ts +0 -21
- package/lib/framework/impl/comments/validate-msg-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-decorate-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-decorate-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-barcode.d.ts +0 -31
- package/lib/framework/impl/data-element/data-element-barcode.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-base-impl.d.ts +0 -68
- package/lib/framework/impl/data-element/data-element-base-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-check-impl.d.ts +0 -35
- package/lib/framework/impl/data-element/data-element-check-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-date-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-date-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-group-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-group-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-image-impl.d.ts +0 -30
- package/lib/framework/impl/data-element/data-element-image-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-list-impl.d.ts +0 -22
- package/lib/framework/impl/data-element/data-element-list-impl.js.map +0 -1
- package/lib/framework/impl/data-element/data-element-text-impl.d.ts +0 -23
- package/lib/framework/impl/data-element/data-element-text-impl.js.map +0 -1
- package/lib/framework/impl/decorate/fill-null-space-imple.d.ts +0 -21
- package/lib/framework/impl/decorate/fill-null-space-imple.js.map +0 -1
- package/lib/framework/impl/document/doc-body-impl.d.ts +0 -27
- package/lib/framework/impl/document/doc-body-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-body-part-impl.d.ts +0 -30
- package/lib/framework/impl/document/doc-body-part-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-container-impl.d.ts +0 -16
- package/lib/framework/impl/document/doc-container-impl.js +0 -21
- package/lib/framework/impl/document/doc-container-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-footer-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-footer-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-header-impl.d.ts +0 -26
- package/lib/framework/impl/document/doc-header-impl.js.map +0 -1
- package/lib/framework/impl/document/doc-impl.d.ts +0 -61
- package/lib/framework/impl/document/doc-impl.js.map +0 -1
- package/lib/framework/impl/media-formula/menstrual-history.d.ts +0 -35
- package/lib/framework/impl/media-formula/menstrual-history.js.map +0 -1
- package/lib/framework/impl/paragraph/p-impl.d.ts +0 -45
- package/lib/framework/impl/paragraph/p-impl.js.map +0 -1
- package/lib/framework/impl/picture/image-impl.d.ts +0 -31
- package/lib/framework/impl/picture/image-impl.js.map +0 -1
- package/lib/framework/impl/radio/radio-impl.d.ts +0 -22
- package/lib/framework/impl/radio/radio-impl.js.map +0 -1
- package/lib/framework/impl/symbol/br-symbol-impl.d.ts +0 -22
- package/lib/framework/impl/symbol/br-symbol-impl.js.map +0 -1
- package/lib/framework/impl/symbol/p-symbol-impl.d.ts +0 -19
- package/lib/framework/impl/symbol/p-symbol-impl.js.map +0 -1
- package/lib/framework/impl/table/table-cell-impl.d.ts +0 -37
- package/lib/framework/impl/table/table-cell-impl.js.map +0 -1
- package/lib/framework/impl/table/table-impl.d.ts +0 -55
- package/lib/framework/impl/table/table-impl.js.map +0 -1
- package/lib/framework/impl/table/table-row-impl.d.ts +0 -26
- package/lib/framework/impl/table/table-row-impl.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell-patch.d.ts +0 -20
- package/lib/framework/impl/table/table-split-cell-patch.js.map +0 -1
- package/lib/framework/impl/table/table-split-cell.d.ts +0 -90
- package/lib/framework/impl/table/table-split-cell.js.map +0 -1
- package/lib/framework/impl/table/table-util.d.ts +0 -150
- package/lib/framework/impl/table/table-util.js.map +0 -1
- package/lib/framework/impl/text/text-impl.d.ts +0 -32
- package/lib/framework/impl/text/text-impl.js.map +0 -1
- package/lib/framework/impl/text/track-run-impl.d.ts +0 -27
- package/lib/framework/impl/text/track-run-impl.js.map +0 -1
- package/lib/framework/notify.d.ts +0 -13
- package/lib/framework/notify.js.map +0 -1
- package/lib/framework/range-util.d.ts +0 -40
- package/lib/framework/range-util.js.map +0 -1
- package/lib/framework/render-context.d.ts +0 -91
- package/lib/framework/render-context.js.map +0 -1
- package/lib/framework/render-define.d.ts +0 -109
- package/lib/framework/render-define.js.map +0 -1
- package/lib/framework/selection-overlays.d.ts +0 -30
- package/lib/framework/selection-overlays.js.map +0 -1
- package/lib/texteditor.d.ts +0 -318
- package/lib/texteditor.js.map +0 -1
- package/lib/util/subject.d.ts +0 -34
- package/lib/util/subject.js +0 -88
- package/lib/util/subject.js.map +0 -1
- package/lib/util/table-bind.d.ts +0 -5
- package/lib/util/table-bind.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@hailin-zheng/editor-core",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.9",
|
4
4
|
"description": "",
|
5
5
|
"main": "texteditor.ts",
|
6
6
|
"scripts": {
|
@@ -39,7 +39,7 @@
|
|
39
39
|
"rxjs": "^6.6.7"
|
40
40
|
},
|
41
41
|
"files": [
|
42
|
-
"
|
42
|
+
"src/med_editor/",
|
43
43
|
"package.json"
|
44
44
|
]
|
45
45
|
}
|
@@ -1,27 +1,36 @@
|
|
1
|
-
import { ElementUtil } from "
|
2
|
-
import { DocumentCursor } from "./framework/document-selection";
|
1
|
+
import { ElementUtil } from "./framework/element-util";
|
2
|
+
import { DocumentCursor, SelectionState } from "./framework/document-selection";
|
3
|
+
import { Position, ViewOptions } from "./framework/element-define";
|
4
|
+
import { HitEventInfo } from "./framework/element-event-define";
|
3
5
|
import { DocumentRenderObject } from "./framework/impl/document/doc-impl";
|
4
6
|
import { ParagraphElement, ParagraphRenderObject } from "./framework/impl/paragraph/p-impl";
|
7
|
+
import { TableCellRenderObject } from "./framework/impl/table/table-cell-impl";
|
5
8
|
import { TableRowRenderObject } from "./framework/impl/table/table-row-impl";
|
9
|
+
import { RenderObject } from "./framework/render-define";
|
10
|
+
|
11
|
+
export interface RuleOptions {
|
12
|
+
width: number;
|
13
|
+
pagePL: number;
|
14
|
+
pagePR: number;
|
15
|
+
docLeft: number;
|
16
|
+
|
17
|
+
}
|
6
18
|
export class DocRule {
|
7
|
-
|
8
|
-
|
9
|
-
ss;
|
10
|
-
ctx;
|
11
|
-
options;
|
19
|
+
private ctx!: CanvasRenderingContext2D;
|
20
|
+
private options: RuleOptions;
|
12
21
|
//标尺高度
|
13
|
-
ruleHeight = 30;
|
22
|
+
private ruleHeight = 30;
|
14
23
|
//当前标尺的位置
|
15
|
-
thumbX
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
this.ctx = this.canvas.getContext('2d');
|
24
|
+
private thumbX: {
|
25
|
+
indent: number,
|
26
|
+
hanging: number
|
27
|
+
}
|
28
|
+
private mouseDownPos!: Position | null;
|
29
|
+
private indentThumbPoints: Array<Position> = [];
|
30
|
+
private hangThumbPoints: Array<Position> = [];
|
31
|
+
private mouseDownThumbType: 'none' | 'indent' | 'hang' = 'none';
|
32
|
+
constructor(public canvas: HTMLCanvasElement, public viewOptions: ViewOptions, public ss: SelectionState) {
|
33
|
+
this.ctx = this.canvas.getContext('2d') as CanvasRenderingContext2D;
|
25
34
|
this.options = {
|
26
35
|
width: 0,
|
27
36
|
pagePL: 0,
|
@@ -36,12 +45,14 @@ export class DocRule {
|
|
36
45
|
this.canvas.addEventListener("mousemove", (evt) => this.canvasMousemove(evt));
|
37
46
|
this.canvas.addEventListener("mouseup", (evt) => this.canvasMouseup(evt));
|
38
47
|
}
|
39
|
-
|
48
|
+
|
49
|
+
destroy(): void {
|
40
50
|
this.canvas.removeEventListener("mousedown", this.canvasMousedown);
|
41
51
|
this.canvas.removeEventListener("mousemove", this.canvasMousemove);
|
42
52
|
this.canvas.removeEventListener("mouseup", this.canvasMouseup);
|
43
53
|
}
|
44
|
-
|
54
|
+
|
55
|
+
setRuleOptions(options: RuleOptions) {
|
45
56
|
this.options = options;
|
46
57
|
const convertRatio = this.viewOptions.mmToPixelsRatio;
|
47
58
|
this.options.pagePL = Math.floor(this.options.pagePL * convertRatio);
|
@@ -50,16 +61,19 @@ export class DocRule {
|
|
50
61
|
ElementUtil.setCanvasProps(this.canvas, this.ctx, { width: this.getParentWidth(), height: this.ruleHeight });
|
51
62
|
//this.canvas.style.left = this.options.docLeft + 'px';
|
52
63
|
}
|
53
|
-
|
54
|
-
|
64
|
+
|
65
|
+
getParentWidth(): number {
|
66
|
+
const parent = this.canvas.parentElement as HTMLDivElement;
|
55
67
|
return parent.getBoundingClientRect().width;
|
56
68
|
}
|
57
|
-
|
69
|
+
|
70
|
+
private fillRect(x: number, y: number, width: number, height: number, color: string) {
|
58
71
|
this.ctx.fillStyle = color;
|
59
72
|
this.ctx.fillRect(x, y, width, height);
|
60
73
|
}
|
61
|
-
|
62
|
-
|
74
|
+
|
75
|
+
private drawIndentThumb(x: number, y: number): Array<Position> {
|
76
|
+
const points: Array<Position> = [];
|
63
77
|
x -= 4;
|
64
78
|
points.push({ x: x, y });
|
65
79
|
points.push({ x: x, y: y + 3 });
|
@@ -70,8 +84,9 @@ export class DocRule {
|
|
70
84
|
this.drawLine(points);
|
71
85
|
return points;
|
72
86
|
}
|
73
|
-
|
74
|
-
|
87
|
+
|
88
|
+
private drawHangThumb(x: number, y: number): Array<Position> {
|
89
|
+
const points: Array<{ x: number, y: number }> = [];
|
75
90
|
x -= 4;
|
76
91
|
points.push({ x: x, y });
|
77
92
|
points.push({ x: x, y: y - 3 });
|
@@ -85,12 +100,14 @@ export class DocRule {
|
|
85
100
|
this.drawLine(points);
|
86
101
|
return points;
|
87
102
|
}
|
88
|
-
|
103
|
+
|
104
|
+
private measureText(text: string) {
|
89
105
|
this.ctx.font = "8px 'Times New Roman'";
|
90
106
|
const measure = this.ctx.measureText(text);
|
91
107
|
return measure.width;
|
92
108
|
}
|
93
|
-
|
109
|
+
|
110
|
+
private drawLine(points: Array<Position>): void {
|
94
111
|
this.ctx.beginPath();
|
95
112
|
this.ctx.save();
|
96
113
|
this.ctx.fillStyle = "white";
|
@@ -101,8 +118,7 @@ export class DocRule {
|
|
101
118
|
y += 0.5;
|
102
119
|
if (j === 0) {
|
103
120
|
this.ctx.moveTo(x, y);
|
104
|
-
}
|
105
|
-
else {
|
121
|
+
} else {
|
106
122
|
this.ctx.lineTo(x, y);
|
107
123
|
}
|
108
124
|
}
|
@@ -111,7 +127,8 @@ export class DocRule {
|
|
111
127
|
this.ctx.closePath();
|
112
128
|
this.ctx.restore();
|
113
129
|
}
|
114
|
-
|
130
|
+
|
131
|
+
private drawText(text: string, x: number, y: number) {
|
115
132
|
this.ctx.save();
|
116
133
|
this.ctx.fillStyle = "rgb(0,0,0)";
|
117
134
|
this.ctx.textBaseline = "alphabetic";
|
@@ -119,39 +136,41 @@ export class DocRule {
|
|
119
136
|
this.ctx.fillText(text, x, y + 8 - 1);
|
120
137
|
this.ctx.restore();
|
121
138
|
}
|
139
|
+
|
122
140
|
/**
|
123
141
|
* 刷新新的状态
|
124
|
-
* @param indent
|
125
|
-
* @param hang
|
142
|
+
* @param indent
|
143
|
+
* @param hang
|
126
144
|
*/
|
127
|
-
refreshRule() {
|
145
|
+
refreshRule(): void {
|
128
146
|
this.ctx.clearRect(0, 0, this.canvas.width, this.ruleHeight);
|
129
147
|
this.ctx.save();
|
130
148
|
this.ctx.translate(this.options.docLeft, 0);
|
131
149
|
this.drawRule();
|
132
150
|
this.ctx.restore();
|
133
151
|
}
|
134
|
-
|
152
|
+
|
153
|
+
private canvasMousedown(evt: MouseEvent): void {
|
135
154
|
const clickPos = this.getMousePos(evt);
|
136
155
|
if (this.pointInPoly(clickPos, this.indentThumbPoints)) {
|
137
156
|
this.mouseDownThumbType = 'indent';
|
138
157
|
this.mouseDownPos = clickPos;
|
139
|
-
}
|
140
|
-
else if (this.pointInPoly(clickPos, this.hangThumbPoints)) {
|
158
|
+
} else if (this.pointInPoly(clickPos, this.hangThumbPoints)) {
|
141
159
|
this.mouseDownThumbType = 'hang';
|
142
160
|
this.mouseDownPos = clickPos;
|
143
|
-
}
|
144
|
-
else {
|
161
|
+
} else {
|
145
162
|
console.log("未点击在里面");
|
146
163
|
}
|
147
164
|
}
|
148
|
-
|
165
|
+
|
166
|
+
private getMousePos(evt: MouseEvent): Position {
|
149
167
|
return {
|
150
168
|
x: evt.offsetX - this.options.docLeft,
|
151
169
|
y: evt.offsetY
|
152
|
-
}
|
170
|
+
}
|
153
171
|
}
|
154
|
-
|
172
|
+
|
173
|
+
private canvasMousemove(evt: MouseEvent): void {
|
155
174
|
if (['indent', 'hang'].indexOf(this.mouseDownThumbType) < 0) {
|
156
175
|
return;
|
157
176
|
}
|
@@ -164,12 +183,10 @@ export class DocRule {
|
|
164
183
|
const remainder = moveX % 5;
|
165
184
|
if (Math.abs(remainder) < 3) {
|
166
185
|
return;
|
167
|
-
}
|
168
|
-
else {
|
186
|
+
} else {
|
169
187
|
if (remainder < 0) {
|
170
188
|
moveX -= 5 + remainder;
|
171
|
-
}
|
172
|
-
else {
|
189
|
+
} else {
|
173
190
|
moveX += 5 - remainder;
|
174
191
|
}
|
175
192
|
}
|
@@ -179,7 +196,7 @@ export class DocRule {
|
|
179
196
|
canvasPos.x = this.mouseDownPos.x + moveX;
|
180
197
|
const para = this.getCurrPara();
|
181
198
|
if (!para) {
|
182
|
-
throw new Error('para is null')
|
199
|
+
throw new Error('para is null')
|
183
200
|
}
|
184
201
|
if (this.mouseDownThumbType === 'indent') {
|
185
202
|
this.thumbX.indent += moveX;
|
@@ -198,28 +215,33 @@ export class DocRule {
|
|
198
215
|
this.drawRule();
|
199
216
|
}
|
200
217
|
}
|
201
|
-
|
218
|
+
|
219
|
+
private canvasMouseup(evt: MouseEvent): void {
|
202
220
|
this.mouseDownThumbType = 'none';
|
203
221
|
this.mouseDownPos = null;
|
204
222
|
}
|
205
|
-
|
223
|
+
|
224
|
+
|
225
|
+
private pointInPoly(pt: Position, poly: Array<Position>): boolean {
|
206
226
|
let c = false;
|
207
227
|
for (let i = -1, l = poly.length, j = l - 1; ++i < l; j = i) {
|
208
228
|
if (((poly[i].y <= pt.y && pt.y < poly[j].y) || (poly[j].y <= pt.y && pt.y < poly[i].y)) && pt.x < ((poly[j].x - poly[i].x) * (pt.y - poly[i].y)) / (poly[j].y - poly[i].y) + poly[i].x) {
|
209
|
-
c = !c
|
229
|
+
c = !c
|
210
230
|
}
|
211
231
|
}
|
212
232
|
return c;
|
213
233
|
}
|
234
|
+
|
235
|
+
|
214
236
|
/**
|
215
237
|
* 绘制
|
216
238
|
*/
|
217
|
-
drawRule() {
|
239
|
+
private drawRule(): void {
|
218
240
|
this.fillRect(0, 0, this.options.pagePL, this.ruleHeight, "rgb(198,198,198)");
|
219
241
|
this.fillRect(this.options.width - this.options.pagePR, 0, this.options.pagePR, this.ruleHeight, "rgb(198,198,198)");
|
220
242
|
for (let j = 0; j < 50; j++) {
|
221
243
|
const gantWidth = 20;
|
222
|
-
const points = [];
|
244
|
+
const points: Array<Position> = [];
|
223
245
|
const x = j * gantWidth;
|
224
246
|
if (x > this.options.width) {
|
225
247
|
break;
|
@@ -234,57 +256,61 @@ export class DocRule {
|
|
234
256
|
this.indentThumbPoints = this.drawIndentThumb(this.thumbX.indent, 6);
|
235
257
|
this.hangThumbPoints = this.drawHangThumb(this.thumbX.hanging, 25);
|
236
258
|
}
|
237
|
-
|
259
|
+
|
260
|
+
private getRuleMarksPos(): void {
|
238
261
|
const { startControl, startOffset, startHitInfo } = this.ss;
|
239
262
|
if (!startControl || !startHitInfo) {
|
240
263
|
return;
|
241
264
|
}
|
242
|
-
const para = ElementUtil.getParentByType(startControl, ParagraphElement);
|
265
|
+
const para = ElementUtil.getParentByType(startControl, ParagraphElement) as ParagraphElement;
|
243
266
|
const indent = para.props.indent;
|
244
267
|
const hanging = para.props.hanging;
|
245
|
-
const { startRegion, hitDocIndex } = this.ss.startHitInfo;
|
268
|
+
const { startRegion, hitDocIndex } = this.ss.startHitInfo as HitEventInfo;
|
246
269
|
const cursorPosi = DocumentCursor.getElementCursorPos(startControl, startOffset, startRegion, hitDocIndex);
|
247
270
|
//当前段落
|
248
|
-
const paraRender = ElementUtil.getParentRender(cursorPosi.render, ParagraphRenderObject);
|
271
|
+
const paraRender = ElementUtil.getParentRender(cursorPosi.render, ParagraphRenderObject) as ParagraphRenderObject;
|
249
272
|
//当前段落位置
|
250
|
-
const paraRenderPos = ElementUtil.getRenderAbsolutePaintPos(paraRender)
|
273
|
+
const paraRenderPos = ElementUtil.getRenderAbsolutePaintPos(paraRender)
|
251
274
|
//当前文档
|
252
|
-
const docRender = ElementUtil.getParentRender(paraRender, DocumentRenderObject);
|
275
|
+
const docRender = ElementUtil.getParentRender(paraRender, DocumentRenderObject) as DocumentRenderObject;
|
253
276
|
//当前文档位置
|
254
|
-
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender)
|
277
|
+
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender)
|
255
278
|
this.thumbX.indent = paraRenderPos.x - docRenderPos.x + indent;
|
256
279
|
this.thumbX.hanging = paraRenderPos.x - docRenderPos.x + hanging;
|
257
280
|
this.setParentMarksPos(paraRender);
|
258
281
|
}
|
259
|
-
|
282
|
+
|
283
|
+
private getCurrPara(): ParagraphElement | null {
|
260
284
|
const { startControl, startOffset } = this.ss;
|
261
285
|
if (!startControl) {
|
262
286
|
return null;
|
263
287
|
}
|
264
288
|
return ElementUtil.getParentByType(startControl, ParagraphElement);
|
265
289
|
}
|
266
|
-
|
267
|
-
|
290
|
+
|
291
|
+
private setParentMarksPos(childRender: RenderObject): Array<{ pos: Position }> {
|
292
|
+
const items: Array<{ pos: Position }> = [];
|
268
293
|
const parentRender = childRender.parent;
|
269
294
|
if (!parentRender || parentRender instanceof DocumentRenderObject) {
|
270
295
|
return items;
|
271
296
|
}
|
272
297
|
if (parentRender instanceof TableRowRenderObject) {
|
273
|
-
const docRender = ElementUtil.getParentRender(parentRender, DocumentRenderObject);
|
274
|
-
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender)
|
298
|
+
const docRender = ElementUtil.getParentRender(parentRender, DocumentRenderObject) as DocumentRenderObject;
|
299
|
+
const docRenderPos = ElementUtil.getRenderAbsolutePaintPos(docRender)
|
275
300
|
for (let i = 0; i < parentRender.length; i++) {
|
276
|
-
const cellRender = parentRender.getChild(i);
|
277
|
-
const pos = ElementUtil.getRenderAbsolutePaintPos(cellRender)
|
301
|
+
const cellRender = parentRender.getChild(i) as TableCellRenderObject;
|
302
|
+
const pos = ElementUtil.getRenderAbsolutePaintPos(cellRender)
|
278
303
|
this.drawCellMark(pos.x - docRenderPos.x, 0, cellRender.padding.left);
|
279
304
|
}
|
280
305
|
}
|
281
306
|
items.push(...this.setParentMarksPos(parentRender));
|
282
307
|
return items;
|
283
308
|
}
|
284
|
-
|
309
|
+
|
310
|
+
private drawCellMark(x: number, y: number, width: number): void {
|
285
311
|
x += 0.5;
|
286
312
|
y += 0.5;
|
287
|
-
this.fillRect(x, y, width, this.ruleHeight, 'rgb(198,198,198,0.2)')
|
313
|
+
this.fillRect(x, y, width, this.ruleHeight, 'rgb(198,198,198,0.2)')
|
288
314
|
for (let i = 0; i < width; i++) {
|
289
315
|
this.ctx.save();
|
290
316
|
this.ctx.beginPath();
|
@@ -297,17 +323,18 @@ export class DocRule {
|
|
297
323
|
this.ctx.restore();
|
298
324
|
}
|
299
325
|
}
|
300
|
-
|
326
|
+
|
327
|
+
scaleView(): void {
|
301
328
|
return;
|
302
329
|
const { scale } = this.viewOptions;
|
303
330
|
//this.canvas.style.transformOrigin = 'center center';
|
304
|
-
const parent = this.canvas.parentElement;
|
331
|
+
const parent = this.canvas.parentElement as HTMLDivElement;
|
305
332
|
if (scale === 1) {
|
306
333
|
parent.style.transform = '';
|
307
|
-
}
|
308
|
-
else {
|
334
|
+
} else {
|
309
335
|
parent.style.transform = `scale(${this.viewOptions.scale})`;
|
310
336
|
}
|
311
337
|
}
|
338
|
+
|
339
|
+
|
312
340
|
}
|
313
|
-
//# sourceMappingURL=doc-ruler.js.map
|
@@ -0,0 +1,200 @@
|
|
1
|
+
import moment from "moment";
|
2
|
+
import { Rect } from "./element-define";
|
3
|
+
import { BorderType } from "./render-define";
|
4
|
+
interface Position {
|
5
|
+
x: number;
|
6
|
+
y: number;
|
7
|
+
}
|
8
|
+
|
9
|
+
export class CommonUtil {
|
10
|
+
|
11
|
+
/**
|
12
|
+
* 判断坐标是否在矩形框内
|
13
|
+
* @param rect
|
14
|
+
* @param position
|
15
|
+
* @returns
|
16
|
+
*/
|
17
|
+
static isInsideRectByPosition(rect: Rect, position: Position): boolean {
|
18
|
+
return position.x >= rect.x
|
19
|
+
&&
|
20
|
+
position.x <= rect.x + rect.width
|
21
|
+
&&
|
22
|
+
position.y >= rect.y
|
23
|
+
&&
|
24
|
+
position.y <= rect.y + rect.height;
|
25
|
+
}
|
26
|
+
|
27
|
+
static isInsideRectByRect(rect: Rect, position: Rect): boolean {
|
28
|
+
return position.x >= rect.x
|
29
|
+
&&
|
30
|
+
position.x <= rect.x + rect.width
|
31
|
+
&&
|
32
|
+
position.y >= rect.y
|
33
|
+
&&
|
34
|
+
position.y <= rect.y + rect.height
|
35
|
+
&&
|
36
|
+
position.y + position.height <= rect.y + rect.height
|
37
|
+
&&
|
38
|
+
position.x + position.width <= rect.x + rect.width;
|
39
|
+
}
|
40
|
+
|
41
|
+
/**
|
42
|
+
* 判断坐标是否在矩形的边框上
|
43
|
+
* @param rect
|
44
|
+
* @param borderWidth
|
45
|
+
* @param position
|
46
|
+
*/
|
47
|
+
static isInRectBorder(rect: Rect, borderWidth: number, position: Position): { borderType: BorderType } {
|
48
|
+
const leftBorderRect: Rect = { x: 0, y: 0, width: borderWidth, height: rect.height, maxWidth: 0, maxHeight: 0 };
|
49
|
+
const rightBorderRect: Rect = { x: rect.width - borderWidth, y: 0, width: borderWidth, height: rect.height, maxWidth: 0, maxHeight: 0 };
|
50
|
+
const topBorderRect: Rect = { x: 0, y: 0, width: rect.width, height: borderWidth, maxWidth: 0, maxHeight: 0 };
|
51
|
+
const bottomBorderRect: Rect = { x: 0, y: rect.height - borderWidth, width: rect.width, height: borderWidth, maxWidth: 0, maxHeight: 0 };
|
52
|
+
let borderType: BorderType = 'none';
|
53
|
+
if (this.isInsideRectByPosition(leftBorderRect, position)) {
|
54
|
+
borderType = 'left';
|
55
|
+
} else if (this.isInsideRectByPosition(rightBorderRect, position)) {
|
56
|
+
borderType = 'right';
|
57
|
+
} else if (this.isInsideRectByPosition(topBorderRect, position)) {
|
58
|
+
borderType = 'top';
|
59
|
+
} else if (this.isInsideRectByPosition(bottomBorderRect, position)) {
|
60
|
+
borderType = 'bottom';
|
61
|
+
}
|
62
|
+
return { borderType };
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* 判断坐标是否在图片的缩放操作点上
|
67
|
+
*/
|
68
|
+
static isInPictureResizePoint(rect: Rect, pos: Position, r: number): { borderType: BorderType } | null {
|
69
|
+
const { width, height } = rect;
|
70
|
+
const x = 0;
|
71
|
+
const y = 0;
|
72
|
+
const points: Array<{ x: number, y: number, type: BorderType }> = [{ x, y, type: 'left-top' }, { x: x + width, y, type: 'right-top' }, { x: x + (Math.floor(width / 2)), y: y, type: 'top-middle' }, { x, y: y + Math.floor(height / 2), type: 'left-middle' }, { x, y: y + height, type: 'left-bottom' }, { x: width, y: Math.floor(height / 2), type: 'right-middle' }, { x: x + width, y: y + height, type: 'right-bottom' }, { x: x + (Math.floor(width / 2)), y: y + height, type: 'bottom-middle' }];
|
73
|
+
for (let i = 0; i < points.length; i++) {
|
74
|
+
const point = points[i];
|
75
|
+
const { x: px, y: py } = point;
|
76
|
+
if (((px - pos.x) * (px - pos.x) + (py - pos.y) * (py - pos.y)) < r * r) {
|
77
|
+
return { borderType: point.type };
|
78
|
+
}
|
79
|
+
}
|
80
|
+
return null;
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
/**
|
85
|
+
* 整形符合连线要求
|
86
|
+
* @param points
|
87
|
+
* @param width
|
88
|
+
* @param strokeColor
|
89
|
+
*/
|
90
|
+
static resharpPoints(points: Array<Position>): Array<Position> {
|
91
|
+
let prevPoint: Position = points[0];
|
92
|
+
const array: Array<Position> = [];
|
93
|
+
array.push(prevPoint);
|
94
|
+
for (let i = 1; i < points.length; i++) {
|
95
|
+
const currPoint = points[i];
|
96
|
+
//不在同一水平线
|
97
|
+
if (currPoint.y !== prevPoint.y && currPoint.x !== prevPoint.x) {
|
98
|
+
array.push({ x: currPoint.x, y: prevPoint.y });
|
99
|
+
}
|
100
|
+
array.push(currPoint);
|
101
|
+
prevPoint = currPoint;
|
102
|
+
}
|
103
|
+
return array;
|
104
|
+
}
|
105
|
+
|
106
|
+
static getOffsetX(node: HTMLElement): number {
|
107
|
+
if (!node.parentElement) {
|
108
|
+
throw new Error('node.parentElement is null')
|
109
|
+
}
|
110
|
+
const parent = node.parentElement.getBoundingClientRect().left;
|
111
|
+
const curr = node.getBoundingClientRect().left;
|
112
|
+
return curr - parent;
|
113
|
+
}
|
114
|
+
|
115
|
+
static randomColor() {
|
116
|
+
let str = "#";
|
117
|
+
for (let i = 0; i < 6; i++) {
|
118
|
+
str += Math.floor(Math.random() * 16).toString(16);
|
119
|
+
}
|
120
|
+
return str;
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* 判断一个数值是否在另一个数值的增益区间中
|
125
|
+
* @param val
|
126
|
+
* @param offset
|
127
|
+
* @param compareValue
|
128
|
+
* @returns
|
129
|
+
*/
|
130
|
+
static ApproxmateValueInRange(val: number, offset: number, compareValue: number): boolean {
|
131
|
+
return (val - offset) <= compareValue && (val + offset) >= compareValue;
|
132
|
+
}
|
133
|
+
|
134
|
+
|
135
|
+
static getEmptyValue<T>(val: T, emptyVal: T): T {
|
136
|
+
if (!val) {
|
137
|
+
return emptyVal;
|
138
|
+
}
|
139
|
+
return val;
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* 移除并集
|
144
|
+
* @param array
|
145
|
+
* @param deleteItems
|
146
|
+
* @returns
|
147
|
+
*/
|
148
|
+
static removeUnionSet<T>(array: Array<T>, deleteItems: Array<T>): Array<T> {
|
149
|
+
const arraySet = new Set(array);
|
150
|
+
for (let i = 0; i < deleteItems.length; i++) {
|
151
|
+
const item = deleteItems[i];
|
152
|
+
if (arraySet.has(item)) {
|
153
|
+
arraySet.delete(item)
|
154
|
+
}
|
155
|
+
}
|
156
|
+
return Array.from(arraySet);
|
157
|
+
}
|
158
|
+
|
159
|
+
static nullToString(val: any): string {
|
160
|
+
if (val === null || val === undefined) {
|
161
|
+
return '';
|
162
|
+
}
|
163
|
+
return val;
|
164
|
+
}
|
165
|
+
|
166
|
+
static formatDate(date: Date, format: string): string {
|
167
|
+
return moment(date).format(format);
|
168
|
+
}
|
169
|
+
|
170
|
+
static formatNow(format: string): string {
|
171
|
+
return this.formatDate(new Date(), format);
|
172
|
+
}
|
173
|
+
|
174
|
+
static parseText(text: string, data: object): string {
|
175
|
+
const reg = /\{(.*?)\}/g;
|
176
|
+
let result = text;
|
177
|
+
let match;
|
178
|
+
while (match = reg.exec(text)) {
|
179
|
+
const key = match[1];
|
180
|
+
const value = data[key];
|
181
|
+
result = result.replace(match[0], value);
|
182
|
+
}
|
183
|
+
return result;
|
184
|
+
}
|
185
|
+
|
186
|
+
//获取和当前日期相差的秒数
|
187
|
+
static getNowDiffSeconds(date: Date | string): number {
|
188
|
+
date = typeof date === 'string' ? new Date(date) : date;
|
189
|
+
const now = new Date();
|
190
|
+
const diff = now.getTime() - date.getTime();
|
191
|
+
return diff / 1000;
|
192
|
+
}
|
193
|
+
|
194
|
+
//验证当前字符串是否为日期格式
|
195
|
+
static isDate(str: string): boolean {
|
196
|
+
const reg = /^\d{4}-\d{2}-\d{2}$/;
|
197
|
+
return reg.test(str);
|
198
|
+
}
|
199
|
+
|
200
|
+
}
|