@dou-ui/sheet 0.0.0-stage → 0.1.0-alpha.1

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.
Files changed (262) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +10 -2
  3. package/dist/cell-types.js +20 -0
  4. package/dist/cell-types.js.map +1 -0
  5. package/dist/code/code-formula-bar.js +6 -0
  6. package/dist/code/code-formula-bar.js.map +1 -0
  7. package/dist/code/code-formula-bar.vue_vue_type_script_setup_true_lang.js +192 -0
  8. package/dist/code/code-formula-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  9. package/dist/code/index.js +12 -0
  10. package/dist/code/index.js.map +1 -0
  11. package/dist/code/language.js +51 -0
  12. package/dist/code/language.js.map +1 -0
  13. package/dist/code/style.d.ts +1 -0
  14. package/dist/code/style.js +2 -0
  15. package/dist/collaboration/anchor.js +143 -0
  16. package/dist/collaboration/anchor.js.map +1 -0
  17. package/dist/collaboration/index.js +770 -0
  18. package/dist/collaboration/index.js.map +1 -0
  19. package/dist/collaboration/peers.js +87 -0
  20. package/dist/collaboration/peers.js.map +1 -0
  21. package/dist/collaboration/shared.js +450 -0
  22. package/dist/collaboration/shared.js.map +1 -0
  23. package/dist/components/cell-panel.js +6 -0
  24. package/dist/components/cell-panel.js.map +1 -0
  25. package/dist/components/cell-panel.vue_vue_type_script_setup_true_lang.js +70 -0
  26. package/dist/components/cell-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  27. package/dist/components/cell-renders.js +40 -0
  28. package/dist/components/cell-renders.js.map +1 -0
  29. package/dist/components/date-panel.js +6 -0
  30. package/dist/components/date-panel.js.map +1 -0
  31. package/dist/components/date-panel.vue_vue_type_script_setup_true_lang.js +48 -0
  32. package/dist/components/date-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  33. package/dist/components/filter-panel.js +6 -0
  34. package/dist/components/filter-panel.js.map +1 -0
  35. package/dist/components/filter-panel.vue_vue_type_script_setup_true_lang.js +259 -0
  36. package/dist/components/filter-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  37. package/dist/components/format-dialog.js +6 -0
  38. package/dist/components/format-dialog.js.map +1 -0
  39. package/dist/components/format-dialog.vue_vue_type_script_setup_true_lang.js +432 -0
  40. package/dist/components/format-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
  41. package/dist/components/format-list.js +6 -0
  42. package/dist/components/format-list.js.map +1 -0
  43. package/dist/components/format-list.vue_vue_type_script_setup_true_lang.js +187 -0
  44. package/dist/components/format-list.vue_vue_type_script_setup_true_lang.js.map +1 -0
  45. package/dist/components/format-presets.js +97 -0
  46. package/dist/components/format-presets.js.map +1 -0
  47. package/dist/components/option-panel.js +6 -0
  48. package/dist/components/option-panel.js.map +1 -0
  49. package/dist/components/option-panel.vue_vue_type_script_setup_true_lang.js +117 -0
  50. package/dist/components/option-panel.vue_vue_type_script_setup_true_lang.js.map +1 -0
  51. package/dist/components/sheet-comment.js +6 -0
  52. package/dist/components/sheet-comment.js.map +1 -0
  53. package/dist/components/sheet-comment.vue_vue_type_script_setup_true_lang.js +104 -0
  54. package/dist/components/sheet-comment.vue_vue_type_script_setup_true_lang.js.map +1 -0
  55. package/dist/components/sheet-formula-bar.js +6 -0
  56. package/dist/components/sheet-formula-bar.js.map +1 -0
  57. package/dist/components/sheet-formula-bar.vue_vue_type_script_setup_true_lang.js +124 -0
  58. package/dist/components/sheet-formula-bar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  59. package/dist/components/sheet-link.js +6 -0
  60. package/dist/components/sheet-link.js.map +1 -0
  61. package/dist/components/sheet-link.vue_vue_type_script_setup_true_lang.js +249 -0
  62. package/dist/components/sheet-link.vue_vue_type_script_setup_true_lang.js.map +1 -0
  63. package/dist/components/sheet-menu.js +6 -0
  64. package/dist/components/sheet-menu.js.map +1 -0
  65. package/dist/components/sheet-menu.vue_vue_type_script_setup_true_lang.js +115 -0
  66. package/dist/components/sheet-menu.vue_vue_type_script_setup_true_lang.js.map +1 -0
  67. package/dist/components/sheet-name-box.js +6 -0
  68. package/dist/components/sheet-name-box.js.map +1 -0
  69. package/dist/components/sheet-name-box.vue_vue_type_script_setup_true_lang.js +91 -0
  70. package/dist/components/sheet-name-box.vue_vue_type_script_setup_true_lang.js.map +1 -0
  71. package/dist/components/sheet-note.js +6 -0
  72. package/dist/components/sheet-note.js.map +1 -0
  73. package/dist/components/sheet-note.vue_vue_type_script_setup_true_lang.js +146 -0
  74. package/dist/components/sheet-note.vue_vue_type_script_setup_true_lang.js.map +1 -0
  75. package/dist/components/sheet-outline.js +6 -0
  76. package/dist/components/sheet-outline.js.map +1 -0
  77. package/dist/components/sheet-outline.vue_vue_type_script_setup_true_lang.js +237 -0
  78. package/dist/components/sheet-outline.vue_vue_type_script_setup_true_lang.js.map +1 -0
  79. package/dist/components/sheet-tabs.js +6 -0
  80. package/dist/components/sheet-tabs.js.map +1 -0
  81. package/dist/components/sheet-tabs.vue_vue_type_script_setup_true_lang.js +487 -0
  82. package/dist/components/sheet-tabs.vue_vue_type_script_setup_true_lang.js.map +1 -0
  83. package/dist/components/sheet-toolbar.js +6 -0
  84. package/dist/components/sheet-toolbar.js.map +1 -0
  85. package/dist/components/sheet-toolbar.vue_vue_type_script_setup_true_lang.js +1562 -0
  86. package/dist/components/sheet-toolbar.vue_vue_type_script_setup_true_lang.js.map +1 -0
  87. package/dist/components/validation-dialog.js +6 -0
  88. package/dist/components/validation-dialog.js.map +1 -0
  89. package/dist/components/validation-dialog.vue_vue_type_script_setup_true_lang.js +370 -0
  90. package/dist/components/validation-dialog.vue_vue_type_script_setup_true_lang.js.map +1 -0
  91. package/dist/context.js +12 -0
  92. package/dist/context.js.map +1 -0
  93. package/dist/core/address.js +256 -0
  94. package/dist/core/address.js.map +1 -0
  95. package/dist/core/axis.js +72 -0
  96. package/dist/core/axis.js.map +1 -0
  97. package/dist/core/cell-type.js +30 -0
  98. package/dist/core/cell-type.js.map +1 -0
  99. package/dist/core/clipboard.js +141 -0
  100. package/dist/core/clipboard.js.map +1 -0
  101. package/dist/core/commands.js +63 -0
  102. package/dist/core/commands.js.map +1 -0
  103. package/dist/core/comments.js +74 -0
  104. package/dist/core/comments.js.map +1 -0
  105. package/dist/core/conditional.js +362 -0
  106. package/dist/core/conditional.js.map +1 -0
  107. package/dist/core/csv.js +191 -0
  108. package/dist/core/csv.js.map +1 -0
  109. package/dist/core/data.js +118 -0
  110. package/dist/core/data.js.map +1 -0
  111. package/dist/core/document.js +187 -0
  112. package/dist/core/document.js.map +1 -0
  113. package/dist/core/extension.js +60 -0
  114. package/dist/core/extension.js.map +1 -0
  115. package/dist/core/file.js +336 -0
  116. package/dist/core/file.js.map +1 -0
  117. package/dist/core/fill.js +153 -0
  118. package/dist/core/fill.js.map +1 -0
  119. package/dist/core/find.js +42 -0
  120. package/dist/core/find.js.map +1 -0
  121. package/dist/core/format.js +404 -0
  122. package/dist/core/format.js.map +1 -0
  123. package/dist/core/group.js +134 -0
  124. package/dist/core/group.js.map +1 -0
  125. package/dist/core/history.js +68 -0
  126. package/dist/core/history.js.map +1 -0
  127. package/dist/core/index.js +17 -0
  128. package/dist/core/link.js +34 -0
  129. package/dist/core/link.js.map +1 -0
  130. package/dist/core/merge.js +105 -0
  131. package/dist/core/merge.js.map +1 -0
  132. package/dist/core/model.js +48 -0
  133. package/dist/core/model.js.map +1 -0
  134. package/dist/core/nav.js +44 -0
  135. package/dist/core/nav.js.map +1 -0
  136. package/dist/core/paint.js +106 -0
  137. package/dist/core/paint.js.map +1 -0
  138. package/dist/core/plain-cell-types.js +54 -0
  139. package/dist/core/plain-cell-types.js.map +1 -0
  140. package/dist/core/protect.js +246 -0
  141. package/dist/core/protect.js.map +1 -0
  142. package/dist/core/selection.js +37 -0
  143. package/dist/core/selection.js.map +1 -0
  144. package/dist/core/transaction.js +1582 -0
  145. package/dist/core/transaction.js.map +1 -0
  146. package/dist/core/validation.js +135 -0
  147. package/dist/core/validation.js.map +1 -0
  148. package/dist/core/versions.js +161 -0
  149. package/dist/core/versions.js.map +1 -0
  150. package/dist/export/color.js +36 -0
  151. package/dist/export/color.js.map +1 -0
  152. package/dist/export/draw.js +316 -0
  153. package/dist/export/draw.js.map +1 -0
  154. package/dist/export/index.js +390 -0
  155. package/dist/export/index.js.map +1 -0
  156. package/dist/formula/edit.js +210 -0
  157. package/dist/formula/edit.js.map +1 -0
  158. package/dist/formula/engine.js +526 -0
  159. package/dist/formula/engine.js.map +1 -0
  160. package/dist/formula/error.js +39 -0
  161. package/dist/formula/error.js.map +1 -0
  162. package/dist/formula/functions.js +1493 -0
  163. package/dist/formula/functions.js.map +1 -0
  164. package/dist/formula/help.js +408 -0
  165. package/dist/formula/help.js.map +1 -0
  166. package/dist/formula/index.js +7 -0
  167. package/dist/formula/parse.js +369 -0
  168. package/dist/formula/parse.js.map +1 -0
  169. package/dist/formula/values.js +123 -0
  170. package/dist/formula/values.js.map +1 -0
  171. package/dist/formulas.js +30 -0
  172. package/dist/formulas.js.map +1 -0
  173. package/dist/index.js +39 -0
  174. package/dist/index.js.map +1 -0
  175. package/dist/locale.js +1312 -0
  176. package/dist/locale.js.map +1 -0
  177. package/dist/sheet.js +6 -0
  178. package/dist/sheet.js.map +1 -0
  179. package/dist/sheet.vue_vue_type_script_setup_true_lang.js +7166 -0
  180. package/dist/sheet.vue_vue_type_script_setup_true_lang.js.map +1 -0
  181. package/dist/style.css +1 -0
  182. package/dist/style.d.ts +1 -0
  183. package/dist/style.js +17 -0
  184. package/dist/types/cell-types.d.ts +2 -0
  185. package/dist/types/code/code-formula-bar.vue.d.ts +3 -0
  186. package/dist/types/code/index.d.ts +12 -0
  187. package/dist/types/code/language.d.ts +13 -0
  188. package/dist/types/collaboration/anchor.d.ts +65 -0
  189. package/dist/types/collaboration/index.d.ts +59 -0
  190. package/dist/types/collaboration/peers.d.ts +21 -0
  191. package/dist/types/collaboration/shared.d.ts +75 -0
  192. package/dist/types/components/cell-panel.vue.d.ts +20 -0
  193. package/dist/types/components/cell-renders.d.ts +9 -0
  194. package/dist/types/components/date-panel.vue.d.ts +9 -0
  195. package/dist/types/components/filter-panel.vue.d.ts +21 -0
  196. package/dist/types/components/format-dialog.vue.d.ts +24 -0
  197. package/dist/types/components/format-list.vue.d.ts +25 -0
  198. package/dist/types/components/format-presets.d.ts +30 -0
  199. package/dist/types/components/option-panel.vue.d.ts +13 -0
  200. package/dist/types/components/sheet-comment.vue.d.ts +29 -0
  201. package/dist/types/components/sheet-formula-bar.vue.d.ts +3 -0
  202. package/dist/types/components/sheet-link.vue.d.ts +32 -0
  203. package/dist/types/components/sheet-menu.vue.d.ts +20 -0
  204. package/dist/types/components/sheet-name-box.vue.d.ts +3 -0
  205. package/dist/types/components/sheet-note.vue.d.ts +22 -0
  206. package/dist/types/components/sheet-outline.vue.d.ts +36 -0
  207. package/dist/types/components/sheet-tabs.vue.d.ts +9 -0
  208. package/dist/types/components/sheet-toolbar.vue.d.ts +11 -0
  209. package/dist/types/components/validation-dialog.vue.d.ts +25 -0
  210. package/dist/types/context.d.ts +189 -0
  211. package/dist/types/core/address.d.ts +109 -0
  212. package/dist/types/core/axis.d.ts +23 -0
  213. package/dist/types/core/cell-type.d.ts +157 -0
  214. package/dist/types/core/clipboard.d.ts +48 -0
  215. package/dist/types/core/commands.d.ts +76 -0
  216. package/dist/types/core/comments.d.ts +22 -0
  217. package/dist/types/core/conditional.d.ts +114 -0
  218. package/dist/types/core/csv.d.ts +93 -0
  219. package/dist/types/core/data.d.ts +26 -0
  220. package/dist/types/core/document.d.ts +49 -0
  221. package/dist/types/core/extension.d.ts +177 -0
  222. package/dist/types/core/file.d.ts +301 -0
  223. package/dist/types/core/fill.d.ts +23 -0
  224. package/dist/types/core/find.d.ts +39 -0
  225. package/dist/types/core/format.d.ts +47 -0
  226. package/dist/types/core/group.d.ts +76 -0
  227. package/dist/types/core/history.d.ts +27 -0
  228. package/dist/types/core/index.d.ts +33 -0
  229. package/dist/types/core/link.d.ts +14 -0
  230. package/dist/types/core/merge.d.ts +26 -0
  231. package/dist/types/core/model.d.ts +363 -0
  232. package/dist/types/core/nav.d.ts +15 -0
  233. package/dist/types/core/paint.d.ts +19 -0
  234. package/dist/types/core/plain-cell-types.d.ts +6 -0
  235. package/dist/types/core/protect.d.ts +34 -0
  236. package/dist/types/core/selection.d.ts +25 -0
  237. package/dist/types/core/transaction.d.ts +470 -0
  238. package/dist/types/core/validation.d.ts +55 -0
  239. package/dist/types/core/versions.d.ts +38 -0
  240. package/dist/types/export/color.d.ts +7 -0
  241. package/dist/types/export/draw.d.ts +98 -0
  242. package/dist/types/export/index.d.ts +47 -0
  243. package/dist/types/formula/edit.d.ts +62 -0
  244. package/dist/types/formula/engine.d.ts +99 -0
  245. package/dist/types/formula/error.d.ts +30 -0
  246. package/dist/types/formula/functions.d.ts +62 -0
  247. package/dist/types/formula/help.d.ts +12 -0
  248. package/dist/types/formula/index.d.ts +13 -0
  249. package/dist/types/formula/parse.d.ts +92 -0
  250. package/dist/types/formula/values.d.ts +65 -0
  251. package/dist/types/formulas.d.ts +32 -0
  252. package/dist/types/index.d.ts +225 -0
  253. package/dist/types/locale.d.ts +531 -0
  254. package/dist/types/sheet.vue.d.ts +60 -0
  255. package/dist/types/types.d.ts +498 -0
  256. package/dist/types/use-comments.d.ts +47 -0
  257. package/dist/types/use-messages.d.ts +7 -0
  258. package/dist/use-comments.js +130 -0
  259. package/dist/use-comments.js.map +1 -0
  260. package/dist/use-messages.js +29 -0
  261. package/dist/use-messages.js.map +1 -0
  262. package/package.json +93 -4
