first commit
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,529 @@
|
||||
/* BASICS */
|
||||
|
||||
.CodeMirror {
|
||||
/* Set height, width, borders, and global font properties here */
|
||||
font-family: monospace;
|
||||
height: 300px;
|
||||
color: black;
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
/* PADDING */
|
||||
|
||||
.CodeMirror-lines {
|
||||
padding: 4px 0; /* Vertical padding around content */
|
||||
}
|
||||
.CodeMirror pre {
|
||||
padding: 0 4px; /* Horizontal padding of content */
|
||||
}
|
||||
|
||||
.CodeMirror-scrollbar-filler,
|
||||
.CodeMirror-gutter-filler {
|
||||
background-color: white; /* The little square between H and V scrollbars */
|
||||
}
|
||||
|
||||
/* GUTTER */
|
||||
|
||||
.CodeMirror-gutters {
|
||||
border-right: 1px solid #ddd;
|
||||
background-color: #f7f7f7;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.CodeMirror-linenumbers {
|
||||
}
|
||||
.CodeMirror-linenumber {
|
||||
padding: 0 3px 0 5px;
|
||||
min-width: 20px;
|
||||
text-align: right;
|
||||
color: #999;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.CodeMirror-guttermarker {
|
||||
color: black;
|
||||
}
|
||||
.CodeMirror-guttermarker-subtle {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
/* CURSOR */
|
||||
|
||||
.CodeMirror-cursor {
|
||||
border-left: 1px solid black;
|
||||
border-right: none;
|
||||
width: 0;
|
||||
}
|
||||
/* Shown when moving in bi-directional text */
|
||||
.CodeMirror div.CodeMirror-secondarycursor {
|
||||
border-left: 1px solid silver;
|
||||
}
|
||||
.cm-fat-cursor .CodeMirror-cursor {
|
||||
width: auto;
|
||||
border: 0 !important;
|
||||
background: #7e7;
|
||||
}
|
||||
.cm-fat-cursor div.CodeMirror-cursors {
|
||||
z-index: 1;
|
||||
}
|
||||
.cm-fat-cursor-mark {
|
||||
background-color: rgba(20, 255, 20, 0.5);
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
}
|
||||
.cm-animate-fat-cursor {
|
||||
width: auto;
|
||||
border: 0;
|
||||
-webkit-animation: blink 1.06s steps(1) infinite;
|
||||
-moz-animation: blink 1.06s steps(1) infinite;
|
||||
animation: blink 1.06s steps(1) infinite;
|
||||
background-color: #7e7;
|
||||
}
|
||||
@-moz-keyframes blink {
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
@-webkit-keyframes blink {
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
@keyframes blink {
|
||||
0% {
|
||||
}
|
||||
50% {
|
||||
background-color: transparent;
|
||||
}
|
||||
100% {
|
||||
}
|
||||
}
|
||||
|
||||
/* Can style cursor different in overwrite (non-insert) mode */
|
||||
.CodeMirror-overwrite .CodeMirror-cursor {
|
||||
}
|
||||
|
||||
.cm-tab {
|
||||
display: inline-block;
|
||||
text-decoration: inherit;
|
||||
}
|
||||
|
||||
.CodeMirror-rulers {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: -50px;
|
||||
bottom: -20px;
|
||||
overflow: hidden;
|
||||
}
|
||||
.CodeMirror-ruler {
|
||||
border-left: 1px solid #ccc;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
/* DEFAULT THEME */
|
||||
|
||||
.cm-s-default .cm-header {
|
||||
color: blue;
|
||||
}
|
||||
.cm-s-default .cm-quote {
|
||||
color: #090;
|
||||
}
|
||||
.cm-negative {
|
||||
color: #d44;
|
||||
}
|
||||
.cm-positive {
|
||||
color: #292;
|
||||
}
|
||||
.cm-header,
|
||||
.cm-strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cm-em {
|
||||
font-style: italic;
|
||||
}
|
||||
.cm-link {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.cm-strikethrough {
|
||||
text-decoration: line-through;
|
||||
}
|
||||
|
||||
.cm-s-default .cm-keyword {
|
||||
color: #708;
|
||||
}
|
||||
.cm-s-default .cm-atom {
|
||||
color: #219;
|
||||
}
|
||||
.cm-s-default .cm-number {
|
||||
color: #164;
|
||||
}
|
||||
.cm-s-default .cm-def {
|
||||
color: #00f;
|
||||
}
|
||||
.cm-s-default .cm-variable,
|
||||
.cm-s-default .cm-punctuation,
|
||||
.cm-s-default .cm-property,
|
||||
.cm-s-default .cm-operator {
|
||||
}
|
||||
.cm-s-default .cm-variable-2 {
|
||||
color: #05a;
|
||||
}
|
||||
.cm-s-default .cm-variable-3,
|
||||
.cm-s-default .cm-type {
|
||||
color: #085;
|
||||
}
|
||||
.cm-s-default .cm-comment {
|
||||
color: #a50;
|
||||
}
|
||||
.cm-s-default .cm-string {
|
||||
color: #a11;
|
||||
}
|
||||
.cm-s-default .cm-string-2 {
|
||||
color: #f50;
|
||||
}
|
||||
.cm-s-default .cm-meta {
|
||||
color: #555;
|
||||
}
|
||||
.cm-s-default .cm-qualifier {
|
||||
color: #555;
|
||||
}
|
||||
.cm-s-default .cm-builtin {
|
||||
color: #30a;
|
||||
}
|
||||
.cm-s-default .cm-bracket {
|
||||
color: #997;
|
||||
}
|
||||
.cm-s-default .cm-tag {
|
||||
color: #170;
|
||||
}
|
||||
.cm-s-default .cm-attribute {
|
||||
color: #00c;
|
||||
}
|
||||
.cm-s-default .cm-hr {
|
||||
color: #999;
|
||||
}
|
||||
.cm-s-default .cm-link {
|
||||
color: #00c;
|
||||
}
|
||||
|
||||
.cm-s-default .cm-error {
|
||||
color: #f00;
|
||||
}
|
||||
.cm-invalidchar {
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
.CodeMirror-composing {
|
||||
border-bottom: 2px solid;
|
||||
}
|
||||
|
||||
/* Default styles for common addons */
|
||||
|
||||
div.CodeMirror span.CodeMirror-matchingbracket {
|
||||
color: #0b0;
|
||||
}
|
||||
div.CodeMirror span.CodeMirror-nonmatchingbracket {
|
||||
color: #a22;
|
||||
}
|
||||
.CodeMirror-matchingtag {
|
||||
background: rgba(255, 150, 0, 0.3);
|
||||
}
|
||||
.CodeMirror-activeline-background {
|
||||
background: #e8f2ff;
|
||||
}
|
||||
|
||||
/* STOP */
|
||||
|
||||
/* The rest of this file contains styles related to the mechanics of
|
||||
the editor. You probably shouldn't touch them. */
|
||||
|
||||
.CodeMirror {
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
background: white;
|
||||
}
|
||||
|
||||
.CodeMirror-scroll {
|
||||
overflow: scroll !important; /* Things will break if this is overridden */
|
||||
/* 30px is the magic margin used to hide the element's real scrollbars */
|
||||
/* See overflow: hidden in .CodeMirror */
|
||||
margin-bottom: -30px;
|
||||
margin-right: -30px;
|
||||
padding-bottom: 30px;
|
||||
height: 100%;
|
||||
outline: none; /* Prevent dragging from highlighting the element */
|
||||
position: relative;
|
||||
}
|
||||
.CodeMirror-sizer {
|
||||
position: relative;
|
||||
border-right: 30px solid transparent;
|
||||
}
|
||||
|
||||
/* The fake, visible scrollbars. Used to force redraw during scrolling
|
||||
before actual scrolling happens, thus preventing shaking and
|
||||
flickering artifacts. */
|
||||
.CodeMirror-vscrollbar,
|
||||
.CodeMirror-hscrollbar,
|
||||
.CodeMirror-scrollbar-filler,
|
||||
.CodeMirror-gutter-filler {
|
||||
position: absolute;
|
||||
z-index: 6;
|
||||
display: none;
|
||||
}
|
||||
.CodeMirror-vscrollbar {
|
||||
right: 0;
|
||||
top: 0;
|
||||
overflow-x: hidden;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
.CodeMirror-hscrollbar {
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
overflow-y: hidden;
|
||||
overflow-x: scroll;
|
||||
}
|
||||
.CodeMirror-scrollbar-filler {
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
.CodeMirror-gutter-filler {
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-gutters {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
z-index: 3;
|
||||
}
|
||||
.CodeMirror-gutter {
|
||||
white-space: normal;
|
||||
height: 100%;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
margin-bottom: -30px;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper {
|
||||
position: absolute;
|
||||
z-index: 4;
|
||||
background: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
.CodeMirror-gutter-background {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-elt {
|
||||
position: absolute;
|
||||
cursor: default;
|
||||
z-index: 4;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
.CodeMirror-gutter-wrapper ::-moz-selection {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.CodeMirror-lines {
|
||||
cursor: text;
|
||||
min-height: 1px; /* prevents collapsing before first draw */
|
||||
}
|
||||
.CodeMirror pre {
|
||||
/* Reset some styles that the rest of the page might have set */
|
||||
-moz-border-radius: 0;
|
||||
-webkit-border-radius: 0;
|
||||
border-radius: 0;
|
||||
border-width: 0;
|
||||
background: transparent;
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
margin: 0;
|
||||
white-space: pre;
|
||||
word-wrap: normal;
|
||||
line-height: inherit;
|
||||
color: inherit;
|
||||
z-index: 2;
|
||||
position: relative;
|
||||
overflow: visible;
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
-webkit-font-variant-ligatures: contextual;
|
||||
font-variant-ligatures: contextual;
|
||||
}
|
||||
.CodeMirror-wrap pre {
|
||||
word-wrap: break-word;
|
||||
white-space: pre-wrap;
|
||||
word-break: normal;
|
||||
}
|
||||
|
||||
.CodeMirror-linebackground {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
right: 0;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.CodeMirror-linewidget {
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
padding: 0.1px; /* Force widget margins to stay inside of the container */
|
||||
}
|
||||
|
||||
.CodeMirror-widget {
|
||||
}
|
||||
|
||||
.CodeMirror-rtl pre {
|
||||
direction: rtl;
|
||||
}
|
||||
|
||||
.CodeMirror-code {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Force content-box sizing for the elements where we expect it */
|
||||
.CodeMirror-scroll,
|
||||
.CodeMirror-sizer,
|
||||
.CodeMirror-gutter,
|
||||
.CodeMirror-gutters,
|
||||
.CodeMirror-linenumber {
|
||||
-moz-box-sizing: content-box;
|
||||
box-sizing: content-box;
|
||||
}
|
||||
|
||||
.CodeMirror-measure {
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 0;
|
||||
overflow: hidden;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.CodeMirror-cursor {
|
||||
position: absolute;
|
||||
pointer-events: none;
|
||||
}
|
||||
.CodeMirror-measure pre {
|
||||
position: static;
|
||||
}
|
||||
|
||||
div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
}
|
||||
div.CodeMirror-dragcursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-focused div.CodeMirror-cursors {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
.CodeMirror-selected {
|
||||
background: #d9d9d9;
|
||||
}
|
||||
.CodeMirror-focused .CodeMirror-selected {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
.CodeMirror-crosshair {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.CodeMirror-line::selection,
|
||||
.CodeMirror-line > span::selection,
|
||||
.CodeMirror-line > span > span::selection {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
.CodeMirror-line::-moz-selection,
|
||||
.CodeMirror-line > span::-moz-selection,
|
||||
.CodeMirror-line > span > span::-moz-selection {
|
||||
background: #d7d4f0;
|
||||
}
|
||||
|
||||
.cm-searching {
|
||||
background-color: #ffa;
|
||||
background-color: rgba(255, 255, 0, 0.4);
|
||||
}
|
||||
|
||||
/* Used to force a border model for a node */
|
||||
.cm-force-border {
|
||||
padding-right: 0.1px;
|
||||
}
|
||||
|
||||
@media print {
|
||||
/* Hide the cursor when printing */
|
||||
.CodeMirror div.CodeMirror-cursors {
|
||||
visibility: hidden;
|
||||
}
|
||||
}
|
||||
|
||||
/* See issue #2901 */
|
||||
.cm-tab-wrap-hack:after {
|
||||
content: "";
|
||||
}
|
||||
|
||||
/* Help users use markselection to safely style text background */
|
||||
span.CodeMirror-selectedtext {
|
||||
background: none;
|
||||
}
|
||||
|
||||
.cm-s-elegant span.cm-number,
|
||||
.cm-s-elegant span.cm-string,
|
||||
.cm-s-elegant span.cm-atom {
|
||||
color: #762;
|
||||
}
|
||||
.cm-s-elegant span.cm-comment {
|
||||
color: #262;
|
||||
font-style: italic;
|
||||
line-height: 1em;
|
||||
}
|
||||
.cm-s-elegant span.cm-meta {
|
||||
color: #555;
|
||||
font-style: italic;
|
||||
line-height: 1em;
|
||||
}
|
||||
.cm-s-elegant span.cm-variable {
|
||||
color: black;
|
||||
}
|
||||
.cm-s-elegant span.cm-variable-2 {
|
||||
color: #b11;
|
||||
}
|
||||
.cm-s-elegant span.cm-qualifier {
|
||||
color: #555;
|
||||
}
|
||||
.cm-s-elegant span.cm-keyword {
|
||||
color: #730;
|
||||
}
|
||||
.cm-s-elegant span.cm-builtin {
|
||||
color: #30a;
|
||||
}
|
||||
.cm-s-elegant span.cm-link {
|
||||
color: #762;
|
||||
}
|
||||
.cm-s-elegant span.cm-error {
|
||||
background-color: #fdd;
|
||||
}
|
||||
|
||||
.cm-s-elegant .CodeMirror-activeline-background {
|
||||
background: #e8f2ff;
|
||||
}
|
||||
.cm-s-elegant .CodeMirror-matchingbracket {
|
||||
outline: 1px solid grey;
|
||||
color: black !important;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,313 @@
|
||||
!(function (e, t) {
|
||||
"object" == typeof exports && "object" == typeof module
|
||||
? (module.exports = t(require("codemirror")))
|
||||
: "function" == typeof define && define.amd
|
||||
? define(["codemirror"], t)
|
||||
: "object" == typeof exports
|
||||
? (exports.VueCodemirror = t(require("codemirror")))
|
||||
: (e.VueCodemirror = t(e.codemirror))
|
||||
})(this, function (e) {
|
||||
return (function (e) {
|
||||
function t(r) {
|
||||
if (n[r]) return n[r].exports
|
||||
var o = (n[r] = { i: r, l: !1, exports: {} })
|
||||
return e[r].call(o.exports, o, o.exports, t), (o.l = !0), o.exports
|
||||
}
|
||||
var n = {}
|
||||
return (
|
||||
(t.m = e),
|
||||
(t.c = n),
|
||||
(t.i = function (e) {
|
||||
return e
|
||||
}),
|
||||
(t.d = function (e, n, r) {
|
||||
t.o(e, n) || Object.defineProperty(e, n, { configurable: !1, enumerable: !0, get: r })
|
||||
}),
|
||||
(t.n = function (e) {
|
||||
var n =
|
||||
e && e.__esModule
|
||||
? function () {
|
||||
return e.default
|
||||
}
|
||||
: function () {
|
||||
return e
|
||||
}
|
||||
return t.d(n, "a", n), n
|
||||
}),
|
||||
(t.o = function (e, t) {
|
||||
return Object.prototype.hasOwnProperty.call(e, t)
|
||||
}),
|
||||
(t.p = "/"),
|
||||
t((t.s = 3))
|
||||
)
|
||||
})([
|
||||
function (t, n) {
|
||||
t.exports = e
|
||||
},
|
||||
function (e, t, n) {
|
||||
"use strict"
|
||||
Object.defineProperty(t, "__esModule", { value: !0 })
|
||||
var r = n(0),
|
||||
o = (function (e) {
|
||||
return e && e.__esModule ? e : { default: e }
|
||||
})(r),
|
||||
i = window.CodeMirror || o.default
|
||||
"function" != typeof Object.assign &&
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function (e, t) {
|
||||
if (null == e) throw new TypeError("Cannot convert undefined or null to object")
|
||||
for (var n = Object(e), r = 1; r < arguments.length; r++) {
|
||||
var o = arguments[r]
|
||||
if (null != o) for (var i in o) Object.prototype.hasOwnProperty.call(o, i) && (n[i] = o[i])
|
||||
}
|
||||
return n
|
||||
},
|
||||
writable: !0,
|
||||
configurable: !0
|
||||
}),
|
||||
(t.default = {
|
||||
name: "codemirror",
|
||||
data: function () {
|
||||
return { content: "", codemirror: null, cminstance: null }
|
||||
},
|
||||
props: {
|
||||
code: String,
|
||||
value: String,
|
||||
marker: Function,
|
||||
unseenLines: Array,
|
||||
name: { type: String, default: "codemirror" },
|
||||
placeholder: { type: String, default: "" },
|
||||
merge: { type: Boolean, default: !1 },
|
||||
options: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
events: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
return []
|
||||
}
|
||||
},
|
||||
globalOptions: {
|
||||
type: Object,
|
||||
default: function () {
|
||||
return {}
|
||||
}
|
||||
},
|
||||
globalEvents: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
return []
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
options: {
|
||||
deep: !0,
|
||||
handler: function (e) {
|
||||
for (var t in e) this.cminstance.setOption(t, e[t])
|
||||
}
|
||||
},
|
||||
merge: function () {
|
||||
this.$nextTick(this.switchMerge)
|
||||
},
|
||||
code: function (e) {
|
||||
this.handerCodeChange(e)
|
||||
},
|
||||
value: function (e) {
|
||||
this.handerCodeChange(e)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initialize: function () {
|
||||
var e = this,
|
||||
t = Object.assign({}, this.globalOptions, this.options)
|
||||
this.merge
|
||||
? ((this.codemirror = i.MergeView(this.$refs.mergeview, t)), (this.cminstance = this.codemirror.edit))
|
||||
: ((this.codemirror = i.fromTextArea(this.$refs.textarea, t)),
|
||||
(this.cminstance = this.codemirror),
|
||||
this.cminstance.setValue(this.code || this.value || this.content)),
|
||||
this.cminstance.on("change", function (t) {
|
||||
;(e.content = t.getValue()), e.$emit && e.$emit("input", e.content)
|
||||
})
|
||||
var n = {}
|
||||
;[
|
||||
"scroll",
|
||||
"changes",
|
||||
"beforeChange",
|
||||
"cursorActivity",
|
||||
"keyHandled",
|
||||
"inputRead",
|
||||
"electricInput",
|
||||
"beforeSelectionChange",
|
||||
"viewportChange",
|
||||
"swapDoc",
|
||||
"gutterClick",
|
||||
"gutterContextMenu",
|
||||
"focus",
|
||||
"blur",
|
||||
"refresh",
|
||||
"optionChange",
|
||||
"scrollCursorIntoView",
|
||||
"update"
|
||||
]
|
||||
.concat(this.events)
|
||||
.concat(this.globalEvents)
|
||||
.filter(function (e) {
|
||||
return !n[e] && (n[e] = !0)
|
||||
})
|
||||
.forEach(function (t) {
|
||||
e.cminstance.on(t, function () {
|
||||
for (var n = arguments.length, r = Array(n), o = 0; o < n; o++) r[o] = arguments[o]
|
||||
e.$emit.apply(e, [t].concat(r))
|
||||
var i = t.replace(/([A-Z])/g, "-$1").toLowerCase()
|
||||
i !== t && e.$emit.apply(e, [i].concat(r))
|
||||
})
|
||||
})
|
||||
this.$emit("ready", this.codemirror), this.unseenLineMarkers(), this.refresh()
|
||||
},
|
||||
refresh: function () {
|
||||
var e = this
|
||||
this.$nextTick(function () {
|
||||
e.cminstance.refresh()
|
||||
})
|
||||
},
|
||||
destroy: function () {
|
||||
var e = this.cminstance.doc.cm.getWrapperElement()
|
||||
e && e.remove && e.remove()
|
||||
},
|
||||
handerCodeChange: function (e) {
|
||||
if (e !== this.cminstance.getValue()) {
|
||||
var t = this.cminstance.getScrollInfo()
|
||||
this.cminstance.setValue(e), (this.content = e), this.cminstance.scrollTo(t.left, t.top)
|
||||
}
|
||||
this.unseenLineMarkers()
|
||||
},
|
||||
unseenLineMarkers: function () {
|
||||
var e = this
|
||||
void 0 !== this.unseenLines &&
|
||||
void 0 !== this.marker &&
|
||||
this.unseenLines.forEach(function (t) {
|
||||
var n = e.cminstance.lineInfo(t)
|
||||
e.cminstance.setGutterMarker(t, "breakpoints", n.gutterMarkers ? null : e.marker())
|
||||
})
|
||||
},
|
||||
switchMerge: function () {
|
||||
var e = this.cminstance.doc.history,
|
||||
t = this.cminstance.doc.cleanGeneration
|
||||
;(this.options.value = this.cminstance.getValue()),
|
||||
this.destroy(),
|
||||
this.initialize(),
|
||||
(this.cminstance.doc.history = e),
|
||||
(this.cminstance.doc.cleanGeneration = t)
|
||||
}
|
||||
},
|
||||
mounted: function () {
|
||||
this.initialize()
|
||||
},
|
||||
beforeDestroy: function () {
|
||||
this.destroy()
|
||||
}
|
||||
})
|
||||
},
|
||||
function (e, t, n) {
|
||||
"use strict"
|
||||
Object.defineProperty(t, "__esModule", { value: !0 })
|
||||
var r = n(1),
|
||||
o = n.n(r)
|
||||
for (var i in r)
|
||||
["default", "default"].indexOf(i) < 0 &&
|
||||
(function (e) {
|
||||
n.d(t, e, function () {
|
||||
return r[e]
|
||||
})
|
||||
})(i)
|
||||
var s = n(5),
|
||||
c = n(4),
|
||||
a = c(o.a, s.a, !1, null, null, null)
|
||||
t.default = a.exports
|
||||
},
|
||||
function (e, t, n) {
|
||||
"use strict"
|
||||
function r(e) {
|
||||
return e && e.__esModule ? e : { default: e }
|
||||
}
|
||||
Object.defineProperty(t, "__esModule", { value: !0 }), (t.install = t.codemirror = t.CodeMirror = void 0)
|
||||
var o = n(0),
|
||||
i = r(o),
|
||||
s = n(2),
|
||||
c = r(s),
|
||||
a = window.CodeMirror || i.default,
|
||||
u = function (e, t) {
|
||||
t &&
|
||||
(t.options &&
|
||||
(c.default.props.globalOptions.default = function () {
|
||||
return t.options
|
||||
}),
|
||||
t.events &&
|
||||
(c.default.props.globalEvents.default = function () {
|
||||
return t.events
|
||||
})),
|
||||
e.component(c.default.name, c.default)
|
||||
},
|
||||
l = { CodeMirror: a, codemirror: c.default, install: u }
|
||||
;(t.default = l), (t.CodeMirror = a), (t.codemirror = c.default), (t.install = u)
|
||||
},
|
||||
function (e, t) {
|
||||
e.exports = function (e, t, n, r, o, i) {
|
||||
var s,
|
||||
c = (e = e || {}),
|
||||
a = typeof e.default
|
||||
;("object" !== a && "function" !== a) || ((s = e), (c = e.default))
|
||||
var u = "function" == typeof c ? c.options : c
|
||||
t && ((u.render = t.render), (u.staticRenderFns = t.staticRenderFns), (u._compiled = !0)),
|
||||
n && (u.functional = !0),
|
||||
o && (u._scopeId = o)
|
||||
var l
|
||||
if (
|
||||
(i
|
||||
? ((l = function (e) {
|
||||
;(e =
|
||||
e ||
|
||||
(this.$vnode && this.$vnode.ssrContext) ||
|
||||
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext)),
|
||||
e || "undefined" == typeof __VUE_SSR_CONTEXT__ || (e = __VUE_SSR_CONTEXT__),
|
||||
r && r.call(this, e),
|
||||
e && e._registeredComponents && e._registeredComponents.add(i)
|
||||
}),
|
||||
(u._ssrRegister = l))
|
||||
: r && (l = r),
|
||||
l)
|
||||
) {
|
||||
var f = u.functional,
|
||||
d = f ? u.render : u.beforeCreate
|
||||
f
|
||||
? ((u._injectStyles = l),
|
||||
(u.render = function (e, t) {
|
||||
return l.call(t), d(e, t)
|
||||
}))
|
||||
: (u.beforeCreate = d ? [].concat(d, l) : [l])
|
||||
}
|
||||
return { esModule: s, exports: c, options: u }
|
||||
}
|
||||
},
|
||||
function (e, t, n) {
|
||||
"use strict"
|
||||
var r = function () {
|
||||
var e = this,
|
||||
t = e.$createElement,
|
||||
n = e._self._c || t
|
||||
return n("div", { staticClass: "vue-codemirror", class: { merge: e.merge } }, [
|
||||
e.merge
|
||||
? n("div", { ref: "mergeview" })
|
||||
: n("textarea", { ref: "textarea", attrs: { name: e.name, placeholder: e.placeholder } })
|
||||
])
|
||||
},
|
||||
o = [],
|
||||
i = { render: r, staticRenderFns: o }
|
||||
t.a = i
|
||||
}
|
||||
])
|
||||
})
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,139 @@
|
||||
;(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("element/locale/en_US", ["module", "exports"], factory)
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(module, exports)
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
}
|
||||
factory(mod, mod.exports)
|
||||
global.ELEMENT.lang = global.ELEMENT.lang || {}
|
||||
global.ELEMENT.lang.en_US = mod.exports
|
||||
}
|
||||
})(this, function (module, exports) {
|
||||
"use strict"
|
||||
|
||||
exports.__esModule = true
|
||||
exports.default = {
|
||||
el: {
|
||||
colorpicker: {
|
||||
confirm: "OK",
|
||||
clear: "Clear"
|
||||
},
|
||||
datepicker: {
|
||||
now: "Now",
|
||||
today: "Today",
|
||||
cancel: "Cancel",
|
||||
clear: "Clear",
|
||||
confirm: "OK",
|
||||
selectDate: "Select date",
|
||||
selectTime: "Select time",
|
||||
startDate: "Start Date",
|
||||
startTime: "Start Time",
|
||||
endDate: "End Date",
|
||||
endTime: "End Time",
|
||||
prevYear: "Previous Year",
|
||||
nextYear: "Next Year",
|
||||
prevMonth: "Previous Month",
|
||||
nextMonth: "Next Month",
|
||||
year: "",
|
||||
month1: "January",
|
||||
month2: "February",
|
||||
month3: "March",
|
||||
month4: "April",
|
||||
month5: "May",
|
||||
month6: "June",
|
||||
month7: "July",
|
||||
month8: "August",
|
||||
month9: "September",
|
||||
month10: "October",
|
||||
month11: "November",
|
||||
month12: "December",
|
||||
week: "week",
|
||||
weeks: {
|
||||
sun: "Sun",
|
||||
mon: "Mon",
|
||||
tue: "Tue",
|
||||
wed: "Wed",
|
||||
thu: "Thu",
|
||||
fri: "Fri",
|
||||
sat: "Sat"
|
||||
},
|
||||
months: {
|
||||
jan: "Jan",
|
||||
feb: "Feb",
|
||||
mar: "Mar",
|
||||
apr: "Apr",
|
||||
may: "May",
|
||||
jun: "Jun",
|
||||
jul: "Jul",
|
||||
aug: "Aug",
|
||||
sep: "Sep",
|
||||
oct: "Oct",
|
||||
nov: "Nov",
|
||||
dec: "Dec"
|
||||
}
|
||||
},
|
||||
select: {
|
||||
loading: "Loading",
|
||||
noMatch: "No matching data",
|
||||
noData: "No data",
|
||||
placeholder: "Select"
|
||||
},
|
||||
cascader: {
|
||||
noMatch: "No matching data",
|
||||
loading: "Loading",
|
||||
placeholder: "Select",
|
||||
noData: "No data"
|
||||
},
|
||||
pagination: {
|
||||
goto: "Go to",
|
||||
pagesize: "/page",
|
||||
total: "Total {total}",
|
||||
pageClassifier: ""
|
||||
},
|
||||
messagebox: {
|
||||
title: "Message",
|
||||
confirm: "OK",
|
||||
cancel: "Cancel",
|
||||
error: "Illegal input"
|
||||
},
|
||||
upload: {
|
||||
deleteTip: "press delete to remove",
|
||||
delete: "Delete",
|
||||
preview: "Preview",
|
||||
continue: "Continue"
|
||||
},
|
||||
table: {
|
||||
emptyText: "No Data",
|
||||
confirmFilter: "Confirm",
|
||||
resetFilter: "Reset",
|
||||
clearFilter: "All",
|
||||
sumText: "Sum"
|
||||
},
|
||||
tree: {
|
||||
emptyText: "No Data"
|
||||
},
|
||||
transfer: {
|
||||
noMatch: "No matching data",
|
||||
noData: "No data",
|
||||
titles: ["List 1", "List 2"], // to be translated
|
||||
filterPlaceholder: "Enter keyword", // to be translated
|
||||
noCheckedFormat: "{total} items", // to be translated
|
||||
hasCheckedFormat: "{checked}/{total} checked" // to be translated
|
||||
},
|
||||
image: {
|
||||
error: "FAILED"
|
||||
},
|
||||
pageHeader: {
|
||||
title: "Back" // to be translated
|
||||
},
|
||||
popconfirm: {
|
||||
confirmButtonText: "Yes",
|
||||
cancelButtonText: "No"
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = exports["default"]
|
||||
})
|
||||
@@ -0,0 +1,139 @@
|
||||
;(function (global, factory) {
|
||||
if (typeof define === "function" && define.amd) {
|
||||
define("element/locale/zh_CN", ["module", "exports"], factory)
|
||||
} else if (typeof exports !== "undefined") {
|
||||
factory(module, exports)
|
||||
} else {
|
||||
var mod = {
|
||||
exports: {}
|
||||
}
|
||||
factory(mod, mod.exports)
|
||||
global.ELEMENT.lang = global.ELEMENT.lang || {}
|
||||
global.ELEMENT.lang.zh_CN = mod.exports
|
||||
}
|
||||
})(this, function (module, exports) {
|
||||
"use strict"
|
||||
|
||||
exports.__esModule = true
|
||||
exports.default = {
|
||||
el: {
|
||||
colorpicker: {
|
||||
confirm: "确定",
|
||||
clear: "清空"
|
||||
},
|
||||
datepicker: {
|
||||
now: "此刻",
|
||||
today: "今天",
|
||||
cancel: "取消",
|
||||
clear: "清空",
|
||||
confirm: "确定",
|
||||
selectDate: "选择日期",
|
||||
selectTime: "选择时间",
|
||||
startDate: "开始日期",
|
||||
startTime: "开始时间",
|
||||
endDate: "结束日期",
|
||||
endTime: "结束时间",
|
||||
prevYear: "前一年",
|
||||
nextYear: "后一年",
|
||||
prevMonth: "上个月",
|
||||
nextMonth: "下个月",
|
||||
year: "年",
|
||||
month1: "1 月",
|
||||
month2: "2 月",
|
||||
month3: "3 月",
|
||||
month4: "4 月",
|
||||
month5: "5 月",
|
||||
month6: "6 月",
|
||||
month7: "7 月",
|
||||
month8: "8 月",
|
||||
month9: "9 月",
|
||||
month10: "10 月",
|
||||
month11: "11 月",
|
||||
month12: "12 月",
|
||||
// week: '周次',
|
||||
weeks: {
|
||||
sun: "日",
|
||||
mon: "一",
|
||||
tue: "二",
|
||||
wed: "三",
|
||||
thu: "四",
|
||||
fri: "五",
|
||||
sat: "六"
|
||||
},
|
||||
months: {
|
||||
jan: "一月",
|
||||
feb: "二月",
|
||||
mar: "三月",
|
||||
apr: "四月",
|
||||
may: "五月",
|
||||
jun: "六月",
|
||||
jul: "七月",
|
||||
aug: "八月",
|
||||
sep: "九月",
|
||||
oct: "十月",
|
||||
nov: "十一月",
|
||||
dec: "十二月"
|
||||
}
|
||||
},
|
||||
select: {
|
||||
loading: "加载中",
|
||||
noMatch: "无匹配数据",
|
||||
noData: "无数据",
|
||||
placeholder: "请选择"
|
||||
},
|
||||
cascader: {
|
||||
noMatch: "无匹配数据",
|
||||
loading: "加载中",
|
||||
placeholder: "请选择",
|
||||
noData: "暂无数据"
|
||||
},
|
||||
pagination: {
|
||||
goto: "前往",
|
||||
pagesize: "条/页",
|
||||
total: "共 {total} 条",
|
||||
pageClassifier: "页"
|
||||
},
|
||||
messagebox: {
|
||||
title: "提示",
|
||||
confirm: "确定",
|
||||
cancel: "取消",
|
||||
error: "输入的数据不合法!"
|
||||
},
|
||||
upload: {
|
||||
deleteTip: "按 delete 键可删除",
|
||||
delete: "删除",
|
||||
preview: "查看图片",
|
||||
continue: "继续上传"
|
||||
},
|
||||
table: {
|
||||
emptyText: "暂无数据",
|
||||
confirmFilter: "筛选",
|
||||
resetFilter: "重置",
|
||||
clearFilter: "全部",
|
||||
sumText: "合计"
|
||||
},
|
||||
tree: {
|
||||
emptyText: "暂无数据"
|
||||
},
|
||||
transfer: {
|
||||
noMatch: "无匹配数据",
|
||||
noData: "无数据",
|
||||
titles: ["列表 1", "列表 2"],
|
||||
filterPlaceholder: "请输入搜索内容",
|
||||
noCheckedFormat: "共 {total} 项",
|
||||
hasCheckedFormat: "已选 {checked}/{total} 项"
|
||||
},
|
||||
image: {
|
||||
error: "加载失败"
|
||||
},
|
||||
pageHeader: {
|
||||
title: "返回"
|
||||
},
|
||||
popconfirm: {
|
||||
confirmButtonText: "确定",
|
||||
cancelButtonText: "取消"
|
||||
}
|
||||
}
|
||||
}
|
||||
module.exports = exports["default"]
|
||||
})
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
BIN
Binary file not shown.
BIN
Binary file not shown.
File diff suppressed because one or more lines are too long
+13205
File diff suppressed because it is too large
Load Diff
+115
@@ -0,0 +1,115 @@
|
||||
@charset "UTF-8";
|
||||
/* 数据量大与遮罩交互冲突优化 */
|
||||
.v-modal.v-modal-leave {
|
||||
display: none;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-corner {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-thumb {
|
||||
border-radius: 6px;
|
||||
border: 2px solid transparent;
|
||||
background-color: var(--scrollbar-background-color);
|
||||
background-clip: padding-box;
|
||||
}
|
||||
|
||||
::-webkit-scrollbar-track {
|
||||
background: transparent;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.el-dialog__header {
|
||||
padding: 15px 20px 15px 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
border-bottom: 1px solid var(--border-color-lighter);
|
||||
}
|
||||
|
||||
.el-dialog__title {
|
||||
flex: 1;
|
||||
font-size: 16px;
|
||||
margin: 0;
|
||||
color: rgba(0, 0, 0, 0.88);
|
||||
font-weight: 600;
|
||||
line-height: 1.5;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.el-dialog__headerbtn{
|
||||
top: auto;
|
||||
right: auto;
|
||||
line-height: 1;
|
||||
font-size: 18px;
|
||||
position: static;
|
||||
}
|
||||
|
||||
.el-dialog__footer {
|
||||
padding-bottom: 12px;
|
||||
border-top: 1px solid var(--border-color-lighter);
|
||||
}
|
||||
|
||||
.el-table thead {
|
||||
color: var(--color-text-primary);
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.el-table td.el-table__cell div {
|
||||
color: var(--color-text-primary);
|
||||
}
|
||||
|
||||
.el-table th.el-table__cell{
|
||||
background: #FAFAFA;
|
||||
}
|
||||
|
||||
.el-card {
|
||||
border: none;
|
||||
}
|
||||
|
||||
.el-card + .el-card {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.el-message:not(.ele-message-border){
|
||||
background: var(--popover-background-color);
|
||||
-webkit-box-shadow: var(--box-shadow-light);
|
||||
box-shadow: var(--box-shadow-light);
|
||||
border-radius: 2px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.el-message {
|
||||
min-width: auto;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
.el-message .el-message__icon {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.el-message .el-icon-success {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
.el-message:not(.ele-message-border) .el-message__content {
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.el-message .el-message__content {
|
||||
line-height: 18px;
|
||||
}
|
||||
|
||||
.el-button{
|
||||
border-radius: 2px;
|
||||
}
|
||||
|
||||
.el-descriptions .is-bordered{
|
||||
table-layout: fixed;!important;
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
+12
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
+5
File diff suppressed because one or more lines are too long
+11
File diff suppressed because one or more lines are too long
@@ -0,0 +1,208 @@
|
||||
/*!
|
||||
* FullCalendar v3.6.1 Print Stylesheet
|
||||
* Docs & License: https://fullcalendar.io/
|
||||
* (c) 2017 Adam Shaw
|
||||
*/
|
||||
|
||||
/*
|
||||
* Include this stylesheet on your page to get a more printer-friendly calendar.
|
||||
* When including this stylesheet, use the media='print' attribute of the <link> tag.
|
||||
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
|
||||
*/
|
||||
|
||||
.fc {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
|
||||
/* Global Event Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-event {
|
||||
background: #fff !important;
|
||||
color: #000 !important;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
.fc-event .fc-resizer {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
||||
/* Table & Day-Row Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc th,
|
||||
.fc td,
|
||||
.fc hr,
|
||||
.fc thead,
|
||||
.fc tbody,
|
||||
.fc-row {
|
||||
border-color: #ccc !important;
|
||||
background: #fff !important;
|
||||
}
|
||||
|
||||
/* kill the overlaid, absolutely-positioned components */
|
||||
/* common... */
|
||||
.fc-bg,
|
||||
.fc-bgevent-skeleton,
|
||||
.fc-highlight-skeleton,
|
||||
.fc-helper-skeleton,
|
||||
/* for timegrid. within cells within table skeletons... */
|
||||
.fc-bgevent-container,
|
||||
.fc-business-container,
|
||||
.fc-highlight-container,
|
||||
.fc-helper-container {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't force a min-height on rows (for DayGrid) */
|
||||
.fc tbody .fc-row {
|
||||
height: auto !important; /* undo height that JS set in distributeHeight */
|
||||
min-height: 0 !important; /* undo the min-height from each view's specific stylesheet */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton {
|
||||
position: static; /* undo .fc-rigid */
|
||||
padding-bottom: 0 !important; /* use a more border-friendly method for this... */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton tbody tr:last-child td { /* only works in newer browsers */
|
||||
padding-bottom: 1em; /* ...gives space within the skeleton. also ensures min height in a way */
|
||||
}
|
||||
|
||||
.fc tbody .fc-row .fc-content-skeleton table {
|
||||
/* provides a min-height for the row, but only effective for IE, which exaggerates this value,
|
||||
making it look more like 3em. for other browers, it will already be this tall */
|
||||
height: 1em;
|
||||
}
|
||||
|
||||
|
||||
/* Undo month-view event limiting. Display all events and hide the "more" links
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-more-cell,
|
||||
.fc-more {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.fc tr.fc-limited {
|
||||
display: table-row !important;
|
||||
}
|
||||
|
||||
.fc td.fc-limited {
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.fc-popover {
|
||||
display: none; /* never display the "more.." popover in print mode */
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* undo the min-height 100% trick used to fill the container's height */
|
||||
.fc-time-grid {
|
||||
min-height: 0 !important;
|
||||
}
|
||||
|
||||
/* don't display the side axis at all ("all-day" and time cells) */
|
||||
.fc-agenda-view .fc-axis {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* don't display the horizontal lines */
|
||||
.fc-slats,
|
||||
.fc-time-grid hr { /* this hr is used when height is underused and needs to be filled */
|
||||
display: none !important; /* important overrides inline declaration */
|
||||
}
|
||||
|
||||
/* let the container that holds the events be naturally positioned and create real height */
|
||||
.fc-time-grid .fc-content-skeleton {
|
||||
position: static;
|
||||
}
|
||||
|
||||
/* in case there are no events, we still want some height */
|
||||
.fc-time-grid .fc-content-skeleton table {
|
||||
height: 4em;
|
||||
}
|
||||
|
||||
/* kill the horizontal spacing made by the event container. event margins will be done below */
|
||||
.fc-time-grid .fc-event-container {
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* TimeGrid *Event* Restyling
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* naturally position events, vertically stacking them */
|
||||
.fc-time-grid .fc-event {
|
||||
position: static !important;
|
||||
margin: 3px 2px !important;
|
||||
}
|
||||
|
||||
/* for events that continue to a future day, give the bottom border back */
|
||||
.fc-time-grid .fc-event.fc-not-end {
|
||||
border-bottom-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event continues via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-end:after {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* for events that are continuations from previous days, give the top border back */
|
||||
.fc-time-grid .fc-event.fc-not-start {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
/* indicate the event is a continuation via "..." text */
|
||||
.fc-time-grid .fc-event.fc-not-start:before {
|
||||
content: "...";
|
||||
}
|
||||
|
||||
/* time */
|
||||
|
||||
/* undo a previous declaration and let the time text span to a second line */
|
||||
.fc-time-grid .fc-event .fc-time {
|
||||
white-space: normal !important;
|
||||
}
|
||||
|
||||
/* hide the the time that is normally displayed... */
|
||||
.fc-time-grid .fc-event .fc-time span {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* ...replace it with a more verbose version (includes AM/PM) stored in an html attribute */
|
||||
.fc-time-grid .fc-event .fc-time:after {
|
||||
content: attr(data-full);
|
||||
}
|
||||
|
||||
|
||||
/* Vertical Scroller & Containers
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
/* kill the scrollbars and allow natural height */
|
||||
.fc-scroller,
|
||||
.fc-day-grid-container, /* these divs might be assigned height, which we need to cleared */
|
||||
.fc-time-grid-container { /* */
|
||||
overflow: visible !important;
|
||||
height: auto !important;
|
||||
}
|
||||
|
||||
/* kill the horizontal border/padding used to compensate for scrollbars */
|
||||
.fc-row {
|
||||
border: 0 !important;
|
||||
margin: 0 !important;
|
||||
}
|
||||
|
||||
|
||||
/* Button Controls
|
||||
--------------------------------------------------------------------------------------------------*/
|
||||
|
||||
.fc-button-group,
|
||||
.fc button {
|
||||
display: none; /* don't display any button-related controls */
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
+1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,195 @@
|
||||
.lf-graph {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
z-index: 0;
|
||||
background: #ffffff;
|
||||
user-select: none;
|
||||
}
|
||||
.lf-element-text {
|
||||
cursor: text;
|
||||
}
|
||||
.lf-text-disabled {
|
||||
pointer-events: none;
|
||||
}
|
||||
.lf-text-draggable {
|
||||
cursor: move;
|
||||
}
|
||||
.lf-node-anchor {
|
||||
cursor: crosshair;
|
||||
}
|
||||
.lf-node-anchor-hover {
|
||||
visibility: hidden;
|
||||
}
|
||||
.lf-anchor:hover .lf-node-anchor-hover {
|
||||
visibility: visible;
|
||||
}
|
||||
.lf-edge.pointer-none {
|
||||
pointer-events: none;
|
||||
}
|
||||
.lf-edge-append {
|
||||
cursor: pointer;
|
||||
}
|
||||
.lf-edge-animation {
|
||||
stroke-dashoffset: 100%;
|
||||
animation: lf_animate_dash 5s linear infinite;
|
||||
}
|
||||
@keyframes lf_animate_dash {
|
||||
to {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
}
|
||||
/* node */
|
||||
.lf-node-not-allow {
|
||||
cursor: not-allowed;
|
||||
}
|
||||
|
||||
.lf-polyline-append-ns-resize {
|
||||
cursor: ns-resize;
|
||||
}
|
||||
.lf-polyline-append-ew-resize {
|
||||
cursor: ew-resize;
|
||||
}
|
||||
.lf-dragging {
|
||||
cursor: grabbing;
|
||||
}
|
||||
.lf-drag-able {
|
||||
cursor: default;
|
||||
}
|
||||
.lf-bezier-adjust-anchor {
|
||||
cursor: pointer;
|
||||
}
|
||||
/* background */
|
||||
.lf-background,
|
||||
.lf-grid {
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: -1;
|
||||
}
|
||||
.lf-background-area {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
/* html-overlay */
|
||||
.lf-html-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
user-select: none;
|
||||
}
|
||||
.lf-html-overlay__transform > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
|
||||
.lf-text-editable {
|
||||
pointer-events: all;
|
||||
}
|
||||
.lf-text-input {
|
||||
text-align: center;
|
||||
outline: none;
|
||||
position: absolute;
|
||||
border: 1px solid #edefed;
|
||||
box-sizing: border-box;
|
||||
line-height: 1.2;
|
||||
border-radius: 3px;
|
||||
resize: none;
|
||||
padding: 5px;
|
||||
min-height: 20px;
|
||||
min-width: 100px;
|
||||
white-space: pre;
|
||||
background: #fff;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
.lf-get-text-height {
|
||||
display: inline-block;
|
||||
word-break: break-all;
|
||||
/* 为了跟输入效果保持一致,设置透明边框占位 */
|
||||
border: 1px solid transparent;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.lf-node-text-auto-wrap {
|
||||
box-sizing: border-box;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
/* border: 1px solid transparent; */
|
||||
}
|
||||
.lf-node-text-auto-wrap-content {
|
||||
line-height: 1.2;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
word-break: break-all;
|
||||
width: 100%;
|
||||
}
|
||||
.lf-node-text-ellipsis-content {
|
||||
line-height: 1.2;
|
||||
background: transparent;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
/* overflow: hidden;
|
||||
text-overflow: ellipsis; */
|
||||
width: 100%;
|
||||
}
|
||||
.lf-node-text-ellipsis-content>div{
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* tool-overlay */
|
||||
.lf-tool-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 2;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.lf-tool-overlay > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
/* modification-overlay */
|
||||
|
||||
.modification-overlay {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
z-index: 1;
|
||||
pointer-events: none;
|
||||
overflow: hidden;
|
||||
}
|
||||
.modification-overlay > * {
|
||||
pointer-events: all;
|
||||
}
|
||||
.lf-outline,.lf-snapline {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.lf-keyboard-tips {
|
||||
float: right;
|
||||
}
|
||||
.lf-node-select-decorate {
|
||||
transform: translate(-50%, -50%);
|
||||
pointer-events: none;
|
||||
border: 1px dashed #343435;
|
||||
position: absolute;
|
||||
}
|
||||
.lf-multiple-select {
|
||||
position: absolute;
|
||||
border: 2px dashed rgba(24, 125, 255, 0.8);
|
||||
box-shadow: 0px 0px 3px 0px rgba(24, 125, 255, 0.5);
|
||||
cursor: move;
|
||||
}
|
||||
.lf-edge-adjust-point {
|
||||
cursor: move;
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -0,0 +1,634 @@
|
||||
(function (global, factory) {
|
||||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
||||
typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
||||
(factory((global.MinDash = {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
/**
|
||||
* Flatten array, one level deep.
|
||||
*
|
||||
* @param {Array<?>} arr
|
||||
*
|
||||
* @return {Array<?>}
|
||||
*/
|
||||
function flatten(arr) {
|
||||
return Array.prototype.concat.apply([], arr);
|
||||
}
|
||||
|
||||
var nativeToString = Object.prototype.toString;
|
||||
var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
function isUndefined(obj) {
|
||||
return obj === undefined;
|
||||
}
|
||||
function isDefined(obj) {
|
||||
return obj !== undefined;
|
||||
}
|
||||
function isNil(obj) {
|
||||
return obj == null;
|
||||
}
|
||||
function isArray(obj) {
|
||||
return nativeToString.call(obj) === '[object Array]';
|
||||
}
|
||||
function isObject(obj) {
|
||||
return nativeToString.call(obj) === '[object Object]';
|
||||
}
|
||||
function isNumber(obj) {
|
||||
return nativeToString.call(obj) === '[object Number]';
|
||||
}
|
||||
function isFunction(obj) {
|
||||
var tag = nativeToString.call(obj);
|
||||
return tag === '[object Function]' || tag === '[object AsyncFunction]' || tag === '[object GeneratorFunction]' || tag === '[object AsyncGeneratorFunction]' || tag === '[object Proxy]';
|
||||
}
|
||||
function isString(obj) {
|
||||
return nativeToString.call(obj) === '[object String]';
|
||||
}
|
||||
/**
|
||||
* Ensure collection is an array.
|
||||
*
|
||||
* @param {Object} obj
|
||||
*/
|
||||
|
||||
function ensureArray(obj) {
|
||||
if (isArray(obj)) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new Error('must supply array');
|
||||
}
|
||||
/**
|
||||
* Return true, if target owns a property with the given key.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {String} key
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
function has(target, key) {
|
||||
return nativeHasOwnProperty.call(target, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Find element in collection.
|
||||
*
|
||||
* @param {Array|Object} collection
|
||||
* @param {Function|Object} matcher
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
function find(collection, matcher) {
|
||||
matcher = toMatcher(matcher);
|
||||
var match;
|
||||
forEach(collection, function (val, key) {
|
||||
if (matcher(val, key)) {
|
||||
match = val;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return match;
|
||||
}
|
||||
/**
|
||||
* Find element index in collection.
|
||||
*
|
||||
* @param {Array|Object} collection
|
||||
* @param {Function} matcher
|
||||
*
|
||||
* @return {Object}
|
||||
*/
|
||||
|
||||
function findIndex(collection, matcher) {
|
||||
matcher = toMatcher(matcher);
|
||||
var idx = isArray(collection) ? -1 : undefined;
|
||||
forEach(collection, function (val, key) {
|
||||
if (matcher(val, key)) {
|
||||
idx = key;
|
||||
return false;
|
||||
}
|
||||
});
|
||||
return idx;
|
||||
}
|
||||
/**
|
||||
* Find element in collection.
|
||||
*
|
||||
* @param {Array|Object} collection
|
||||
* @param {Function} matcher
|
||||
*
|
||||
* @return {Array} result
|
||||
*/
|
||||
|
||||
function filter(collection, matcher) {
|
||||
var result = [];
|
||||
forEach(collection, function (val, key) {
|
||||
if (matcher(val, key)) {
|
||||
result.push(val);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Iterate over collection; returning something
|
||||
* (non-undefined) will stop iteration.
|
||||
*
|
||||
* @param {Array|Object} collection
|
||||
* @param {Function} iterator
|
||||
*
|
||||
* @return {Object} return result that stopped the iteration
|
||||
*/
|
||||
|
||||
function forEach(collection, iterator) {
|
||||
var val, result;
|
||||
|
||||
if (isUndefined(collection)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var convertKey = isArray(collection) ? toNum : identity;
|
||||
|
||||
for (var key in collection) {
|
||||
if (has(collection, key)) {
|
||||
val = collection[key];
|
||||
result = iterator(val, convertKey(key));
|
||||
|
||||
if (result === false) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Return collection without element.
|
||||
*
|
||||
* @param {Array} arr
|
||||
* @param {Function} matcher
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function without(arr, matcher) {
|
||||
if (isUndefined(arr)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
ensureArray(arr);
|
||||
matcher = toMatcher(matcher);
|
||||
return arr.filter(function (el, idx) {
|
||||
return !matcher(el, idx);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Reduce collection, returning a single result.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {Function} iterator
|
||||
* @param {Any} result
|
||||
*
|
||||
* @return {Any} result returned from last iterator
|
||||
*/
|
||||
|
||||
function reduce(collection, iterator, result) {
|
||||
forEach(collection, function (value, idx) {
|
||||
result = iterator(result, value, idx);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Return true if every element in the collection
|
||||
* matches the criteria.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {Function} matcher
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
function every(collection, matcher) {
|
||||
return !!reduce(collection, function (matches, val, key) {
|
||||
return matches && matcher(val, key);
|
||||
}, true);
|
||||
}
|
||||
/**
|
||||
* Return true if some elements in the collection
|
||||
* match the criteria.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {Function} matcher
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
|
||||
function some(collection, matcher) {
|
||||
return !!find(collection, matcher);
|
||||
}
|
||||
/**
|
||||
* Transform a collection into another collection
|
||||
* by piping each member through the given fn.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {Function} fn
|
||||
*
|
||||
* @return {Array} transformed collection
|
||||
*/
|
||||
|
||||
function map(collection, fn) {
|
||||
var result = [];
|
||||
forEach(collection, function (val, key) {
|
||||
result.push(fn(val, key));
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Get the collections keys.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function keys(collection) {
|
||||
return collection && Object.keys(collection) || [];
|
||||
}
|
||||
/**
|
||||
* Shorthand for `keys(o).length`.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
*
|
||||
* @return {Number}
|
||||
*/
|
||||
|
||||
function size(collection) {
|
||||
return keys(collection).length;
|
||||
}
|
||||
/**
|
||||
* Get the values in the collection.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function values(collection) {
|
||||
return map(collection, function (val) {
|
||||
return val;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Group collection members by attribute.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {Function} extractor
|
||||
*
|
||||
* @return {Object} map with { attrValue => [ a, b, c ] }
|
||||
*/
|
||||
|
||||
function groupBy(collection, extractor) {
|
||||
var grouped = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
extractor = toExtractor(extractor);
|
||||
forEach(collection, function (val) {
|
||||
var discriminator = extractor(val) || '_';
|
||||
var group = grouped[discriminator];
|
||||
|
||||
if (!group) {
|
||||
group = grouped[discriminator] = [];
|
||||
}
|
||||
|
||||
group.push(val);
|
||||
});
|
||||
return grouped;
|
||||
}
|
||||
function uniqueBy(extractor) {
|
||||
extractor = toExtractor(extractor);
|
||||
var grouped = {};
|
||||
|
||||
for (var _len = arguments.length, collections = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
collections[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
forEach(collections, function (c) {
|
||||
return groupBy(c, extractor, grouped);
|
||||
});
|
||||
var result = map(grouped, function (val, key) {
|
||||
return val[0];
|
||||
});
|
||||
return result;
|
||||
}
|
||||
var unionBy = uniqueBy;
|
||||
/**
|
||||
* Sort collection by criteria.
|
||||
*
|
||||
* @param {Object|Array} collection
|
||||
* @param {String|Function} extractor
|
||||
*
|
||||
* @return {Array}
|
||||
*/
|
||||
|
||||
function sortBy(collection, extractor) {
|
||||
extractor = toExtractor(extractor);
|
||||
var sorted = [];
|
||||
forEach(collection, function (value, key) {
|
||||
var disc = extractor(value, key);
|
||||
var entry = {
|
||||
d: disc,
|
||||
v: value
|
||||
};
|
||||
|
||||
for (var idx = 0; idx < sorted.length; idx++) {
|
||||
var d = sorted[idx].d;
|
||||
|
||||
if (disc < d) {
|
||||
sorted.splice(idx, 0, entry);
|
||||
return;
|
||||
}
|
||||
} // not inserted, append (!)
|
||||
|
||||
|
||||
sorted.push(entry);
|
||||
});
|
||||
return map(sorted, function (e) {
|
||||
return e.v;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Create an object pattern matcher.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
* const matcher = matchPattern({ id: 1 });
|
||||
*
|
||||
* var element = find(elements, matcher);
|
||||
*
|
||||
* @param {Object} pattern
|
||||
*
|
||||
* @return {Function} matcherFn
|
||||
*/
|
||||
|
||||
function matchPattern(pattern) {
|
||||
return function (el) {
|
||||
return every(pattern, function (val, key) {
|
||||
return el[key] === val;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function toExtractor(extractor) {
|
||||
return isFunction(extractor) ? extractor : function (e) {
|
||||
return e[extractor];
|
||||
};
|
||||
}
|
||||
|
||||
function toMatcher(matcher) {
|
||||
return isFunction(matcher) ? matcher : function (e) {
|
||||
return e === matcher;
|
||||
};
|
||||
}
|
||||
|
||||
function identity(arg) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
function toNum(arg) {
|
||||
return Number(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Debounce fn, calling it only once if
|
||||
* the given time elapsed between calls.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @param {Number} timeout
|
||||
*
|
||||
* @return {Function} debounced function
|
||||
*/
|
||||
function debounce(fn, timeout) {
|
||||
var timer;
|
||||
var lastArgs;
|
||||
var lastThis;
|
||||
var lastNow;
|
||||
|
||||
function fire() {
|
||||
var now = Date.now();
|
||||
var scheduledDiff = lastNow + timeout - now;
|
||||
|
||||
if (scheduledDiff > 0) {
|
||||
return schedule(scheduledDiff);
|
||||
}
|
||||
|
||||
fn.apply(lastThis, lastArgs);
|
||||
timer = lastNow = lastArgs = lastThis = undefined;
|
||||
}
|
||||
|
||||
function schedule(timeout) {
|
||||
timer = setTimeout(fire, timeout);
|
||||
}
|
||||
|
||||
return function () {
|
||||
lastNow = Date.now();
|
||||
|
||||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||||
args[_key] = arguments[_key];
|
||||
}
|
||||
|
||||
lastArgs = args;
|
||||
lastThis = this; // ensure an execution is scheduled
|
||||
|
||||
if (!timer) {
|
||||
schedule(timeout);
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Throttle fn, calling at most once
|
||||
* in the given interval.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @param {Number} interval
|
||||
*
|
||||
* @return {Function} throttled function
|
||||
*/
|
||||
|
||||
function throttle(fn, interval) {
|
||||
var throttling = false;
|
||||
return function () {
|
||||
if (throttling) {
|
||||
return;
|
||||
}
|
||||
|
||||
fn.apply(void 0, arguments);
|
||||
throttling = true;
|
||||
setTimeout(function () {
|
||||
throttling = false;
|
||||
}, interval);
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Bind function against target <this>.
|
||||
*
|
||||
* @param {Function} fn
|
||||
* @param {Object} target
|
||||
*
|
||||
* @return {Function} bound function
|
||||
*/
|
||||
|
||||
function bind(fn, target) {
|
||||
return fn.bind(target);
|
||||
}
|
||||
|
||||
function _extends() {
|
||||
_extends = Object.assign || function (target) {
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
var source = arguments[i];
|
||||
|
||||
for (var key in source) {
|
||||
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
||||
target[key] = source[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
};
|
||||
|
||||
return _extends.apply(this, arguments);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convenience wrapper for `Object.assign`.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {...Object} others
|
||||
*
|
||||
* @return {Object} the target
|
||||
*/
|
||||
|
||||
function assign(target) {
|
||||
for (var _len = arguments.length, others = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||||
others[_key - 1] = arguments[_key];
|
||||
}
|
||||
|
||||
return _extends.apply(void 0, [target].concat(others));
|
||||
}
|
||||
/**
|
||||
* Pick given properties from the target object.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {Array} properties
|
||||
*
|
||||
* @return {Object} target
|
||||
*/
|
||||
|
||||
function pick(target, properties) {
|
||||
var result = {};
|
||||
var obj = Object(target);
|
||||
forEach(properties, function (prop) {
|
||||
if (prop in obj) {
|
||||
result[prop] = target[prop];
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Pick all target properties, excluding the given ones.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {Array} properties
|
||||
*
|
||||
* @return {Object} target
|
||||
*/
|
||||
|
||||
function omit(target, properties) {
|
||||
var result = {};
|
||||
var obj = Object(target);
|
||||
forEach(obj, function (prop, key) {
|
||||
if (properties.indexOf(key) === -1) {
|
||||
result[key] = prop;
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Recursively merge `...sources` into given target.
|
||||
*
|
||||
* Does support merging objects; does not support merging arrays.
|
||||
*
|
||||
* @param {Object} target
|
||||
* @param {...Object} sources
|
||||
*
|
||||
* @return {Object} the target
|
||||
*/
|
||||
|
||||
function merge(target) {
|
||||
for (var _len2 = arguments.length, sources = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
||||
sources[_key2 - 1] = arguments[_key2];
|
||||
}
|
||||
|
||||
if (!sources.length) {
|
||||
return target;
|
||||
}
|
||||
|
||||
forEach(sources, function (source) {
|
||||
// skip non-obj sources, i.e. null
|
||||
if (!source || !isObject(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
forEach(source, function (sourceVal, key) {
|
||||
if (key === '__proto__') {
|
||||
return;
|
||||
}
|
||||
|
||||
var targetVal = target[key];
|
||||
|
||||
if (isObject(sourceVal)) {
|
||||
if (!isObject(targetVal)) {
|
||||
// override target[key] with object
|
||||
targetVal = {};
|
||||
}
|
||||
|
||||
target[key] = merge(targetVal, sourceVal);
|
||||
} else {
|
||||
target[key] = sourceVal;
|
||||
}
|
||||
});
|
||||
});
|
||||
return target;
|
||||
}
|
||||
|
||||
exports.flatten = flatten;
|
||||
exports.find = find;
|
||||
exports.findIndex = findIndex;
|
||||
exports.filter = filter;
|
||||
exports.forEach = forEach;
|
||||
exports.without = without;
|
||||
exports.reduce = reduce;
|
||||
exports.every = every;
|
||||
exports.some = some;
|
||||
exports.map = map;
|
||||
exports.keys = keys;
|
||||
exports.size = size;
|
||||
exports.values = values;
|
||||
exports.groupBy = groupBy;
|
||||
exports.uniqueBy = uniqueBy;
|
||||
exports.unionBy = unionBy;
|
||||
exports.sortBy = sortBy;
|
||||
exports.matchPattern = matchPattern;
|
||||
exports.debounce = debounce;
|
||||
exports.throttle = throttle;
|
||||
exports.bind = bind;
|
||||
exports.isUndefined = isUndefined;
|
||||
exports.isDefined = isDefined;
|
||||
exports.isNil = isNil;
|
||||
exports.isArray = isArray;
|
||||
exports.isObject = isObject;
|
||||
exports.isNumber = isNumber;
|
||||
exports.isFunction = isFunction;
|
||||
exports.isString = isString;
|
||||
exports.ensureArray = ensureArray;
|
||||
exports.has = has;
|
||||
exports.assign = assign;
|
||||
exports.pick = pick;
|
||||
exports.omit = omit;
|
||||
exports.merge = merge;
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,72 @@
|
||||
#nprogress {
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
#nprogress .bar {
|
||||
background: #29d;
|
||||
|
||||
position: fixed;
|
||||
z-index: 1031;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
width: 100%;
|
||||
height: 2px;
|
||||
}
|
||||
|
||||
/* Fancy blur effect */
|
||||
#nprogress .peg {
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
width: 100px;
|
||||
height: 100%;
|
||||
box-shadow: 0 0 10px #29d, 0 0 5px #29d;
|
||||
opacity: 1.0;
|
||||
|
||||
-webkit-transform: rotate(3deg) translate(0px, -4px);
|
||||
-ms-transform: rotate(3deg) translate(0px, -4px);
|
||||
transform: rotate(3deg) translate(0px, -4px);
|
||||
}
|
||||
|
||||
/* Remove these to get rid of the spinner */
|
||||
#nprogress .spinner {
|
||||
display: block;
|
||||
position: fixed;
|
||||
z-index: 1031;
|
||||
top: 15px;
|
||||
right: 15px;
|
||||
}
|
||||
|
||||
#nprogress .spinner-icon {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
box-sizing: border-box;
|
||||
|
||||
border: solid 2px transparent;
|
||||
border-top-color: #29d;
|
||||
border-left-color: #29d;
|
||||
border-radius: 50%;
|
||||
|
||||
-webkit-animation: nprogress-spinner 400ms linear infinite;
|
||||
animation: nprogress-spinner 400ms linear infinite;
|
||||
}
|
||||
|
||||
.nprogress-custom-parent {
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.nprogress-custom-parent #nprogress .spinner,
|
||||
.nprogress-custom-parent #nprogress .bar {
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
@-webkit-keyframes nprogress-spinner {
|
||||
0% { -webkit-transform: rotate(0deg); }
|
||||
100% { -webkit-transform: rotate(360deg); }
|
||||
}
|
||||
@keyframes nprogress-spinner {
|
||||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
@@ -0,0 +1,475 @@
|
||||
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
|
||||
* @license MIT */
|
||||
|
||||
;(function(root, factory) {
|
||||
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
define(factory);
|
||||
} else if (typeof exports === 'object') {
|
||||
module.exports = factory();
|
||||
} else {
|
||||
root.NProgress = factory();
|
||||
}
|
||||
|
||||
})(this, function() {
|
||||
var NProgress = {};
|
||||
|
||||
NProgress.version = '0.2.0';
|
||||
|
||||
var Settings = NProgress.settings = {
|
||||
minimum: 0.08,
|
||||
easing: 'ease',
|
||||
positionUsing: '',
|
||||
speed: 200,
|
||||
trickle: true,
|
||||
trickleRate: 0.02,
|
||||
trickleSpeed: 800,
|
||||
showSpinner: true,
|
||||
barSelector: '[role="bar"]',
|
||||
spinnerSelector: '[role="spinner"]',
|
||||
parent: 'body',
|
||||
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
|
||||
};
|
||||
|
||||
/**
|
||||
* Updates configuration.
|
||||
*
|
||||
* NProgress.configure({
|
||||
* minimum: 0.1
|
||||
* });
|
||||
*/
|
||||
NProgress.configure = function(options) {
|
||||
var key, value;
|
||||
for (key in options) {
|
||||
value = options[key];
|
||||
if (value !== undefined && options.hasOwnProperty(key)) Settings[key] = value;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Last number.
|
||||
*/
|
||||
|
||||
NProgress.status = null;
|
||||
|
||||
/**
|
||||
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
|
||||
*
|
||||
* NProgress.set(0.4);
|
||||
* NProgress.set(1.0);
|
||||
*/
|
||||
|
||||
NProgress.set = function(n) {
|
||||
var started = NProgress.isStarted();
|
||||
|
||||
n = clamp(n, Settings.minimum, 1);
|
||||
NProgress.status = (n === 1 ? null : n);
|
||||
|
||||
var progress = NProgress.render(!started),
|
||||
bar = progress.querySelector(Settings.barSelector),
|
||||
speed = Settings.speed,
|
||||
ease = Settings.easing;
|
||||
|
||||
progress.offsetWidth; /* Repaint */
|
||||
|
||||
queue(function(next) {
|
||||
// Set positionUsing if it hasn't already been set
|
||||
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
|
||||
|
||||
// Add transition
|
||||
css(bar, barPositionCSS(n, speed, ease));
|
||||
|
||||
if (n === 1) {
|
||||
// Fade out
|
||||
css(progress, {
|
||||
transition: 'none',
|
||||
opacity: 1
|
||||
});
|
||||
progress.offsetWidth; /* Repaint */
|
||||
|
||||
setTimeout(function() {
|
||||
css(progress, {
|
||||
transition: 'all ' + speed + 'ms linear',
|
||||
opacity: 0
|
||||
});
|
||||
setTimeout(function() {
|
||||
NProgress.remove();
|
||||
next();
|
||||
}, speed);
|
||||
}, speed);
|
||||
} else {
|
||||
setTimeout(next, speed);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
NProgress.isStarted = function() {
|
||||
return typeof NProgress.status === 'number';
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows the progress bar.
|
||||
* This is the same as setting the status to 0%, except that it doesn't go backwards.
|
||||
*
|
||||
* NProgress.start();
|
||||
*
|
||||
*/
|
||||
NProgress.start = function() {
|
||||
if (!NProgress.status) NProgress.set(0);
|
||||
|
||||
var work = function() {
|
||||
setTimeout(function() {
|
||||
if (!NProgress.status) return;
|
||||
NProgress.trickle();
|
||||
work();
|
||||
}, Settings.trickleSpeed);
|
||||
};
|
||||
|
||||
if (Settings.trickle) work();
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* Hides the progress bar.
|
||||
* This is the *sort of* the same as setting the status to 100%, with the
|
||||
* difference being `done()` makes some placebo effect of some realistic motion.
|
||||
*
|
||||
* NProgress.done();
|
||||
*
|
||||
* If `true` is passed, it will show the progress bar even if its hidden.
|
||||
*
|
||||
* NProgress.done(true);
|
||||
*/
|
||||
|
||||
NProgress.done = function(force) {
|
||||
if (!force && !NProgress.status) return this;
|
||||
|
||||
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
|
||||
};
|
||||
|
||||
/**
|
||||
* Increments by a random amount.
|
||||
*/
|
||||
|
||||
NProgress.inc = function(amount) {
|
||||
var n = NProgress.status;
|
||||
|
||||
if (!n) {
|
||||
return NProgress.start();
|
||||
} else {
|
||||
if (typeof amount !== 'number') {
|
||||
amount = (1 - n) * clamp(Math.random() * n, 0.1, 0.95);
|
||||
}
|
||||
|
||||
n = clamp(n + amount, 0, 0.994);
|
||||
return NProgress.set(n);
|
||||
}
|
||||
};
|
||||
|
||||
NProgress.trickle = function() {
|
||||
return NProgress.inc(Math.random() * Settings.trickleRate);
|
||||
};
|
||||
|
||||
/**
|
||||
* Waits for all supplied jQuery promises and
|
||||
* increases the progress as the promises resolve.
|
||||
*
|
||||
* @param $promise jQUery Promise
|
||||
*/
|
||||
(function() {
|
||||
var initial = 0, current = 0;
|
||||
|
||||
NProgress.promise = function($promise) {
|
||||
if (!$promise || $promise.state() === "resolved") {
|
||||
return this;
|
||||
}
|
||||
|
||||
if (current === 0) {
|
||||
NProgress.start();
|
||||
}
|
||||
|
||||
initial++;
|
||||
current++;
|
||||
|
||||
$promise.always(function() {
|
||||
current--;
|
||||
if (current === 0) {
|
||||
initial = 0;
|
||||
NProgress.done();
|
||||
} else {
|
||||
NProgress.set((initial - current) / initial);
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Internal) renders the progress bar markup based on the `template`
|
||||
* setting.
|
||||
*/
|
||||
|
||||
NProgress.render = function(fromStart) {
|
||||
if (NProgress.isRendered()) return document.getElementById('nprogress');
|
||||
|
||||
addClass(document.documentElement, 'nprogress-busy');
|
||||
|
||||
var progress = document.createElement('div');
|
||||
progress.id = 'nprogress';
|
||||
progress.innerHTML = Settings.template;
|
||||
|
||||
var bar = progress.querySelector(Settings.barSelector),
|
||||
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
|
||||
parent = document.querySelector(Settings.parent),
|
||||
spinner;
|
||||
|
||||
css(bar, {
|
||||
transition: 'all 0 linear',
|
||||
transform: 'translate3d(' + perc + '%,0,0)'
|
||||
});
|
||||
|
||||
if (!Settings.showSpinner) {
|
||||
spinner = progress.querySelector(Settings.spinnerSelector);
|
||||
spinner && removeElement(spinner);
|
||||
}
|
||||
|
||||
if (parent != document.body) {
|
||||
addClass(parent, 'nprogress-custom-parent');
|
||||
}
|
||||
|
||||
parent.appendChild(progress);
|
||||
return progress;
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes the element. Opposite of render().
|
||||
*/
|
||||
|
||||
NProgress.remove = function() {
|
||||
removeClass(document.documentElement, 'nprogress-busy');
|
||||
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
|
||||
var progress = document.getElementById('nprogress');
|
||||
progress && removeElement(progress);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if the progress bar is rendered.
|
||||
*/
|
||||
|
||||
NProgress.isRendered = function() {
|
||||
return !!document.getElementById('nprogress');
|
||||
};
|
||||
|
||||
/**
|
||||
* Determine which positioning CSS rule to use.
|
||||
*/
|
||||
|
||||
NProgress.getPositioningCSS = function() {
|
||||
// Sniff on document.body.style
|
||||
var bodyStyle = document.body.style;
|
||||
|
||||
// Sniff prefixes
|
||||
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
|
||||
('MozTransform' in bodyStyle) ? 'Moz' :
|
||||
('msTransform' in bodyStyle) ? 'ms' :
|
||||
('OTransform' in bodyStyle) ? 'O' : '';
|
||||
|
||||
if (vendorPrefix + 'Perspective' in bodyStyle) {
|
||||
// Modern browsers with 3D support, e.g. Webkit, IE10
|
||||
return 'translate3d';
|
||||
} else if (vendorPrefix + 'Transform' in bodyStyle) {
|
||||
// Browsers without 3D support, e.g. IE9
|
||||
return 'translate';
|
||||
} else {
|
||||
// Browsers without translate() support, e.g. IE7-8
|
||||
return 'margin';
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Helpers
|
||||
*/
|
||||
|
||||
function clamp(n, min, max) {
|
||||
if (n < min) return min;
|
||||
if (n > max) return max;
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) converts a percentage (`0..1`) to a bar translateX
|
||||
* percentage (`-100%..0%`).
|
||||
*/
|
||||
|
||||
function toBarPerc(n) {
|
||||
return (-1 + n) * 100;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* (Internal) returns the correct CSS for changing the bar's
|
||||
* position given an n percentage, and speed and ease from Settings
|
||||
*/
|
||||
|
||||
function barPositionCSS(n, speed, ease) {
|
||||
var barCSS;
|
||||
|
||||
if (Settings.positionUsing === 'translate3d') {
|
||||
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
|
||||
} else if (Settings.positionUsing === 'translate') {
|
||||
barCSS = { transform: 'translate('+toBarPerc(n)+'%,0)' };
|
||||
} else {
|
||||
barCSS = { 'margin-left': toBarPerc(n)+'%' };
|
||||
}
|
||||
|
||||
barCSS.transition = 'all '+speed+'ms '+ease;
|
||||
|
||||
return barCSS;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) Queues a function to be executed.
|
||||
*/
|
||||
|
||||
var queue = (function() {
|
||||
var pending = [];
|
||||
|
||||
function next() {
|
||||
var fn = pending.shift();
|
||||
if (fn) {
|
||||
fn(next);
|
||||
}
|
||||
}
|
||||
|
||||
return function(fn) {
|
||||
pending.push(fn);
|
||||
if (pending.length == 1) next();
|
||||
};
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Internal) Applies css properties to an element, similar to the jQuery
|
||||
* css method.
|
||||
*
|
||||
* While this helper does assist with vendor prefixed property names, it
|
||||
* does not perform any manipulation of values prior to setting styles.
|
||||
*/
|
||||
|
||||
var css = (function() {
|
||||
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
|
||||
cssProps = {};
|
||||
|
||||
function camelCase(string) {
|
||||
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
|
||||
return letter.toUpperCase();
|
||||
});
|
||||
}
|
||||
|
||||
function getVendorProp(name) {
|
||||
var style = document.body.style;
|
||||
if (name in style) return name;
|
||||
|
||||
var i = cssPrefixes.length,
|
||||
capName = name.charAt(0).toUpperCase() + name.slice(1),
|
||||
vendorName;
|
||||
while (i--) {
|
||||
vendorName = cssPrefixes[i] + capName;
|
||||
if (vendorName in style) return vendorName;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
function getStyleProp(name) {
|
||||
name = camelCase(name);
|
||||
return cssProps[name] || (cssProps[name] = getVendorProp(name));
|
||||
}
|
||||
|
||||
function applyCss(element, prop, value) {
|
||||
prop = getStyleProp(prop);
|
||||
element.style[prop] = value;
|
||||
}
|
||||
|
||||
return function(element, properties) {
|
||||
var args = arguments,
|
||||
prop,
|
||||
value;
|
||||
|
||||
if (args.length == 2) {
|
||||
for (prop in properties) {
|
||||
value = properties[prop];
|
||||
if (value !== undefined && properties.hasOwnProperty(prop)) applyCss(element, prop, value);
|
||||
}
|
||||
} else {
|
||||
applyCss(element, args[1], args[2]);
|
||||
}
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* (Internal) Determines if an element or space separated list of class names contains a class name.
|
||||
*/
|
||||
|
||||
function hasClass(element, name) {
|
||||
var list = typeof element == 'string' ? element : classList(element);
|
||||
return list.indexOf(' ' + name + ' ') >= 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) Adds a class to an element.
|
||||
*/
|
||||
|
||||
function addClass(element, name) {
|
||||
var oldList = classList(element),
|
||||
newList = oldList + name;
|
||||
|
||||
if (hasClass(oldList, name)) return;
|
||||
|
||||
// Trim the opening space.
|
||||
element.className = newList.substring(1);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) Removes a class from an element.
|
||||
*/
|
||||
|
||||
function removeClass(element, name) {
|
||||
var oldList = classList(element),
|
||||
newList;
|
||||
|
||||
if (!hasClass(element, name)) return;
|
||||
|
||||
// Replace the class name.
|
||||
newList = oldList.replace(' ' + name + ' ', ' ');
|
||||
|
||||
// Trim the opening and closing spaces.
|
||||
element.className = newList.substring(1, newList.length - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) Gets a space separated list of the class names on the element.
|
||||
* The list is wrapped with a single space on each end to facilitate finding
|
||||
* matches within the list.
|
||||
*/
|
||||
|
||||
function classList(element) {
|
||||
return (' ' + (element.className || '') + ' ').replace(/\s+/gi, ' ');
|
||||
}
|
||||
|
||||
/**
|
||||
* (Internal) Removes an element from the DOM.
|
||||
*/
|
||||
|
||||
function removeElement(element) {
|
||||
element && element.parentNode && element.parentNode.removeChild(element);
|
||||
}
|
||||
|
||||
return NProgress;
|
||||
});
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,927 @@
|
||||
/*
|
||||
|
||||
PinchZoom.js
|
||||
Copyright (c) Manuel Stofer 2013 - today
|
||||
|
||||
Author: Manuel Stofer (mst@rtp.ch)
|
||||
Version: 2.3.5
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
*/
|
||||
|
||||
// polyfills
|
||||
if (typeof Object.assign != 'function') {
|
||||
// Must be writable: true, enumerable: false, configurable: true
|
||||
Object.defineProperty(Object, "assign", {
|
||||
value: function assign(target, varArgs) { // .length of function is 2
|
||||
if (target == null) { // TypeError if undefined or null
|
||||
throw new TypeError('Cannot convert undefined or null to object');
|
||||
}
|
||||
|
||||
var to = Object(target);
|
||||
|
||||
for (var index = 1; index < arguments.length; index++) {
|
||||
var nextSource = arguments[index];
|
||||
|
||||
if (nextSource != null) { // Skip over if undefined or null
|
||||
for (var nextKey in nextSource) {
|
||||
// Avoid bugs when hasOwnProperty is shadowed
|
||||
if (Object.prototype.hasOwnProperty.call(nextSource, nextKey)) {
|
||||
to[nextKey] = nextSource[nextKey];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return to;
|
||||
},
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
}
|
||||
|
||||
if (typeof Array.from != 'function') {
|
||||
Array.from = function (object) {
|
||||
return [].slice.call(object);
|
||||
};
|
||||
}
|
||||
|
||||
// utils
|
||||
var buildElement = function(str) {
|
||||
// empty string as title argument required by IE and Edge
|
||||
var tmp = document.implementation.createHTMLDocument('');
|
||||
tmp.body.innerHTML = str;
|
||||
return Array.from(tmp.body.children)[0];
|
||||
};
|
||||
|
||||
var triggerEvent = function(el, name) {
|
||||
var event = document.createEvent('HTMLEvents');
|
||||
event.initEvent(name, true, false);
|
||||
el.dispatchEvent(event);
|
||||
};
|
||||
|
||||
var definePinchZoom = function () {
|
||||
|
||||
/**
|
||||
* Pinch zoom
|
||||
* @param el
|
||||
* @param options
|
||||
* @constructor
|
||||
*/
|
||||
var PinchZoom = function (el, options) {
|
||||
this.el = el;
|
||||
this.zoomFactor = 1;
|
||||
this.lastScale = 1;
|
||||
this.offset = {
|
||||
x: 0,
|
||||
y: 0
|
||||
};
|
||||
this.initialOffset = {
|
||||
x: 0,
|
||||
y: 0,
|
||||
};
|
||||
this.options = Object.assign({}, this.defaults, options);
|
||||
this.setupMarkup();
|
||||
this.bindEvents();
|
||||
this.update();
|
||||
|
||||
// The image may already be loaded when PinchZoom is initialized,
|
||||
// and then the load event (which trigger update) will never fire.
|
||||
if (this.isImageLoaded(this.el)) {
|
||||
this.updateAspectRatio();
|
||||
this.setupOffsets();
|
||||
}
|
||||
|
||||
this.enable();
|
||||
|
||||
},
|
||||
sum = function (a, b) {
|
||||
return a + b;
|
||||
},
|
||||
isCloseTo = function (value, expected) {
|
||||
return value > expected - 0.01 && value < expected + 0.01;
|
||||
};
|
||||
|
||||
PinchZoom.prototype = {
|
||||
|
||||
defaults: {
|
||||
tapZoomFactor: 2,
|
||||
zoomOutFactor: 1.3,
|
||||
animationDuration: 300,
|
||||
maxZoom: 4,
|
||||
minZoom: 0.5,
|
||||
draggableUnzoomed: true,
|
||||
lockDragAxis: false,
|
||||
setOffsetsOnce: false,
|
||||
use2d: true,
|
||||
zoomStartEventName: 'pz_zoomstart',
|
||||
zoomUpdateEventName: 'pz_zoomupdate',
|
||||
zoomEndEventName: 'pz_zoomend',
|
||||
dragStartEventName: 'pz_dragstart',
|
||||
dragUpdateEventName: 'pz_dragupdate',
|
||||
dragEndEventName: 'pz_dragend',
|
||||
doubleTapEventName: 'pz_doubletap',
|
||||
verticalPadding: 0,
|
||||
horizontalPadding: 0,
|
||||
onZoomStart: null,
|
||||
onZoomEnd: null,
|
||||
onZoomUpdate: null,
|
||||
onDragStart: null,
|
||||
onDragEnd: null,
|
||||
onDragUpdate: null,
|
||||
onDoubleTap: null
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for 'dragstart'
|
||||
* @param event
|
||||
*/
|
||||
handleDragStart: function (event) {
|
||||
triggerEvent(this.el, this.options.dragStartEventName);
|
||||
if(typeof this.options.onDragStart == "function"){
|
||||
this.options.onDragStart(this, event)
|
||||
}
|
||||
this.stopAnimation();
|
||||
this.lastDragPosition = false;
|
||||
this.hasInteraction = true;
|
||||
this.handleDrag(event);
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for 'drag'
|
||||
* @param event
|
||||
*/
|
||||
handleDrag: function (event) {
|
||||
var touch = this.getTouches(event)[0];
|
||||
this.drag(touch, this.lastDragPosition);
|
||||
this.offset = this.sanitizeOffset(this.offset);
|
||||
this.lastDragPosition = touch;
|
||||
},
|
||||
|
||||
handleDragEnd: function () {
|
||||
triggerEvent(this.el, this.options.dragEndEventName);
|
||||
if(typeof this.options.onDragEnd == "function"){
|
||||
this.options.onDragEnd(this, event)
|
||||
}
|
||||
this.end();
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for 'zoomstart'
|
||||
* @param event
|
||||
*/
|
||||
handleZoomStart: function (event) {
|
||||
triggerEvent(this.el, this.options.zoomStartEventName);
|
||||
if(typeof this.options.onZoomStart == "function"){
|
||||
this.options.onZoomStart(this, event)
|
||||
}
|
||||
this.stopAnimation();
|
||||
this.lastScale = 1;
|
||||
this.nthZoom = 0;
|
||||
this.lastZoomCenter = false;
|
||||
this.hasInteraction = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for 'zoom'
|
||||
* @param event
|
||||
*/
|
||||
handleZoom: function (event, newScale) {
|
||||
// a relative scale factor is used
|
||||
var touchCenter = this.getTouchCenter(this.getTouches(event)),
|
||||
scale = newScale / this.lastScale;
|
||||
this.lastScale = newScale;
|
||||
|
||||
// the first touch events are thrown away since they are not precise
|
||||
this.nthZoom += 1;
|
||||
if (this.nthZoom > 3) {
|
||||
|
||||
this.scale(scale, touchCenter);
|
||||
this.drag(touchCenter, this.lastZoomCenter);
|
||||
}
|
||||
this.lastZoomCenter = touchCenter;
|
||||
},
|
||||
|
||||
handleZoomEnd: function () {
|
||||
triggerEvent(this.el, this.options.zoomEndEventName);
|
||||
if(typeof this.options.onZoomEnd == "function"){
|
||||
this.options.onZoomEnd(this, event)
|
||||
}
|
||||
this.end();
|
||||
},
|
||||
|
||||
/**
|
||||
* Event handler for 'doubletap'
|
||||
* @param event
|
||||
*/
|
||||
handleDoubleTap: function (event) {
|
||||
var center = this.getTouches(event)[0],
|
||||
zoomFactor = this.zoomFactor > 1 ? 1 : this.options.tapZoomFactor,
|
||||
startZoomFactor = this.zoomFactor,
|
||||
updateProgress = (function (progress) {
|
||||
this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
|
||||
}).bind(this);
|
||||
|
||||
if (this.hasInteraction) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.isDoubleTap = true;
|
||||
|
||||
if (startZoomFactor > zoomFactor) {
|
||||
center = this.getCurrentZoomCenter();
|
||||
}
|
||||
|
||||
this.animate(this.options.animationDuration, updateProgress, this.swing);
|
||||
triggerEvent(this.el, this.options.doubleTapEventName);
|
||||
if(typeof this.options.onDoubleTap == "function"){
|
||||
this.options.onDoubleTap(this, event)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Compute the initial offset
|
||||
*
|
||||
* the element should be centered in the container upon initialization
|
||||
*/
|
||||
computeInitialOffset: function () {
|
||||
this.initialOffset = {
|
||||
x: -Math.abs(this.el.offsetWidth * this.getInitialZoomFactor() - this.container.offsetWidth) / 2,
|
||||
y: -Math.abs(this.el.offsetHeight * this.getInitialZoomFactor() - this.container.offsetHeight) / 2,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Reset current image offset to that of the initial offset
|
||||
*/
|
||||
resetOffset: function() {
|
||||
this.offset.x = this.initialOffset.x;
|
||||
this.offset.y = this.initialOffset.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine if image is loaded
|
||||
*/
|
||||
isImageLoaded: function (el) {
|
||||
if (el.nodeName === 'IMG') {
|
||||
return el.complete && el.naturalHeight !== 0;
|
||||
} else {
|
||||
return Array.from(el.querySelectorAll('img')).every(this.isImageLoaded);
|
||||
}
|
||||
},
|
||||
|
||||
setupOffsets: function() {
|
||||
if (this.options.setOffsetsOnce && this._isOffsetsSet) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._isOffsetsSet = true;
|
||||
|
||||
this.computeInitialOffset();
|
||||
this.resetOffset();
|
||||
},
|
||||
|
||||
/**
|
||||
* Max / min values for the offset
|
||||
* @param offset
|
||||
* @return {Object} the sanitized offset
|
||||
*/
|
||||
sanitizeOffset: function (offset) {
|
||||
var elWidth = this.el.offsetWidth * this.getInitialZoomFactor() * this.zoomFactor;
|
||||
var elHeight = this.el.offsetHeight * this.getInitialZoomFactor() * this.zoomFactor;
|
||||
var maxX = elWidth - this.getContainerX() + this.options.horizontalPadding,
|
||||
maxY = elHeight - this.getContainerY() + this.options.verticalPadding,
|
||||
maxOffsetX = Math.max(maxX, 0),
|
||||
maxOffsetY = Math.max(maxY, 0),
|
||||
minOffsetX = Math.min(maxX, 0) - this.options.horizontalPadding,
|
||||
minOffsetY = Math.min(maxY, 0) - this.options.verticalPadding;
|
||||
|
||||
return {
|
||||
x: Math.min(Math.max(offset.x, minOffsetX), maxOffsetX),
|
||||
y: Math.min(Math.max(offset.y, minOffsetY), maxOffsetY)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Scale to a specific zoom factor (not relative)
|
||||
* @param zoomFactor
|
||||
* @param center
|
||||
*/
|
||||
scaleTo: function (zoomFactor, center) {
|
||||
this.scale(zoomFactor / this.zoomFactor, center);
|
||||
},
|
||||
|
||||
/**
|
||||
* Scales the element from specified center
|
||||
* @param scale
|
||||
* @param center
|
||||
*/
|
||||
scale: function (scale, center) {
|
||||
scale = this.scaleZoomFactor(scale);
|
||||
this.addOffset({
|
||||
x: (scale - 1) * (center.x + this.offset.x),
|
||||
y: (scale - 1) * (center.y + this.offset.y)
|
||||
});
|
||||
triggerEvent(this.el, this.options.zoomUpdateEventName);
|
||||
if(typeof this.options.onZoomUpdate == "function"){
|
||||
this.options.onZoomUpdate(this, event)
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Scales the zoom factor relative to current state
|
||||
* @param scale
|
||||
* @return the actual scale (can differ because of max min zoom factor)
|
||||
*/
|
||||
scaleZoomFactor: function (scale) {
|
||||
var originalZoomFactor = this.zoomFactor;
|
||||
this.zoomFactor *= scale;
|
||||
this.zoomFactor = Math.min(this.options.maxZoom, Math.max(this.zoomFactor, this.options.minZoom));
|
||||
return this.zoomFactor / originalZoomFactor;
|
||||
},
|
||||
|
||||
/**
|
||||
* Determine if the image is in a draggable state
|
||||
*
|
||||
* When the image can be dragged, the drag event is acted upon and cancelled.
|
||||
* When not draggable, the drag event bubbles through this component.
|
||||
*
|
||||
* @return {Boolean}
|
||||
*/
|
||||
canDrag: function () {
|
||||
return this.options.draggableUnzoomed || !isCloseTo(this.zoomFactor, 1);
|
||||
},
|
||||
|
||||
/**
|
||||
* Drags the element
|
||||
* @param center
|
||||
* @param lastCenter
|
||||
*/
|
||||
drag: function (center, lastCenter) {
|
||||
if (lastCenter) {
|
||||
if(this.options.lockDragAxis) {
|
||||
// lock scroll to position that was changed the most
|
||||
if(Math.abs(center.x - lastCenter.x) > Math.abs(center.y - lastCenter.y)) {
|
||||
this.addOffset({
|
||||
x: -(center.x - lastCenter.x),
|
||||
y: 0
|
||||
});
|
||||
}
|
||||
else {
|
||||
this.addOffset({
|
||||
y: -(center.y - lastCenter.y),
|
||||
x: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.addOffset({
|
||||
y: -(center.y - lastCenter.y),
|
||||
x: -(center.x - lastCenter.x)
|
||||
});
|
||||
}
|
||||
triggerEvent(this.el, this.options.dragUpdateEventName);
|
||||
if(typeof this.options.onDragUpdate == "function"){
|
||||
this.options.onDragUpdate(this, event)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the touch center of multiple touches
|
||||
* @param touches
|
||||
* @return {Object}
|
||||
*/
|
||||
getTouchCenter: function (touches) {
|
||||
return this.getVectorAvg(touches);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the average of multiple vectors (x, y values)
|
||||
*/
|
||||
getVectorAvg: function (vectors) {
|
||||
return {
|
||||
x: vectors.map(function (v) { return v.x; }).reduce(sum) / vectors.length,
|
||||
y: vectors.map(function (v) { return v.y; }).reduce(sum) / vectors.length
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Adds an offset
|
||||
* @param offset the offset to add
|
||||
* @return return true when the offset change was accepted
|
||||
*/
|
||||
addOffset: function (offset) {
|
||||
this.offset = {
|
||||
x: this.offset.x + offset.x,
|
||||
y: this.offset.y + offset.y
|
||||
};
|
||||
},
|
||||
|
||||
sanitize: function () {
|
||||
if (this.zoomFactor < this.options.zoomOutFactor) {
|
||||
this.zoomOutAnimation();
|
||||
} else if (this.isInsaneOffset(this.offset)) {
|
||||
this.sanitizeOffsetAnimation();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Checks if the offset is ok with the current zoom factor
|
||||
* @param offset
|
||||
* @return {Boolean}
|
||||
*/
|
||||
isInsaneOffset: function (offset) {
|
||||
var sanitizedOffset = this.sanitizeOffset(offset);
|
||||
return sanitizedOffset.x !== offset.x ||
|
||||
sanitizedOffset.y !== offset.y;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an animation moving to a sane offset
|
||||
*/
|
||||
sanitizeOffsetAnimation: function () {
|
||||
var targetOffset = this.sanitizeOffset(this.offset),
|
||||
startOffset = {
|
||||
x: this.offset.x,
|
||||
y: this.offset.y
|
||||
},
|
||||
updateProgress = (function (progress) {
|
||||
this.offset.x = startOffset.x + progress * (targetOffset.x - startOffset.x);
|
||||
this.offset.y = startOffset.y + progress * (targetOffset.y - startOffset.y);
|
||||
this.update();
|
||||
}).bind(this);
|
||||
|
||||
this.animate(
|
||||
this.options.animationDuration,
|
||||
updateProgress,
|
||||
this.swing
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Zooms back to the original position,
|
||||
* (no offset and zoom factor 1)
|
||||
*/
|
||||
zoomOutAnimation: function () {
|
||||
if (this.zoomFactor === 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var startZoomFactor = this.zoomFactor,
|
||||
zoomFactor = 1,
|
||||
center = this.getCurrentZoomCenter(),
|
||||
updateProgress = (function (progress) {
|
||||
this.scaleTo(startZoomFactor + progress * (zoomFactor - startZoomFactor), center);
|
||||
}).bind(this);
|
||||
|
||||
this.animate(
|
||||
this.options.animationDuration,
|
||||
updateProgress,
|
||||
this.swing
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the container aspect ratio
|
||||
*
|
||||
* Any previous container height must be cleared before re-measuring the
|
||||
* parent height, since it depends implicitly on the height of any of its children
|
||||
*/
|
||||
updateAspectRatio: function () {
|
||||
this.unsetContainerY();
|
||||
this.setContainerY(this.container.parentElement.offsetHeight);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the initial zoom factor (for the element to fit into the container)
|
||||
* @return {number} the initial zoom factor
|
||||
*/
|
||||
getInitialZoomFactor: function () {
|
||||
var xZoomFactor = this.container.offsetWidth / this.el.offsetWidth;
|
||||
var yZoomFactor = this.container.offsetHeight / this.el.offsetHeight;
|
||||
|
||||
return Math.min(xZoomFactor, yZoomFactor);
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the aspect ratio of the element
|
||||
* @return the aspect ratio
|
||||
*/
|
||||
getAspectRatio: function () {
|
||||
return this.el.offsetWidth / this.el.offsetHeight;
|
||||
},
|
||||
|
||||
/**
|
||||
* Calculates the virtual zoom center for the current offset and zoom factor
|
||||
* (used for reverse zoom)
|
||||
* @return {Object} the current zoom center
|
||||
*/
|
||||
getCurrentZoomCenter: function () {
|
||||
var offsetLeft = this.offset.x - this.initialOffset.x;
|
||||
var centerX = -1 * this.offset.x - offsetLeft / (1 / this.zoomFactor - 1);
|
||||
|
||||
var offsetTop = this.offset.y - this.initialOffset.y;
|
||||
var centerY = -1 * this.offset.y - offsetTop / (1 / this.zoomFactor - 1);
|
||||
|
||||
return {
|
||||
x: centerX,
|
||||
y: centerY
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the touches of an event relative to the container offset
|
||||
* @param event
|
||||
* @return array touches
|
||||
*/
|
||||
getTouches: function (event) {
|
||||
var rect = this.container.getBoundingClientRect();
|
||||
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
||||
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
|
||||
var posTop = rect.top + scrollTop;
|
||||
var posLeft = rect.left + scrollLeft;
|
||||
|
||||
return Array.prototype.slice.call(event.touches).map(function (touch) {
|
||||
return {
|
||||
x: touch.pageX - posLeft,
|
||||
y: touch.pageY - posTop,
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Animation loop
|
||||
* does not support simultaneous animations
|
||||
* @param duration
|
||||
* @param framefn
|
||||
* @param timefn
|
||||
* @param callback
|
||||
*/
|
||||
animate: function (duration, framefn, timefn, callback) {
|
||||
var startTime = new Date().getTime(),
|
||||
renderFrame = (function () {
|
||||
if (!this.inAnimation) { return; }
|
||||
var frameTime = new Date().getTime() - startTime,
|
||||
progress = frameTime / duration;
|
||||
if (frameTime >= duration) {
|
||||
framefn(1);
|
||||
if (callback) {
|
||||
callback();
|
||||
}
|
||||
this.update();
|
||||
this.stopAnimation();
|
||||
this.update();
|
||||
} else {
|
||||
if (timefn) {
|
||||
progress = timefn(progress);
|
||||
}
|
||||
framefn(progress);
|
||||
this.update();
|
||||
requestAnimationFrame(renderFrame);
|
||||
}
|
||||
}).bind(this);
|
||||
this.inAnimation = true;
|
||||
requestAnimationFrame(renderFrame);
|
||||
},
|
||||
|
||||
/**
|
||||
* Stops the animation
|
||||
*/
|
||||
stopAnimation: function () {
|
||||
this.inAnimation = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Swing timing function for animations
|
||||
* @param p
|
||||
* @return {Number}
|
||||
*/
|
||||
swing: function (p) {
|
||||
return -Math.cos(p * Math.PI) / 2 + 0.5;
|
||||
},
|
||||
|
||||
getContainerX: function () {
|
||||
return this.container.offsetWidth;
|
||||
},
|
||||
|
||||
getContainerY: function () {
|
||||
return this.container.offsetHeight;
|
||||
},
|
||||
|
||||
setContainerY: function (y) {
|
||||
return this.container.style.height = y + 'px';
|
||||
},
|
||||
|
||||
unsetContainerY: function () {
|
||||
this.container.style.height = null;
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates the expected html structure
|
||||
*/
|
||||
setupMarkup: function () {
|
||||
this.container = buildElement('<div class="pinch-zoom-container"></div>');
|
||||
this.el.parentNode.insertBefore(this.container, this.el);
|
||||
this.container.appendChild(this.el);
|
||||
|
||||
this.container.style.overflow = 'hidden';
|
||||
this.container.style.position = 'relative';
|
||||
|
||||
this.el.style.webkitTransformOrigin = '0% 0%';
|
||||
this.el.style.mozTransformOrigin = '0% 0%';
|
||||
this.el.style.msTransformOrigin = '0% 0%';
|
||||
this.el.style.oTransformOrigin = '0% 0%';
|
||||
this.el.style.transformOrigin = '0% 0%';
|
||||
|
||||
this.el.style.position = 'absolute';
|
||||
},
|
||||
|
||||
end: function () {
|
||||
this.hasInteraction = false;
|
||||
this.sanitize();
|
||||
this.update();
|
||||
},
|
||||
|
||||
/**
|
||||
* Binds all required event listeners
|
||||
*/
|
||||
bindEvents: function () {
|
||||
var self = this;
|
||||
detectGestures(this.container, this);
|
||||
|
||||
this.resizeHandler = this.update.bind(this)
|
||||
window.addEventListener('resize', this.resizeHandler);
|
||||
Array.from(this.el.querySelectorAll('img')).forEach(function(imgEl) {
|
||||
imgEl.addEventListener('load', self.update.bind(self));
|
||||
});
|
||||
|
||||
if (this.el.nodeName === 'IMG') {
|
||||
this.el.addEventListener('load', this.update.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Updates the css values according to the current zoom factor and offset
|
||||
*/
|
||||
update: function (event) {
|
||||
if (event && event.type === 'resize') {
|
||||
this.updateAspectRatio();
|
||||
this.setupOffsets();
|
||||
}
|
||||
|
||||
if (event && event.type === 'load') {
|
||||
this.updateAspectRatio();
|
||||
this.setupOffsets();
|
||||
}
|
||||
|
||||
if (this.updatePlanned) {
|
||||
return;
|
||||
}
|
||||
this.updatePlanned = true;
|
||||
|
||||
window.setTimeout((function () {
|
||||
this.updatePlanned = false;
|
||||
|
||||
var zoomFactor = this.getInitialZoomFactor() * this.zoomFactor,
|
||||
offsetX = -this.offset.x / zoomFactor,
|
||||
offsetY = -this.offset.y / zoomFactor,
|
||||
transform3d = 'scale3d(' + zoomFactor + ', ' + zoomFactor + ',1) ' +
|
||||
'translate3d(' + offsetX + 'px,' + offsetY + 'px,0px)',
|
||||
transform2d = 'scale(' + zoomFactor + ', ' + zoomFactor + ') ' +
|
||||
'translate(' + offsetX + 'px,' + offsetY + 'px)',
|
||||
removeClone = (function () {
|
||||
if (this.clone) {
|
||||
this.clone.parentNode.removeChild(this.clone);
|
||||
delete this.clone;
|
||||
}
|
||||
}).bind(this);
|
||||
|
||||
// Scale 3d and translate3d are faster (at least on ios)
|
||||
// but they also reduce the quality.
|
||||
// PinchZoom uses the 3d transformations during interactions
|
||||
// after interactions it falls back to 2d transformations
|
||||
if (!this.options.use2d || this.hasInteraction || this.inAnimation) {
|
||||
this.is3d = true;
|
||||
removeClone();
|
||||
|
||||
this.el.style.webkitTransform = transform3d;
|
||||
this.el.style.mozTransform = transform2d;
|
||||
this.el.style.msTransform = transform2d;
|
||||
this.el.style.oTransform = transform2d;
|
||||
this.el.style.transform = transform3d;
|
||||
} else {
|
||||
// When changing from 3d to 2d transform webkit has some glitches.
|
||||
// To avoid this, a copy of the 3d transformed element is displayed in the
|
||||
// foreground while the element is converted from 3d to 2d transform
|
||||
if (this.is3d) {
|
||||
this.clone = this.el.cloneNode(true);
|
||||
this.clone.style.pointerEvents = 'none';
|
||||
this.container.appendChild(this.clone);
|
||||
window.setTimeout(removeClone, 200);
|
||||
}
|
||||
|
||||
this.el.style.webkitTransform = transform2d;
|
||||
this.el.style.mozTransform = transform2d;
|
||||
this.el.style.msTransform = transform2d;
|
||||
this.el.style.oTransform = transform2d;
|
||||
this.el.style.transform = transform2d;
|
||||
|
||||
this.is3d = false;
|
||||
}
|
||||
}).bind(this), 0);
|
||||
},
|
||||
|
||||
/**
|
||||
* Enables event handling for gestures
|
||||
*/
|
||||
enable: function() {
|
||||
this.enabled = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Disables event handling for gestures
|
||||
*/
|
||||
disable: function() {
|
||||
this.enabled = false;
|
||||
},
|
||||
|
||||
/**
|
||||
* Unmounts the zooming container and global event listeners
|
||||
*/
|
||||
destroy: function () {
|
||||
window.removeEventListener('resize', this.resizeHandler);
|
||||
|
||||
if (this.container) {
|
||||
this.container.remove();
|
||||
this.container = null;
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var detectGestures = function (el, target) {
|
||||
var interaction = null,
|
||||
fingers = 0,
|
||||
lastTouchStart = null,
|
||||
startTouches = null,
|
||||
|
||||
setInteraction = function (newInteraction, event) {
|
||||
if (interaction !== newInteraction) {
|
||||
|
||||
if (interaction && !newInteraction) {
|
||||
switch (interaction) {
|
||||
case "zoom":
|
||||
target.handleZoomEnd(event);
|
||||
break;
|
||||
case 'drag':
|
||||
target.handleDragEnd(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (newInteraction) {
|
||||
case 'zoom':
|
||||
target.handleZoomStart(event);
|
||||
break;
|
||||
case 'drag':
|
||||
target.handleDragStart(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
interaction = newInteraction;
|
||||
},
|
||||
|
||||
updateInteraction = function (event) {
|
||||
if (fingers === 2) {
|
||||
setInteraction('zoom');
|
||||
} else if (fingers === 1 && target.canDrag()) {
|
||||
setInteraction('drag', event);
|
||||
} else {
|
||||
setInteraction(null, event);
|
||||
}
|
||||
},
|
||||
|
||||
targetTouches = function (touches) {
|
||||
return Array.from(touches).map(function (touch) {
|
||||
return {
|
||||
x: touch.pageX,
|
||||
y: touch.pageY
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
getDistance = function (a, b) {
|
||||
var x, y;
|
||||
x = a.x - b.x;
|
||||
y = a.y - b.y;
|
||||
return Math.sqrt(x * x + y * y);
|
||||
},
|
||||
|
||||
calculateScale = function (startTouches, endTouches) {
|
||||
var startDistance = getDistance(startTouches[0], startTouches[1]),
|
||||
endDistance = getDistance(endTouches[0], endTouches[1]);
|
||||
return endDistance / startDistance;
|
||||
},
|
||||
|
||||
cancelEvent = function (event) {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
},
|
||||
|
||||
detectDoubleTap = function (event) {
|
||||
var time = (new Date()).getTime();
|
||||
|
||||
if (fingers > 1) {
|
||||
lastTouchStart = null;
|
||||
}
|
||||
|
||||
if (time - lastTouchStart < 300) {
|
||||
cancelEvent(event);
|
||||
|
||||
target.handleDoubleTap(event);
|
||||
switch (interaction) {
|
||||
case "zoom":
|
||||
target.handleZoomEnd(event);
|
||||
break;
|
||||
case 'drag':
|
||||
target.handleDragEnd(event);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
target.isDoubleTap = false;
|
||||
}
|
||||
|
||||
if (fingers === 1) {
|
||||
lastTouchStart = time;
|
||||
}
|
||||
},
|
||||
firstMove = true;
|
||||
|
||||
el.addEventListener('touchstart', function (event) {
|
||||
if(target.enabled) {
|
||||
firstMove = true;
|
||||
fingers = event.touches.length;
|
||||
detectDoubleTap(event);
|
||||
}
|
||||
}, { passive: false });
|
||||
|
||||
el.addEventListener('touchmove', function (event) {
|
||||
if(target.enabled && !target.isDoubleTap) {
|
||||
if (firstMove) {
|
||||
updateInteraction(event);
|
||||
if (interaction) {
|
||||
cancelEvent(event);
|
||||
}
|
||||
startTouches = targetTouches(event.touches);
|
||||
} else {
|
||||
switch (interaction) {
|
||||
case 'zoom':
|
||||
if (startTouches.length == 2 && event.touches.length == 2) {
|
||||
target.handleZoom(event, calculateScale(startTouches, targetTouches(event.touches)));
|
||||
}
|
||||
break;
|
||||
case 'drag':
|
||||
target.handleDrag(event);
|
||||
break;
|
||||
}
|
||||
if (interaction) {
|
||||
cancelEvent(event);
|
||||
target.update();
|
||||
}
|
||||
}
|
||||
|
||||
firstMove = false;
|
||||
}
|
||||
}, { passive: false });
|
||||
|
||||
el.addEventListener('touchend', function (event) {
|
||||
if(target.enabled) {
|
||||
fingers = event.touches.length;
|
||||
updateInteraction(event);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return PinchZoom;
|
||||
};
|
||||
|
||||
var PinchZoom = definePinchZoom();
|
||||
|
||||
export default PinchZoom;
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user