@univerjs_sheets-sort-ui.js 43 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043
  1. import {
  2. $,
  3. E,
  4. f,
  5. g
  6. } from "./chunk-5XPMH3SW.js";
  7. import {
  8. Gm,
  9. Mr,
  10. bb,
  11. ue
  12. } from "./chunk-T4NNB5UY.js";
  13. import {
  14. F,
  15. Me,
  16. Mh,
  17. N,
  18. Pe,
  19. Te,
  20. re as re2,
  21. ur as ur2,
  22. ve
  23. } from "./chunk-BW43Z7N3.js";
  24. import {
  25. fr
  26. } from "./chunk-QRYBFJ3R.js";
  27. import "./chunk-MIOQ566M.js";
  28. import {
  29. $e,
  30. Fa,
  31. He,
  32. P1,
  33. _1,
  34. d3,
  35. f1,
  36. h3,
  37. l1,
  38. m1,
  39. n1
  40. } from "./chunk-POAJ2YNP.js";
  41. import {
  42. Po,
  43. e_,
  44. g_,
  45. sC,
  46. t_,
  47. um
  48. } from "./chunk-GBYP4PB2.js";
  49. import "./chunk-PZD7N4BC.js";
  50. import "./chunk-2MK3Q52E.js";
  51. import "./chunk-BSDDCPAW.js";
  52. import "./chunk-QG2HZMYH.js";
  53. import {
  54. B0,
  55. BehaviorSubject,
  56. Fe,
  57. J0,
  58. Mt,
  59. OR,
  60. Ot,
  61. Pt,
  62. Ra,
  63. SE,
  64. Vr,
  65. W0,
  66. _n,
  67. ar,
  68. nt,
  69. nu,
  70. ot,
  71. re,
  72. tR,
  73. takeUntil,
  74. ur
  75. } from "./chunk-23V3HWTR.js";
  76. import {
  77. require_react
  78. } from "./chunk-GNR2UJZM.js";
  79. import {
  80. __toESM
  81. } from "./chunk-2LSFTFF7.js";
  82. // node_modules/.pnpm/@univerjs+sheets-sort-ui@0.5.5_@grpc+grpc-js@1.13.4_react-dom@18.3.1_react@18.3.1_rxjs@7.8.1_typescript@5.4.5/node_modules/@univerjs/sheets-sort-ui/lib/es/index.js
  83. var import_react = __toESM(require_react());
  84. var We = Object.defineProperty;
  85. var qe = (e, t, n) => t in e ? We(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;
  86. var X = (e, t, n) => qe(e, typeof t != "symbol" ? t + "" : t, n);
  87. var Pt2 = "sheets-sort-ui.config";
  88. var _e = {};
  89. var v = function() {
  90. return v = Object.assign || function(e) {
  91. for (var t, n = 1, r = arguments.length; n < r; n++) {
  92. t = arguments[n];
  93. for (var o in t)
  94. Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
  95. }
  96. return e;
  97. }, v.apply(this, arguments);
  98. };
  99. var wt = function(e, t) {
  100. var n = {};
  101. for (var r in e)
  102. Object.prototype.hasOwnProperty.call(e, r) && t.indexOf(r) < 0 && (n[r] = e[r]);
  103. if (e != null && typeof Object.getOwnPropertySymbols == "function")
  104. for (var o = 0, r = Object.getOwnPropertySymbols(e); o < r.length; o++)
  105. t.indexOf(r[o]) < 0 && Object.prototype.propertyIsEnumerable.call(e, r[o]) && (n[r[o]] = e[r[o]]);
  106. return n;
  107. };
  108. var R = (0, import_react.forwardRef)(function(e, t) {
  109. var n = e.icon, r = e.id, o = e.className, s = e.extend, c = wt(e, ["icon", "id", "className", "extend"]), l = "univerjs-icon univerjs-icon-".concat(r, " ").concat(o || "").trim(), d = (0, import_react.useRef)("_".concat(jt()));
  110. return Le(n, "".concat(r), { defIds: n.defIds, idSuffix: d.current }, v({ ref: t, className: l }, c), s);
  111. });
  112. function Le(e, t, n, r, o) {
  113. return (0, import_react.createElement)(e.tag, v(v({ key: t }, Nt(e, n, o)), r), (Lt(e, n).children || []).map(function(s, c) {
  114. return Le(s, "".concat(t, "-").concat(e.tag, "-").concat(c), n, void 0, o);
  115. }));
  116. }
  117. function Nt(e, t, n) {
  118. var r = v({}, e.attrs);
  119. n != null && n.colorChannel1 && r.fill === "colorChannel1" && (r.fill = n.colorChannel1);
  120. var o = t.defIds;
  121. return !o || o.length === 0 || (e.tag === "use" && r["xlink:href"] && (r["xlink:href"] = r["xlink:href"] + t.idSuffix), Object.entries(r).forEach(function(s) {
  122. var c = s[0], l = s[1];
  123. typeof l == "string" && (r[c] = l.replace(/url\(#(.*)\)/, "url(#$1".concat(t.idSuffix, ")")));
  124. })), r;
  125. }
  126. function Lt(e, t) {
  127. var n, r = t.defIds;
  128. return !r || r.length === 0 ? e : e.tag === "defs" && (!((n = e.children) === null || n === void 0) && n.length) ? v(v({}, e), { children: e.children.map(function(o) {
  129. return typeof o.attrs.id == "string" && r && r.indexOf(o.attrs.id) > -1 ? v(v({}, o), { attrs: v(v({}, o.attrs), { id: o.attrs.id + t.idSuffix }) }) : o;
  130. }) }) : e;
  131. }
  132. function jt() {
  133. return Math.random().toString(36).substring(2, 8);
  134. }
  135. R.displayName = "UniverIcon";
  136. var Dt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.4208 14.4667C12.4208 14.798 12.1522 15.0667 11.8208 15.0667C11.4895 15.0667 11.2208 14.798 11.2208 14.4667V2.98193L9.97861 4.22417C9.7443 4.45848 9.3644 4.45848 9.13008 4.22417C8.89577 3.98985 8.89577 3.60995 9.13008 3.37564L11.3967 1.10897C11.6311 0.874657 12.011 0.874657 12.2453 1.10897L14.5119 3.37564C14.7463 3.60995 14.7463 3.98985 14.5119 4.22417C14.2776 4.45848 13.8977 4.45848 13.6634 4.22417L12.4208 2.9816V14.4667Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  137. var te = (0, import_react.forwardRef)(function(e, t) {
  138. return (0, import_react.createElement)(R, Object.assign({}, e, {
  139. id: "ascending- single",
  140. ref: t,
  141. icon: Dt
  142. }));
  143. });
  144. te.displayName = "AscendingSingle";
  145. var kt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M14.1544 3.75557C14.3887 3.98988 14.3887 4.36978 14.1544 4.6041L6.51409 12.2444C6.40157 12.3569 6.24896 12.4201 6.08983 12.4201C5.9307 12.4201 5.77808 12.3569 5.66556 12.2444L1.84541 8.42425C1.6111 8.18993 1.6111 7.81003 1.84541 7.57572C2.07973 7.34141 2.45963 7.34141 2.69394 7.57572L6.08983 10.9716L13.3059 3.75557C13.5402 3.52126 13.9201 3.52126 14.1544 3.75557Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  146. var je = (0, import_react.forwardRef)(function(e, t) {
  147. return (0, import_react.createElement)(R, Object.assign({}, e, {
  148. id: "check-mark-single",
  149. ref: t,
  150. icon: kt
  151. }));
  152. });
  153. je.displayName = "CheckMarkSingle";
  154. var Ht = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M9.77445 9.24306L9.77457 11.9573C9.77458 12.2887 9.50597 12.5574 9.17459 12.5574 8.84322 12.5574 8.57458 12.2888 8.57457 11.9574L8.57439 7.79509C8.57438 7.46372 8.84299 7.19508 9.17436 7.19507 9.3281 7.19493 9.48196 7.25351 9.59925 7.3708L11.3465 9.11808C11.5808 9.3524 11.5808 9.7323 11.3465 9.96661 11.1122 10.2009 10.7323 10.2009 10.498 9.96661L9.77445 9.24306zM6.22584 10.5094L6.22572 7.79514C6.22571 7.46377 6.49433 7.19513 6.8257 7.19512 7.15707 7.1951 7.42571 7.46372 7.42572 7.79509L7.4259 11.9574C7.42592 12.2888 7.1573 12.5574 6.82593 12.5574 6.67228 12.5575 6.51828 12.4989 6.40104 12.3817L4.65376 10.6344C4.41945 10.4001 4.41945 10.0202 4.65376 9.78588 4.88808 9.55156 5.26798 9.55156 5.50229 9.78588L6.22584 10.5094z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.14014 3.73989C1.14014 2.30396 2.3042 1.13989 3.74014 1.13989H12.2601C13.6961 1.13989 14.8601 2.30395 14.8601 3.73989V12.2599C14.8601 13.6958 13.6961 14.8599 12.2601 14.8599H3.74014C2.3042 14.8599 1.14014 13.6958 1.14014 12.2599V3.73989ZM2.34014 5.86724V12.2599C2.34014 13.0331 2.96694 13.6599 3.74014 13.6599H12.2601C13.0333 13.6599 13.6601 13.0331 13.6601 12.2599V5.86724H2.34014ZM13.6601 4.66724H2.34014V3.73989C2.34014 2.9667 2.96694 2.33989 3.74014 2.33989H12.2601C13.0333 2.33989 13.6601 2.96669 13.6601 3.73989V4.66724Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  155. var De = (0, import_react.forwardRef)(function(e, t) {
  156. return (0, import_react.createElement)(R, Object.assign({}, e, {
  157. id: "custom-sort-single",
  158. ref: t,
  159. icon: Ht
  160. }));
  161. });
  162. De.displayName = "CustomSortSingle";
  163. var Ut = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M5.3313 1.4667C5.3313 1.13533 5.59993.866699 5.9313.866699H10.069C10.4004.866699 10.669 1.13533 10.669 1.4667 10.669 1.79807 10.4004 2.0667 10.069 2.0667H5.9313C5.59993 2.0667 5.3313 1.79807 5.3313 1.4667zM1.09985 3.64443C1.09985 3.31306 1.36848 3.04443 1.69985 3.04443H14.2999C14.6312 3.04443 14.8999 3.31306 14.8999 3.64443 14.8999 3.9758 14.6312 4.24443 14.2999 4.24443H1.69985C1.36848 4.24443 1.09985 3.9758 1.09985 3.64443z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M4.75332 5.22217C3.86966 5.22217 3.15332 5.93851 3.15332 6.82217V13.1332C3.15332 14.2377 4.04875 15.1332 5.15332 15.1332H10.8465C11.9511 15.1332 12.8465 14.2377 12.8465 13.1331V6.82217C12.8465 5.93851 12.1302 5.22217 11.2465 5.22217H4.75332ZM4.35332 6.82217C4.35332 6.60125 4.53241 6.42217 4.75332 6.42217H11.2465C11.4674 6.42217 11.6465 6.60125 11.6465 6.82217V13.1331C11.6465 13.575 11.2884 13.9331 10.8465 13.9331H5.15332C4.71149 13.9331 4.35332 13.575 4.35332 13.1332V6.82217Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  164. var ke = (0, import_react.forwardRef)(function(e, t) {
  165. return (0, import_react.createElement)(R, Object.assign({}, e, {
  166. id: "delete-empty-single",
  167. ref: t,
  168. icon: Ut
  169. }));
  170. });
  171. ke.displayName = "DeleteEmptySingle";
  172. var $t = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M12.4208 1.53335C12.4208 1.20198 12.1522 0.93335 11.8208 0.93335C11.4895 0.93335 11.2208 1.20198 11.2208 1.53335V13.0181L9.97861 11.7758C9.7443 11.5415 9.3644 11.5415 9.13008 11.7758C8.89577 12.0101 8.89577 12.39 9.13008 12.6244L11.3967 14.891C11.6311 15.1253 12.011 15.1253 12.2453 14.891L14.5119 12.6244C14.7463 12.39 14.7463 12.0101 14.5119 11.7758C14.2776 11.5415 13.8977 11.5415 13.6634 11.7758L12.4208 13.0184V1.53335Z" } }, { tag: "path", attrs: { fill: "currentColor", d: "M1.98967 10.2798C1.6583 10.2798 1.38967 10.0112 1.38967 9.67983 1.38967 9.34846 1.6583 9.07983 1.98967 9.07983H6.50138C6.74406 9.07983 6.96284 9.22602 7.05571 9.45022 7.14858 9.67443 7.09725 9.9325 6.92565 10.1041L3.43819 13.5916H6.50138C6.83276 13.5916 7.10138 13.8602 7.10138 14.1916 7.10138 14.5229 6.83276 14.7916 6.50138 14.7916H1.98967C1.74699 14.7916 1.52821 14.6454 1.43534 14.4212 1.34247 14.197 1.3938 13.9389 1.5654 13.7673L5.05286 10.2798H1.98967zM5.1846 1.86439C4.8641.989866 3.62725.989866 3.30674 1.86439L1.34882 7.20672C1.23479 7.51786 1.39458 7.86252 1.70571 7.97655 2.01684 8.09058 2.3615 7.93079 2.47553 7.61966L3.06159 6.02055 3.06338 6.02056H5.42975L6.01581 7.61966C6.12984 7.93079 6.4745 8.09058 6.78563 7.97655 7.09677 7.86252 7.25655 7.51786 7.14252 7.20672L5.1846 1.86439zM4.98996 4.82056L4.24567 2.78971 3.50138 4.82056H4.98996z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  173. var ne = (0, import_react.forwardRef)(function(e, t) {
  174. return (0, import_react.createElement)(R, Object.assign({}, e, {
  175. id: "descending-single",
  176. ref: t,
  177. icon: $t
  178. }));
  179. });
  180. ne.displayName = "DescendingSingle";
  181. var At = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.9064 3.20024C1.57503 3.20024 1.3064 2.93161 1.3064 2.60024C1.3064 2.26887 1.57503 2.00024 1.9064 2.00024H4.57306C4.90443 2.00024 5.17306 2.26887 5.17306 2.60024C5.17306 2.93161 4.90443 3.20024 4.57306 3.20024H1.9064ZM1.3064 6.19985C1.3064 6.53122 1.57503 6.79985 1.9064 6.79985H5.9064C6.23777 6.79985 6.5064 6.53122 6.5064 6.19985C6.5064 5.86848 6.23777 5.59985 5.9064 5.59985H1.9064C1.57503 5.59985 1.3064 5.86848 1.3064 6.19985ZM1.9064 10.3997C1.57503 10.3997 1.3064 10.1311 1.3064 9.79971C1.3064 9.46834 1.57503 9.19971 1.9064 9.19971H7.23973C7.5711 9.19971 7.83973 9.46834 7.83973 9.79971C7.83973 10.1311 7.5711 10.3997 7.23973 10.3997H1.9064ZM1.9064 13.9996C1.57503 13.9996 1.3064 13.7309 1.3064 13.3996C1.3064 13.0682 1.57503 12.7996 1.9064 12.7996H8.57306C8.90443 12.7996 9.17306 13.0682 9.17306 13.3996C9.17306 13.7309 8.90443 13.9996 8.57306 13.9996H1.9064Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4267 14.2667C12.4267 14.5981 12.1581 14.8667 11.8267 14.8667C11.4953 14.8667 11.2267 14.5981 11.2267 14.2667V3.18198L9.98447 4.42422C9.75015 4.65853 9.37026 4.65853 9.13594 4.42422C8.90163 4.1899 8.90163 3.81 9.13594 3.57569L11.4026 1.30902C11.6369 1.07471 12.0168 1.07471 12.2511 1.30902L14.5178 3.57569C14.7521 3.81 14.7521 4.1899 14.5178 4.42422C14.2835 4.65853 13.9036 4.65853 13.6693 4.42422L12.4267 3.18165V14.2667Z" } }] };
  182. var He2 = (0, import_react.forwardRef)(function(e, t) {
  183. return (0, import_react.createElement)(R, Object.assign({}, e, {
  184. id: "expand-ascending-single",
  185. ref: t,
  186. icon: At
  187. }));
  188. });
  189. He2.displayName = "ExpandAscendingSingle";
  190. var Bt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M1.9064 12.7998C1.57503 12.7998 1.3064 13.0684 1.3064 13.3998C1.3064 13.7311 1.57503 13.9998 1.9064 13.9998H4.57306C4.90443 13.9998 5.17306 13.7311 5.17306 13.3998C5.17306 13.0684 4.90443 12.7998 4.57306 12.7998H1.9064ZM1.3064 9.80015C1.3064 9.46878 1.57503 9.20015 1.9064 9.20015H5.9064C6.23777 9.20015 6.5064 9.46878 6.5064 9.80015C6.5064 10.1315 6.23777 10.4001 5.9064 10.4001H1.9064C1.57503 10.4001 1.3064 10.1315 1.3064 9.80015ZM1.9064 5.60029C1.57503 5.60029 1.3064 5.86892 1.3064 6.20029C1.3064 6.53166 1.57503 6.80029 1.9064 6.80029H7.23973C7.5711 6.80029 7.83973 6.53166 7.83973 6.20029C7.83973 5.86892 7.5711 5.60029 7.23973 5.60029H1.9064ZM1.9064 2.00044C1.57503 2.00044 1.3064 2.26907 1.3064 2.60044C1.3064 2.93181 1.57503 3.20044 1.9064 3.20044H8.57306C8.90443 3.20044 9.17306 2.93181 9.17306 2.60044C9.17306 2.26907 8.90443 2.00044 8.57306 2.00044H1.9064Z", fillRule: "evenodd", clipRule: "evenodd" } }, { tag: "path", attrs: { fill: "currentColor", d: "M12.4267 1.7333C12.4267 1.40193 12.1581 1.1333 11.8267 1.1333C11.4953 1.1333 11.2267 1.40193 11.2267 1.7333V12.818L9.98447 11.5758C9.75015 11.3415 9.37026 11.3415 9.13594 11.5758C8.90163 11.8101 8.90163 12.19 9.13594 12.4243L11.4026 14.691C11.6369 14.9253 12.0168 14.9253 12.2511 14.691L14.5178 12.4243C14.7521 12.19 14.7521 11.8101 14.5178 11.5758C14.2835 11.3415 13.9036 11.3415 13.6693 11.5758L12.4267 12.8183V1.7333Z" } }] };
  191. var Ue = (0, import_react.forwardRef)(function(e, t) {
  192. return (0, import_react.createElement)(R, Object.assign({}, e, {
  193. id: "expand-descending-single",
  194. ref: t,
  195. icon: Bt
  196. }));
  197. });
  198. Ue.displayName = "ExpandDescendingSingle";
  199. var Ft = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M8.6 1.99991C8.60001 1.66854 8.33138 1.39991 8.00001 1.3999C7.66864 1.3999 7.40001 1.66853 7.4 1.9999L7.39996 7.3999H1.9999C1.66853 7.3999 1.3999 7.66853 1.3999 7.9999C1.3999 8.33127 1.66853 8.5999 1.9999 8.5999H7.39995L7.3999 13.9999C7.3999 14.3313 7.66853 14.5999 7.9999 14.5999C8.33127 14.5999 8.5999 14.3313 8.5999 13.9999L8.59995 8.5999H13.9999C14.3313 8.5999 14.5999 8.33127 14.5999 7.9999C14.5999 7.66853 14.3313 7.3999 13.9999 7.3999H8.59996L8.6 1.99991Z" } }] };
  200. var ee = (0, import_react.forwardRef)(function(e, t) {
  201. return (0, import_react.createElement)(R, Object.assign({}, e, {
  202. id: "increase-single",
  203. ref: t,
  204. icon: Ft
  205. }));
  206. });
  207. ee.displayName = "IncreaseSingle";
  208. var Vt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "path", attrs: { fill: "currentColor", d: "M11.3536 6.14645C11.5488 6.34171 11.5488 6.65829 11.3536 6.85355L8.35355 9.85355C8.15829 10.0488 7.84171 10.0488 7.64645 9.85355L4.64645 6.85355C4.45118 6.65829 4.45118 6.34171 4.64645 6.14645C4.84171 5.95118 5.15829 5.95118 5.35355 6.14645L8 8.79289L10.6464 6.14645C10.8417 5.95118 11.1583 5.95118 11.3536 6.14645Z", fillRule: "evenodd", clipRule: "evenodd" } }] };
  209. var $e2 = (0, import_react.forwardRef)(function(e, t) {
  210. return (0, import_react.createElement)(R, Object.assign({}, e, {
  211. id: "more-down-single",
  212. ref: t,
  213. icon: Vt
  214. }));
  215. });
  216. $e2.displayName = "MoreDownSingle";
  217. var zt = { tag: "svg", attrs: { fill: "none", viewBox: "0 0 16 16", width: "1em", height: "1em" }, children: [{ tag: "mask", attrs: { id: "mask0_622_8", style: { maskType: "alpha" }, width: 16, height: 16, x: 0, y: 0, maskUnits: "userSpaceOnUse" }, children: [{ tag: "path", attrs: { fill: "#D9D9D9", d: "M0 0H16V16H0z" } }] }, { tag: "g", attrs: { fill: "currentColor", mask: "url(#mask0_622_8)" }, children: [{ tag: "path", attrs: { d: "M6 5C6.55228 5 7 4.55228 7 4 7 3.44772 6.55228 3 6 3 5.44772 3 5 3.44772 5 4 5 4.55228 5.44772 5 6 5zM6 9C6.55228 9 7 8.55229 7 8 7 7.44772 6.55228 7 6 7 5.44772 7 5 7.44772 5 8 5 8.55229 5.44772 9 6 9zM7 12C7 12.5523 6.55228 13 6 13 5.44772 13 5 12.5523 5 12 5 11.4477 5.44772 11 6 11 6.55228 11 7 11.4477 7 12zM10 5C10.5523 5 11 4.55228 11 4 11 3.44772 10.5523 3 10 3 9.44771 3 9 3.44772 9 4 9 4.55228 9.44771 5 10 5zM11 8C11 8.55229 10.5523 9 10 9 9.44771 9 9 8.55229 9 8 9 7.44772 9.44771 7 10 7 10.5523 7 11 7.44772 11 8zM10 13C10.5523 13 11 12.5523 11 12 11 11.4477 10.5523 11 10 11 9.44771 11 9 11.4477 9 12 9 12.5523 9.44771 13 10 13z" } }] }] };
  218. var Ae = (0, import_react.forwardRef)(function(e, t) {
  219. return (0, import_react.createElement)(R, Object.assign({}, e, {
  220. id: "sequence-single",
  221. ref: t,
  222. icon: zt
  223. }));
  224. });
  225. Ae.displayName = "SequenceSingle";
  226. var K = { exports: {} };
  227. var A = {};
  228. var xe;
  229. function Zt() {
  230. if (xe)
  231. return A;
  232. xe = 1;
  233. var e = import_react.default, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), r = Object.prototype.hasOwnProperty, o = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, s = { key: true, ref: true, __self: true, __source: true };
  234. function c(l, d, u) {
  235. var h, g2 = {}, p = null, S = null;
  236. u !== void 0 && (p = "" + u), d.key !== void 0 && (p = "" + d.key), d.ref !== void 0 && (S = d.ref);
  237. for (h in d)
  238. r.call(d, h) && !s.hasOwnProperty(h) && (g2[h] = d[h]);
  239. if (l && l.defaultProps)
  240. for (h in d = l.defaultProps, d)
  241. g2[h] === void 0 && (g2[h] = d[h]);
  242. return { $$typeof: t, type: l, key: p, ref: S, props: g2, _owner: o.current };
  243. }
  244. return A.Fragment = n, A.jsx = c, A.jsxs = c, A;
  245. }
  246. var Ie;
  247. function Gt() {
  248. return Ie || (Ie = 1, K.exports = Zt()), K.exports;
  249. }
  250. var i = Gt();
  251. var Wt = "univer-extend-confirm-content";
  252. var qt = "univer-extend-confirm-radio-group";
  253. var Yt = "univer-custom-sort-panel-container";
  254. var Jt = "univer-custom-sort-panel-ext";
  255. var Xt = "univer-add-condition";
  256. var Kt = "univer-add-condition-text";
  257. var Qt = "univer-add-condition-disable";
  258. var en = "univer-custom-sort-panel-footer";
  259. var tn = "univer-custom-sort-panel-footer-btn";
  260. var nn = "univer-custom-sort-panel-item";
  261. var rn = "univer-custom-sort-panel-item-head";
  262. var on = "univer-custom-sort-panel-item-handler";
  263. var sn = "univer-custom-sort-panel-item-remove";
  264. var cn = "univer-custom-sort-panel-item-column-input";
  265. var an = "univer-custom-sort-panel-item-column-input-dropdown";
  266. var ln = "univer-custom-sort-panel-item-column-input-text";
  267. var dn = "univer-custom-sort-panel-item-order-radio";
  268. var un = "univer-custom-sort-panel-item-order-radio-cn";
  269. var mn = "univer-condition-list";
  270. var hn = "univer-embed-sort-btn-container";
  271. var gn = "univer-embed-sort-btn";
  272. var Cn = "univer-embed-sort-btn-asc";
  273. var Sn = "univer-embed-sort-btn-desc";
  274. var fn = "univer-embed-sort-btn-icon";
  275. var pn = "univer-custom-sort-col-menu";
  276. var vn = "univer-custom-sort-col-menu-item";
  277. var _n2 = "univer-custom-sort-col-menu-item-desc";
  278. var a = {
  279. extendConfirmContent: Wt,
  280. extendConfirmRadioGroup: qt,
  281. customSortPanelContainer: Yt,
  282. customSortPanelExt: Jt,
  283. addCondition: Xt,
  284. addConditionText: Kt,
  285. addConditionDisable: Qt,
  286. customSortPanelFooter: en,
  287. customSortPanelFooterBtn: tn,
  288. customSortPanelItem: nn,
  289. customSortPanelItemHead: rn,
  290. customSortPanelItemHandler: on,
  291. customSortPanelItemRemove: sn,
  292. customSortPanelItemColumnInput: cn,
  293. customSortPanelItemColumnInputDropdown: an,
  294. customSortPanelItemColumnInputText: ln,
  295. customSortPanelItemOrderRadio: dn,
  296. customSortPanelItemOrderRadioCn: un,
  297. conditionList: mn,
  298. embedSortBtnContainer: hn,
  299. embedSortBtn: gn,
  300. embedSortBtnAsc: Cn,
  301. embedSortBtnDesc: Sn,
  302. embedSortBtnIcon: fn,
  303. customSortColMenu: pn,
  304. customSortColMenuItem: vn,
  305. customSortColMenuItemDesc: _n2
  306. };
  307. var xn = (e) => {
  308. const [t, n] = (0, import_react.useState)("0"), r = W0(Vr);
  309. return i.jsxs("div", { className: a.extendConfirmContent, children: [
  310. i.jsx("div", { className: "extend-confirm-desc", children: r.t("sheets-sort.dialog.sort-reminder-desc") }),
  311. i.jsxs(
  312. t_,
  313. {
  314. className: a.extendConfirmRadioGroup,
  315. value: t,
  316. direction: "vertical",
  317. onChange: (o) => {
  318. n(o), e.onChange(o);
  319. },
  320. children: [
  321. i.jsx(
  322. e_,
  323. {
  324. value: "0",
  325. children: r.t("sheets-sort.dialog.sort-reminder-no")
  326. }
  327. ),
  328. i.jsx(e_, { value: "1", children: r.t("sheets-sort.dialog.sort-reminder-ext") })
  329. ]
  330. }
  331. )
  332. ] });
  333. };
  334. var In = Object.defineProperty;
  335. var yn = Object.getOwnPropertyDescriptor;
  336. var Rn = (e, t, n, r) => {
  337. for (var o = r > 1 ? void 0 : r ? yn(t, n) : t, s = e.length - 1, c; s >= 0; s--)
  338. (c = e[s]) && (o = (r ? c(t, n, o) : c(o)) || o);
  339. return r && o && In(t, n, o), o;
  340. };
  341. var T = (e, t) => (n, r) => t(n, r, e);
  342. var z = {
  343. MERGE_ERROR: "sheets-sort.error.merge-size",
  344. EMPTY_ERROR: "sheets-sort.error.empty",
  345. SINGLE_ERROR: "sheets-sort.error.single",
  346. FORMULA_ARRAY: "sheets-sort.error.formula-array"
  347. };
  348. var f2 = class extends nt {
  349. constructor(t, n, r, o, s, c, l) {
  350. super();
  351. X(this, "_customSortState$", new BehaviorSubject(null));
  352. X(this, "customSortState$", this._customSortState$.asObservable());
  353. this._univerInstanceService = t, this._confirmService = n, this._logService = r, this._selectionManagerService = o, this._sheetsSortService = s, this._localeService = c, this._commandService = l;
  354. }
  355. async triggerSortDirectly(t, n, r) {
  356. const o = r || await this._detectSortLocation(n);
  357. if (!o || !this._check(o))
  358. return false;
  359. const c = {
  360. orderRules: [{
  361. type: t ? f.ASC : f.DESC,
  362. colIndex: o.colIndex
  363. }],
  364. range: o.range
  365. };
  366. return this._sheetsSortService.applySort(c, o.unitId, o.subUnitId), true;
  367. }
  368. async triggerSortCustomize() {
  369. const t = await this._detectSortLocation();
  370. return !t || !this._check(t) ? false : (this.showCustomSortPanel(t), true);
  371. }
  372. customSortState() {
  373. return this._customSortState$.getValue();
  374. }
  375. getTitles(t) {
  376. var d, u;
  377. const n = (d = this.customSortState()) == null ? void 0 : d.location;
  378. if (!n)
  379. return [];
  380. const { unitId: r, subUnitId: o, range: s } = n, c = (u = this._univerInstanceService.getUnit(r)) == null ? void 0 : u.getSheetBySheetId(o);
  381. if (!c)
  382. return [];
  383. const l = Mn(this._localeService);
  384. return Array.from(
  385. { length: s.endColumn - s.startColumn + 1 },
  386. (h, g2) => {
  387. var S;
  388. const p = (S = c.getCell(s.startRow, g2 + s.startColumn)) == null ? void 0 : S.v;
  389. return {
  390. index: g2 + s.startColumn,
  391. label: t ? `${p != null ? p : l(g2 + s.startColumn)}` : l(g2 + s.startColumn)
  392. };
  393. }
  394. );
  395. }
  396. setSelection(t, n, r) {
  397. var c;
  398. const o = (c = this._univerInstanceService.getUnit(t)) == null ? void 0 : c.getSheetBySheetId(n);
  399. if (!o)
  400. return;
  401. const s = {
  402. unitId: t,
  403. subUnitId: n,
  404. selections: [{ range: r, primary: ve(r, o), style: null }]
  405. };
  406. this._commandService.executeCommand(re2.id, s);
  407. }
  408. async showCheckError(t) {
  409. return await this._confirmService.confirm({
  410. id: "sort-range-check-error",
  411. title: {
  412. title: this._localeService.t("info.tooltip")
  413. },
  414. children: {
  415. title: i.jsx("div", { children: this._localeService.t(t) })
  416. }
  417. });
  418. }
  419. async showExtendConfirm() {
  420. let t = false;
  421. return await this._confirmService.confirm({
  422. id: "extend-sort-range-dialog",
  423. title: {
  424. title: this._localeService.t("sheets-sort.dialog.sort-reminder")
  425. },
  426. children: {
  427. title: i.jsx(
  428. xn,
  429. {
  430. onChange: (r) => {
  431. t = r === "1";
  432. }
  433. }
  434. )
  435. },
  436. width: 400
  437. }) ? t ? "extend" : "keep" : "cancel";
  438. }
  439. showCustomSortPanel(t) {
  440. this._customSortState$.next({ location: t, show: true });
  441. }
  442. closeCustomSortPanel() {
  443. this._customSortState$.next({ show: false });
  444. }
  445. _check(t) {
  446. return this._sheetsSortService.singleCheck(t) ? this._sheetsSortService.mergeCheck(t) ? this._sheetsSortService.formulaCheck(t) ? this._sheetsSortService.emptyCheck(t) ? true : (this.showCheckError(z.EMPTY_ERROR), false) : (this.showCheckError(z.FORMULA_ARRAY), false) : (this.showCheckError(z.MERGE_ERROR), false) : (this.showCheckError(z.SINGLE_ERROR), false);
  447. }
  448. async _detectSortLocation(t) {
  449. const n = this._univerInstanceService.getCurrentUnitForType(Fe.UNIVER_SHEET), r = n.getActiveSheet(), o = n.getUnitId(), s = r.getSheetId(), c = this._selectionManagerService.getCurrentLastSelection();
  450. if (!c)
  451. return null;
  452. let l;
  453. if (t === true)
  454. l = Mh(c.range, { up: true, down: true, left: true, right: true }, r), this.setSelection(o, s, l);
  455. else if (t === false)
  456. l = c.range;
  457. else {
  458. const d = await this.showExtendConfirm();
  459. if (d === "cancel")
  460. return null;
  461. d === "keep" ? l = c.range : (l = Mh(c.range, { up: true, down: true, left: true, right: true }, r), this.setSelection(o, s, l));
  462. }
  463. return {
  464. range: l,
  465. unitId: o,
  466. subUnitId: s,
  467. colIndex: c.primary.actualColumn
  468. };
  469. }
  470. };
  471. f2 = Rn([
  472. T(0, _n),
  473. T(1, d3),
  474. T(2, Mt),
  475. T(3, ot(F)),
  476. T(4, ot(g)),
  477. T(5, ot(Vr)),
  478. T(6, Pt)
  479. ], f2);
  480. function Mn(e) {
  481. return (t) => {
  482. const n = re.chatAtABC(t);
  483. switch (e.getCurrentLocale()) {
  484. case ur.ZH_CN:
  485. return `"${n}"列`;
  486. case ur.EN_US:
  487. return `Column "${n}"`;
  488. default:
  489. return `Column "${n}"`;
  490. }
  491. };
  492. }
  493. var re3 = {
  494. id: "sheet.command.sort-range-asc",
  495. type: ar.COMMAND,
  496. handler: async (e) => await e.get(f2).triggerSortDirectly(true, false)
  497. };
  498. var oe = {
  499. id: "sheet.command.sort-range-asc-ext",
  500. type: ar.COMMAND,
  501. handler: async (e) => await e.get(f2).triggerSortDirectly(true, true)
  502. };
  503. var se = {
  504. id: "sheet.command.sort-range-desc",
  505. type: ar.COMMAND,
  506. handler: async (e) => await e.get(f2).triggerSortDirectly(false, false)
  507. };
  508. var ie = {
  509. id: "sheet.command.sort-range-desc-ext",
  510. type: ar.COMMAND,
  511. handler: async (e) => await e.get(f2).triggerSortDirectly(false, true)
  512. };
  513. var ce = {
  514. id: "sheet.command.sort-range-custom",
  515. type: ar.COMMAND,
  516. handler: async (e) => await e.get(f2).triggerSortCustomize()
  517. };
  518. var ae = {
  519. id: "sheet.command.sort-range-asc-ctx",
  520. type: ar.COMMAND,
  521. handler: async (e) => await e.get(f2).triggerSortDirectly(true, false)
  522. };
  523. var le = {
  524. id: "sheet.command.sort-range-asc-ext-ctx",
  525. type: ar.COMMAND,
  526. handler: async (e) => await e.get(f2).triggerSortDirectly(true, true)
  527. };
  528. var de = {
  529. id: "sheet.command.sort-range-desc-ctx",
  530. type: ar.COMMAND,
  531. handler: async (e) => await e.get(f2).triggerSortDirectly(false, false)
  532. };
  533. var ue2 = {
  534. id: "sheet.command.sort-range-desc-ext-ctx",
  535. type: ar.COMMAND,
  536. handler: async (e) => await e.get(f2).triggerSortDirectly(false, true)
  537. };
  538. var me = {
  539. id: "sheet.command.sort-range-custom-ctx",
  540. type: ar.COMMAND,
  541. handler: async (e) => await e.get(f2).triggerSortCustomize()
  542. };
  543. function bn() {
  544. const e = W0(f2), t = W0(g), n = W0(Vr), [r, o] = (0, import_react.useState)(false), [s, c] = (0, import_react.useState)(0), l = (0, import_react.useRef)(null), d = e.customSortState();
  545. if (!d || !d.location)
  546. return null;
  547. const { range: u, unitId: h, subUnitId: g2 } = d.location, p = e.getTitles(r), [S, U] = (0, import_react.useState)([
  548. { type: f.ASC, colIndex: u.startColumn }
  549. ]), Y = (0, import_react.useCallback)((m, x) => {
  550. const $2 = [...S];
  551. x === null ? $2.splice(m, 1) : $2[m] = x, U($2);
  552. }, [S]), V = (0, import_react.useCallback)(
  553. tR(() => {
  554. const m = [...S], x = On(u, S);
  555. x !== null && (m.push({ type: f.ASC, colIndex: x }), U(m));
  556. }, 200),
  557. [S, u]
  558. ), C = (0, import_react.useCallback)((m, x) => {
  559. t.applySort({ range: u, orderRules: m, hasTitle: x }), e.closeCustomSortPanel();
  560. }, [t, e, u]), J = (0, import_react.useCallback)(() => {
  561. e.closeCustomSortPanel();
  562. }, [e]), Ze = (0, import_react.useCallback)((m) => {
  563. o(m), m ? e.setSelection(h, g2, { ...u, startRow: u.startRow + 1 }) : e.setSelection(h, g2, u);
  564. }, [e, u, g2, h]);
  565. (0, import_react.useEffect)(() => {
  566. l.current && S.length > 5 && (l.current.scrollTop = l.current.scrollHeight);
  567. }, [S]);
  568. const Ge = S.length < p.length, fe = S.map((m) => ({ ...m, id: `${m.colIndex}` }));
  569. return i.jsxs("div", { className: a.customSortPanelContainer, children: [
  570. i.jsxs("div", { className: a.customSortPanelContent, onMouseDown: (m) => {
  571. m.stopPropagation();
  572. }, children: [
  573. i.jsxs("div", { className: a.customSortPanelExt, children: [
  574. i.jsx("div", { className: a.firstRowCheck, children: i.jsx(um, { checked: r, onChange: (m) => Ze(!!m), children: n.t("sheets-sort.dialog.first-row-check") }) }),
  575. Ge ? i.jsxs("div", { className: a.addCondition, onClick: V, children: [
  576. i.jsx(ee, {}),
  577. i.jsx("span", { className: a.addConditionText, children: n.t("sheets-sort.dialog.add-condition") })
  578. ] }) : i.jsxs(
  579. "div",
  580. {
  581. className: `
  582. ${a.addCondition}
  583. ${a.addConditionDisable}
  584. `,
  585. children: [
  586. i.jsx(ee, {}),
  587. i.jsx("span", { className: a.addConditionText, children: n.t("sheets-sort.dialog.add-condition") })
  588. ]
  589. }
  590. )
  591. ] }),
  592. i.jsx(
  593. "div",
  594. {
  595. className: a.conditionList,
  596. onScroll: (m) => {
  597. const x = m.currentTarget.scrollTop;
  598. c(x);
  599. },
  600. ref: l,
  601. children: i.jsx(
  602. g_,
  603. {
  604. list: fe,
  605. onListChange: U,
  606. idKey: "id",
  607. draggableHandle: `.${a.customSortPanelItemHandler}`,
  608. itemRender: (m) => i.jsx(
  609. En,
  610. {
  611. titles: p,
  612. list: fe,
  613. item: m,
  614. onChange: (x, $2) => Y($2, x),
  615. scrollPosition: s
  616. }
  617. ),
  618. rowHeight: 32,
  619. margin: [0, 12]
  620. }
  621. )
  622. }
  623. )
  624. ] }),
  625. i.jsxs("div", { className: a.customSortPanelFooter, children: [
  626. i.jsx(Po, { className: a.customSortPanelFooterBtn, type: "default", onClick: () => J(), children: n.t("sheets-sort.dialog.cancel") }),
  627. i.jsx(Po, { className: a.customSortPanelFooterBtn, type: "primary", onClick: () => C(S, r), children: n.t("sheets-sort.dialog.confirm") })
  628. ] })
  629. ] });
  630. }
  631. function En(e) {
  632. var V;
  633. const { list: t, item: n, titles: r, onChange: o, scrollPosition: s } = e, c = W0(Vr), l = r.filter((C) => !t.some((J) => J.colIndex === C.index) || C.index === n.colIndex), d = t.findIndex((C) => C.colIndex === n.colIndex), u = (0, import_react.useCallback)((C) => {
  634. o({ ...n, colIndex: C.index }, d), g2(false);
  635. }, [d, n, o]), [h, g2] = (0, import_react.useState)(false), p = (C) => {
  636. g2(C);
  637. };
  638. (0, import_react.useEffect)(() => {
  639. g2(false);
  640. }, [s]);
  641. const S = t.length > 1, U = (V = r.find((C) => C.index === n.colIndex)) == null ? void 0 : V.label, Y = c.getCurrentLocale() === ur.ZH_CN ? a.customSortPanelItemOrderRadioCn : a.customSortPanelItemOrderRadio;
  642. return i.jsxs("div", { className: a.customSortPanelItem, children: [
  643. i.jsxs("div", { className: a.customSortPanelItemHead, children: [
  644. i.jsx("div", { className: a.customSortPanelItemHandler, children: i.jsx(Ae, {}) }),
  645. i.jsx("div", { className: a.customSortPanelItemColumn, children: i.jsx(
  646. sC,
  647. {
  648. placement: "bottomLeft",
  649. trigger: ["click"],
  650. visible: h,
  651. onVisibleChange: p,
  652. overlay: i.jsx("ul", { className: a.customSortColMenu, children: l.map((C) => i.jsxs(
  653. "li",
  654. {
  655. onClick: () => u(C),
  656. className: a.customSortColMenuItem,
  657. children: [
  658. i.jsx("span", { className: a.customSortColMenuItemDesc, children: C.label }),
  659. i.jsx("span", { className: a.customSortColMenuItemCheck, children: C.index === n.colIndex && i.jsx(je, {}) })
  660. ]
  661. },
  662. C.index
  663. )) }),
  664. children: i.jsxs("div", { className: a.customSortPanelItemColumnInput, children: [
  665. i.jsx("span", { className: a.customSortPanelItemColumnInputText, children: U }),
  666. i.jsx($e2, { className: a.customSortPanelItemColumnInputDropdown })
  667. ] })
  668. }
  669. ) })
  670. ] }),
  671. i.jsx("div", { className: a.customSortPanelItemOrder, children: i.jsxs(
  672. t_,
  673. {
  674. className: Y,
  675. value: n.type,
  676. onChange: (C) => {
  677. o({ ...n, type: C }, d);
  678. },
  679. children: [
  680. i.jsx(e_, { value: f.ASC, children: c.t("sheets-sort.general.sort-asc") }),
  681. i.jsx(e_, { value: f.DESC, children: c.t("sheets-sort.general.sort-desc") })
  682. ]
  683. }
  684. ) }),
  685. i.jsx("div", { className: a.customSortPanelItemRemove, children: S && i.jsx(ke, { onClick: () => o(null, d) }) })
  686. ] });
  687. }
  688. function On(e, t) {
  689. const { startColumn: n, endColumn: r } = e, o = new Set(t.map((s) => s == null ? void 0 : s.colIndex));
  690. for (let s = n; s <= r; s++)
  691. if (!o.has(s))
  692. return s;
  693. return null;
  694. }
  695. function Tn(e) {
  696. const { range: t, colIndex: n, onClose: r } = e, o = W0(f2), s = W0(_n), c = W0(Vr), l = (0, import_react.useCallback)((d) => {
  697. const { unitId: u, subUnitId: h } = N(s) || {};
  698. if (t && u && h) {
  699. const g2 = { ...t, startRow: t.startRow + 1 };
  700. o.triggerSortDirectly(d, false, { unitId: u, subUnitId: h, range: g2, colIndex: n });
  701. } else
  702. console.warn(`Cannot find the target to sort. unitId: ${u}, subUnitId: ${h}, range: ${t}, colIndex: ${n}`);
  703. r();
  704. }, [t, n, o, s, r]);
  705. return i.jsxs("div", { className: a.embedSortBtnContainer, children: [
  706. i.jsxs(
  707. "div",
  708. {
  709. className: `
  710. ${a.embedSortBtn}
  711. ${a.embedSortBtnAsc}
  712. `,
  713. onClick: () => l(true),
  714. children: [
  715. i.jsx(te, { className: a.embedSortBtnIcon }),
  716. c.t("sheets-sort.general.sort-asc")
  717. ]
  718. }
  719. ),
  720. i.jsxs(
  721. "div",
  722. {
  723. className: `
  724. ${a.embedSortBtn}
  725. ${a.embedSortBtnDesc}
  726. `,
  727. onClick: () => l(false),
  728. children: [
  729. i.jsx(ne, { className: a.embedSortBtnIcon }),
  730. c.t("sheets-sort.general.sort-desc")
  731. ]
  732. }
  733. )
  734. ] });
  735. }
  736. var Be = "sheet.menu.sheets-sort";
  737. var Fe2 = "sheet.menu.sheets-sort-ctx";
  738. var F2 = "AscendingSingle";
  739. var he = "ExpandAscendingSingle";
  740. var ge = "DescendingSingle";
  741. var Ce = "ExpandDescendingSingle";
  742. var Se = "CustomSortSingle";
  743. function Pn(e) {
  744. return {
  745. id: Be,
  746. type: $e.SUBITEMS,
  747. icon: F2,
  748. tooltip: "sheets-sort.general.sort",
  749. hidden$: Fa(e, Fe.UNIVER_SHEET),
  750. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  751. };
  752. }
  753. function wn(e) {
  754. return {
  755. id: re3.id,
  756. icon: F2,
  757. title: "sheets-sort.general.sort-asc-cur",
  758. type: $e.BUTTON,
  759. hidden$: bb(e)
  760. };
  761. }
  762. function Nn(e) {
  763. return {
  764. id: oe.id,
  765. title: "sheets-sort.general.sort-asc-ext",
  766. icon: he,
  767. type: $e.BUTTON
  768. };
  769. }
  770. function Ln(e) {
  771. return {
  772. id: se.id,
  773. title: "sheets-sort.general.sort-desc-cur",
  774. icon: ge,
  775. type: $e.BUTTON
  776. };
  777. }
  778. function jn(e) {
  779. return {
  780. id: ie.id,
  781. title: "sheets-sort.general.sort-desc-ext",
  782. icon: Ce,
  783. type: $e.BUTTON
  784. };
  785. }
  786. function Dn(e) {
  787. return {
  788. id: ce.id,
  789. title: "sheets-sort.general.sort-custom",
  790. type: $e.BUTTON,
  791. icon: Se
  792. };
  793. }
  794. function kn(e) {
  795. return {
  796. id: Fe2,
  797. title: "sheets-sort.general.sort",
  798. type: $e.SUBITEMS,
  799. icon: F2,
  800. hidden$: Fa(e, Fe.UNIVER_SHEET),
  801. disabled$: ue(e, {
  802. workbookTypes: [Me],
  803. worksheetTypes: [ur2, Te],
  804. rangeTypes: [Pe]
  805. })
  806. };
  807. }
  808. function Hn(e) {
  809. return {
  810. id: ae.id,
  811. title: "sheets-sort.general.sort-asc-cur",
  812. type: $e.BUTTON,
  813. icon: F2,
  814. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  815. };
  816. }
  817. function Un(e) {
  818. return {
  819. id: le.id,
  820. title: "sheets-sort.general.sort-asc-ext",
  821. type: $e.BUTTON,
  822. icon: he,
  823. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  824. };
  825. }
  826. function $n(e) {
  827. return {
  828. id: de.id,
  829. title: "sheets-sort.general.sort-desc-cur",
  830. type: $e.BUTTON,
  831. icon: ge,
  832. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  833. };
  834. }
  835. function An(e) {
  836. return {
  837. id: ue2.id,
  838. title: "sheets-sort.general.sort-desc-ext",
  839. type: $e.BUTTON,
  840. icon: Ce,
  841. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  842. };
  843. }
  844. function Bn(e) {
  845. return {
  846. id: me.id,
  847. title: "sheets-sort.general.sort-custom",
  848. type: $e.BUTTON,
  849. icon: Se,
  850. disabled$: ue(e, { workbookTypes: [Me], worksheetTypes: [ur2, Te], rangeTypes: [Pe] })
  851. };
  852. }
  853. var Fn = {
  854. [l1.FORMULAS_INSERT]: {
  855. [Be]: {
  856. order: 2,
  857. menuItemFactory: Pn,
  858. [re3.id]: {
  859. order: 0,
  860. menuItemFactory: wn
  861. },
  862. [oe.id]: {
  863. order: 1,
  864. menuItemFactory: Nn
  865. },
  866. [se.id]: {
  867. order: 2,
  868. menuItemFactory: Ln
  869. },
  870. [ie.id]: {
  871. order: 3,
  872. menuItemFactory: jn
  873. },
  874. [ce.id]: {
  875. order: 4,
  876. menuItemFactory: Dn
  877. }
  878. }
  879. },
  880. [P1.MAIN_AREA]: {
  881. [He.DATA]: {
  882. [Fe2]: {
  883. order: 0,
  884. menuItemFactory: kn,
  885. [ae.id]: {
  886. order: 0,
  887. menuItemFactory: Hn
  888. },
  889. [le.id]: {
  890. order: 1,
  891. menuItemFactory: Un
  892. },
  893. [de.id]: {
  894. order: 2,
  895. menuItemFactory: $n
  896. },
  897. [ue2.id]: {
  898. order: 3,
  899. menuItemFactory: An
  900. },
  901. [me.id]: {
  902. order: 4,
  903. menuItemFactory: Bn
  904. }
  905. }
  906. }
  907. }
  908. };
  909. var Vn = Object.defineProperty;
  910. var zn = Object.getOwnPropertyDescriptor;
  911. var Zn = (e, t, n, r) => {
  912. for (var o = r > 1 ? void 0 : r ? zn(t, n) : t, s = e.length - 1, c; s >= 0; s--)
  913. (c = e[s]) && (o = (r ? c(t, n, o) : c(o)) || o);
  914. return r && o && Vn(t, n, o), o;
  915. };
  916. var M = (e, t) => (n, r) => t(n, r, e);
  917. var ye = "custom-sort-dialog";
  918. var Gn = 560;
  919. var G = class extends J0 {
  920. constructor(e, t, n, r, o, s, c, l, d, u) {
  921. super(), this._commandService = e, this._menuManagerService = t, this._dialogService = n, this._layoutService = r, this._uiPartsService = o, this._sheetRenderService = s, this._localeService = c, this._sheetsSortUIService = l, this._injector = d, this._componentManager = u, this._initCommands(), this._initMenu(), this._initUI();
  922. }
  923. _initMenu() {
  924. this._menuManagerService.mergeMenu(Fn);
  925. }
  926. _initCommands() {
  927. [
  928. re3,
  929. oe,
  930. se,
  931. ie,
  932. ce,
  933. ae,
  934. le,
  935. de,
  936. ue2,
  937. me
  938. ].forEach((e) => this.disposeWithMe(this._commandService.registerCommand(e))), this.disposeWithMe(this._sheetRenderService.registerSkeletonChangingMutations($.id));
  939. }
  940. _initUI() {
  941. this.disposeWithMe(this._componentManager.register("CustomSortPanel", bn)), this.disposeWithMe(this._uiPartsService.registerComponent(Gm.FILTER_PANEL_EMBED_POINT, () => B0(Tn, this._injector))), this.disposeWithMe(this._componentManager.register(F2, te)), this.disposeWithMe(this._componentManager.register(he, He2)), this.disposeWithMe(this._componentManager.register(ge, ne)), this.disposeWithMe(this._componentManager.register(Ce, Ue)), this.disposeWithMe(this._componentManager.register(Se, De)), this._sheetsSortUIService.customSortState$.pipe(takeUntil(this.dispose$)).subscribe((e) => {
  942. e && e.show && e.location ? this._openCustomSortPanel(e.location) : e && !(e != null && e.show) && this._closePanel();
  943. });
  944. }
  945. _openCustomSortPanel(e) {
  946. this._dialogService.open({
  947. id: ye,
  948. draggable: true,
  949. width: Gn,
  950. title: { title: `${this._localeService.t("sheets-sort.general.sort-custom")}: ${fr(e.range)}` },
  951. children: { label: "CustomSortPanel" },
  952. destroyOnClose: true,
  953. defaultPosition: Wn(),
  954. preservePositionOnDestroy: false,
  955. onClose: () => this._closePanel(),
  956. mask: true
  957. });
  958. }
  959. _closePanel() {
  960. this._dialogService.close(ye), queueMicrotask(() => this._layoutService.focus());
  961. }
  962. };
  963. G = Zn([
  964. M(0, Pt),
  965. M(1, m1),
  966. M(2, h3),
  967. M(3, _1),
  968. M(4, f1),
  969. M(5, ot(Mr)),
  970. M(6, ot(Vr)),
  971. M(7, ot(f2)),
  972. M(8, ot(Ot)),
  973. M(9, ot(n1))
  974. ], G);
  975. function Wn() {
  976. return { x: 0, y: 0 };
  977. }
  978. var Ve = Object.defineProperty;
  979. var qn = Object.getOwnPropertyDescriptor;
  980. var Yn = (e, t, n) => t in e ? Ve(e, t, { enumerable: true, configurable: true, writable: true, value: n }) : e[t] = n;
  981. var Jn = (e, t, n, r) => {
  982. for (var o = r > 1 ? void 0 : r ? qn(t, n) : t, s = e.length - 1, c; s >= 0; s--)
  983. (c = e[s]) && (o = (r ? c(t, n, o) : c(o)) || o);
  984. return r && o && Ve(t, n, o), o;
  985. };
  986. var Re = (e, t) => (n, r) => t(n, r, e);
  987. var ze = (e, t, n) => Yn(e, typeof t != "symbol" ? t + "" : t, n);
  988. var Xn = "SHEET_SORT_UI_PLUGIN";
  989. var W = class extends Ra {
  990. constructor(e = _e, t, n) {
  991. super(), this._config = e, this._injector = t, this._configService = n;
  992. const { ...r } = nu(
  993. {},
  994. _e,
  995. this._config
  996. );
  997. this._configService.setConfig(Pt2, r);
  998. }
  999. onStarting() {
  1000. [
  1001. [f2],
  1002. [G]
  1003. ].forEach((e) => this._injector.add(e));
  1004. }
  1005. onRendered() {
  1006. this._injector.get(G);
  1007. }
  1008. };
  1009. ze(W, "type", Fe.UNIVER_SHEET);
  1010. ze(W, "pluginName", Xn);
  1011. W = Jn([
  1012. OR(E),
  1013. Re(1, ot(Ot)),
  1014. Re(2, SE)
  1015. ], W);
  1016. export {
  1017. re3 as SortRangeAscCommand,
  1018. oe as SortRangeAscExtCommand,
  1019. le as SortRangeAscExtInCtxMenuCommand,
  1020. ae as SortRangeAscInCtxMenuCommand,
  1021. ce as SortRangeCustomCommand,
  1022. me as SortRangeCustomInCtxMenuCommand,
  1023. se as SortRangeDescCommand,
  1024. ie as SortRangeDescExtCommand,
  1025. ue2 as SortRangeDescExtInCtxMenuCommand,
  1026. de as SortRangeDescInCtxMenuCommand,
  1027. W as UniverSheetsSortUIPlugin
  1028. };
  1029. /*! Bundled license information:
  1030. @univerjs/sheets-sort-ui/lib/es/index.js:
  1031. (**
  1032. * @license React
  1033. * react-jsx-runtime.production.min.js
  1034. *
  1035. * Copyright (c) Facebook, Inc. and its affiliates.
  1036. *
  1037. * This source code is licensed under the MIT license found in the
  1038. * LICENSE file in the root directory of this source tree.
  1039. *)
  1040. */
  1041. //# sourceMappingURL=@univerjs_sheets-sort-ui.js.map