@@ -0,0 +1,432 @@
1
+ import { readRuleRange, ruleRangeText } from "../core/conditional.js";
2
+ import { LOOKS, SCALES, TONES, barSwatch, lookName, scaleName, scaleSwatch, styleSample, toneKey } from "./format-presets.js";
3
+ import { DouButton, DouCheckbox, DouDialog, DouForm, DouFormItem, DouInput, DouInputNumber, DouSegmentedControl, DouSelect } from "dou-ui";
4
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, normalizeClass, normalizeStyle, openBlock, ref, toDisplayString, unref, useModel, useTemplateRef, watch, withCtx, withKeys, withModifiers } from "vue";
5
+ // src/components/format-dialog.vue?vue&type=script&setup=true&lang.ts
6
+ var _hoisted_1 = { class: "dou-sheet-format__values" };
7
+ var _hoisted_2 = { class: "dou-sheet-format__and" };
8
+ var _hoisted_3 = { class: "dou-sheet-format__values" };
9
+ var _hoisted_4 = { class: "dou-sheet-format__look" };
10
+ var _hoisted_5 = { class: "dou-sheet-format__look" };
11
+ var _hoisted_6 = { class: "dou-sheet-format__look" };
12
+ var _hoisted_7 = { class: "dou-sheet-format__look" };
13
+ var _hoisted_8 = { class: "dou-sheet-format__look" };
14
+ var _hoisted_9 = { class: "dou-sheet-format__look" };
15
+ var format_dialog_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
16
+ __name: "format-dialog",
17
+ props: /*@__PURE__*/ mergeModels({
18
+ format: {},
19
+ title: {},
20
+ styles: {},
21
+ messages: {}
22
+ }, {
23
+ "open": {
24
+ type: Boolean,
25
+ required: true
26
+ },
27
+ "openModifiers": {}
28
+ }),
29
+ emits: /*@__PURE__*/ mergeModels(["apply", "closed"], ["update:open"]),
30
+ setup(__props, { emit: __emit }) {
31
+ const props = __props;
32
+ const open = useModel(__props, "open");
33
+ const emit = __emit;
34
+ const m = computed(() => props.messages.formats);
35
+ function kindOf(f) {
36
+ if ("when" in f) return "when";
37
+ if ("formula" in f) return "formula";
38
+ if ("duplicates" in f || "unique" in f) return "duplicates";
39
+ if ("top" in f || "bottom" in f) return "rank";
40
+ if ("average" in f) return "average";
41
+ return "scale" in f ? "scale" : "bar";
42
+ }
43
+ const kind = computed(() => kindOf(props.format));
44
+ const OPS = [
45
+ "gt",
46
+ "ge",
47
+ "lt",
48
+ "le",
49
+ "eq",
50
+ "ne",
51
+ "between",
52
+ "notBetween",
53
+ "contains",
54
+ "notContains",
55
+ "begins",
56
+ "ends",
57
+ "blank",
58
+ "notBlank"
59
+ ];
60
+ const opOptions = computed(() => OPS.map((value) => ({
61
+ value,
62
+ label: props.messages.ops[value]
63
+ })));
64
+ const target = ref("");
65
+ const op = ref("gt");
66
+ const value = ref("");
67
+ const to = ref("");
68
+ const formula = ref("");
69
+ const count = ref(10);
70
+ const percent = ref(false);
71
+ const repeated = ref("repeated");
72
+ const look = ref("danger");
73
+ const scale = ref("rag");
74
+ const bar = ref("neutral");
75
+ const tried = ref(false);
76
+ const text = (v) => v == null ? "" : String(v);
77
+ /** The rule's own look, when it isn't one the dialog offers. */
78
+ const current = computed(() => {
79
+ const f = props.format;
80
+ if (!("style" in f)) return void 0;
81
+ const style = typeof f.style === "string" ? void 0 : f.style;
82
+ return style && lookName(style) ? void 0 : f.style;
83
+ });
84
+ const resolve = (style) => typeof style === "string" ? props.styles?.[style] : style;
85
+ watch(open, (now) => {
86
+ if (!now) return;
87
+ const f = props.format;
88
+ target.value = ruleRangeText(f.range);
89
+ op.value = "when" in f ? f.when.op : "gt";
90
+ value.value = "when" in f ? text(f.when.value) : "";
91
+ to.value = "when" in f ? text(f.when.to) : "";
92
+ formula.value = "formula" in f ? f.formula : "";
93
+ count.value = "top" in f && f.top != null ? f.top : "bottom" in f ? f.bottom ?? 10 : 10;
94
+ percent.value = "percent" in f && !!f.percent;
95
+ repeated.value = "unique" in f ? "unique" : "repeated";
96
+ look.value = "style" in f ? (typeof f.style === "string" ? void 0 : lookName(f.style)) ?? "current" : "danger";
97
+ scale.value = "scale" in f ? scaleName(f.scale) ?? "current" : "rag";
98
+ bar.value = "bar" in f ? f.bar === true ? "neutral" : TONES.includes(f.bar) ? f.bar : "current" : "neutral";
99
+ tried.value = false;
100
+ });
101
+ const lookOptions = computed(() => [...current.value === void 0 ? [] : [{
102
+ value: "current",
103
+ label: m.value.current
104
+ }], ...Object.keys(LOOKS).map((name) => ({
105
+ value: name,
106
+ label: m.value.looks[name]
107
+ }))]);
108
+ function lookSample(name) {
109
+ return styleSample(name === "current" ? resolve(current.value) : LOOKS[name]);
110
+ }
111
+ const scaleOptions = computed(() => [..."scale" in props.format && !scaleName(props.format.scale) ? [{
112
+ value: "current",
113
+ label: m.value.current
114
+ }] : [], ...Object.keys(SCALES).map((name) => ({
115
+ value: name,
116
+ label: m.value.scales[name]
117
+ }))]);
118
+ function scaleColors(name) {
119
+ if (name !== "current") return SCALES[name];
120
+ return "scale" in props.format ? props.format.scale : SCALES.rag;
121
+ }
122
+ const barOptions = computed(() => [..."bar" in props.format && props.format.bar !== true && !TONES.includes(props.format.bar) ? [{
123
+ value: "current",
124
+ label: m.value.current
125
+ }] : [], ...TONES.map((tone) => ({
126
+ value: tone,
127
+ label: props.messages[toneKey(tone)]
128
+ }))]);
129
+ function barOf(name) {
130
+ if (name !== "current") return name;
131
+ return "bar" in props.format && props.format.bar !== true ? props.format.bar : "neutral";
132
+ }
133
+ const needsValue = computed(() => kind.value === "when" && op.value !== "blank" && op.value !== "notBlank");
134
+ const needsTo = computed(() => op.value === "between" || op.value === "notBetween");
135
+ const rangeOk = computed(() => readRuleRange(target.value) != null);
136
+ const valueOk = computed(() => !needsValue.value || value.value.trim() !== "" && (!needsTo.value || to.value.trim() !== ""));
137
+ const formulaOk = computed(() => kind.value !== "formula" || formula.value.trim().replace(/^=/, "") !== "");
138
+ const countOk = computed(() => kind.value !== "rank" || (count.value ?? 0) >= 1);
139
+ /** A typed operand: a number when it reads as one, otherwise the text. */
140
+ function operand(input) {
141
+ const trimmed = input.trim();
142
+ const n = Number(trimmed.replace(/,/g, ""));
143
+ return trimmed && Number.isFinite(n) && /\d/.test(trimmed) ? n : trimmed;
144
+ }
145
+ function result() {
146
+ const f = props.format;
147
+ const range = readRuleRange(target.value);
148
+ const style = look.value === "current" && current.value !== void 0 ? current.value : { ...LOOKS[look.value] };
149
+ switch (kind.value) {
150
+ case "when": {
151
+ const when = { op: op.value };
152
+ if (needsValue.value) when.value = operand(value.value);
153
+ if (needsValue.value && needsTo.value) when.to = operand(to.value);
154
+ return {
155
+ range,
156
+ when,
157
+ style
158
+ };
159
+ }
160
+ case "formula": {
161
+ const body = formula.value.trim();
162
+ return {
163
+ range,
164
+ formula: body.startsWith("=") ? body : `=${body}`,
165
+ style
166
+ };
167
+ }
168
+ case "duplicates": return repeated.value === "repeated" ? {
169
+ range,
170
+ duplicates: true,
171
+ style
172
+ } : {
173
+ range,
174
+ unique: true,
175
+ style
176
+ };
177
+ case "rank": {
178
+ const n = Math.round(count.value);
179
+ return {
180
+ range,
181
+ ..."bottom" in f && f.bottom != null ? { bottom: n } : { top: n },
182
+ ...percent.value && { percent: true },
183
+ style
184
+ };
185
+ }
186
+ case "average": return {
187
+ range,
188
+ average: "average" in f ? f.average : "above",
189
+ style
190
+ };
191
+ case "scale": return {
192
+ range,
193
+ scale: [...scaleColors(scale.value)]
194
+ };
195
+ case "bar": return {
196
+ range,
197
+ bar: bar.value === "neutral" && "bar" in f && f.bar === true ? true : barOf(bar.value)
198
+ };
199
+ }
200
+ }
201
+ const rangeInput = useTemplateRef("rangeInput");
202
+ const valueInput = useTemplateRef("valueInput");
203
+ const formulaInput = useTemplateRef("formulaInput");
204
+ const countInput = useTemplateRef("countInput");
205
+ function focusFirst() {
206
+ (valueInput.value ?? formulaInput.value ?? countInput.value ?? rangeInput.value)?.focus();
207
+ }
208
+ function apply() {
209
+ tried.value = true;
210
+ if (!rangeOk.value || !valueOk.value || !formulaOk.value || !countOk.value) return;
211
+ emit("apply", result());
212
+ open.value = false;
213
+ }
214
+ return (_ctx, _cache) => {
215
+ return openBlock(), createBlock(unref(DouDialog), {
216
+ open: open.value,
217
+ "onUpdate:open": _cache[11] || (_cache[11] = ($event) => open.value = $event),
218
+ title: __props.title,
219
+ width: 400,
220
+ onOpened: focusFirst,
221
+ onClosed: _cache[12] || (_cache[12] = ($event) => emit("closed"))
222
+ }, {
223
+ footer: withCtx(({ close }) => [createVNode(unref(DouButton), {
224
+ variant: "outline",
225
+ onClick: close
226
+ }, {
227
+ default: withCtx(() => [createTextVNode(toDisplayString(m.value.cancel), 1)]),
228
+ _: 1
229
+ }, 8, ["onClick"]), createVNode(unref(DouButton), {
230
+ variant: "solid",
231
+ onClick: apply
232
+ }, {
233
+ default: withCtx(() => [createTextVNode(toDisplayString(m.value.apply), 1)]),
234
+ _: 1
235
+ })]),
236
+ default: withCtx(() => [createVNode(unref(DouForm), {
237
+ layout: "vertical",
238
+ class: "dou-sheet-format",
239
+ onSubmit: apply
240
+ }, {
241
+ default: withCtx(() => [
242
+ createVNode(unref(DouFormItem), {
243
+ label: m.value.range,
244
+ error: tried.value && !rangeOk.value ? m.value.invalidRange : void 0
245
+ }, {
246
+ default: withCtx(() => [createVNode(unref(DouInput), {
247
+ ref_key: "rangeInput",
248
+ ref: rangeInput,
249
+ modelValue: target.value,
250
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => target.value = $event),
251
+ invalid: tried.value && !rangeOk.value
252
+ }, null, 8, ["modelValue", "invalid"])]),
253
+ _: 1
254
+ }, 8, ["label", "error"]),
255
+ kind.value === "when" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(DouFormItem), { label: m.value.condition }, {
256
+ default: withCtx(() => [createVNode(unref(DouSelect), {
257
+ modelValue: op.value,
258
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => op.value = $event),
259
+ options: opOptions.value
260
+ }, null, 8, ["modelValue", "options"])]),
261
+ _: 1
262
+ }, 8, ["label"]), needsValue.value ? (openBlock(), createBlock(unref(DouFormItem), {
263
+ key: 0,
264
+ label: m.value.value,
265
+ error: tried.value && !valueOk.value ? m.value.needValue : void 0
266
+ }, {
267
+ default: withCtx(() => [createElementVNode("div", _hoisted_1, [createVNode(unref(DouInput), {
268
+ ref_key: "valueInput",
269
+ ref: valueInput,
270
+ modelValue: value.value,
271
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => value.value = $event),
272
+ "aria-label": m.value.value,
273
+ invalid: tried.value && !value.value.trim(),
274
+ onKeydown: withKeys(withModifiers(apply, ["prevent"]), ["enter"])
275
+ }, null, 8, [
276
+ "modelValue",
277
+ "aria-label",
278
+ "invalid",
279
+ "onKeydown"
280
+ ]), needsTo.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", _hoisted_2, toDisplayString(m.value.and), 1), createVNode(unref(DouInput), {
281
+ modelValue: to.value,
282
+ "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => to.value = $event),
283
+ "aria-label": m.value.value,
284
+ invalid: tried.value && !to.value.trim(),
285
+ onKeydown: withKeys(withModifiers(apply, ["prevent"]), ["enter"])
286
+ }, null, 8, [
287
+ "modelValue",
288
+ "aria-label",
289
+ "invalid",
290
+ "onKeydown"
291
+ ])], 64)) : createCommentVNode("", true)])]),
292
+ _: 1
293
+ }, 8, ["label", "error"])) : createCommentVNode("", true)], 64)) : createCommentVNode("", true),
294
+ kind.value === "formula" ? (openBlock(), createBlock(unref(DouFormItem), {
295
+ key: 1,
296
+ label: m.value.formulaField,
297
+ help: m.value.formulaHelp,
298
+ error: tried.value && !formulaOk.value ? m.value.needFormula : void 0
299
+ }, {
300
+ default: withCtx(() => [createVNode(unref(DouInput), {
301
+ ref_key: "formulaInput",
302
+ ref: formulaInput,
303
+ modelValue: formula.value,
304
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => formula.value = $event),
305
+ class: "dou-sheet-format__formula",
306
+ spellcheck: "false",
307
+ autocomplete: "off",
308
+ invalid: tried.value && !formulaOk.value,
309
+ onKeydown: withKeys(withModifiers(apply, ["prevent"]), ["enter"])
310
+ }, null, 8, [
311
+ "modelValue",
312
+ "invalid",
313
+ "onKeydown"
314
+ ])]),
315
+ _: 1
316
+ }, 8, [
317
+ "label",
318
+ "help",
319
+ "error"
320
+ ])) : createCommentVNode("", true),
321
+ kind.value === "rank" ? (openBlock(), createBlock(unref(DouFormItem), {
322
+ key: 2,
323
+ label: m.value.count
324
+ }, {
325
+ default: withCtx(() => [createElementVNode("div", _hoisted_3, [createVNode(unref(DouInputNumber), {
326
+ ref_key: "countInput",
327
+ ref: countInput,
328
+ modelValue: count.value,
329
+ "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => count.value = $event),
330
+ min: 1,
331
+ step: 1,
332
+ precision: 0
333
+ }, null, 8, ["modelValue"]), createVNode(unref(DouCheckbox), {
334
+ modelValue: percent.value,
335
+ "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => percent.value = $event)
336
+ }, {
337
+ default: withCtx(() => [createTextVNode(toDisplayString(m.value.percent), 1)]),
338
+ _: 1
339
+ }, 8, ["modelValue"])])]),
340
+ _: 1
341
+ }, 8, ["label"])) : createCommentVNode("", true),
342
+ kind.value === "duplicates" ? (openBlock(), createBlock(unref(DouSegmentedControl), {
343
+ key: 3,
344
+ modelValue: repeated.value,
345
+ "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => repeated.value = $event),
346
+ block: "",
347
+ options: [{
348
+ value: "repeated",
349
+ label: m.value.repeated
350
+ }, {
351
+ value: "unique",
352
+ label: m.value.unique
353
+ }]
354
+ }, null, 8, ["modelValue", "options"])) : createCommentVNode("", true),
355
+ kind.value === "scale" ? (openBlock(), createBlock(unref(DouFormItem), {
356
+ key: 4,
357
+ label: m.value.color
358
+ }, {
359
+ default: withCtx(() => [createVNode(unref(DouSelect), {
360
+ modelValue: scale.value,
361
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => scale.value = $event),
362
+ options: scaleOptions.value
363
+ }, {
364
+ option: withCtx(({ option }) => [createElementVNode("span", _hoisted_4, [createElementVNode("span", {
365
+ class: "dou-sheet-format__sample",
366
+ style: normalizeStyle({ backgroundImage: unref(scaleSwatch)(scaleColors(String(option.value))) }),
367
+ "aria-hidden": "true"
368
+ }, null, 4), createTextVNode(" " + toDisplayString(option.label), 1)])]),
369
+ label: withCtx(({ option }) => [createElementVNode("span", _hoisted_5, [createElementVNode("span", {
370
+ class: "dou-sheet-format__sample",
371
+ style: normalizeStyle({ backgroundImage: unref(scaleSwatch)(scaleColors(String(option.value))) }),
372
+ "aria-hidden": "true"
373
+ }, null, 4), createTextVNode(" " + toDisplayString(option.label), 1)])]),
374
+ _: 1
375
+ }, 8, ["modelValue", "options"])]),
376
+ _: 1
377
+ }, 8, ["label"])) : kind.value === "bar" ? (openBlock(), createBlock(unref(DouFormItem), {
378
+ key: 5,
379
+ label: m.value.color
380
+ }, {
381
+ default: withCtx(() => [createVNode(unref(DouSelect), {
382
+ modelValue: bar.value,
383
+ "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => bar.value = $event),
384
+ options: barOptions.value
385
+ }, {
386
+ option: withCtx(({ option }) => [createElementVNode("span", _hoisted_6, [createElementVNode("span", {
387
+ class: "dou-sheet-format__sample is-bar",
388
+ style: normalizeStyle({ backgroundImage: unref(barSwatch)(barOf(String(option.value))) }),
389
+ "aria-hidden": "true"
390
+ }, null, 4), createTextVNode(" " + toDisplayString(option.label), 1)])]),
391
+ label: withCtx(({ option }) => [createElementVNode("span", _hoisted_7, [createElementVNode("span", {
392
+ class: "dou-sheet-format__sample is-bar",
393
+ style: normalizeStyle({ backgroundImage: unref(barSwatch)(barOf(String(option.value))) }),
394
+ "aria-hidden": "true"
395
+ }, null, 4), createTextVNode(" " + toDisplayString(option.label), 1)])]),
396
+ _: 1
397
+ }, 8, ["modelValue", "options"])]),
398
+ _: 1
399
+ }, 8, ["label"])) : (openBlock(), createBlock(unref(DouFormItem), {
400
+ key: 6,
401
+ label: m.value.look
402
+ }, {
403
+ default: withCtx(() => [createVNode(unref(DouSelect), {
404
+ modelValue: look.value,
405
+ "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => look.value = $event),
406
+ options: lookOptions.value
407
+ }, {
408
+ option: withCtx(({ option }) => [createElementVNode("span", _hoisted_8, [createElementVNode("span", {
409
+ class: normalizeClass(["dou-sheet-format__sample", lookSample(String(option.value)).cls]),
410
+ style: normalizeStyle(lookSample(String(option.value)).css),
411
+ "aria-hidden": "true"
412
+ }, "123", 6), createTextVNode(" " + toDisplayString(option.label), 1)])]),
413
+ label: withCtx(({ option }) => [createElementVNode("span", _hoisted_9, [createElementVNode("span", {
414
+ class: normalizeClass(["dou-sheet-format__sample", lookSample(String(option.value)).cls]),
415
+ style: normalizeStyle(lookSample(String(option.value)).css),
416
+ "aria-hidden": "true"
417
+ }, "123", 6), createTextVNode(" " + toDisplayString(option.label), 1)])]),
418
+ _: 1
419
+ }, 8, ["modelValue", "options"])]),
420
+ _: 1
421
+ }, 8, ["label"]))
422
+ ]),
423
+ _: 1
424
+ })]),
425
+ _: 1
426
+ }, 8, ["open", "title"]);
427
+ };
428
+ }
429
+ });
430
+ export { format_dialog_vue_vue_type_script_setup_true_lang_default as default };
431
+
432
+ //# sourceMappingURL=format-dialog.vue_vue_type_script_setup_true_lang.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-dialog.vue_vue_type_script_setup_true_lang.js","names":["_useModel","_openBlock","_createBlock","_unref","_withCtx","_createVNode","_createTextVNode","_toDisplayString","_createElementBlock","_Fragment","_createElementVNode","_withKeys","_withModifiers","_createCommentVNode","_normalizeStyle","_normalizeClass"],"sources":["../../src/components/format-dialog.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n DouButton,\n DouCheckbox,\n DouDialog,\n DouForm,\n DouFormItem,\n DouInput,\n DouInputNumber,\n DouSegmentedControl,\n DouSelect,\n type Tone,\n} from 'dou-ui'\nimport { computed, ref, useTemplateRef, watch } from 'vue'\nimport { readRuleRange, ruleRangeText } from '../core/conditional'\nimport type {\n SheetColor,\n SheetCondition,\n SheetConditionalFormat,\n SheetConditionalStyle,\n SheetStyle,\n SheetValue,\n} from '../core/model'\nimport type { SheetMessages } from '../locale'\nimport {\n barSwatch,\n LOOKS,\n lookName,\n SCALES,\n scaleName,\n scaleSwatch,\n styleSample,\n TONES,\n toneKey,\n type SheetLookName,\n type SheetScaleColors,\n type SheetScaleName,\n} from './format-presets'\n\n/*\n * Adds or edits one conditional format: the cells it applies to, what\n * they must meet, and how they look then. It starts from `format`, which\n * the toolbar's menu fills in for a new rule.\n */\n\nconst props = defineProps<{\n format: SheetConditionalFormat\n title: string\n /** The workbook's named styles, for a rule that names one. */\n styles: Record<string, SheetStyle> | undefined\n messages: SheetMessages\n}>()\nconst open = defineModel<boolean>('open', { required: true })\nconst emit = defineEmits<{ apply: [format: SheetConditionalFormat]; closed: [] }>()\n\nconst m = computed(() => props.messages.formats)\n\ntype Kind = 'when' | 'formula' | 'duplicates' | 'rank' | 'average' | 'scale' | 'bar'\nfunction kindOf(f: SheetConditionalFormat): Kind {\n if ('when' in f) return 'when'\n if ('formula' in f) return 'formula'\n if ('duplicates' in f || 'unique' in f) return 'duplicates'\n if ('top' in f || 'bottom' in f) return 'rank'\n if ('average' in f) return 'average'\n return 'scale' in f ? 'scale' : 'bar'\n}\nconst kind = computed(() => kindOf(props.format))\n\nconst OPS: SheetCondition['op'][] = [\n 'gt',\n 'ge',\n 'lt',\n 'le',\n 'eq',\n 'ne',\n 'between',\n 'notBetween',\n 'contains',\n 'notContains',\n 'begins',\n 'ends',\n 'blank',\n 'notBlank',\n]\nconst opOptions = computed(() => OPS.map((value) => ({ value, label: props.messages.ops[value] })))\n\nconst target = ref('')\nconst op = ref<SheetCondition['op']>('gt')\nconst value = ref('')\nconst to = ref('')\nconst formula = ref('')\nconst count = ref<number | null>(10)\nconst percent = ref(false)\nconst repeated = ref<'repeated' | 'unique'>('repeated')\nconst look = ref<SheetLookName | 'current'>('danger')\nconst scale = ref<SheetScaleName | 'current'>('rag')\nconst bar = ref<Tone | 'current'>('neutral')\nconst tried = ref(false)\n\nconst text = (v: SheetValue | undefined) => (v == null ? '' : String(v))\n\n/** The rule's own look, when it isn't one the dialog offers. */\nconst current = computed<SheetConditionalStyle | undefined>(() => {\n const f = props.format\n if (!('style' in f)) return undefined\n const style = typeof f.style === 'string' ? undefined : f.style\n return style && lookName(style) ? undefined : f.style\n})\nconst resolve = (style: SheetConditionalStyle | undefined) =>\n typeof style === 'string' ? props.styles?.[style] : style\n\nwatch(open, (now) => {\n if (!now) return\n const f = props.format\n target.value = ruleRangeText(f.range)\n op.value = 'when' in f ? f.when.op : 'gt'\n value.value = 'when' in f ? text(f.when.value) : ''\n to.value = 'when' in f ? text(f.when.to) : ''\n formula.value = 'formula' in f ? f.formula : ''\n count.value = 'top' in f && f.top != null ? f.top : 'bottom' in f ? (f.bottom ?? 10) : 10\n percent.value = 'percent' in f && !!f.percent\n repeated.value = 'unique' in f ? 'unique' : 'repeated'\n look.value =\n 'style' in f\n ? ((typeof f.style === 'string' ? undefined : lookName(f.style)) ?? 'current')\n : 'danger'\n scale.value = 'scale' in f ? (scaleName(f.scale) ?? 'current') : 'rag'\n bar.value =\n 'bar' in f\n ? f.bar === true\n ? 'neutral'\n : TONES.includes(f.bar as Tone)\n ? (f.bar as Tone)\n : 'current'\n : 'neutral'\n tried.value = false\n})\n\nconst lookOptions = computed(() => [\n ...(current.value === undefined ? [] : [{ value: 'current', label: m.value.current }]),\n ...(Object.keys(LOOKS) as SheetLookName[]).map((name) => ({\n value: name,\n label: m.value.looks[name],\n })),\n])\nfunction lookSample(name: string) {\n return styleSample(name === 'current' ? resolve(current.value) : LOOKS[name as SheetLookName])\n}\n\nconst scaleOptions = computed(() => [\n ...('scale' in props.format && !scaleName(props.format.scale)\n ? [{ value: 'current', label: m.value.current }]\n : []),\n ...(Object.keys(SCALES) as SheetScaleName[]).map((name) => ({\n value: name,\n label: m.value.scales[name],\n })),\n])\nfunction scaleColors(name: string): readonly SheetColor[] {\n if (name !== 'current') return SCALES[name as SheetScaleName]\n return 'scale' in props.format ? props.format.scale : SCALES.rag\n}\n\nconst barOptions = computed(() => [\n ...('bar' in props.format &&\n props.format.bar !== true &&\n !TONES.includes(props.format.bar as Tone)\n ? [{ value: 'current', label: m.value.current }]\n : []),\n ...TONES.map((tone) => ({ value: tone, label: props.messages[toneKey(tone)] })),\n])\nfunction barOf(name: string): SheetColor {\n if (name !== 'current') return name\n return 'bar' in props.format && props.format.bar !== true ? props.format.bar : 'neutral'\n}\n\nconst needsValue = computed(\n () => kind.value === 'when' && op.value !== 'blank' && op.value !== 'notBlank',\n)\nconst needsTo = computed(() => op.value === 'between' || op.value === 'notBetween')\nconst rangeOk = computed(() => readRuleRange(target.value) != null)\nconst valueOk = computed(\n () =>\n !needsValue.value || (value.value.trim() !== '' && (!needsTo.value || to.value.trim() !== '')),\n)\nconst formulaOk = computed(\n () => kind.value !== 'formula' || formula.value.trim().replace(/^=/, '') !== '',\n)\nconst countOk = computed(() => kind.value !== 'rank' || (count.value ?? 0) >= 1)\n\n/** A typed operand: a number when it reads as one, otherwise the text. */\nfunction operand(input: string): SheetValue {\n const trimmed = input.trim()\n const n = Number(trimmed.replace(/,/g, ''))\n return trimmed && Number.isFinite(n) && /\\d/.test(trimmed) ? n : trimmed\n}\n\nfunction result(): SheetConditionalFormat {\n const f = props.format\n const range = readRuleRange(target.value)!\n const style: SheetConditionalStyle =\n look.value === 'current' && current.value !== undefined\n ? current.value\n : { ...LOOKS[look.value as SheetLookName] }\n switch (kind.value) {\n case 'when': {\n const when: SheetCondition = { op: op.value }\n if (needsValue.value) when.value = operand(value.value)\n if (needsValue.value && needsTo.value) when.to = operand(to.value)\n return { range, when, style }\n }\n case 'formula': {\n const body = formula.value.trim()\n return { range, formula: body.startsWith('=') ? body : `=${body}`, style }\n }\n case 'duplicates':\n return repeated.value === 'repeated'\n ? { range, duplicates: true, style }\n : { range, unique: true, style }\n case 'rank': {\n const n = Math.round(count.value!)\n const rank = 'bottom' in f && f.bottom != null ? { bottom: n } : { top: n }\n return { range, ...rank, ...(percent.value && { percent: true }), style }\n }\n case 'average':\n return { range, average: 'average' in f ? f.average : 'above', style }\n case 'scale':\n return { range, scale: [...scaleColors(scale.value)] as SheetScaleColors }\n case 'bar':\n return {\n range,\n bar: bar.value === 'neutral' && 'bar' in f && f.bar === true ? true : barOf(bar.value),\n }\n }\n}\n\n// the first thing to fill in takes the focus, not the close button\nconst rangeInput = useTemplateRef<InstanceType<typeof DouInput>>('rangeInput')\nconst valueInput = useTemplateRef<InstanceType<typeof DouInput>>('valueInput')\nconst formulaInput = useTemplateRef<InstanceType<typeof DouInput>>('formulaInput')\nconst countInput = useTemplateRef<InstanceType<typeof DouInputNumber>>('countInput')\nfunction focusFirst() {\n ;(valueInput.value ?? formulaInput.value ?? countInput.value ?? rangeInput.value)?.focus()\n}\n\nfunction apply() {\n tried.value = true\n if (!rangeOk.value || !valueOk.value || !formulaOk.value || !countOk.value) return\n emit('apply', result())\n open.value = false\n}\n</script>\n\n<template>\n <DouDialog\n v-model:open=\"open\"\n :title=\"title\"\n :width=\"400\"\n @opened=\"focusFirst\"\n @closed=\"emit('closed')\"\n >\n <DouForm layout=\"vertical\" class=\"dou-sheet-format\" @submit=\"apply\">\n <DouFormItem :label=\"m.range\" :error=\"tried && !rangeOk ? m.invalidRange : undefined\">\n <DouInput ref=\"rangeInput\" v-model=\"target\" :invalid=\"tried && !rangeOk\" />\n </DouFormItem>\n <template v-if=\"kind === 'when'\">\n <DouFormItem :label=\"m.condition\">\n <DouSelect v-model=\"op\" :options=\"opOptions\" />\n </DouFormItem>\n <DouFormItem\n v-if=\"needsValue\"\n :label=\"m.value\"\n :error=\"tried && !valueOk ? m.needValue : undefined\"\n >\n <div class=\"dou-sheet-format__values\">\n <DouInput\n ref=\"valueInput\"\n v-model=\"value\"\n :aria-label=\"m.value\"\n :invalid=\"tried && !value.trim()\"\n @keydown.enter.prevent=\"apply\"\n />\n <template v-if=\"needsTo\">\n <span class=\"dou-sheet-format__and\">{{ m.and }}</span>\n <DouInput\n v-model=\"to\"\n :aria-label=\"m.value\"\n :invalid=\"tried && !to.trim()\"\n @keydown.enter.prevent=\"apply\"\n />\n </template>\n </div>\n </DouFormItem>\n </template>\n <DouFormItem\n v-if=\"kind === 'formula'\"\n :label=\"m.formulaField\"\n :help=\"m.formulaHelp\"\n :error=\"tried && !formulaOk ? m.needFormula : undefined\"\n >\n <DouInput\n ref=\"formulaInput\"\n v-model=\"formula\"\n class=\"dou-sheet-format__formula\"\n spellcheck=\"false\"\n autocomplete=\"off\"\n :invalid=\"tried && !formulaOk\"\n @keydown.enter.prevent=\"apply\"\n />\n </DouFormItem>\n <DouFormItem v-if=\"kind === 'rank'\" :label=\"m.count\">\n <div class=\"dou-sheet-format__values\">\n <DouInputNumber ref=\"countInput\" v-model=\"count\" :min=\"1\" :step=\"1\" :precision=\"0\" />\n <DouCheckbox v-model=\"percent\">{{ m.percent }}</DouCheckbox>\n </div>\n </DouFormItem>\n <DouSegmentedControl\n v-if=\"kind === 'duplicates'\"\n v-model=\"repeated\"\n block\n :options=\"[\n { value: 'repeated', label: m.repeated },\n { value: 'unique', label: m.unique },\n ]\"\n />\n <DouFormItem v-if=\"kind === 'scale'\" :label=\"m.color\">\n <DouSelect v-model=\"scale\" :options=\"scaleOptions\">\n <template #option=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample\"\n :style=\"{ backgroundImage: scaleSwatch(scaleColors(String(option.value))) }\"\n aria-hidden=\"true\"\n />\n {{ option.label }}\n </span>\n </template>\n <template #label=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample\"\n :style=\"{ backgroundImage: scaleSwatch(scaleColors(String(option.value))) }\"\n aria-hidden=\"true\"\n />\n {{ option.label }}\n </span>\n </template>\n </DouSelect>\n </DouFormItem>\n <DouFormItem v-else-if=\"kind === 'bar'\" :label=\"m.color\">\n <DouSelect v-model=\"bar\" :options=\"barOptions\">\n <template #option=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample is-bar\"\n :style=\"{ backgroundImage: barSwatch(barOf(String(option.value))) }\"\n aria-hidden=\"true\"\n />\n {{ option.label }}\n </span>\n </template>\n <template #label=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample is-bar\"\n :style=\"{ backgroundImage: barSwatch(barOf(String(option.value))) }\"\n aria-hidden=\"true\"\n />\n {{ option.label }}\n </span>\n </template>\n </DouSelect>\n </DouFormItem>\n <DouFormItem v-else :label=\"m.look\">\n <DouSelect v-model=\"look\" :options=\"lookOptions\">\n <template #option=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample\"\n :class=\"lookSample(String(option.value)).cls\"\n :style=\"lookSample(String(option.value)).css\"\n aria-hidden=\"true\"\n >123</span\n >\n {{ option.label }}\n </span>\n </template>\n <template #label=\"{ option }\">\n <span class=\"dou-sheet-format__look\">\n <span\n class=\"dou-sheet-format__sample\"\n :class=\"lookSample(String(option.value)).cls\"\n :style=\"lookSample(String(option.value)).css\"\n aria-hidden=\"true\"\n >123</span\n >\n {{ option.label }}\n </span>\n </template>\n </DouSelect>\n </DouFormItem>\n </DouForm>\n <template #footer=\"{ close }\">\n <DouButton variant=\"outline\" @click=\"close\">{{ m.cancel }}</DouButton>\n <DouButton variant=\"solid\" @click=\"apply\">{{ m.apply }}</DouButton>\n </template>\n </DouDialog>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6CA,MAAM,QAAQ;EAOd,MAAM,OAAOA,SAAoB,SAAC,MAA0B;EAC5D,MAAM,OAAO;EAEb,MAAM,IAAI,eAAe,MAAM,SAAS,OAAO;EAG/C,SAAS,OAAO,GAAiC;GAC/C,IAAI,UAAU,GAAG,OAAO;GACxB,IAAI,aAAa,GAAG,OAAO;GAC3B,IAAI,gBAAgB,KAAK,YAAY,GAAG,OAAO;GAC/C,IAAI,SAAS,KAAK,YAAY,GAAG,OAAO;GACxC,IAAI,aAAa,GAAG,OAAO;GAC3B,OAAO,WAAW,IAAI,UAAU;EAClC;EACA,MAAM,OAAO,eAAe,OAAO,MAAM,MAAM,CAAC;EAEhD,MAAM,MAA8B;GAClC;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;GACA;EACF;EACA,MAAM,YAAY,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AAA,EAAA,iBAAqBX,MAAA,SAAA,CAAS,CAAC,MAAM,OAAO,OAAO,KAAK,CAAA,CAAA,EAAA,CAAA;SAC9D,eAAY;Q,aACZG,gBAAA,MACFC,gBAAG,OAAO,KAAK,GAAA,CAAA,C;;;;M,qBAKvBN,UAAA,GAAAC,YA2BcC,MAAA,WAAA,GAAA;;OA3BO,OAAO,EAAA,MAAE;;OAC5B,SAAAC,cAyBY,CAzBZC,YAyBYF,MAAA,SAAA,GAAA;QAzBQ,YAAA,KAAA;QAAA,uBAAA,OAAA,QAAA,OAAA,OAAA,WAAA,KAAI,QAAA;QAAG,SAAS,YAAA;;QACvB,QAAMC,SAUR,EAVY,aAAM,CACzBM,mBASO,QATP,YASO,CARLA,mBAMC,QAAA;SALC,OAAKK,eAAA,CAAC,4BACE,WAAW,OAAO,OAAO,KAAK,CAAA,CAAA,CAAG,GAAG,CAAA;SAC3C,OAAKD,eAAE,WAAW,OAAO,OAAO,KAAK,CAAA,CAAA,CAAG,GAAG;SAC5C,eAAY;QACX,GAAA,OAAG,CAAA,GACLR,gBAAA,MACDC,gBAAG,OAAO,KAAK,GAAA,CAAA,C;QAGR,OAAKH,SAUP,EAVW,aAAM,CACxBM,mBASO,QATP,YASO,CARLA,mBAMC,QAAA;SALC,OAAKK,eAAA,CAAC,4BACE,WAAW,OAAO,OAAO,KAAK,CAAA,CAAA,CAAG,GAAG,CAAA;SAC3C,OAAKD,eAAE,WAAW,OAAO,OAAO,KAAK,CAAA,CAAA,CAAG,GAAG;SAC5C,eAAY;QACX,GAAA,OAAG,CAAA,GACLR,gBAAA,MACDC,gBAAG,OAAO,KAAK,GAAA,CAAA,C"}
@@ -0,0 +1,6 @@
1
+ import format_list_vue_vue_type_script_setup_true_lang_default from "./format-list.vue_vue_type_script_setup_true_lang.js";
2
+ // src/components/format-list.vue
3
+ var format_list_default = format_list_vue_vue_type_script_setup_true_lang_default;
4
+ export { format_list_default as default };
5
+
6
+ //# sourceMappingURL=format-list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-list.js","names":["_sfc_main"],"sources":["../../src/components/format-list.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ArrowDownIcon, ArrowUpIcon, PencilIcon, TrashIcon } from '@dou-ui/icons'\nimport { DouButton, DouDialog, DouTooltip } from 'dou-ui'\nimport { computed, useId } from 'vue'\nimport { ruleRangeText } from '../core/conditional'\nimport type { SheetConditionalFormat, SheetStyle, SheetValue } from '../core/model'\nimport { format, type SheetMessages } from '../locale'\nimport { formatSample } from './format-presets'\n\n/*\n * The conditional formats of the sheet shown, in the order they apply:\n * what each checks, its cells and how they look, to edit, reorder or delete.\n */\n\nconst props = defineProps<{\n formats: readonly SheetConditionalFormat[]\n /** The workbook's named styles, for formats that name one. */\n styles: Record<string, SheetStyle> | undefined\n messages: SheetMessages\n}>()\nconst open = defineModel<boolean>('open', { required: true })\nconst emit = defineEmits<{\n change: [formats: SheetConditionalFormat[]]\n /** Asks to edit the format at `index`. */\n edit: [index: number]\n closed: []\n}>()\n\nconst m = computed(() => props.messages.formats)\nconst uid = useId()\n\nconst text = (value: SheetValue | undefined) =>\n typeof value === 'string' ? `“${value}”` : String(value ?? '')\n\n/** What a format checks, in words. */\nfunction describe(f: SheetConditionalFormat) {\n const d = m.value.describe\n if ('when' in f) {\n const { op, value, to } = f.when\n const between = op === 'between' || op === 'notBetween'\n return format(between ? d.between : d.when, {\n op: props.messages.ops[op],\n value: text(value),\n to: text(to),\n }).trim()\n }\n if ('formula' in f) return format(d.formula, { formula: f.formula })\n if ('top' in f && f.top != null) return format(f.percent ? d.topPercent : d.top, { count: f.top })\n if ('bottom' in f && f.bottom != null)\n return format(f.percent ? d.bottomPercent : d.bottom, { count: f.bottom })\n if ('average' in f) return f.average === 'above' ? d.above : d.below\n if ('duplicates' in f) return d.repeated\n if ('unique' in f) return d.unique\n if ('scale' in f) return d.scale\n return d.bar\n}\n\nconst sample = (f: SheetConditionalFormat) => formatSample(f, props.styles)\n\nfunction move(index: number, by: number) {\n const list = [...props.formats]\n const [item] = list.splice(index, 1)\n list.splice(index + by, 0, item!)\n emit('change', list)\n}\nfunction remove(index: number) {\n emit(\n 'change',\n props.formats.filter((_, i) => i !== index),\n )\n}\n</script>\n\n<template>\n <DouDialog v-model:open=\"open\" :title=\"m.title\" :width=\"520\" @closed=\"emit('closed')\">\n <p v-if=\"!formats.length\" class=\"dou-sheet-formats__empty\">{{ m.empty }}</p>\n <ol v-else class=\"dou-sheet-formats\">\n <li v-for=\"(f, i) in formats\" :key=\"i\" class=\"dou-sheet-formats__item\">\n <span\n class=\"dou-sheet-format__sample\"\n :class=\"sample(f).cls\"\n :style=\"sample(f).css\"\n aria-hidden=\"true\"\n >123</span\n >\n <span class=\"dou-sheet-formats__what\">\n <span :id=\"`${uid}-${i}`\" class=\"dou-sheet-formats__rule\">{{ describe(f) }}</span>\n <span class=\"dou-sheet-formats__range\">{{ ruleRangeText(f.range) }}</span>\n </span>\n <span class=\"dou-sheet-formats__actions\">\n <DouTooltip :content=\"m.edit\">\n <DouButton\n variant=\"ghost\"\n size=\"sm\"\n :aria-label=\"m.edit\"\n :aria-describedby=\"`${uid}-${i}`\"\n @click=\"emit('edit', i)\"\n >\n <PencilIcon />\n </DouButton>\n </DouTooltip>\n <DouTooltip :content=\"m.moveUp\">\n <DouButton\n variant=\"ghost\"\n size=\"sm\"\n :aria-label=\"m.moveUp\"\n :aria-describedby=\"`${uid}-${i}`\"\n :disabled=\"i === 0\"\n @click=\"move(i, -1)\"\n >\n <ArrowUpIcon />\n </DouButton>\n </DouTooltip>\n <DouTooltip :content=\"m.moveDown\">\n <DouButton\n variant=\"ghost\"\n size=\"sm\"\n :aria-label=\"m.moveDown\"\n :aria-describedby=\"`${uid}-${i}`\"\n :disabled=\"i === formats.length - 1\"\n @click=\"move(i, 1)\"\n >\n <ArrowDownIcon />\n </DouButton>\n </DouTooltip>\n <DouTooltip :content=\"m.remove\">\n <DouButton\n variant=\"ghost\"\n size=\"sm\"\n :aria-label=\"m.remove\"\n :aria-describedby=\"`${uid}-${i}`\"\n @click=\"remove(i)\"\n >\n <TrashIcon />\n </DouButton>\n </DouTooltip>\n </span>\n </li>\n </ol>\n <template #footer=\"{ close }\">\n <DouButton variant=\"outline\" @click=\"close\">{{ m.close }}</DouButton>\n </template>\n </DouDialog>\n</template>\n"],"mappings":""}