@stll/folio-vue 0.32.1 → 0.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/FindReplaceDialog-CfcTl2Ra.cjs +1 -0
- package/dist/FindReplaceDialog-DEWjhuOw.js +168 -0
- package/dist/HorizontalRuler-Cuk0l4Us.cjs +1 -0
- package/dist/HorizontalRuler-TM9dg--R.js +341 -0
- package/dist/HyperlinkDialog-BEse_y7R.js +175 -0
- package/dist/HyperlinkDialog-Cs1y6aol.cjs +1 -0
- package/dist/ImagePropertiesDialog-CTbX2GrE.cjs +1 -0
- package/dist/ImagePropertiesDialog-mrJ8S3sl.js +186 -0
- package/dist/ImageSelectionOverlay-DULrvfOJ.js +386 -0
- package/dist/ImageSelectionOverlay-Dr0lg9WZ.cjs +1 -0
- package/dist/InsertSymbolDialog-BjB-Q9EO.js +93 -0
- package/dist/InsertSymbolDialog-BsjgPYM-.cjs +1 -0
- package/dist/PageSetupDialog-CZ5fE9rz.cjs +1 -0
- package/dist/PageSetupDialog-DNNSezj3.js +208 -0
- package/dist/SetNumberingValueDialog-ClCYr37D.cjs +1 -0
- package/dist/SetNumberingValueDialog-CwLHfO7f.js +54 -0
- package/dist/SplitCellDialog-Bfuo5WCO.cjs +1 -0
- package/dist/SplitCellDialog-HIg4ZEqt.js +1031 -0
- package/dist/StylePicker-BnGGlXOX.cjs +4 -0
- package/dist/{StylePicker-DmTN56Yg.js → StylePicker-F3cLPvRE.js} +593 -1100
- package/dist/TablePropertiesDialog-CRX9Xgdr.js +102 -0
- package/dist/TablePropertiesDialog-ClJSuB0F.cjs +1 -0
- package/dist/VerticalRuler-D973NTMv.js +178 -0
- package/dist/VerticalRuler-DVi2P_TO.cjs +1 -0
- package/dist/WatermarkDialog-BYyBTlDK.cjs +1 -0
- package/dist/WatermarkDialog-BoAdQ-qK.js +161 -0
- package/dist/components/dialogs/recentSymbols.d.ts +7 -0
- package/dist/composables/useDocxEditor.d.ts +4 -1
- package/dist/composables.cjs +1 -1
- package/dist/composables.js +1 -1
- package/dist/dialogs.cjs +1 -1
- package/dist/dialogs.js +9 -1
- package/dist/{SplitCellDialog-BczVYfpm.js → folio-ui-ctJdVP-s.js} +678 -2753
- package/dist/folio-ui-u7h3WXUO.cjs +15 -0
- package/dist/folio-vue.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1665 -2064
- package/dist/messages/ar.cjs +1 -1
- package/dist/messages/cs.cjs +1 -1
- package/dist/messages/de.cjs +1 -1
- package/dist/messages/en.cjs +1 -1
- package/dist/messages/es.cjs +1 -1
- package/dist/messages/et.cjs +1 -1
- package/dist/messages/fr.cjs +1 -1
- package/dist/messages/he.cjs +1 -1
- package/dist/messages/hi.cjs +1 -1
- package/dist/messages/hu.cjs +1 -1
- package/dist/messages/lt.cjs +1 -1
- package/dist/messages/lv.cjs +1 -1
- package/dist/messages/pl.cjs +1 -1
- package/dist/messages/pt-BR.cjs +1 -1
- package/dist/messages/sk.cjs +1 -1
- package/dist/messages/tr.cjs +1 -1
- package/dist/messages/zh-CN.cjs +1 -1
- package/dist/rolldown-runtime-DbbDpzbe.cjs +1 -0
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +28 -18
- package/dist/{useZoom-1kmdkmJ4.js → useZoom-CX69Me_z.js} +289 -285
- package/dist/useZoom-QSSrGY_r.cjs +1 -0
- package/package.json +2 -2
- package/dist/SplitCellDialog-CrLHwVLc.cjs +0 -15
- package/dist/StylePicker-C0iEQnw6.cjs +0 -4
- package/dist/rolldown-runtime-5iZMYShA.cjs +0 -1
- package/dist/useZoom-Bj5B9uT1.cjs +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./folio-ui-u7h3WXUO.cjs");let n=require("vue");var r={class:`find-replace-dialog__header`},i={class:`find-replace-dialog__title`},a={class:`find-replace-dialog__body`},o={class:`find-replace-dialog__row`},s={class:`find-replace-dialog__count`},c={class:`find-replace-dialog__options`},l={key:0,class:`find-replace-dialog__row`},u={key:1,role:`status`,"aria-live":`polite`,class:`find-replace-dialog__summary`},d=(0,n.defineComponent)({__name:`FindReplaceDialog`,props:{isOpen:{type:Boolean},search:{}},emits:[`close`],setup(e,{emit:d}){let{t:f}=t.S(),{Button:p,Input:m,Checkbox:h}=t.a(),g=e,_=d,v=(0,n.ref)(null),y=(0,n.ref)(!1),b=(0,n.ref)(null),x=(0,n.computed)(()=>g.search.replacementRefusal.value!==null),{searchText:S,replaceText:C,options:w,matches:T,currentIndex:E,canReplaceCurrent:D,performSearch:O,scheduleSearch:k,findNext:A,findPrevious:j,replaceCurrent:M,replaceAll:N,clear:P}=g.search,F=()=>{b.value=N()};(0,n.watch)([S,()=>w.matchCase,()=>w.matchWholeWord],()=>{b.value=null});let I=(0,n.toRef)(w,`matchCase`),L=(0,n.toRef)(w,`matchWholeWord`),R=(0,n.computed)(()=>S.value.trim()?T.value.length===0?f(`findReplace.noResults`):E.value<0?f(`dialogs.findReplace.matchesFound`,{total:T.value.length}):f(`findReplace.matchCounter`,{current:E.value+1,total:T.value.length}):``);(0,n.watch)(()=>g.isOpen,async e=>{e?(await(0,n.nextTick)(),v.value?.focus(),v.value?.select(),O()):P()},{immediate:!0});function z(){b.value=null,P(),_(`close`)}function B(e){e.key===`Enter`?(e.preventDefault(),e.shiftKey?j():A()):e.key===`Escape`&&z()}return(t,d)=>e.isOpen?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`find-replace-dialog`,"data-testid":`find-replace-dialog`,onMousedown:d[5]||=(0,n.withModifiers)(()=>{},[`stop`]),onKeydown:d[6]||=(0,n.withModifiers)(()=>{},[`stop`])},[(0,n.createElementVNode)(`div`,r,[(0,n.createElementVNode)(`span`,i,(0,n.toDisplayString)(y.value?(0,n.unref)(f)(`findReplace.findAndReplace`):(0,n.unref)(f)(`findReplace.find`)),1),(0,n.createVNode)((0,n.unref)(p),{class:`find-replace-dialog__close`,variant:`ghost`,size:`icon-xs`,onClick:z,title:(0,n.unref)(f)(`findReplace.close`)},{default:(0,n.withCtx)(()=>[...d[7]||=[(0,n.createTextVNode)(` ✕ `,-1)]]),_:1},8,[`title`])]),(0,n.createElementVNode)(`div`,a,[(0,n.createElementVNode)(`div`,o,[(0,n.createVNode)((0,n.unref)(m),{ref_key:`searchInputRef`,ref:v,modelValue:(0,n.unref)(S),"onUpdate:modelValue":d[0]||=e=>(0,n.isRef)(S)?S.value=e:null,class:`find-replace-dialog__input`,"data-testid":`find-input`,placeholder:(0,n.unref)(f)(`findReplace.findPlaceholder`),"aria-label":(0,n.unref)(f)(`findReplace.findText`),onKeydown:B,onInput:(0,n.unref)(k)},null,8,[`modelValue`,`placeholder`,`aria-label`,`onInput`]),(0,n.createElementVNode)(`span`,s,(0,n.toDisplayString)(R.value),1),(0,n.createVNode)((0,n.unref)(p),{variant:`ghost`,size:`icon-xs`,title:(0,n.unref)(f)(`findReplace.previous`),onMousedown:(0,n.withModifiers)((0,n.unref)(j),[`prevent`])},{default:(0,n.withCtx)(()=>[...d[8]||=[(0,n.createTextVNode)(`▲`,-1)]]),_:1},8,[`title`,`onMousedown`]),(0,n.createVNode)((0,n.unref)(p),{variant:`ghost`,size:`icon-xs`,title:(0,n.unref)(f)(`findReplace.next`),onMousedown:(0,n.withModifiers)((0,n.unref)(A),[`prevent`])},{default:(0,n.withCtx)(()=>[...d[9]||=[(0,n.createTextVNode)(`▼`,-1)]]),_:1},8,[`title`,`onMousedown`])]),(0,n.createElementVNode)(`div`,c,[(0,n.createElementVNode)(`label`,null,[(0,n.createVNode)((0,n.unref)(h),{checked:I.value,"onUpdate:checked":d[1]||=e=>{I.value=e,(0,n.unref)(O)()}},null,8,[`checked`]),(0,n.createTextVNode)(` `+(0,n.toDisplayString)((0,n.unref)(f)(`findReplace.matchCase`)),1)]),(0,n.createElementVNode)(`label`,null,[(0,n.createVNode)((0,n.unref)(h),{checked:L.value,"onUpdate:checked":d[2]||=e=>{L.value=e,(0,n.unref)(O)()}},null,8,[`checked`]),(0,n.createTextVNode)(` `+(0,n.toDisplayString)((0,n.unref)(f)(`findReplace.wholeWords`)),1)]),x.value?(0,n.createCommentVNode)(``,!0):((0,n.openBlock)(),(0,n.createBlock)((0,n.unref)(p),{key:0,class:(0,n.normalizeClass)([`find-replace-dialog__toggle`,{active:y.value}]),"data-testid":`find-replace-toggle`,variant:`ghost`,size:`xs`,onMousedown:d[3]||=(0,n.withModifiers)(e=>y.value=!y.value,[`prevent`]),title:(0,n.unref)(f)(`dialogs.findReplace.toggleReplace`)},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)(` ↔ `+(0,n.toDisplayString)((0,n.unref)(f)(`dialogs.findReplace.replaceButton`)),1)]),_:1},8,[`class`,`title`]))]),y.value&&!x.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,l,[(0,n.createVNode)((0,n.unref)(m),{modelValue:(0,n.unref)(C),"onUpdate:modelValue":d[4]||=e=>(0,n.isRef)(C)?C.value=e:null,class:`find-replace-dialog__input`,"data-testid":`replace-input`,placeholder:(0,n.unref)(f)(`findReplace.replacePlaceholder`),"aria-label":(0,n.unref)(f)(`findReplace.replaceText`),onKeydown:(0,n.withKeys)((0,n.withModifiers)((0,n.unref)(M),[`prevent`]),[`enter`])},null,8,[`modelValue`,`placeholder`,`aria-label`,`onKeydown`]),(0,n.createVNode)((0,n.unref)(p),{variant:`ghost`,size:`xs`,disabled:!(0,n.unref)(D),"data-testid":`replace-current`,title:(0,n.unref)(f)(`findReplace.replaceCurrent`),onMousedown:(0,n.withModifiers)((0,n.unref)(M),[`prevent`])},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(f)(`dialogs.findReplace.replaceButton`)),1)]),_:1},8,[`disabled`,`title`,`onMousedown`]),(0,n.createVNode)((0,n.unref)(p),{variant:`ghost`,size:`xs`,"data-testid":`replace-all`,title:(0,n.unref)(f)(`findReplace.replaceAll`),onMousedown:(0,n.withModifiers)(F,[`prevent`])},{default:(0,n.withCtx)(()=>[(0,n.createTextVNode)((0,n.toDisplayString)((0,n.unref)(f)(`findReplace.replaceAll`)),1)]),_:1},8,[`title`])])):(0,n.createCommentVNode)(``,!0),b.value?((0,n.openBlock)(),(0,n.createElementBlock)(`p`,u,(0,n.toDisplayString)((0,n.unref)(f)(`findReplace.replaceAllSummary`,b.value)),1)):(0,n.createCommentVNode)(``,!0)])],32)):(0,n.createCommentVNode)(``,!0)}}),f=e.n({default:()=>p}),p=t.g(d,[[`__scopeId`,`data-v-6eeec1a2`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return p}});
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { C as e, S as t, a as n, g as r } from "./folio-ui-ctJdVP-s.js";
|
|
2
|
+
import { computed as i, createBlock as ee, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, createVNode as l, defineComponent as u, isRef as d, nextTick as te, normalizeClass as f, openBlock as p, ref as m, toDisplayString as h, toRef as g, unref as _, watch as v, withCtx as y, withKeys as ne, withModifiers as b } from "vue";
|
|
3
|
+
// src/components/dialogs/FindReplaceDialog.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var x = { class: "find-replace-dialog__header" }, S = { class: "find-replace-dialog__title" }, C = { class: "find-replace-dialog__body" }, w = { class: "find-replace-dialog__row" }, T = { class: "find-replace-dialog__count" }, E = { class: "find-replace-dialog__options" }, D = {
|
|
5
|
+
key: 0,
|
|
6
|
+
class: "find-replace-dialog__row"
|
|
7
|
+
}, O = {
|
|
8
|
+
key: 1,
|
|
9
|
+
role: "status",
|
|
10
|
+
"aria-live": "polite",
|
|
11
|
+
class: "find-replace-dialog__summary"
|
|
12
|
+
}, k = /*@__PURE__*/ u({
|
|
13
|
+
__name: "FindReplaceDialog",
|
|
14
|
+
props: {
|
|
15
|
+
isOpen: { type: Boolean },
|
|
16
|
+
search: {}
|
|
17
|
+
},
|
|
18
|
+
emits: ["close"],
|
|
19
|
+
setup(e, { emit: r }) {
|
|
20
|
+
let { t: u } = t(), { Button: k, Input: A, Checkbox: j } = n(), M = e, N = r, P = m(null), F = m(!1), I = m(null), L = i(() => M.search.replacementRefusal.value !== null), { searchText: R, replaceText: z, options: B, matches: V, currentIndex: H, canReplaceCurrent: U, performSearch: W, scheduleSearch: G, findNext: K, findPrevious: q, replaceCurrent: J, replaceAll: Y, clear: X } = M.search, re = () => {
|
|
21
|
+
I.value = Y();
|
|
22
|
+
};
|
|
23
|
+
v([
|
|
24
|
+
R,
|
|
25
|
+
() => B.matchCase,
|
|
26
|
+
() => B.matchWholeWord
|
|
27
|
+
], () => {
|
|
28
|
+
I.value = null;
|
|
29
|
+
});
|
|
30
|
+
let Z = g(B, "matchCase"), Q = g(B, "matchWholeWord"), ie = i(() => R.value.trim() ? V.value.length === 0 ? u("findReplace.noResults") : H.value < 0 ? u("dialogs.findReplace.matchesFound", { total: V.value.length }) : u("findReplace.matchCounter", {
|
|
31
|
+
current: H.value + 1,
|
|
32
|
+
total: V.value.length
|
|
33
|
+
}) : "");
|
|
34
|
+
v(() => M.isOpen, async (e) => {
|
|
35
|
+
e ? (await te(), P.value?.focus(), P.value?.select(), W()) : X();
|
|
36
|
+
}, { immediate: !0 });
|
|
37
|
+
function $() {
|
|
38
|
+
I.value = null, X(), N("close");
|
|
39
|
+
}
|
|
40
|
+
function ae(e) {
|
|
41
|
+
e.key === "Enter" ? (e.preventDefault(), e.shiftKey ? q() : K()) : e.key === "Escape" && $();
|
|
42
|
+
}
|
|
43
|
+
return (t, n) => e.isOpen ? (p(), o("div", {
|
|
44
|
+
key: 0,
|
|
45
|
+
class: "find-replace-dialog",
|
|
46
|
+
"data-testid": "find-replace-dialog",
|
|
47
|
+
onMousedown: n[5] ||= b(() => {}, ["stop"]),
|
|
48
|
+
onKeydown: n[6] ||= b(() => {}, ["stop"])
|
|
49
|
+
}, [s("div", x, [s("span", S, h(F.value ? _(u)("findReplace.findAndReplace") : _(u)("findReplace.find")), 1), l(_(k), {
|
|
50
|
+
class: "find-replace-dialog__close",
|
|
51
|
+
variant: "ghost",
|
|
52
|
+
size: "icon-xs",
|
|
53
|
+
onClick: $,
|
|
54
|
+
title: _(u)("findReplace.close")
|
|
55
|
+
}, {
|
|
56
|
+
default: y(() => [...n[7] ||= [c(" ✕ ", -1)]]),
|
|
57
|
+
_: 1
|
|
58
|
+
}, 8, ["title"])]), s("div", C, [
|
|
59
|
+
s("div", w, [
|
|
60
|
+
l(_(A), {
|
|
61
|
+
ref_key: "searchInputRef",
|
|
62
|
+
ref: P,
|
|
63
|
+
modelValue: _(R),
|
|
64
|
+
"onUpdate:modelValue": n[0] ||= (e) => d(R) ? R.value = e : null,
|
|
65
|
+
class: "find-replace-dialog__input",
|
|
66
|
+
"data-testid": "find-input",
|
|
67
|
+
placeholder: _(u)("findReplace.findPlaceholder"),
|
|
68
|
+
"aria-label": _(u)("findReplace.findText"),
|
|
69
|
+
onKeydown: ae,
|
|
70
|
+
onInput: _(G)
|
|
71
|
+
}, null, 8, [
|
|
72
|
+
"modelValue",
|
|
73
|
+
"placeholder",
|
|
74
|
+
"aria-label",
|
|
75
|
+
"onInput"
|
|
76
|
+
]),
|
|
77
|
+
s("span", T, h(ie.value), 1),
|
|
78
|
+
l(_(k), {
|
|
79
|
+
variant: "ghost",
|
|
80
|
+
size: "icon-xs",
|
|
81
|
+
title: _(u)("findReplace.previous"),
|
|
82
|
+
onMousedown: b(_(q), ["prevent"])
|
|
83
|
+
}, {
|
|
84
|
+
default: y(() => [...n[8] ||= [c("▲", -1)]]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["title", "onMousedown"]),
|
|
87
|
+
l(_(k), {
|
|
88
|
+
variant: "ghost",
|
|
89
|
+
size: "icon-xs",
|
|
90
|
+
title: _(u)("findReplace.next"),
|
|
91
|
+
onMousedown: b(_(K), ["prevent"])
|
|
92
|
+
}, {
|
|
93
|
+
default: y(() => [...n[9] ||= [c("▼", -1)]]),
|
|
94
|
+
_: 1
|
|
95
|
+
}, 8, ["title", "onMousedown"])
|
|
96
|
+
]),
|
|
97
|
+
s("div", E, [
|
|
98
|
+
s("label", null, [l(_(j), {
|
|
99
|
+
checked: Z.value,
|
|
100
|
+
"onUpdate:checked": n[1] ||= (e) => {
|
|
101
|
+
Z.value = e, _(W)();
|
|
102
|
+
}
|
|
103
|
+
}, null, 8, ["checked"]), c(" " + h(_(u)("findReplace.matchCase")), 1)]),
|
|
104
|
+
s("label", null, [l(_(j), {
|
|
105
|
+
checked: Q.value,
|
|
106
|
+
"onUpdate:checked": n[2] ||= (e) => {
|
|
107
|
+
Q.value = e, _(W)();
|
|
108
|
+
}
|
|
109
|
+
}, null, 8, ["checked"]), c(" " + h(_(u)("findReplace.wholeWords")), 1)]),
|
|
110
|
+
L.value ? a("", !0) : (p(), ee(_(k), {
|
|
111
|
+
key: 0,
|
|
112
|
+
class: f(["find-replace-dialog__toggle", { active: F.value }]),
|
|
113
|
+
"data-testid": "find-replace-toggle",
|
|
114
|
+
variant: "ghost",
|
|
115
|
+
size: "xs",
|
|
116
|
+
onMousedown: n[3] ||= b((e) => F.value = !F.value, ["prevent"]),
|
|
117
|
+
title: _(u)("dialogs.findReplace.toggleReplace")
|
|
118
|
+
}, {
|
|
119
|
+
default: y(() => [c(" ↔ " + h(_(u)("dialogs.findReplace.replaceButton")), 1)]),
|
|
120
|
+
_: 1
|
|
121
|
+
}, 8, ["class", "title"]))
|
|
122
|
+
]),
|
|
123
|
+
F.value && !L.value ? (p(), o("div", D, [
|
|
124
|
+
l(_(A), {
|
|
125
|
+
modelValue: _(z),
|
|
126
|
+
"onUpdate:modelValue": n[4] ||= (e) => d(z) ? z.value = e : null,
|
|
127
|
+
class: "find-replace-dialog__input",
|
|
128
|
+
"data-testid": "replace-input",
|
|
129
|
+
placeholder: _(u)("findReplace.replacePlaceholder"),
|
|
130
|
+
"aria-label": _(u)("findReplace.replaceText"),
|
|
131
|
+
onKeydown: ne(b(_(J), ["prevent"]), ["enter"])
|
|
132
|
+
}, null, 8, [
|
|
133
|
+
"modelValue",
|
|
134
|
+
"placeholder",
|
|
135
|
+
"aria-label",
|
|
136
|
+
"onKeydown"
|
|
137
|
+
]),
|
|
138
|
+
l(_(k), {
|
|
139
|
+
variant: "ghost",
|
|
140
|
+
size: "xs",
|
|
141
|
+
disabled: !_(U),
|
|
142
|
+
"data-testid": "replace-current",
|
|
143
|
+
title: _(u)("findReplace.replaceCurrent"),
|
|
144
|
+
onMousedown: b(_(J), ["prevent"])
|
|
145
|
+
}, {
|
|
146
|
+
default: y(() => [c(h(_(u)("dialogs.findReplace.replaceButton")), 1)]),
|
|
147
|
+
_: 1
|
|
148
|
+
}, 8, [
|
|
149
|
+
"disabled",
|
|
150
|
+
"title",
|
|
151
|
+
"onMousedown"
|
|
152
|
+
]),
|
|
153
|
+
l(_(k), {
|
|
154
|
+
variant: "ghost",
|
|
155
|
+
size: "xs",
|
|
156
|
+
"data-testid": "replace-all",
|
|
157
|
+
title: _(u)("findReplace.replaceAll"),
|
|
158
|
+
onMousedown: b(re, ["prevent"])
|
|
159
|
+
}, {
|
|
160
|
+
default: y(() => [c(h(_(u)("findReplace.replaceAll")), 1)]),
|
|
161
|
+
_: 1
|
|
162
|
+
}, 8, ["title"])
|
|
163
|
+
])) : a("", !0),
|
|
164
|
+
I.value ? (p(), o("p", O, h(_(u)("findReplace.replaceAllSummary", I.value)), 1)) : a("", !0)
|
|
165
|
+
])], 32)) : a("", !0);
|
|
166
|
+
}
|
|
167
|
+
}), A = /* @__PURE__ */ e({ default: () => j }), j = /*#__PURE__*/ r(k, [["__scopeId", "data-v-6eeec1a2"]]);
|
|
168
|
+
export { A as n, j as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./rolldown-runtime-DbbDpzbe.cjs"),t=require("./folio-ui-u7h3WXUO.cjs");let n=require("vue"),r=require("@stll/folio-core/utils/rulerControl"),i=require("@stll/folio-core/utils/units");var ee=[`aria-label`],te=[`aria-label`,`aria-orientation`],a=[`aria-label`,`aria-orientation`],o={class:`docx-horizontal-ruler__ticks`},s=[`aria-label`,`aria-orientation`],c=[`aria-label`,`aria-orientation`],ne=[`aria-label`,`aria-orientation`],re=[`title`,`onDblclick`],l=12240,u=1440,d=1440,f=567,ie=`var(--doc-primary)`,ae=`var(--doc-primary)`,oe=`var(--doc-primary-hover)`,p=5,m=(0,n.defineComponent)({__name:`HorizontalRuler`,props:{sectionProps:{},zoom:{default:1},editable:{type:Boolean,default:!0},showFirstLineIndent:{type:Boolean,default:!1},firstLineIndent:{default:0},hangingIndent:{type:Boolean,default:!1},indentLeft:{default:0},indentRight:{default:0},unit:{default:`inch`},tabStops:{}},emits:[`left-margin-change`,`right-margin-change`,`first-line-indent-change`,`indent-left-change`,`indent-right-change`,`tab-stop-remove`],setup(e,{emit:m}){let h=e,g=m,{t:_}=t.S(),v=Math.round(p*1.6),y=(0,n.ref)(null),b=(0,n.ref)(null),x=(0,n.ref)(null),S=(0,n.ref)(0),C=(0,n.ref)(``);function w(e){return(0,i.twipsToPixels)(e)*h.zoom}function se(e){return Math.round((0,i.pixelsToTwips)(e/h.zoom))}let T=(0,n.computed)(()=>h.sectionProps?.pageWidth??l),E=(0,n.computed)(()=>h.sectionProps?.marginLeft??u),D=(0,n.computed)(()=>h.sectionProps?.marginRight??u),O=(0,n.computed)(()=>w(T.value)),k=(0,n.computed)(()=>w(E.value)),A=(0,n.computed)(()=>w(D.value)),j=(0,n.computed)(()=>w(h.indentLeft)),M=(0,n.computed)(()=>w(h.indentRight)),N=(0,n.computed)(()=>h.hangingIndent?-h.firstLineIndent:h.firstLineIndent),P=(0,n.computed)(()=>w(N.value)),F=(0,n.computed)(()=>k.value+j.value),I=(0,n.computed)(()=>O.value-A.value-M.value),L=(0,n.computed)(()=>k.value+j.value+P.value),R=(0,n.computed)(()=>({position:`relative`,width:O.value+`px`,height:r.HORIZONTAL_RULER_HEIGHT_PX+`px`,backgroundColor:`transparent`,overflow:`visible`,userSelect:`none`,cursor:b.value?`ew-resize`:`default`})),z=(0,n.computed)(()=>({position:`absolute`,top:0,left:0,width:k.value+`px`,height:r.HORIZONTAL_RULER_HEIGHT_PX+`px`,backgroundColor:`var(--doc-shadow-subtle)`,borderRight:`1px solid var(--doc-shadow-subtle)`,cursor:h.editable?`ew-resize`:`default`,zIndex:1})),B=(0,n.computed)(()=>({position:`absolute`,top:0,right:0,width:A.value+`px`,height:r.HORIZONTAL_RULER_HEIGHT_PX+`px`,backgroundColor:`var(--doc-shadow-subtle)`,borderLeft:`1px solid var(--doc-shadow-subtle)`,cursor:h.editable?`ew-resize`:`default`,zIndex:1})),V=(0,n.computed)(()=>(0,r.getHorizontalRulerBounds)({pageWidth:T.value,leftMargin:E.value,rightMargin:D.value,leftIndent:h.indentLeft,rightIndent:h.indentRight})),H=(0,n.computed)(()=>({leftMargin:(0,r.createRulerControl)({value:E.value,...V.value.leftMargin,unit:h.unit,onChange:h.editable?e=>$(`leftMargin`,e):void 0}),rightMargin:(0,r.createRulerControl)({value:D.value,...V.value.rightMargin,unit:h.unit,onChange:h.editable?e=>$(`rightMargin`,e):void 0}),firstLineIndent:(0,r.createRulerControl)({value:h.hangingIndent?-h.firstLineIndent:h.firstLineIndent,...V.value.firstLineIndent,unit:h.unit,onChange:h.editable?e=>$(`firstLineIndent`,e):void 0}),leftIndent:(0,r.createRulerControl)({value:h.indentLeft,...V.value.leftIndent,unit:h.unit,onChange:h.editable?e=>$(`leftIndent`,e):void 0}),rightIndent:(0,r.createRulerControl)({value:h.indentRight,...V.value.rightIndent,unit:h.unit,onChange:h.editable?e=>$(`rightIndent`,e):void 0})})),U=(0,n.computed)(()=>{let e=[];if(h.unit===`inch`){let t=d/8,n=Math.ceil(T.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>T.value)break;let i=w(n);r%8==0?e.push({position:i,height:10,label:r/8>0?String(r/8):void 0}):r%4==0?e.push({position:i,height:6}):r%2==0?e.push({position:i,height:4}):e.push({position:i,height:2})}}else{let t=f/10,n=Math.ceil(T.value/t);for(let r=0;r<=n;r++){let n=r*t;if(n>T.value)break;let i=w(n);r%10==0?e.push({position:i,height:10,label:r/10>0?String(r/10):void 0}):r%5==0?e.push({position:i,height:6}):e.push({position:i,height:3})}}return e}),W=(0,n.computed)(()=>h.tabStops?.length?h.tabStops.map(e=>{let t=e.position;return{px:w(E.value+t),twips:t,label:G(t)}}):[]);function G(e){return h.unit===`cm`?(e/f).toFixed(1)+` cm`:(e/d).toFixed(2)+`"`}function K(e){return b.value===e?oe:x.value===e?ae:ie}function q(e,t,n){return{position:`absolute`,left:t-p+`px`,width:`10px`,height:`10px`,cursor:h.editable?`ew-resize`:`default`,zIndex:n?10:4,...e===`down`?{top:0}:{bottom:0}}}function J(e,t){return e===`down`?{position:`absolute`,top:`1px`,left:0,width:0,height:0,borderLeft:`${p}px solid transparent`,borderRight:`${p}px solid transparent`,borderTop:`${v}px solid ${t}`,transition:`border-top-color 0.1s`}:{position:`absolute`,bottom:`1px`,left:0,width:0,height:0,borderLeft:`${p}px solid transparent`,borderRight:`${p}px solid transparent`,borderBottom:`${v}px solid ${t}`,transition:`border-bottom-color 0.1s`}}let Y=0;function X(e,t){h.editable&&(b.value=e,e===`leftMargin`?Y=E.value:e===`rightMargin`?Y=D.value:e===`leftIndent`?Y=h.indentLeft:e===`rightIndent`?Y=h.indentRight:e===`firstLineIndent`&&(Y=h.firstLineIndent),S.value=t.clientX-(y.value?.getBoundingClientRect().left??0),C.value=G(Y),document.addEventListener(`mousemove`,Z),document.addEventListener(`mouseup`,Q))}function Z(e){if(!b.value||!y.value)return;let t=y.value.getBoundingClientRect();if(!t)return;let n=e.clientX-t.left;S.value=n;let r=se(n),i=ce(b.value,r);C.value=G(i),$(b.value,i)}function Q(e){b.value=null,document.removeEventListener(`mousemove`,Z),document.removeEventListener(`mouseup`,Q)}function ce(e,t){if(e===`leftMargin`)return(0,r.clampRulerValue)(t,V.value.leftMargin);if(e===`rightMargin`){let e=T.value-t;return(0,r.clampRulerValue)(e,V.value.rightMargin)}if(e===`firstLineIndent`){let e=t-(E.value+h.indentLeft);return(0,r.clampRulerValue)(e,V.value.firstLineIndent)}if(e===`leftIndent`){let e=t-E.value;return(0,r.clampRulerValue)(e,V.value.leftIndent)}let n=T.value-D.value-t;return(0,r.clampRulerValue)(n,V.value.rightIndent)}function $(e,t){switch(e){case`leftMargin`:g(`left-margin-change`,t);break;case`rightMargin`:g(`right-margin-change`,t);break;case`firstLineIndent`:g(`first-line-indent-change`,t);break;case`leftIndent`:g(`indent-left-change`,t);break;case`rightIndent`:g(`indent-right-change`,t)}}return(0,n.onBeforeUnmount)(()=>{document.removeEventListener(`mousemove`,Z),document.removeEventListener(`mouseup`,Q)}),(t,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{ref_key:`rulerRef`,ref:y,class:`docx-horizontal-ruler`,style:(0,n.normalizeStyle)(R.value),role:`group`,"aria-label":(0,n.unref)(_)(`ruler.horizontal`)},[(0,n.createElementVNode)(`div`,(0,n.mergeProps)({class:`docx-horizontal-ruler__margin`,style:z.value},H.value.leftMargin.attributes,{"aria-label":H.value.leftMargin.attributes.role?`${(0,n.unref)(_)(`dialogs.pageSetup.margins`)}: ${(0,n.unref)(_)(`dialogs.pageSetup.left`)}`:void 0,"aria-orientation":H.value.leftMargin.attributes.role?`horizontal`:void 0,onKeydown:r[0]||=(...e)=>H.value.leftMargin.onKeyDown&&H.value.leftMargin.onKeyDown(...e),onMousedown:r[1]||=(0,n.withModifiers)(t=>e.editable?X(`leftMargin`,t):null,[`prevent`,`stop`])}),null,16,te),(0,n.createElementVNode)(`div`,(0,n.mergeProps)({class:`docx-horizontal-ruler__margin`,style:B.value},H.value.rightMargin.attributes,{"aria-label":H.value.rightMargin.attributes.role?`${(0,n.unref)(_)(`dialogs.pageSetup.margins`)}: ${(0,n.unref)(_)(`dialogs.pageSetup.right`)}`:void 0,"aria-orientation":H.value.rightMargin.attributes.role?`horizontal`:void 0,onKeydown:r[2]||=(...e)=>H.value.rightMargin.onKeyDown&&H.value.rightMargin.onKeyDown(...e),onMousedown:r[3]||=(0,n.withModifiers)(t=>e.editable?X(`rightMargin`,t):null,[`prevent`,`stop`])}),null,16,a),(0,n.createElementVNode)(`div`,o,[((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(U.value,(e,t)=>((0,n.openBlock)(),(0,n.createElementBlock)(n.Fragment,{key:t},[(0,n.createElementVNode)(`div`,{class:`docx-horizontal-ruler__tick-line`,style:(0,n.normalizeStyle)({left:e.position+`px`,height:e.height+`px`})},null,4),e.label?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:0,class:`docx-horizontal-ruler__tick-label`,style:(0,n.normalizeStyle)({left:e.position+`px`})},(0,n.toDisplayString)(e.label),5)):(0,n.createCommentVNode)(``,!0)],64))),128))]),e.showFirstLineIndent?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({key:0,class:`docx-ruler-indent`,style:q(`down`,L.value,b.value===`firstLineIndent`),onMousedown:r[4]||=(0,n.withModifiers)(t=>e.editable?X(`firstLineIndent`,t):null,[`prevent`,`stop`]),onMouseenter:r[5]||=e=>x.value=`firstLineIndent`},H.value.firstLineIndent.attributes,{"aria-label":H.value.firstLineIndent.attributes.role?(0,n.unref)(_)(`ruler.firstLineIndent`):void 0,"aria-orientation":H.value.firstLineIndent.attributes.role?`horizontal`:void 0,onKeydown:r[6]||=(...e)=>H.value.firstLineIndent.onKeyDown&&H.value.firstLineIndent.onKeyDown(...e),onMouseleave:r[7]||=e=>x.value=null}),[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(J(`down`,K(`firstLineIndent`)))},null,4)],16,s)):(0,n.createCommentVNode)(``,!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({key:1,class:`docx-ruler-indent`,style:q(`up`,F.value,b.value===`leftIndent`),onMousedown:r[8]||=(0,n.withModifiers)(e=>X(`leftIndent`,e),[`prevent`,`stop`]),onMouseenter:r[9]||=e=>x.value=`leftIndent`},H.value.leftIndent.attributes,{"aria-label":H.value.leftIndent.attributes.role?(0,n.unref)(_)(`ruler.leftIndent`):void 0,"aria-orientation":H.value.leftIndent.attributes.role?`horizontal`:void 0,onKeydown:r[10]||=(...e)=>H.value.leftIndent.onKeyDown&&H.value.leftIndent.onKeyDown(...e),onMouseleave:r[11]||=e=>x.value=null}),[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(J(`up`,K(`leftIndent`)))},null,4)],16,c)):(0,n.createCommentVNode)(``,!0),e.editable?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,(0,n.mergeProps)({key:2,class:`docx-ruler-indent`,style:q(`down`,I.value,b.value===`rightIndent`),onMousedown:r[12]||=(0,n.withModifiers)(e=>X(`rightIndent`,e),[`prevent`,`stop`]),onMouseenter:r[13]||=e=>x.value=`rightIndent`},H.value.rightIndent.attributes,{"aria-label":H.value.rightIndent.attributes.role?(0,n.unref)(_)(`ruler.rightIndent`):void 0,"aria-orientation":H.value.rightIndent.attributes.role?`horizontal`:void 0,onKeydown:r[14]||=(...e)=>H.value.rightIndent.onKeyDown&&H.value.rightIndent.onKeyDown(...e),onMouseleave:r[15]||=e=>x.value=null}),[(0,n.createElementVNode)(`div`,{style:(0,n.normalizeStyle)(J(`down`,K(`rightIndent`)))},null,4)],16,ne)):(0,n.createCommentVNode)(``,!0),((0,n.openBlock)(!0),(0,n.createElementBlock)(n.Fragment,null,(0,n.renderList)(W.value,(e,r)=>((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:r,class:`docx-horizontal-ruler__tab`,style:(0,n.normalizeStyle)({left:e.px+`px`}),title:`${e.label}`,onDblclick:(0,n.withModifiers)(n=>t.$emit(`tab-stop-remove`,e.twips),[`prevent`])},` L `,44,re))),128)),b.value&&C.value?((0,n.openBlock)(),(0,n.createElementBlock)(`div`,{key:3,class:`docx-horizontal-ruler__tooltip`,style:(0,n.normalizeStyle)({left:S.value+`px`})},(0,n.toDisplayString)(C.value),5)):(0,n.createCommentVNode)(``,!0)],12,ee))}}),h=e.n({default:()=>g}),g=t.g(m,[[`__scopeId`,`data-v-26e024a3`]]);Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return h}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return g}});
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
import { C as e, S as t, g as n } from "./folio-ui-ctJdVP-s.js";
|
|
2
|
+
import { Fragment as r, computed as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, defineComponent as c, mergeProps as l, normalizeStyle as u, onBeforeUnmount as ee, openBlock as d, ref as f, renderList as p, toDisplayString as m, unref as h, withModifiers as g } from "vue";
|
|
3
|
+
import { HORIZONTAL_RULER_HEIGHT_PX as _, clampRulerValue as v, createRulerControl as y, getHorizontalRulerBounds as te } from "@stll/folio-core/utils/rulerControl";
|
|
4
|
+
import { pixelsToTwips as ne, twipsToPixels as re } from "@stll/folio-core/utils/units";
|
|
5
|
+
// src/components/ui/HorizontalRuler.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var ie = ["aria-label"], ae = ["aria-label", "aria-orientation"], oe = ["aria-label", "aria-orientation"], b = { class: "docx-horizontal-ruler__ticks" }, se = ["aria-label", "aria-orientation"], ce = ["aria-label", "aria-orientation"], le = ["aria-label", "aria-orientation"], ue = ["title", "onDblclick"], x = 12240, S = 1440, C = 1440, w = 567, de = "var(--doc-primary)", fe = "var(--doc-primary)", pe = "var(--doc-primary-hover)", T = 5, E = /*@__PURE__*/ c({
|
|
7
|
+
__name: "HorizontalRuler",
|
|
8
|
+
props: {
|
|
9
|
+
sectionProps: {},
|
|
10
|
+
zoom: { default: 1 },
|
|
11
|
+
editable: {
|
|
12
|
+
type: Boolean,
|
|
13
|
+
default: !0
|
|
14
|
+
},
|
|
15
|
+
showFirstLineIndent: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !1
|
|
18
|
+
},
|
|
19
|
+
firstLineIndent: { default: 0 },
|
|
20
|
+
hangingIndent: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: !1
|
|
23
|
+
},
|
|
24
|
+
indentLeft: { default: 0 },
|
|
25
|
+
indentRight: { default: 0 },
|
|
26
|
+
unit: { default: "inch" },
|
|
27
|
+
tabStops: {}
|
|
28
|
+
},
|
|
29
|
+
emits: [
|
|
30
|
+
"left-margin-change",
|
|
31
|
+
"right-margin-change",
|
|
32
|
+
"first-line-indent-change",
|
|
33
|
+
"indent-left-change",
|
|
34
|
+
"indent-right-change",
|
|
35
|
+
"tab-stop-remove"
|
|
36
|
+
],
|
|
37
|
+
setup(e, { emit: n }) {
|
|
38
|
+
let c = e, E = n, { t: D } = t(), O = Math.round(T * 1.6), k = f(null), A = f(null), j = f(null), M = f(0), N = f("");
|
|
39
|
+
function P(e) {
|
|
40
|
+
return re(e) * c.zoom;
|
|
41
|
+
}
|
|
42
|
+
function me(e) {
|
|
43
|
+
return Math.round(ne(e / c.zoom));
|
|
44
|
+
}
|
|
45
|
+
let F = i(() => c.sectionProps?.pageWidth ?? x), I = i(() => c.sectionProps?.marginLeft ?? S), L = i(() => c.sectionProps?.marginRight ?? S), R = i(() => P(F.value)), z = i(() => P(I.value)), B = i(() => P(L.value)), V = i(() => P(c.indentLeft)), he = i(() => P(c.indentRight)), ge = i(() => c.hangingIndent ? -c.firstLineIndent : c.firstLineIndent), _e = i(() => P(ge.value)), H = i(() => z.value + V.value), ve = i(() => R.value - B.value - he.value), ye = i(() => z.value + V.value + _e.value), be = i(() => ({
|
|
46
|
+
position: "relative",
|
|
47
|
+
width: R.value + "px",
|
|
48
|
+
height: _ + "px",
|
|
49
|
+
backgroundColor: "transparent",
|
|
50
|
+
overflow: "visible",
|
|
51
|
+
userSelect: "none",
|
|
52
|
+
cursor: A.value ? "ew-resize" : "default"
|
|
53
|
+
})), xe = i(() => ({
|
|
54
|
+
position: "absolute",
|
|
55
|
+
top: 0,
|
|
56
|
+
left: 0,
|
|
57
|
+
width: z.value + "px",
|
|
58
|
+
height: _ + "px",
|
|
59
|
+
backgroundColor: "var(--doc-shadow-subtle)",
|
|
60
|
+
borderRight: "1px solid var(--doc-shadow-subtle)",
|
|
61
|
+
cursor: c.editable ? "ew-resize" : "default",
|
|
62
|
+
zIndex: 1
|
|
63
|
+
})), Se = i(() => ({
|
|
64
|
+
position: "absolute",
|
|
65
|
+
top: 0,
|
|
66
|
+
right: 0,
|
|
67
|
+
width: B.value + "px",
|
|
68
|
+
height: _ + "px",
|
|
69
|
+
backgroundColor: "var(--doc-shadow-subtle)",
|
|
70
|
+
borderLeft: "1px solid var(--doc-shadow-subtle)",
|
|
71
|
+
cursor: c.editable ? "ew-resize" : "default",
|
|
72
|
+
zIndex: 1
|
|
73
|
+
})), U = i(() => te({
|
|
74
|
+
pageWidth: F.value,
|
|
75
|
+
leftMargin: I.value,
|
|
76
|
+
rightMargin: L.value,
|
|
77
|
+
leftIndent: c.indentLeft,
|
|
78
|
+
rightIndent: c.indentRight
|
|
79
|
+
})), W = i(() => ({
|
|
80
|
+
leftMargin: y({
|
|
81
|
+
value: I.value,
|
|
82
|
+
...U.value.leftMargin,
|
|
83
|
+
unit: c.unit,
|
|
84
|
+
onChange: c.editable ? (e) => $("leftMargin", e) : void 0
|
|
85
|
+
}),
|
|
86
|
+
rightMargin: y({
|
|
87
|
+
value: L.value,
|
|
88
|
+
...U.value.rightMargin,
|
|
89
|
+
unit: c.unit,
|
|
90
|
+
onChange: c.editable ? (e) => $("rightMargin", e) : void 0
|
|
91
|
+
}),
|
|
92
|
+
firstLineIndent: y({
|
|
93
|
+
value: c.hangingIndent ? -c.firstLineIndent : c.firstLineIndent,
|
|
94
|
+
...U.value.firstLineIndent,
|
|
95
|
+
unit: c.unit,
|
|
96
|
+
onChange: c.editable ? (e) => $("firstLineIndent", e) : void 0
|
|
97
|
+
}),
|
|
98
|
+
leftIndent: y({
|
|
99
|
+
value: c.indentLeft,
|
|
100
|
+
...U.value.leftIndent,
|
|
101
|
+
unit: c.unit,
|
|
102
|
+
onChange: c.editable ? (e) => $("leftIndent", e) : void 0
|
|
103
|
+
}),
|
|
104
|
+
rightIndent: y({
|
|
105
|
+
value: c.indentRight,
|
|
106
|
+
...U.value.rightIndent,
|
|
107
|
+
unit: c.unit,
|
|
108
|
+
onChange: c.editable ? (e) => $("rightIndent", e) : void 0
|
|
109
|
+
})
|
|
110
|
+
})), Ce = i(() => {
|
|
111
|
+
let e = [];
|
|
112
|
+
if (c.unit === "inch") {
|
|
113
|
+
let t = C / 8, n = Math.ceil(F.value / t);
|
|
114
|
+
for (let r = 0; r <= n; r++) {
|
|
115
|
+
let n = r * t;
|
|
116
|
+
if (n > F.value) break;
|
|
117
|
+
let i = P(n);
|
|
118
|
+
r % 8 == 0 ? e.push({
|
|
119
|
+
position: i,
|
|
120
|
+
height: 10,
|
|
121
|
+
label: r / 8 > 0 ? String(r / 8) : void 0
|
|
122
|
+
}) : r % 4 == 0 ? e.push({
|
|
123
|
+
position: i,
|
|
124
|
+
height: 6
|
|
125
|
+
}) : r % 2 == 0 ? e.push({
|
|
126
|
+
position: i,
|
|
127
|
+
height: 4
|
|
128
|
+
}) : e.push({
|
|
129
|
+
position: i,
|
|
130
|
+
height: 2
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
} else {
|
|
134
|
+
let t = w / 10, n = Math.ceil(F.value / t);
|
|
135
|
+
for (let r = 0; r <= n; r++) {
|
|
136
|
+
let n = r * t;
|
|
137
|
+
if (n > F.value) break;
|
|
138
|
+
let i = P(n);
|
|
139
|
+
r % 10 == 0 ? e.push({
|
|
140
|
+
position: i,
|
|
141
|
+
height: 10,
|
|
142
|
+
label: r / 10 > 0 ? String(r / 10) : void 0
|
|
143
|
+
}) : r % 5 == 0 ? e.push({
|
|
144
|
+
position: i,
|
|
145
|
+
height: 6
|
|
146
|
+
}) : e.push({
|
|
147
|
+
position: i,
|
|
148
|
+
height: 3
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return e;
|
|
153
|
+
}), we = i(() => c.tabStops?.length ? c.tabStops.map((e) => {
|
|
154
|
+
let t = e.position;
|
|
155
|
+
return {
|
|
156
|
+
px: P(I.value + t),
|
|
157
|
+
twips: t,
|
|
158
|
+
label: G(t)
|
|
159
|
+
};
|
|
160
|
+
}) : []);
|
|
161
|
+
function G(e) {
|
|
162
|
+
return c.unit === "cm" ? (e / w).toFixed(1) + " cm" : (e / C).toFixed(2) + "\"";
|
|
163
|
+
}
|
|
164
|
+
function K(e) {
|
|
165
|
+
return A.value === e ? pe : j.value === e ? fe : de;
|
|
166
|
+
}
|
|
167
|
+
function q(e, t, n) {
|
|
168
|
+
return {
|
|
169
|
+
position: "absolute",
|
|
170
|
+
left: t - T + "px",
|
|
171
|
+
width: "10px",
|
|
172
|
+
height: "10px",
|
|
173
|
+
cursor: c.editable ? "ew-resize" : "default",
|
|
174
|
+
zIndex: n ? 10 : 4,
|
|
175
|
+
...e === "down" ? { top: 0 } : { bottom: 0 }
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
function J(e, t) {
|
|
179
|
+
return e === "down" ? {
|
|
180
|
+
position: "absolute",
|
|
181
|
+
top: "1px",
|
|
182
|
+
left: 0,
|
|
183
|
+
width: 0,
|
|
184
|
+
height: 0,
|
|
185
|
+
borderLeft: `${T}px solid transparent`,
|
|
186
|
+
borderRight: `${T}px solid transparent`,
|
|
187
|
+
borderTop: `${O}px solid ${t}`,
|
|
188
|
+
transition: "border-top-color 0.1s"
|
|
189
|
+
} : {
|
|
190
|
+
position: "absolute",
|
|
191
|
+
bottom: "1px",
|
|
192
|
+
left: 0,
|
|
193
|
+
width: 0,
|
|
194
|
+
height: 0,
|
|
195
|
+
borderLeft: `${T}px solid transparent`,
|
|
196
|
+
borderRight: `${T}px solid transparent`,
|
|
197
|
+
borderBottom: `${O}px solid ${t}`,
|
|
198
|
+
transition: "border-bottom-color 0.1s"
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
let Y = 0;
|
|
202
|
+
function X(e, t) {
|
|
203
|
+
c.editable && (A.value = e, e === "leftMargin" ? Y = I.value : e === "rightMargin" ? Y = L.value : e === "leftIndent" ? Y = c.indentLeft : e === "rightIndent" ? Y = c.indentRight : e === "firstLineIndent" && (Y = c.firstLineIndent), M.value = t.clientX - (k.value?.getBoundingClientRect().left ?? 0), N.value = G(Y), document.addEventListener("mousemove", Z), document.addEventListener("mouseup", Q));
|
|
204
|
+
}
|
|
205
|
+
function Z(e) {
|
|
206
|
+
if (!A.value || !k.value) return;
|
|
207
|
+
let t = k.value.getBoundingClientRect();
|
|
208
|
+
if (!t) return;
|
|
209
|
+
let n = e.clientX - t.left;
|
|
210
|
+
M.value = n;
|
|
211
|
+
let r = me(n), i = Te(A.value, r);
|
|
212
|
+
N.value = G(i), $(A.value, i);
|
|
213
|
+
}
|
|
214
|
+
function Q(e) {
|
|
215
|
+
A.value = null, document.removeEventListener("mousemove", Z), document.removeEventListener("mouseup", Q);
|
|
216
|
+
}
|
|
217
|
+
function Te(e, t) {
|
|
218
|
+
if (e === "leftMargin") return v(t, U.value.leftMargin);
|
|
219
|
+
if (e === "rightMargin") {
|
|
220
|
+
let e = F.value - t;
|
|
221
|
+
return v(e, U.value.rightMargin);
|
|
222
|
+
}
|
|
223
|
+
if (e === "firstLineIndent") {
|
|
224
|
+
let e = t - (I.value + c.indentLeft);
|
|
225
|
+
return v(e, U.value.firstLineIndent);
|
|
226
|
+
}
|
|
227
|
+
if (e === "leftIndent") {
|
|
228
|
+
let e = t - I.value;
|
|
229
|
+
return v(e, U.value.leftIndent);
|
|
230
|
+
}
|
|
231
|
+
let n = F.value - L.value - t;
|
|
232
|
+
return v(n, U.value.rightIndent);
|
|
233
|
+
}
|
|
234
|
+
function $(e, t) {
|
|
235
|
+
switch (e) {
|
|
236
|
+
case "leftMargin":
|
|
237
|
+
E("left-margin-change", t);
|
|
238
|
+
break;
|
|
239
|
+
case "rightMargin":
|
|
240
|
+
E("right-margin-change", t);
|
|
241
|
+
break;
|
|
242
|
+
case "firstLineIndent":
|
|
243
|
+
E("first-line-indent-change", t);
|
|
244
|
+
break;
|
|
245
|
+
case "leftIndent":
|
|
246
|
+
E("indent-left-change", t);
|
|
247
|
+
break;
|
|
248
|
+
case "rightIndent": E("indent-right-change", t);
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return ee(() => {
|
|
252
|
+
document.removeEventListener("mousemove", Z), document.removeEventListener("mouseup", Q);
|
|
253
|
+
}), (t, n) => (d(), o("div", {
|
|
254
|
+
ref_key: "rulerRef",
|
|
255
|
+
ref: k,
|
|
256
|
+
class: "docx-horizontal-ruler",
|
|
257
|
+
style: u(be.value),
|
|
258
|
+
role: "group",
|
|
259
|
+
"aria-label": h(D)("ruler.horizontal")
|
|
260
|
+
}, [
|
|
261
|
+
s("div", l({
|
|
262
|
+
class: "docx-horizontal-ruler__margin",
|
|
263
|
+
style: xe.value
|
|
264
|
+
}, W.value.leftMargin.attributes, {
|
|
265
|
+
"aria-label": W.value.leftMargin.attributes.role ? `${h(D)("dialogs.pageSetup.margins")}: ${h(D)("dialogs.pageSetup.left")}` : void 0,
|
|
266
|
+
"aria-orientation": W.value.leftMargin.attributes.role ? "horizontal" : void 0,
|
|
267
|
+
onKeydown: n[0] ||= (...e) => W.value.leftMargin.onKeyDown && W.value.leftMargin.onKeyDown(...e),
|
|
268
|
+
onMousedown: n[1] ||= g((t) => e.editable ? X("leftMargin", t) : null, ["prevent", "stop"])
|
|
269
|
+
}), null, 16, ae),
|
|
270
|
+
s("div", l({
|
|
271
|
+
class: "docx-horizontal-ruler__margin",
|
|
272
|
+
style: Se.value
|
|
273
|
+
}, W.value.rightMargin.attributes, {
|
|
274
|
+
"aria-label": W.value.rightMargin.attributes.role ? `${h(D)("dialogs.pageSetup.margins")}: ${h(D)("dialogs.pageSetup.right")}` : void 0,
|
|
275
|
+
"aria-orientation": W.value.rightMargin.attributes.role ? "horizontal" : void 0,
|
|
276
|
+
onKeydown: n[2] ||= (...e) => W.value.rightMargin.onKeyDown && W.value.rightMargin.onKeyDown(...e),
|
|
277
|
+
onMousedown: n[3] ||= g((t) => e.editable ? X("rightMargin", t) : null, ["prevent", "stop"])
|
|
278
|
+
}), null, 16, oe),
|
|
279
|
+
s("div", b, [(d(!0), o(r, null, p(Ce.value, (e, t) => (d(), o(r, { key: t }, [s("div", {
|
|
280
|
+
class: "docx-horizontal-ruler__tick-line",
|
|
281
|
+
style: u({
|
|
282
|
+
left: e.position + "px",
|
|
283
|
+
height: e.height + "px"
|
|
284
|
+
})
|
|
285
|
+
}, null, 4), e.label ? (d(), o("div", {
|
|
286
|
+
key: 0,
|
|
287
|
+
class: "docx-horizontal-ruler__tick-label",
|
|
288
|
+
style: u({ left: e.position + "px" })
|
|
289
|
+
}, m(e.label), 5)) : a("", !0)], 64))), 128))]),
|
|
290
|
+
e.showFirstLineIndent ? (d(), o("div", l({
|
|
291
|
+
key: 0,
|
|
292
|
+
class: "docx-ruler-indent",
|
|
293
|
+
style: q("down", ye.value, A.value === "firstLineIndent"),
|
|
294
|
+
onMousedown: n[4] ||= g((t) => e.editable ? X("firstLineIndent", t) : null, ["prevent", "stop"]),
|
|
295
|
+
onMouseenter: n[5] ||= (e) => j.value = "firstLineIndent"
|
|
296
|
+
}, W.value.firstLineIndent.attributes, {
|
|
297
|
+
"aria-label": W.value.firstLineIndent.attributes.role ? h(D)("ruler.firstLineIndent") : void 0,
|
|
298
|
+
"aria-orientation": W.value.firstLineIndent.attributes.role ? "horizontal" : void 0,
|
|
299
|
+
onKeydown: n[6] ||= (...e) => W.value.firstLineIndent.onKeyDown && W.value.firstLineIndent.onKeyDown(...e),
|
|
300
|
+
onMouseleave: n[7] ||= (e) => j.value = null
|
|
301
|
+
}), [s("div", { style: u(J("down", K("firstLineIndent"))) }, null, 4)], 16, se)) : a("", !0),
|
|
302
|
+
e.editable ? (d(), o("div", l({
|
|
303
|
+
key: 1,
|
|
304
|
+
class: "docx-ruler-indent",
|
|
305
|
+
style: q("up", H.value, A.value === "leftIndent"),
|
|
306
|
+
onMousedown: n[8] ||= g((e) => X("leftIndent", e), ["prevent", "stop"]),
|
|
307
|
+
onMouseenter: n[9] ||= (e) => j.value = "leftIndent"
|
|
308
|
+
}, W.value.leftIndent.attributes, {
|
|
309
|
+
"aria-label": W.value.leftIndent.attributes.role ? h(D)("ruler.leftIndent") : void 0,
|
|
310
|
+
"aria-orientation": W.value.leftIndent.attributes.role ? "horizontal" : void 0,
|
|
311
|
+
onKeydown: n[10] ||= (...e) => W.value.leftIndent.onKeyDown && W.value.leftIndent.onKeyDown(...e),
|
|
312
|
+
onMouseleave: n[11] ||= (e) => j.value = null
|
|
313
|
+
}), [s("div", { style: u(J("up", K("leftIndent"))) }, null, 4)], 16, ce)) : a("", !0),
|
|
314
|
+
e.editable ? (d(), o("div", l({
|
|
315
|
+
key: 2,
|
|
316
|
+
class: "docx-ruler-indent",
|
|
317
|
+
style: q("down", ve.value, A.value === "rightIndent"),
|
|
318
|
+
onMousedown: n[12] ||= g((e) => X("rightIndent", e), ["prevent", "stop"]),
|
|
319
|
+
onMouseenter: n[13] ||= (e) => j.value = "rightIndent"
|
|
320
|
+
}, W.value.rightIndent.attributes, {
|
|
321
|
+
"aria-label": W.value.rightIndent.attributes.role ? h(D)("ruler.rightIndent") : void 0,
|
|
322
|
+
"aria-orientation": W.value.rightIndent.attributes.role ? "horizontal" : void 0,
|
|
323
|
+
onKeydown: n[14] ||= (...e) => W.value.rightIndent.onKeyDown && W.value.rightIndent.onKeyDown(...e),
|
|
324
|
+
onMouseleave: n[15] ||= (e) => j.value = null
|
|
325
|
+
}), [s("div", { style: u(J("down", K("rightIndent"))) }, null, 4)], 16, le)) : a("", !0),
|
|
326
|
+
(d(!0), o(r, null, p(we.value, (e, n) => (d(), o("div", {
|
|
327
|
+
key: n,
|
|
328
|
+
class: "docx-horizontal-ruler__tab",
|
|
329
|
+
style: u({ left: e.px + "px" }),
|
|
330
|
+
title: `${e.label}`,
|
|
331
|
+
onDblclick: g((n) => t.$emit("tab-stop-remove", e.twips), ["prevent"])
|
|
332
|
+
}, " L ", 44, ue))), 128)),
|
|
333
|
+
A.value && N.value ? (d(), o("div", {
|
|
334
|
+
key: 3,
|
|
335
|
+
class: "docx-horizontal-ruler__tooltip",
|
|
336
|
+
style: u({ left: M.value + "px" })
|
|
337
|
+
}, m(N.value), 5)) : a("", !0)
|
|
338
|
+
], 12, ie));
|
|
339
|
+
}
|
|
340
|
+
}), D = /* @__PURE__ */ e({ default: () => O }), O = /*#__PURE__*/ n(E, [["__scopeId", "data-v-26e024a3"]]);
|
|
341
|
+
export { D as n, O as t };
|