snail.vue 1.0.37 → 1.0.39

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.
@@ -1,7 +1,7 @@
1
- import * as vue from 'vue';
2
- import { ShallowRef, Component, Ref, WatchSource, App } from 'vue';
3
1
  import * as snail_view from 'snail.view';
4
2
  import { BaseStyle, HeightStyle, FlexBoxStyle, WidthStyle, BorderStyle, PaddingStyle, MarginStyle } from 'snail.view';
3
+ import * as vue from 'vue';
4
+ import { Component, ShallowRef, Ref, WatchSource, App } from 'vue';
5
5
  import { IScope, RunResult, IAsyncScope } from 'snail.core';
6
6
 
7
7
  /**
@@ -166,35 +166,12 @@ type DragVerifyInfo = {
166
166
  distance: number;
167
167
  };
168
168
 
169
- /**
170
- * 搜索组件配置选项
171
- */
172
- type SearchOptions = ReadonlyOptions & PlaceholderOptions & {
173
- /**
174
- * 启用【自动完成】
175
- * - true 时,只要文本变化了,就触发 search 事件
176
- * - false 时,只有点击【搜索】按钮,才触发 search 事件
177
- */
178
- autoComplete?: boolean;
179
- };
180
- /**
181
- * 搜索组件事件
182
- */
183
- type SearchEvents = {
184
- /**
185
- * 事件:执行搜索
186
- * @param value 为搜索文本
187
- */
188
- search: [value: string];
189
- };
190
-
191
169
  /**
192
170
  * 树形 数据相关的基础实体结构
193
171
  * 1、封装一些基础实体;如树形节点数据结构
194
172
  * 2、配合树形组件使用;如select的多级筛选,树组件等
195
173
  * 3、封装树的基础共性操作,如显隐判断、搜索查询等
196
174
  */
197
-
198
175
  /**
199
176
  * 树节点
200
177
  * - 仅提供树节点基础属性;可以基于 Extend 为 TreeNode 扩展节点属性
@@ -222,7 +199,7 @@ type TreeNodeExtend = {
222
199
  * 节点Id,确保唯一
223
200
  * - 不传入则内部自动 newId()
224
201
  */
225
- id?: string;
202
+ readonly id?: string;
226
203
  /**
227
204
  * 是否可点击
228
205
  * - true 此节点可点击,点击时触发 click 事件
@@ -247,41 +224,84 @@ type TreeNodeExtend = {
247
224
  fixed?: boolean;
248
225
  };
249
226
  /**
250
- * 树的上下文对象
227
+ * 树的基础上下文对象
251
228
  */
252
- interface ITreeContext<T> {
229
+ interface ITreeBaseContext<T> {
253
230
  /**
254
231
  * 执行搜索
255
232
  * @param text 搜索文本
256
233
  */
257
234
  doSearch(text: string): void;
258
235
  /**
259
- * 指定节点是否可显示
236
+ * 是否是【补丁】节点
237
+ * - 子节点搜索命中时,父级路径上节点没命中,则作父级路径节点作为路径修补节点存在,避免命中子节点展示不出来
238
+ * @param node 要判断的节点
239
+ * @returns true 是补丁节点,false 不是补丁节点
240
+ */
241
+ isPatched(node: TreeNode<T>): boolean;
242
+ /**
243
+ * 是否显示【树节点】
260
244
  * @param node 要判断的节点
245
+ * @param needPatched 是否需要【补丁】节点。true时(补丁节点始终显示);false时(根据hidden和搜索结果判断)
261
246
  * @returns 能显示返回true;否则返回false
262
247
  */
263
- canShow(node: TreeNode<T, TreeNodeExtend>): boolean;
248
+ isShow(node: TreeNode<T, TreeNodeExtend>, needPatched: boolean): boolean;
264
249
  /**
265
- * 获取指定树节点的上下文
266
- * @param node
267
- * @returns 节点上下文
250
+ * 是否显示指定【树节点】的子节点
251
+ * - 不会判断node节点自身是否可显示
252
+ * @param node 要判断的节点
253
+ * @param needPatched 是否需要【补丁】节点。true时(补丁节点始终显示);false时(根据hidden和搜索结果判断)
254
+ * @returns 能显示返回true;否则返回false
268
255
  */
269
- getContext(node: TreeNode<T, TreeNodeExtend>): ITreeNodeContext<T>;
256
+ isShowChildren(node: TreeNode<T, TreeNodeExtend>, needPatched: boolean): boolean;
257
+ /**
258
+ * 获取指定【树节点】的路径
259
+ * @param node 树节点
260
+ * @returns 从【顶级节点】->【指定节点】的全路径数据
261
+ */
262
+ getPath(node: TreeNode<T, TreeNodeExtend>): TreeNode<T, TreeNodeExtend>[];
270
263
  }
271
264
  /**
272
- * 树节点 上下文
265
+ * 树搜索结果
273
266
  */
274
- interface ITreeNodeContext<T> {
267
+ type TreeSearchResult<T> = {
275
268
  /**
276
- * 节点是否展示:响应式
269
+ * 匹配上的节点集合
277
270
  */
278
- show: ShallowRef<boolean>;
271
+ matched: TreeNode<T>[];
279
272
  /**
280
- * 是否显示子节点
281
- * - 若node.children有值,但不能显示出来,则也算无子节点
273
+ * 未匹配上的节点集合
282
274
  */
283
- showChildren: ShallowRef<boolean>;
284
- }
275
+ failed: TreeNode<T>[];
276
+ /**
277
+ * 搜索时的【补丁】节点集合
278
+ * - 子节点搜索命中时,父级路径上节点没命中,则作父级路径节点作为路径修补节点存在,避免命中子节点展示不出来
279
+ * - 仅在有搜索条件时成立,补丁节点同时在【failed】节点集合中
280
+ */
281
+ patched: TreeNode<T>[];
282
+ };
283
+
284
+ /**
285
+ * 搜索组件配置选项
286
+ */
287
+ type SearchOptions = ReadonlyOptions & PlaceholderOptions & {
288
+ /**
289
+ * 启用【自动完成】
290
+ * - true 时,只要文本变化了,就触发 search 事件
291
+ * - false 时,只有点击【搜索】按钮,才触发 search 事件
292
+ */
293
+ autoComplete?: boolean;
294
+ };
295
+ /**
296
+ * 搜索组件事件
297
+ */
298
+ type SearchEvents = {
299
+ /**
300
+ * 事件:执行搜索
301
+ * @param value 为搜索文本
302
+ */
303
+ search: [value: string];
304
+ };
285
305
 
286
306
  /**
287
307
  * 树组件 相关实体
@@ -309,7 +329,13 @@ type TreeOptions<T> = {
309
329
  /**
310
330
  * 树组件事件
311
331
  */
312
- type TreeEvents<T> = TreeNodeEvents<T> & {};
332
+ type TreeEvents<T> = TreeNodeEvents<T> & {
333
+ /**
334
+ * 搜索完成后
335
+ * @param text 搜索文本
336
+ */
337
+ (el: "searched", text: string): any;
338
+ };
313
339
  /**
314
340
  * 树节点 组件配置选项
315
341
  */
@@ -334,7 +360,7 @@ type TreeNodeOptions<T> = {
334
360
  /**
335
361
  * 树组件的上下文对象
336
362
  */
337
- context: ITreeContext<T>;
363
+ context: ITreeBaseContext<T>;
338
364
  };
339
365
  /**
340
366
  * 树节点事件
@@ -373,7 +399,7 @@ type TreeNodeRenderOptions = {
373
399
  /**
374
400
  * 树节点 插槽配置选项
375
401
  */
376
- type TreeNodeSoltOptions<T> = {
402
+ type TreeNodeSlotOptions<T> = {
377
403
  /**
378
404
  * 当前节点
379
405
  */
@@ -594,10 +620,27 @@ type SelectOptions<T> = ReadonlyOptions & PlaceholderOptions & SelectBaseOptions
594
620
  * 选项菜单 组件 事件
595
621
  */
596
622
  type SelectEvents<T> = SelectBaseEvents<T> & {};
623
+ /**
624
+ * 选项菜单 组件的Slot配置选项
625
+ */
626
+ type SelectSlotOptions<T> = {
627
+ /**
628
+ * 关闭Follow弹窗
629
+ * - 将隐藏已弹出的选项 follow 弹窗
630
+ * @returns 已弹出则销毁成功返回true;未弹出则销毁失败返回false
631
+ */
632
+ closeFollow(): boolean;
633
+ /**
634
+ * 停止事件冒泡
635
+ * - 解决问题:插槽内元素需要处理自定义click事件,此时不希望Select组件响应click事件
636
+ * @param delay 在此延迟时间内,停止事件冒泡
637
+ */
638
+ stopPropagation(delay: number): any;
639
+ };
597
640
  /**
598
641
  * 【选项菜单】 组件上下文
599
642
  */
600
- interface ISelectContext<T> extends ITreeContext<T> {
643
+ interface ISelectContext<T> extends ITreeBaseContext<T> {
601
644
  /**
602
645
  * 指定节点是否选中了
603
646
  * @param multiple 是否是【多选模式】
@@ -933,6 +976,18 @@ type SwitchEvents = {
933
976
  change: [value: boolean];
934
977
  };
935
978
 
979
+ /**
980
+ * 树的基础组件信息
981
+ * 1、组件基础上下文 默认实现
982
+ */
983
+
984
+ /**
985
+ * 使用【树上下文】
986
+ * @param nodes 树节点集合
987
+ * @returns 上下文对象+作用域
988
+ */
989
+ declare function useTreeContext<T>(nodes: TreeNode<T, TreeNodeExtend>[]): ITreeBaseContext<T> & IScope;
990
+
936
991
  /**
937
992
  * 使用【响应式管理器】
938
993
  * - 请在Vue组件的setup中使用此方法,否则 getCurrentScope 方法无法取到值
@@ -1585,17 +1640,47 @@ declare const components: {
1585
1640
  onSearch?: (value: string) => any;
1586
1641
  "onUpdate:modelValue"?: (value: string) => any;
1587
1642
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
1588
- Select: vue.DefineComponent<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1589
- modelValue?: SelectItem<any>[];
1590
- }, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1591
- change: (values: SelectItem<any>[]) => any;
1592
- "update:modelValue": (value: SelectItem<any>[]) => any;
1593
- }, string, vue.PublicProps, Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1643
+ Select: {
1644
+ new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1645
+ modelValue?: SelectItem<any>[];
1646
+ }> & Readonly<{
1647
+ onChange?: (values: SelectItem<any>[]) => any;
1648
+ "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1649
+ }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1650
+ change: (values: SelectItem<any>[]) => any;
1651
+ "update:modelValue": (value: SelectItem<any>[]) => any;
1652
+ }, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1653
+ P: {};
1654
+ B: {};
1655
+ D: {};
1656
+ C: {};
1657
+ M: {};
1658
+ Defaults: {};
1659
+ }, Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1660
+ modelValue?: SelectItem<any>[];
1661
+ }> & Readonly<{
1662
+ onChange?: (values: SelectItem<any>[]) => any;
1663
+ "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1664
+ }>, {}, {}, {}, {}, {}>;
1665
+ __isFragment?: never;
1666
+ __isTeleport?: never;
1667
+ __isSuspense?: never;
1668
+ } & vue.ComponentOptionsBase<Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1594
1669
  modelValue?: SelectItem<any>[];
1595
1670
  }> & Readonly<{
1596
1671
  onChange?: (values: SelectItem<any>[]) => any;
1597
1672
  "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1598
- }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, false, {}, any>;
1673
+ }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1674
+ change: (values: SelectItem<any>[]) => any;
1675
+ "update:modelValue": (value: SelectItem<any>[]) => any;
1676
+ }, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1677
+ $slots: {
1678
+ default?: (props: {
1679
+ closeFollow: () => boolean;
1680
+ stopPropagation: (delay: number) => any;
1681
+ }) => any;
1682
+ };
1683
+ });
1599
1684
  Switch: vue.DefineComponent<ReadonlyOptions & {
1600
1685
  modelValue?: boolean;
1601
1686
  }, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
@@ -1801,8 +1886,12 @@ declare const components: {
1801
1886
  nodeOptions?: TreeNodeRenderOptions;
1802
1887
  }> & Readonly<{
1803
1888
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1804
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1889
+ onSearched?: (text: string) => any;
1890
+ }>, {
1891
+ context: ITreeBaseContext<any>;
1892
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1805
1893
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1894
+ searched: (text: string) => any;
1806
1895
  }, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1807
1896
  P: {};
1808
1897
  B: {};
@@ -1816,7 +1905,10 @@ declare const components: {
1816
1905
  nodeOptions?: TreeNodeRenderOptions;
1817
1906
  }> & Readonly<{
1818
1907
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1819
- }>, {}, {}, {}, {}, {}>;
1908
+ onSearched?: (text: string) => any;
1909
+ }>, {
1910
+ context: ITreeBaseContext<any>;
1911
+ }, {}, {}, {}, {}>;
1820
1912
  __isFragment?: never;
1821
1913
  __isTeleport?: never;
1822
1914
  __isSuspense?: never;
@@ -1826,11 +1918,21 @@ declare const components: {
1826
1918
  nodeOptions?: TreeNodeRenderOptions;
1827
1919
  }> & Readonly<{
1828
1920
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1829
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1921
+ onSearched?: (text: string) => any;
1922
+ }>, {
1923
+ context: ITreeBaseContext<any>;
1924
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1830
1925
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1926
+ searched: (text: string) => any;
1831
1927
  }, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1832
1928
  $slots: {
1833
- default?: (props: any) => any;
1929
+ default?: (props: {
1930
+ node: TreeNodeModel<any>;
1931
+ parent?: TreeNodeModel<any>;
1932
+ level: number;
1933
+ click(): void;
1934
+ toggle(): void;
1935
+ }) => any;
1834
1936
  };
1835
1937
  });
1836
1938
  Input: vue.DefineComponent<ReadonlyOptions & PlaceholderOptions & TitleOptions & {
@@ -1895,5 +1997,5 @@ declare const components: {
1895
1997
  });
1896
1998
  };
1897
1999
 
1898
- export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive };
1899
- export type { ButtonOptions, ChooseEvents, ChooseItem, ChooseOptions, ComponentMountOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, DialogHandle, DialogOptions, DisabledOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, FoldEvents, FoldOptions, FoldStatus, FollowElectResult, FollowExtend, FollowHandle, FollowOptions, FollowStrategy, FollowStrategyOptions, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IPopupManager, IReactiveManager, ISelectContext, IconOptions, IconType, InputEvents, InputOptions, LoadingOptions, MessageOptions, PlaceholderOptions, PopupDescriptor, PopupHandle, PopupOptions, PopupStatus, PopupStatusOptions, ReactiveVar, ReadonlyOptions, ScrollEvents, ScrollOptions, ScrollTouchType, SearchEvents, SearchOptions, SelectBaseEvents, SelectBaseOptions, SelectEvents, SelectItem, SelectNodeEvents, SelectNodeOptions, SelectOptions, SelectPopupExtend, SelectPopupOptions, SortEvents, SortOptions, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, TitleOptions, ToastOptions, TreeEvents, TreeNodeEvents, TreeNodeModel, TreeNodeOptions, TreeNodeRenderOptions, TreeNodeSoltOptions, TreeOptions };
2000
+ export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
2001
+ export type { ButtonOptions, ChooseEvents, ChooseItem, ChooseOptions, ComponentMountOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, DialogHandle, DialogOptions, DisabledOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, FoldEvents, FoldOptions, FoldStatus, FollowElectResult, FollowExtend, FollowHandle, FollowOptions, FollowStrategy, FollowStrategyOptions, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IPopupManager, IReactiveManager, ISelectContext, ITreeBaseContext, IconOptions, IconType, InputEvents, InputOptions, LoadingOptions, MessageOptions, PlaceholderOptions, PopupDescriptor, PopupHandle, PopupOptions, PopupStatus, PopupStatusOptions, ReactiveVar, ReadonlyOptions, ScrollEvents, ScrollOptions, ScrollTouchType, SearchEvents, SearchOptions, SelectBaseEvents, SelectBaseOptions, SelectEvents, SelectItem, SelectNodeEvents, SelectNodeOptions, SelectOptions, SelectPopupExtend, SelectPopupOptions, SelectSlotOptions, SortEvents, SortOptions, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, TitleOptions, ToastOptions, TreeEvents, TreeNode, TreeNodeEvents, TreeNodeExtend, TreeNodeModel, TreeNodeOptions, TreeNodeRenderOptions, TreeNodeSlotOptions, TreeOptions, TreeSearchResult };
package/dist/snail.vue.js CHANGED
@@ -1205,25 +1205,25 @@ var _sfc_main$d = defineComponent({
1205
1205
  emit: __emit
1206
1206
  } = _ref;
1207
1207
  const emits = __emit;
1208
- const show = computed(() => __props.context.canShow(__props.item));
1209
- const children = __props.showChildren == true && __props.item.type == "group" ? computed(() => (__props.item.children || []).filter(__props.context.canShow)) : [];
1210
- const selectNodDom = useTemplateRef("select-node");
1208
+ const rootDom = useTemplateRef("select-node");
1209
+ const selectedRef = computed(() => __props.context.selected(__props.multiple, __props.item));
1210
+ const showRef = computed(() => __props.context.isShow(__props.item, true));
1211
+ const showChildrenRef = __props.showChildren == true && __props.item.type == "group" ? computed(() => (__props.item.children || []).filter(item => __props.context.isShow(item, true))) : [];
1211
1212
  const classRef = computed(() => ({
1212
1213
  child: __props.showChildren != true,
1213
1214
  clickable: __props.item.clickable,
1214
1215
  group: __props.item.type == "group",
1215
1216
  item: __props.item.type != "group",
1216
- selected: selected.value
1217
+ selected: selectedRef.value
1217
1218
  }));
1218
- const selected = computed(() => __props.context.selected(__props.multiple, __props.item));
1219
1219
  return (_ctx, _cache) => {
1220
1220
  const _component_SelectNode = resolveComponent("SelectNode", true);
1221
- return openBlock(), createElementBlock(Fragment, null, [show.value ? (openBlock(), createElementBlock("div", {
1221
+ return openBlock(), createElementBlock(Fragment, null, [showRef.value ? (openBlock(), createElementBlock("div", {
1222
1222
  key: 0,
1223
1223
  class: normalizeClass(["select-node", classRef.value]),
1224
1224
  title: _ctx.item.text,
1225
1225
  ref: "select-node",
1226
- onMouseenter: _cache[0] || (_cache[0] = $event => emits("enter", selectNodDom.value, _ctx.item)),
1226
+ onMouseenter: _cache[0] || (_cache[0] = $event => emits("enter", rootDom.value, _ctx.item)),
1227
1227
  onClick: _cache[1] || (_cache[1] = () => emits("click", _ctx.item))
1228
1228
  }, [createElementVNode("div", {
1229
1229
  class: "item-text",
@@ -1232,9 +1232,9 @@ var _sfc_main$d = defineComponent({
1232
1232
  key: 0,
1233
1233
  type: "arrow",
1234
1234
  color: "#8a9099"
1235
- })) : createCommentVNode("", true)], 42, _hoisted_1$7)) : createCommentVNode("", true), show.value ? (openBlock(true), createElementBlock(Fragment, {
1235
+ })) : createCommentVNode("", true)], 42, _hoisted_1$7)) : createCommentVNode("", true), showRef.value ? (openBlock(true), createElementBlock(Fragment, {
1236
1236
  key: 1
1237
- }, renderList(unref(children), child => {
1237
+ }, renderList(unref(showChildrenRef), child => {
1238
1238
  return openBlock(), createBlock(_component_SelectNode, {
1239
1239
  key: child.id || unref(newId)(),
1240
1240
  multiple: _ctx.multiple,
@@ -1285,9 +1285,6 @@ var _sfc_main$c = defineComponent({
1285
1285
  emit: __emit
1286
1286
  } = _ref;
1287
1287
  const props = __props;
1288
- const {
1289
- context
1290
- } = props;
1291
1288
  const emits = __emit;
1292
1289
  const {
1293
1290
  follow
@@ -1299,24 +1296,25 @@ var _sfc_main$c = defineComponent({
1299
1296
  watcher
1300
1297
  } = useReactive();
1301
1298
  const {
1299
+ context,
1302
1300
  popupStatus,
1303
1301
  pinned,
1304
1302
  parentPinned
1305
1303
  } = props;
1306
- const items = computed(() => (props.items || []).filter(context.canShow));
1304
+ const itemsRef = computed(() => (props.items || []).filter(item => context.isShow(item, true)));
1307
1305
  const classRef = computed(() => ({
1308
1306
  "snail-select-popup": true,
1309
1307
  "child-popup": props.level > 1,
1310
- "text-tips": items.value.length == 0,
1311
- "has-group": items.value.find(node => node.type == "group") != void 0
1308
+ "text-tips": itemsRef.value.length == 0,
1309
+ "has-group": itemsRef.value.find(node => node.type == "group") != void 0
1312
1310
  }));
1313
- const childDestroyTimer = shallowRef(void 0);
1311
+ const childDestroyTimerRef = shallowRef(void 0);
1314
1312
  var mouseStatus = "Leave";
1315
1313
  var childFollowTargetDom = void 0;
1316
1314
  var childFollowScope = void 0;
1317
1315
  function destroyChildFollow(onlyTimer) {
1318
- childDestroyTimer.value && childDestroyTimer.value.destroy();
1319
- childDestroyTimer.value = void 0;
1316
+ childDestroyTimerRef.value && childDestroyTimerRef.value.destroy();
1317
+ childDestroyTimerRef.value = void 0;
1320
1318
  if (onlyTimer != true && childFollowScope && childFollowScope.destroyed == false) {
1321
1319
  childFollowScope.destroy();
1322
1320
  childFollowScope = void 0;
@@ -1372,7 +1370,7 @@ var _sfc_main$c = defineComponent({
1372
1370
  search: void 0,
1373
1371
  level: props.level + 1,
1374
1372
  popupStyle: props.popupStyle,
1375
- childDestroyTimer,
1373
+ childDestroyTimer: childDestroyTimerRef,
1376
1374
  parentPinned: pinned
1377
1375
  })
1378
1376
  });
@@ -1402,7 +1400,7 @@ var _sfc_main$c = defineComponent({
1402
1400
  key: 0
1403
1401
  }, props.search, {
1404
1402
  onSearch
1405
- }), null, 16)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, item => {
1403
+ }), null, 16)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(itemsRef.value, item => {
1406
1404
  return openBlock(), createBlock(_sfc_main$d, {
1407
1405
  key: item.id || unref(newId)(),
1408
1406
  multiple: props.multiple,
@@ -1412,7 +1410,7 @@ var _sfc_main$c = defineComponent({
1412
1410
  onEnter: onEnterSelectNode,
1413
1411
  onClick: onClickSelectNode
1414
1412
  }, null, 8, ["multiple", "item", "context"]);
1415
- }), 128)), items.value.length == 0 ? (openBlock(), createBlock(_sfc_main$e, {
1413
+ }), 128)), itemsRef.value.length == 0 ? (openBlock(), createBlock(_sfc_main$e, {
1416
1414
  key: 1,
1417
1415
  message: "无结果"
1418
1416
  })) : createCommentVNode("", true)], 64))], 38);
@@ -1423,66 +1421,92 @@ var _sfc_main$c = defineComponent({
1423
1421
  function useTreeContext(nodes) {
1424
1422
  const scopes = useScopes();
1425
1423
  const failed = shallowRef();
1424
+ const patched = shallowRef();
1426
1425
  function doSearch(text) {
1427
1426
  text = isStringNotEmpty(text) ? text.toLowerCase() : void 0;
1428
1427
  const result = searchTree(nodes, text);
1429
1428
  failed.value = result.failed;
1429
+ patched.value = result.patched;
1430
1430
  }
1431
- function canShow(node) {
1432
- return node.hidden != true && (failed.value == void 0 || failed.value.includes(node) == false);
1431
+ function isPatched(node) {
1432
+ return patched.value ? patched.value.includes(node) : false;
1433
1433
  }
1434
- function getContext(node) {
1435
- const show = computed(() => canShow(node));
1436
- const showChildren = computed(() => node.children ? node.children.filter(canShow).length > 0 : false);
1437
- return {
1438
- show,
1439
- showChildren
1440
- };
1434
+ function isShow(node, needPatched) {
1435
+ if (node.hidden == true) {
1436
+ return false;
1437
+ }
1438
+ if (failed.value == void 0 || failed.value.includes(node) == false) {
1439
+ return true;
1440
+ }
1441
+ return needPatched == true ? isPatched(node) : false;
1442
+ }
1443
+ function isShowChildren(node, needPatched) {
1444
+ return node.children ? node.children.find(child => isShow(child, needPatched)) != void 0 : false;
1445
+ }
1446
+ function getPath(node) {
1447
+ return searchPath(nodes, node);
1441
1448
  }
1442
1449
  const context = mountScope({
1443
1450
  doSearch,
1444
- canShow,
1445
- getContext
1451
+ isPatched,
1452
+ isShow,
1453
+ isShowChildren,
1454
+ getPath
1446
1455
  });
1447
1456
  context.onDestroy(() => {
1448
1457
  scopes.destroy();
1449
1458
  failed.value = void 0;
1459
+ patched.value = void 0;
1450
1460
  });
1451
1461
  return Object.freeze(context);
1452
1462
  }
1453
1463
  function searchTree(nodes, text) {
1454
1464
  const result = Object.freeze({
1455
1465
  matched: [],
1456
- failed: []
1466
+ failed: [],
1467
+ patched: []
1457
1468
  });
1458
1469
  for (const node of nodes || []) {
1459
- var matched = false;
1470
+ const matched = node.fixed == true || text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1471
+ matched ? result.matched.push(node) : result.failed.push(node);
1472
+ var childMatched = false;
1460
1473
  if (hasAny(node.children) == true) {
1461
1474
  const childResult = searchTree(node.children, text);
1462
1475
  result.matched.push(...childResult.matched);
1463
1476
  result.failed.push(...childResult.failed);
1464
- matched = childResult.matched.length > 0;
1477
+ result.patched.push(...childResult.patched);
1478
+ childMatched = childResult.matched.length > 0 || childResult.patched.length > 0;
1465
1479
  }
1466
- matched = matched || node.fixed == true;
1467
- if (matched == false && node.searchable == true) {
1468
- matched = text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1469
- }
1470
- matched ? result.matched.push(node) : result.failed.push(node);
1480
+ childMatched && matched == false && result.patched.push(node);
1471
1481
  }
1472
1482
  return result;
1473
1483
  }
1484
+ function searchPath(nodes, target) {
1485
+ for (const node of nodes || []) {
1486
+ if (target === node) {
1487
+ return [node];
1488
+ }
1489
+ }
1490
+ for (const node of nodes || []) {
1491
+ const childPath = searchPath(node.children, target);
1492
+ if (childPath.length > 0) {
1493
+ return [node, ...childPath];
1494
+ }
1495
+ }
1496
+ return [];
1497
+ }
1474
1498
 
1475
- function useSelectContext(items, selects) {
1499
+ function useSelectContext(items, selectsRef) {
1476
1500
  const treeContxt = useTreeContext(items);
1477
1501
  function selected(multiple, item) {
1478
- if (selects.value) {
1479
- return multiple == true ? selects.value.includes(item) : selects.value[selects.value.length - 1] == item;
1502
+ if (selectsRef.value) {
1503
+ return multiple == true ? selectsRef.value.includes(item) : selectsRef.value[selectsRef.value.length - 1] == item;
1480
1504
  }
1481
1505
  return false;
1482
1506
  }
1483
1507
  function selectedText(multiple, showPath) {
1484
- if (selects.value) {
1485
- return multiple == true || showPath == true ? selects.value.map(item => item.text).join(multiple ? "、" : " / ") : selects.value[selects.value.length - 1].text;
1508
+ if (selectsRef.value) {
1509
+ return multiple == true || showPath == true ? selectsRef.value.map(item => item.text).join(multiple ? "、" : " / ") : selectsRef.value[selectsRef.value.length - 1].text;
1486
1510
  }
1487
1511
  return "";
1488
1512
  }
@@ -1493,8 +1517,11 @@ function useSelectContext(items, selects) {
1493
1517
  });
1494
1518
  }
1495
1519
 
1496
- const _hoisted_1$6 = ["textContent"];
1497
- const _hoisted_2$3 = ["title"];
1520
+ const _hoisted_1$6 = {
1521
+ key: 0,
1522
+ class: "select-result"
1523
+ };
1524
+ const _hoisted_2$3 = ["title", "textContent"];
1498
1525
  const _hoisted_3$3 = ["textContent"];
1499
1526
  const _hoisted_4$3 = {
1500
1527
  key: 1,
@@ -1540,18 +1567,35 @@ var _sfc_main$b = defineComponent({
1540
1567
  const {
1541
1568
  follow
1542
1569
  } = usePopup();
1543
- const selects = shallowRef([...valuesModel.value]);
1544
- const context = useSelectContext(props.items, selects);
1570
+ const {
1571
+ onTimeout
1572
+ } = useTimer();
1545
1573
  const rootDom = useTemplateRef("select");
1546
- const selectText = computed(() => context.selectedText(props.multiple, props.showPath));
1574
+ const context = useSelectContext(props.items, valuesModel);
1575
+ const selectTextRef = computed(() => context.selectedText(props.multiple, props.showPath));
1576
+ const slotOptions = Object.freeze({
1577
+ closeFollow,
1578
+ stopPropagation
1579
+ });
1547
1580
  var followScope = void 0;
1581
+ var stopPropagationScope = void 0;
1582
+ function closeFollow() {
1583
+ if (followScope != void 0) {
1584
+ followScope.destroy();
1585
+ followScope = void 0;
1586
+ return true;
1587
+ }
1588
+ return false;
1589
+ }
1590
+ function stopPropagation(delay) {
1591
+ stopPropagationScope && stopPropagationScope.destroy();
1592
+ stopPropagationScope = onTimeout(() => stopPropagationScope = void 0, delay);
1593
+ }
1548
1594
  async function onClick() {
1549
1595
  if (props.readonly == true || rootDom.value == void 0) {
1550
1596
  return;
1551
1597
  }
1552
- if (followScope != void 0) {
1553
- followScope.destroy();
1554
- followScope = void 0;
1598
+ if (closeFollow() == true || stopPropagationScope != void 0) {
1555
1599
  return;
1556
1600
  }
1557
1601
  const values = valuesModel.value && valuesModel.value.length > 0 ? [...valuesModel.value] : [];
@@ -1582,7 +1626,6 @@ var _sfc_main$b = defineComponent({
1582
1626
  }
1583
1627
  function onSelectItemChange(items) {
1584
1628
  items = hasAny(items) ? [...items] : [];
1585
- selects.value = items;
1586
1629
  valuesModel.value = items;
1587
1630
  emits("change", items);
1588
1631
  }
@@ -1593,20 +1636,17 @@ var _sfc_main$b = defineComponent({
1593
1636
  }]),
1594
1637
  onClick: _cache[0] || (_cache[0] = $event => onClick()),
1595
1638
  ref: "select"
1596
- }, [props.items && props.items.length > 0 ? (openBlock(), createElementBlock(Fragment, {
1639
+ }, [unref(hasAny)(props.items) == true ? (openBlock(), createElementBlock(Fragment, {
1597
1640
  key: 0
1598
- }, [unref(isArrayNotEmpty)(selects.value) == false ? (openBlock(), createElementBlock("div", {
1599
- key: 0,
1641
+ }, [unref(hasAny)(valuesModel.value) ? (openBlock(), createElementBlock("div", _hoisted_1$6, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotOptions))), () => [createElementVNode("div", {
1642
+ class: "select-text",
1643
+ title: selectTextRef.value,
1644
+ textContent: toDisplayString(selectTextRef.value)
1645
+ }, null, 8, _hoisted_2$3)])])) : (openBlock(), createElementBlock("div", {
1646
+ key: 1,
1600
1647
  class: "select-result text-tips",
1601
1648
  textContent: toDisplayString(props.placeholder || "请选择")
1602
- }, null, 8, _hoisted_1$6)) : (openBlock(), createElementBlock("div", {
1603
- key: 1,
1604
- class: "select-result",
1605
- title: selectText.value
1606
- }, [createElementVNode("div", {
1607
- class: "select-text",
1608
- textContent: toDisplayString(selectText.value)
1609
- }, null, 8, _hoisted_3$3)], 8, _hoisted_2$3)), createVNode(_sfc_main$o, {
1649
+ }, null, 8, _hoisted_3$3)), createVNode(_sfc_main$o, {
1610
1650
  type: "arrow",
1611
1651
  size: 24,
1612
1652
  color: "#8a9099",
@@ -2020,10 +2060,13 @@ var _sfc_main$3 = defineComponent({
2020
2060
  const {
2021
2061
  transition
2022
2062
  } = useAnimation();
2023
- const {
2024
- show,
2025
- showChildren
2026
- } = __props.context.getContext(__props.node);
2063
+ const showRef = computed(() => __props.context.isShow(__props.node, true));
2064
+ const showChildrenRef = computed(() => __props.context.isShowChildren(__props.node, true));
2065
+ const classRef = computed(() => {
2066
+ const array = [`level-${__props.level}`];
2067
+ __props.node.clickable && array.push("clickable");
2068
+ return array;
2069
+ });
2027
2070
  const slotOptions = Object.freeze({
2028
2071
  node: __props.node,
2029
2072
  parent: __props.parent,
@@ -2071,16 +2114,16 @@ var _sfc_main$3 = defineComponent({
2071
2114
  }
2072
2115
  return (_ctx, _cache) => {
2073
2116
  const _component_TreeNode = resolveComponent("TreeNode", true);
2074
- return openBlock(), createElementBlock(Fragment, null, [unref(show) ? (openBlock(), createElementBlock("div", {
2117
+ return openBlock(), createElementBlock(Fragment, null, [showRef.value ? (openBlock(), createElementBlock("div", {
2075
2118
  key: 0,
2076
- class: normalizeClass(["snail-tree-node", [`level-${_ctx.level}`, _ctx.node.clickable ? "clickable" : ""]])
2119
+ class: normalizeClass(["snail-tree-node", classRef.value])
2077
2120
  }, [_ctx.options.rewrite == true ? renderSlot(_ctx.$slots, "default", normalizeProps(mergeProps({
2078
2121
  key: 0
2079
2122
  }, unref(slotOptions)))) : (openBlock(), createElementBlock(Fragment, {
2080
2123
  key: 1
2081
2124
  }, [_cache[2] || (_cache[2] = createElementVNode("div", {
2082
2125
  class: "indent"
2083
- }, null, -1)), _ctx.options.foldDisabled != true ? (openBlock(), createElementBlock("div", _hoisted_1$3, [unref(showChildren) ? (openBlock(), createBlock(_sfc_main$o, {
2126
+ }, null, -1)), _ctx.options.foldDisabled != true ? (openBlock(), createElementBlock("div", _hoisted_1$3, [showChildrenRef.value ? (openBlock(), createBlock(_sfc_main$o, {
2084
2127
  key: 0,
2085
2128
  class: normalizeClass(statusRef.value),
2086
2129
  type: "custom",
@@ -2093,7 +2136,7 @@ var _sfc_main$3 = defineComponent({
2093
2136
  title: _ctx.node.text,
2094
2137
  textContent: toDisplayString(_ctx.node.text),
2095
2138
  onClick: _cache[0] || (_cache[0] = $event => onNodeClick(_ctx.node))
2096
- }, null, 8, _hoisted_2$1), createElementVNode("div", _hoisted_3$1, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotOptions))))])], 64))], 2)) : createCommentVNode("", true), unref(show) && unref(showChildren) ? (openBlock(), createElementBlock("div", _hoisted_4$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.children, child => {
2139
+ }, null, 8, _hoisted_2$1), createElementVNode("div", _hoisted_3$1, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotOptions))))])], 64))], 2)) : createCommentVNode("", true), showRef.value && showChildrenRef.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.node.children, child => {
2097
2140
  return openBlock(), createBlock(_component_TreeNode, {
2098
2141
  key: child.id || unref(newId)(),
2099
2142
  node: child,
@@ -2127,21 +2170,28 @@ var _sfc_main$2 = defineComponent({
2127
2170
  search: {},
2128
2171
  nodeOptions: {}
2129
2172
  },
2130
- emits: ["click"],
2173
+ emits: ["click", "searched"],
2131
2174
  setup(__props, _ref) {
2132
2175
  let {
2176
+ expose: __expose,
2133
2177
  emit: __emit
2134
2178
  } = _ref;
2135
2179
  const props = __props;
2136
2180
  const emits = __emit;
2137
2181
  const context = useTreeContext(props.nodes);
2138
- shallowRef([]);
2182
+ __expose({
2183
+ context
2184
+ });
2185
+ function onSearch(text) {
2186
+ context.doSearch(text);
2187
+ emits("searched", text);
2188
+ }
2139
2189
  return (_ctx, _cache) => {
2140
2190
  return openBlock(), createElementBlock("div", _hoisted_1$2, [props.search ? (openBlock(), createBlock(_sfc_main$m, mergeProps({
2141
2191
  key: 0
2142
2192
  }, props.search, {
2143
- onSearch: unref(context).doSearch
2144
- }), null, 16, ["onSearch"])) : createCommentVNode("", true), createVNode(_sfc_main$8, {
2193
+ onSearch
2194
+ }), null, 16)) : createCommentVNode("", true), createVNode(_sfc_main$8, {
2145
2195
  "scroll-y": true
2146
2196
  }, {
2147
2197
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.nodes || [], node => {
@@ -2394,4 +2444,4 @@ const components = {
2394
2444
 
2395
2445
  onMountScope(scope => getCurrentScope() && onScopeDispose(scope.destroy));
2396
2446
 
2397
- export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive };
2447
+ export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
@@ -1207,25 +1207,25 @@
1207
1207
  emit: __emit
1208
1208
  } = _ref;
1209
1209
  const emits = __emit;
1210
- const show = vue.computed(() => __props.context.canShow(__props.item));
1211
- const children = __props.showChildren == true && __props.item.type == "group" ? vue.computed(() => (__props.item.children || []).filter(__props.context.canShow)) : [];
1212
- const selectNodDom = vue.useTemplateRef("select-node");
1210
+ const rootDom = vue.useTemplateRef("select-node");
1211
+ const selectedRef = vue.computed(() => __props.context.selected(__props.multiple, __props.item));
1212
+ const showRef = vue.computed(() => __props.context.isShow(__props.item, true));
1213
+ const showChildrenRef = __props.showChildren == true && __props.item.type == "group" ? vue.computed(() => (__props.item.children || []).filter(item => __props.context.isShow(item, true))) : [];
1213
1214
  const classRef = vue.computed(() => ({
1214
1215
  child: __props.showChildren != true,
1215
1216
  clickable: __props.item.clickable,
1216
1217
  group: __props.item.type == "group",
1217
1218
  item: __props.item.type != "group",
1218
- selected: selected.value
1219
+ selected: selectedRef.value
1219
1220
  }));
1220
- const selected = vue.computed(() => __props.context.selected(__props.multiple, __props.item));
1221
1221
  return (_ctx, _cache) => {
1222
1222
  const _component_SelectNode = vue.resolveComponent("SelectNode", true);
1223
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [show.value ? (vue.openBlock(), vue.createElementBlock("div", {
1223
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [showRef.value ? (vue.openBlock(), vue.createElementBlock("div", {
1224
1224
  key: 0,
1225
1225
  class: vue.normalizeClass(["select-node", classRef.value]),
1226
1226
  title: _ctx.item.text,
1227
1227
  ref: "select-node",
1228
- onMouseenter: _cache[0] || (_cache[0] = $event => emits("enter", selectNodDom.value, _ctx.item)),
1228
+ onMouseenter: _cache[0] || (_cache[0] = $event => emits("enter", rootDom.value, _ctx.item)),
1229
1229
  onClick: _cache[1] || (_cache[1] = () => emits("click", _ctx.item))
1230
1230
  }, [vue.createElementVNode("div", {
1231
1231
  class: "item-text",
@@ -1234,9 +1234,9 @@
1234
1234
  key: 0,
1235
1235
  type: "arrow",
1236
1236
  color: "#8a9099"
1237
- })) : vue.createCommentVNode("", true)], 42, _hoisted_1$7)) : vue.createCommentVNode("", true), show.value ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
1237
+ })) : vue.createCommentVNode("", true)], 42, _hoisted_1$7)) : vue.createCommentVNode("", true), showRef.value ? (vue.openBlock(true), vue.createElementBlock(vue.Fragment, {
1238
1238
  key: 1
1239
- }, vue.renderList(vue.unref(children), child => {
1239
+ }, vue.renderList(vue.unref(showChildrenRef), child => {
1240
1240
  return vue.openBlock(), vue.createBlock(_component_SelectNode, {
1241
1241
  key: child.id || vue.unref(snail_core.newId)(),
1242
1242
  multiple: _ctx.multiple,
@@ -1287,9 +1287,6 @@
1287
1287
  emit: __emit
1288
1288
  } = _ref;
1289
1289
  const props = __props;
1290
- const {
1291
- context
1292
- } = props;
1293
1290
  const emits = __emit;
1294
1291
  const {
1295
1292
  follow
@@ -1301,24 +1298,25 @@
1301
1298
  watcher
1302
1299
  } = useReactive();
1303
1300
  const {
1301
+ context,
1304
1302
  popupStatus,
1305
1303
  pinned,
1306
1304
  parentPinned
1307
1305
  } = props;
1308
- const items = vue.computed(() => (props.items || []).filter(context.canShow));
1306
+ const itemsRef = vue.computed(() => (props.items || []).filter(item => context.isShow(item, true)));
1309
1307
  const classRef = vue.computed(() => ({
1310
1308
  "snail-select-popup": true,
1311
1309
  "child-popup": props.level > 1,
1312
- "text-tips": items.value.length == 0,
1313
- "has-group": items.value.find(node => node.type == "group") != void 0
1310
+ "text-tips": itemsRef.value.length == 0,
1311
+ "has-group": itemsRef.value.find(node => node.type == "group") != void 0
1314
1312
  }));
1315
- const childDestroyTimer = vue.shallowRef(void 0);
1313
+ const childDestroyTimerRef = vue.shallowRef(void 0);
1316
1314
  var mouseStatus = "Leave";
1317
1315
  var childFollowTargetDom = void 0;
1318
1316
  var childFollowScope = void 0;
1319
1317
  function destroyChildFollow(onlyTimer) {
1320
- childDestroyTimer.value && childDestroyTimer.value.destroy();
1321
- childDestroyTimer.value = void 0;
1318
+ childDestroyTimerRef.value && childDestroyTimerRef.value.destroy();
1319
+ childDestroyTimerRef.value = void 0;
1322
1320
  if (onlyTimer != true && childFollowScope && childFollowScope.destroyed == false) {
1323
1321
  childFollowScope.destroy();
1324
1322
  childFollowScope = void 0;
@@ -1374,7 +1372,7 @@
1374
1372
  search: void 0,
1375
1373
  level: props.level + 1,
1376
1374
  popupStyle: props.popupStyle,
1377
- childDestroyTimer,
1375
+ childDestroyTimer: childDestroyTimerRef,
1378
1376
  parentPinned: pinned
1379
1377
  })
1380
1378
  });
@@ -1404,7 +1402,7 @@
1404
1402
  key: 0
1405
1403
  }, props.search, {
1406
1404
  onSearch
1407
- }), null, 16)) : vue.createCommentVNode("", true), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(items.value, item => {
1405
+ }), null, 16)) : vue.createCommentVNode("", true), (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(itemsRef.value, item => {
1408
1406
  return vue.openBlock(), vue.createBlock(_sfc_main$d, {
1409
1407
  key: item.id || vue.unref(snail_core.newId)(),
1410
1408
  multiple: props.multiple,
@@ -1414,7 +1412,7 @@
1414
1412
  onEnter: onEnterSelectNode,
1415
1413
  onClick: onClickSelectNode
1416
1414
  }, null, 8, ["multiple", "item", "context"]);
1417
- }), 128)), items.value.length == 0 ? (vue.openBlock(), vue.createBlock(_sfc_main$e, {
1415
+ }), 128)), itemsRef.value.length == 0 ? (vue.openBlock(), vue.createBlock(_sfc_main$e, {
1418
1416
  key: 1,
1419
1417
  message: "无结果"
1420
1418
  })) : vue.createCommentVNode("", true)], 64))], 38);
@@ -1425,66 +1423,92 @@
1425
1423
  function useTreeContext(nodes) {
1426
1424
  const scopes = snail_core.useScopes();
1427
1425
  const failed = vue.shallowRef();
1426
+ const patched = vue.shallowRef();
1428
1427
  function doSearch(text) {
1429
1428
  text = snail_core.isStringNotEmpty(text) ? text.toLowerCase() : void 0;
1430
1429
  const result = searchTree(nodes, text);
1431
1430
  failed.value = result.failed;
1431
+ patched.value = result.patched;
1432
1432
  }
1433
- function canShow(node) {
1434
- return node.hidden != true && (failed.value == void 0 || failed.value.includes(node) == false);
1433
+ function isPatched(node) {
1434
+ return patched.value ? patched.value.includes(node) : false;
1435
1435
  }
1436
- function getContext(node) {
1437
- const show = vue.computed(() => canShow(node));
1438
- const showChildren = vue.computed(() => node.children ? node.children.filter(canShow).length > 0 : false);
1439
- return {
1440
- show,
1441
- showChildren
1442
- };
1436
+ function isShow(node, needPatched) {
1437
+ if (node.hidden == true) {
1438
+ return false;
1439
+ }
1440
+ if (failed.value == void 0 || failed.value.includes(node) == false) {
1441
+ return true;
1442
+ }
1443
+ return needPatched == true ? isPatched(node) : false;
1444
+ }
1445
+ function isShowChildren(node, needPatched) {
1446
+ return node.children ? node.children.find(child => isShow(child, needPatched)) != void 0 : false;
1447
+ }
1448
+ function getPath(node) {
1449
+ return searchPath(nodes, node);
1443
1450
  }
1444
1451
  const context = snail_core.mountScope({
1445
1452
  doSearch,
1446
- canShow,
1447
- getContext
1453
+ isPatched,
1454
+ isShow,
1455
+ isShowChildren,
1456
+ getPath
1448
1457
  });
1449
1458
  context.onDestroy(() => {
1450
1459
  scopes.destroy();
1451
1460
  failed.value = void 0;
1461
+ patched.value = void 0;
1452
1462
  });
1453
1463
  return Object.freeze(context);
1454
1464
  }
1455
1465
  function searchTree(nodes, text) {
1456
1466
  const result = Object.freeze({
1457
1467
  matched: [],
1458
- failed: []
1468
+ failed: [],
1469
+ patched: []
1459
1470
  });
1460
1471
  for (const node of nodes || []) {
1461
- var matched = false;
1472
+ const matched = node.fixed == true || text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1473
+ matched ? result.matched.push(node) : result.failed.push(node);
1474
+ var childMatched = false;
1462
1475
  if (snail_core.hasAny(node.children) == true) {
1463
1476
  const childResult = searchTree(node.children, text);
1464
1477
  result.matched.push(...childResult.matched);
1465
1478
  result.failed.push(...childResult.failed);
1466
- matched = childResult.matched.length > 0;
1479
+ result.patched.push(...childResult.patched);
1480
+ childMatched = childResult.matched.length > 0 || childResult.patched.length > 0;
1467
1481
  }
1468
- matched = matched || node.fixed == true;
1469
- if (matched == false && node.searchable == true) {
1470
- matched = text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1471
- }
1472
- matched ? result.matched.push(node) : result.failed.push(node);
1482
+ childMatched && matched == false && result.patched.push(node);
1473
1483
  }
1474
1484
  return result;
1475
1485
  }
1486
+ function searchPath(nodes, target) {
1487
+ for (const node of nodes || []) {
1488
+ if (target === node) {
1489
+ return [node];
1490
+ }
1491
+ }
1492
+ for (const node of nodes || []) {
1493
+ const childPath = searchPath(node.children, target);
1494
+ if (childPath.length > 0) {
1495
+ return [node, ...childPath];
1496
+ }
1497
+ }
1498
+ return [];
1499
+ }
1476
1500
 
1477
- function useSelectContext(items, selects) {
1501
+ function useSelectContext(items, selectsRef) {
1478
1502
  const treeContxt = useTreeContext(items);
1479
1503
  function selected(multiple, item) {
1480
- if (selects.value) {
1481
- return multiple == true ? selects.value.includes(item) : selects.value[selects.value.length - 1] == item;
1504
+ if (selectsRef.value) {
1505
+ return multiple == true ? selectsRef.value.includes(item) : selectsRef.value[selectsRef.value.length - 1] == item;
1482
1506
  }
1483
1507
  return false;
1484
1508
  }
1485
1509
  function selectedText(multiple, showPath) {
1486
- if (selects.value) {
1487
- return multiple == true || showPath == true ? selects.value.map(item => item.text).join(multiple ? "、" : " / ") : selects.value[selects.value.length - 1].text;
1510
+ if (selectsRef.value) {
1511
+ return multiple == true || showPath == true ? selectsRef.value.map(item => item.text).join(multiple ? "、" : " / ") : selectsRef.value[selectsRef.value.length - 1].text;
1488
1512
  }
1489
1513
  return "";
1490
1514
  }
@@ -1495,8 +1519,11 @@
1495
1519
  });
1496
1520
  }
1497
1521
 
1498
- const _hoisted_1$6 = ["textContent"];
1499
- const _hoisted_2$3 = ["title"];
1522
+ const _hoisted_1$6 = {
1523
+ key: 0,
1524
+ class: "select-result"
1525
+ };
1526
+ const _hoisted_2$3 = ["title", "textContent"];
1500
1527
  const _hoisted_3$3 = ["textContent"];
1501
1528
  const _hoisted_4$3 = {
1502
1529
  key: 1,
@@ -1542,18 +1569,35 @@
1542
1569
  const {
1543
1570
  follow
1544
1571
  } = usePopup();
1545
- const selects = vue.shallowRef([...valuesModel.value]);
1546
- const context = useSelectContext(props.items, selects);
1572
+ const {
1573
+ onTimeout
1574
+ } = snail_core.useTimer();
1547
1575
  const rootDom = vue.useTemplateRef("select");
1548
- const selectText = vue.computed(() => context.selectedText(props.multiple, props.showPath));
1576
+ const context = useSelectContext(props.items, valuesModel);
1577
+ const selectTextRef = vue.computed(() => context.selectedText(props.multiple, props.showPath));
1578
+ const slotOptions = Object.freeze({
1579
+ closeFollow,
1580
+ stopPropagation
1581
+ });
1549
1582
  var followScope = void 0;
1583
+ var stopPropagationScope = void 0;
1584
+ function closeFollow() {
1585
+ if (followScope != void 0) {
1586
+ followScope.destroy();
1587
+ followScope = void 0;
1588
+ return true;
1589
+ }
1590
+ return false;
1591
+ }
1592
+ function stopPropagation(delay) {
1593
+ stopPropagationScope && stopPropagationScope.destroy();
1594
+ stopPropagationScope = onTimeout(() => stopPropagationScope = void 0, delay);
1595
+ }
1550
1596
  async function onClick() {
1551
1597
  if (props.readonly == true || rootDom.value == void 0) {
1552
1598
  return;
1553
1599
  }
1554
- if (followScope != void 0) {
1555
- followScope.destroy();
1556
- followScope = void 0;
1600
+ if (closeFollow() == true || stopPropagationScope != void 0) {
1557
1601
  return;
1558
1602
  }
1559
1603
  const values = valuesModel.value && valuesModel.value.length > 0 ? [...valuesModel.value] : [];
@@ -1584,7 +1628,6 @@
1584
1628
  }
1585
1629
  function onSelectItemChange(items) {
1586
1630
  items = snail_core.hasAny(items) ? [...items] : [];
1587
- selects.value = items;
1588
1631
  valuesModel.value = items;
1589
1632
  emits("change", items);
1590
1633
  }
@@ -1595,20 +1638,17 @@
1595
1638
  }]),
1596
1639
  onClick: _cache[0] || (_cache[0] = $event => onClick()),
1597
1640
  ref: "select"
1598
- }, [props.items && props.items.length > 0 ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
1641
+ }, [vue.unref(snail_core.hasAny)(props.items) == true ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
1599
1642
  key: 0
1600
- }, [vue.unref(snail_core.isArrayNotEmpty)(selects.value) == false ? (vue.openBlock(), vue.createElementBlock("div", {
1601
- key: 0,
1643
+ }, [vue.unref(snail_core.hasAny)(valuesModel.value) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$6, [vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(vue.unref(slotOptions))), () => [vue.createElementVNode("div", {
1644
+ class: "select-text",
1645
+ title: selectTextRef.value,
1646
+ textContent: vue.toDisplayString(selectTextRef.value)
1647
+ }, null, 8, _hoisted_2$3)])])) : (vue.openBlock(), vue.createElementBlock("div", {
1648
+ key: 1,
1602
1649
  class: "select-result text-tips",
1603
1650
  textContent: vue.toDisplayString(props.placeholder || "请选择")
1604
- }, null, 8, _hoisted_1$6)) : (vue.openBlock(), vue.createElementBlock("div", {
1605
- key: 1,
1606
- class: "select-result",
1607
- title: selectText.value
1608
- }, [vue.createElementVNode("div", {
1609
- class: "select-text",
1610
- textContent: vue.toDisplayString(selectText.value)
1611
- }, null, 8, _hoisted_3$3)], 8, _hoisted_2$3)), vue.createVNode(_sfc_main$o, {
1651
+ }, null, 8, _hoisted_3$3)), vue.createVNode(_sfc_main$o, {
1612
1652
  type: "arrow",
1613
1653
  size: 24,
1614
1654
  color: "#8a9099",
@@ -2022,10 +2062,13 @@
2022
2062
  const {
2023
2063
  transition
2024
2064
  } = snail_view.useAnimation();
2025
- const {
2026
- show,
2027
- showChildren
2028
- } = __props.context.getContext(__props.node);
2065
+ const showRef = vue.computed(() => __props.context.isShow(__props.node, true));
2066
+ const showChildrenRef = vue.computed(() => __props.context.isShowChildren(__props.node, true));
2067
+ const classRef = vue.computed(() => {
2068
+ const array = [`level-${__props.level}`];
2069
+ __props.node.clickable && array.push("clickable");
2070
+ return array;
2071
+ });
2029
2072
  const slotOptions = Object.freeze({
2030
2073
  node: __props.node,
2031
2074
  parent: __props.parent,
@@ -2073,16 +2116,16 @@
2073
2116
  }
2074
2117
  return (_ctx, _cache) => {
2075
2118
  const _component_TreeNode = vue.resolveComponent("TreeNode", true);
2076
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [vue.unref(show) ? (vue.openBlock(), vue.createElementBlock("div", {
2119
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [showRef.value ? (vue.openBlock(), vue.createElementBlock("div", {
2077
2120
  key: 0,
2078
- class: vue.normalizeClass(["snail-tree-node", [`level-${_ctx.level}`, _ctx.node.clickable ? "clickable" : ""]])
2121
+ class: vue.normalizeClass(["snail-tree-node", classRef.value])
2079
2122
  }, [_ctx.options.rewrite == true ? vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.mergeProps({
2080
2123
  key: 0
2081
2124
  }, vue.unref(slotOptions)))) : (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
2082
2125
  key: 1
2083
2126
  }, [_cache[2] || (_cache[2] = vue.createElementVNode("div", {
2084
2127
  class: "indent"
2085
- }, null, -1)), _ctx.options.foldDisabled != true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [vue.unref(showChildren) ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
2128
+ }, null, -1)), _ctx.options.foldDisabled != true ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$3, [showChildrenRef.value ? (vue.openBlock(), vue.createBlock(_sfc_main$o, {
2086
2129
  key: 0,
2087
2130
  class: vue.normalizeClass(statusRef.value),
2088
2131
  type: "custom",
@@ -2095,7 +2138,7 @@
2095
2138
  title: _ctx.node.text,
2096
2139
  textContent: vue.toDisplayString(_ctx.node.text),
2097
2140
  onClick: _cache[0] || (_cache[0] = $event => onNodeClick(_ctx.node))
2098
- }, null, 8, _hoisted_2$1), vue.createElementVNode("div", _hoisted_3$1, [vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(vue.unref(slotOptions))))])], 64))], 2)) : vue.createCommentVNode("", true), vue.unref(show) && vue.unref(showChildren) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.children, child => {
2141
+ }, null, 8, _hoisted_2$1), vue.createElementVNode("div", _hoisted_3$1, [vue.renderSlot(_ctx.$slots, "default", vue.normalizeProps(vue.guardReactiveProps(vue.unref(slotOptions))))])], 64))], 2)) : vue.createCommentVNode("", true), showRef.value && showChildrenRef.value ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_4$1, [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(_ctx.node.children, child => {
2099
2142
  return vue.openBlock(), vue.createBlock(_component_TreeNode, {
2100
2143
  key: child.id || vue.unref(snail_core.newId)(),
2101
2144
  node: child,
@@ -2129,21 +2172,28 @@
2129
2172
  search: {},
2130
2173
  nodeOptions: {}
2131
2174
  },
2132
- emits: ["click"],
2175
+ emits: ["click", "searched"],
2133
2176
  setup(__props, _ref) {
2134
2177
  let {
2178
+ expose: __expose,
2135
2179
  emit: __emit
2136
2180
  } = _ref;
2137
2181
  const props = __props;
2138
2182
  const emits = __emit;
2139
2183
  const context = useTreeContext(props.nodes);
2140
- vue.shallowRef([]);
2184
+ __expose({
2185
+ context
2186
+ });
2187
+ function onSearch(text) {
2188
+ context.doSearch(text);
2189
+ emits("searched", text);
2190
+ }
2141
2191
  return (_ctx, _cache) => {
2142
2192
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [props.search ? (vue.openBlock(), vue.createBlock(_sfc_main$m, vue.mergeProps({
2143
2193
  key: 0
2144
2194
  }, props.search, {
2145
- onSearch: vue.unref(context).doSearch
2146
- }), null, 16, ["onSearch"])) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$8, {
2195
+ onSearch
2196
+ }), null, 16)) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$8, {
2147
2197
  "scroll-y": true
2148
2198
  }, {
2149
2199
  default: vue.withCtx(() => [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.nodes || [], node => {
@@ -2403,5 +2453,6 @@
2403
2453
  exports.triggerAppCreated = triggerAppCreated;
2404
2454
  exports.usePopup = usePopup;
2405
2455
  exports.useReactive = useReactive;
2456
+ exports.useTreeContext = useTreeContext;
2406
2457
 
2407
2458
  }));
@@ -1 +1 @@
1
- .snail-app{font-family:"Microsoft YaHei","微软雅黑","Hiragino Sans GB","tahoma","arial","simsun","宋体","sans-serif"}.snail-app,.snail-app *{box-sizing:border-box!important}.snail-app div,.snail-app span{font-size:14px}.snail-app input[type=email],.snail-app input[type=number],.snail-app input[type=password],.snail-app input[type=search],.snail-app input[type=text],.snail-app input[type=url]{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border:1px solid #dddfed;border-radius:4px;color:#2e3033;font:inherit;font-size:14px;font-weight:400;margin:0;min-width:10px;outline:0!important;padding:0 10px;text-overflow:ellipsis}.snail-app input[type=email]::-webkit-search-cancel-button,.snail-app input[type=number]::-webkit-search-cancel-button,.snail-app input[type=password]::-webkit-search-cancel-button,.snail-app input[type=search]::-webkit-search-cancel-button,.snail-app input[type=text]::-webkit-search-cancel-button,.snail-app input[type=url]::-webkit-search-cancel-button{display:none}.snail-app input[type=email]:focus,.snail-app input[type=number]:focus,.snail-app input[type=password]:focus,.snail-app input[type=search]:focus,.snail-app input[type=text]:focus,.snail-app input[type=url]:focus{border:1px solid #3292ea}.snail-app input[type=email]:-moz-read-only:focus,.snail-app input[type=number]:-moz-read-only:focus,.snail-app input[type=password]:-moz-read-only:focus,.snail-app input[type=search]:-moz-read-only:focus,.snail-app input[type=text]:-moz-read-only:focus,.snail-app input[type=url]:-moz-read-only:focus{border:1px solid #dddfed}.snail-app input[type=email]:read-only:focus,.snail-app input[type=number]:read-only:focus,.snail-app input[type=password]:read-only:focus,.snail-app input[type=search]:read-only:focus,.snail-app input[type=text]:read-only:focus,.snail-app input[type=url]:read-only:focus{border:1px solid #dddfed}.snail-app input[type=checkbox],.snail-app input[type=radio]{margin:0;padding:0}.snail-app ::-webkit-scrollbar{background-color:transparent;border-radius:12px;height:10px;width:10px}.snail-app ::-webkit-scrollbar-button{display:none!important;height:0;width:0}.snail-app ::-webkit-scrollbar-thumb{background-color:hsla(0,0%,71%,.9);border:1px solid hsla(0,0%,100%,.85);border-radius:10px}.snail-app ::-webkit-scrollbar-track{background-color:transparent;border-radius:10px}.snail-app .text-tips{color:#8a9099;font-size:14px;font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-fade-in{animation:snail-fade-in .4s ease-in-out;opacity:1}@keyframes snail-fade-in{0%{opacity:0}to{opacity:1}}.snail-fade-out{animation:snail-fade-out .4s ease-in-out;opacity:0}@keyframes snail-fade-out{0%{opacity:1}to{opacity:0}}.snail-scale-in{animation:snail-scale-in .2s ease-in-out;scale:1}@keyframes snail-scale-in{0%{scale:0}to{scale:1}}.snail-scale-out{animation:snail-scale-out .2s ease-in-out;scale:0}@keyframes snail-scale-out{0%{scale:1}to{scale:0}}
1
+ .snail-app{font-family:"Microsoft YaHei","微软雅黑","Hiragino Sans GB","tahoma","arial","simsun","宋体","sans-serif"}.snail-app,.snail-app *{box-sizing:border-box!important}.snail-app div,.snail-app span{font-size:14px}.snail-app input[type=email],.snail-app input[type=number],.snail-app input[type=password],.snail-app input[type=search],.snail-app input[type=text],.snail-app input[type=url]{-webkit-appearance:none!important;-moz-appearance:none!important;appearance:none!important;border:1px solid #dddfed;border-radius:4px;color:#2e3033;font:inherit;font-size:14px;font-weight:400;margin:0;min-width:10px;outline:0!important;padding:0 10px;text-overflow:ellipsis}.snail-app input[type=email]::-webkit-search-cancel-button,.snail-app input[type=number]::-webkit-search-cancel-button,.snail-app input[type=password]::-webkit-search-cancel-button,.snail-app input[type=search]::-webkit-search-cancel-button,.snail-app input[type=text]::-webkit-search-cancel-button,.snail-app input[type=url]::-webkit-search-cancel-button{display:none}.snail-app input[type=email]:focus,.snail-app input[type=number]:focus,.snail-app input[type=password]:focus,.snail-app input[type=search]:focus,.snail-app input[type=text]:focus,.snail-app input[type=url]:focus{border:1px solid #3292ea}.snail-app input[type=email]:-moz-read-only:focus,.snail-app input[type=number]:-moz-read-only:focus,.snail-app input[type=password]:-moz-read-only:focus,.snail-app input[type=search]:-moz-read-only:focus,.snail-app input[type=text]:-moz-read-only:focus,.snail-app input[type=url]:-moz-read-only:focus{border:1px solid #dddfed}.snail-app input[type=email]:read-only:focus,.snail-app input[type=number]:read-only:focus,.snail-app input[type=password]:read-only:focus,.snail-app input[type=search]:read-only:focus,.snail-app input[type=text]:read-only:focus,.snail-app input[type=url]:read-only:focus{border:1px solid #dddfed}.snail-app input[type=checkbox],.snail-app input[type=radio]{margin:0;padding:0}.snail-app ::-webkit-scrollbar{background-color:transparent;border-radius:12px;height:10px;width:10px}.snail-app ::-webkit-scrollbar-button{display:none!important;height:0;width:0}.snail-app ::-webkit-scrollbar-thumb{background-color:hsla(0,0%,71%,.9);border:1px solid hsla(0,0%,100%,.85);border-radius:10px}.snail-app ::-webkit-scrollbar-track{background-color:transparent;border-radius:10px}.snail-app .text-tips{color:#8a9099;font-size:14px;font-weight:400;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}
@@ -1,53 +1,53 @@
1
1
  /* src:base\button.vue index:0 */
2
- .snail-button{align-items:center;border-radius:2px;cursor:pointer;display:flex;display:inline-flex;font-size:14px;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.snail-button.max{height:40px;width:120px}.snail-button.middle{height:32px;width:90px}.snail-button.normal{height:28px;width:54px}.snail-button.small{height:20px;width:30px}.snail-button.primary{background-color:#5ca3ff;color:#fff}.snail-button.default{background-color:#fff;border:1px solid #dddfed;color:#2e2f33}.snail-button.link{color:#4c9aff}
2
+ .snail-button{align-items:center;border-radius:2px;cursor:pointer;display:flex;display:inline-flex;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.snail-button.max{height:40px;width:120px}.snail-button.middle{height:32px;width:90px}.snail-button.normal{height:28px;width:54px}.snail-button.small{height:20px;width:30px}.snail-button.primary{background-color:#5ca3ff;color:#fff}.snail-button.default{background-color:#fff;border:1px solid #dddfed;color:#2e2f33}.snail-button.link{color:#4c9aff}
3
+ /* src:base\choose.vue index:0 */
4
+ .snail-choose{align-items:center;display:flex;flex-wrap:wrap;overflow-x:hidden}.snail-choose>div.choose-item{align-items:center;cursor:pointer;display:flex;flex-shrink:0;margin:0 8px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-choose>div.choose-item:after{content:"";height:100%;left:0;overflow:hidden;position:absolute;top:0;width:100%}.snail-choose>div.choose-item>input::checkmark{background-color:#2196f3;border-color:#2196f3}.snail-choose>div.choose-item>span{margin-left:4px}.snail-choose.readonly>div.choose-item{cursor:not-allowed}
3
5
  /* src:base\header.vue index:0 */
4
6
  .snail-header{align-items:center;background-color:#fff;display:flex;flex-shrink:0;position:relative;width:100%}.snail-header>.header-title{color:#2e3033;flex:1;line-height:48px;overflow:hidden;padding:0 30px;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-header>.header-title.left{text-align:left}.snail-header>.header-title.center{text-align:center}.snail-header>.header-title.right{text-align:right}.snail-header.start-divider{border-bottom:1px solid #dddfed}.snail-header.page{height:48px}.snail-header.page>.header-title{font-size:16px;font-weight:bold}.snail-header.page>.close-icon{margin-right:18px}.snail-header.dialog{height:64px;padding-top:16px}.snail-header.dialog>.header-title{font-size:20px}.snail-header.dialog>.close-icon{position:absolute;right:8px;top:8px}
7
+ /* src:base\select.vue index:0 */
8
+ .snail-select{align-items:center;background-color:#fff;border:1px solid #dddfed;border-radius:4px;color:#2e3033;cursor:pointer;display:flex;height:32px;width:100%}.snail-select>div.select-result{align-items:center;display:flex;flex:1;flex-wrap:nowrap;height:30px;overflow:hidden;padding:0 10px 0 6px}.snail-select>div.select-result>div.select-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-select>svg.snail-icon{flex-shrink:0;margin-right:4px}.snail-select>div.no-items{cursor:text;padding:0 8px}.snail-select.readonly{cursor:auto}.snail-select.readonly>svg.snail-icon{display:none}
5
9
  /* src:base\icon.vue index:0 */
6
10
  .snail-icon{cursor:pointer;opacity:1}
7
- /* src:base\choose.vue index:0 */
8
- .snail-choose{align-items:center;display:flex;flex-wrap:wrap;overflow-x:hidden}.snail-choose>div.choose-item{align-items:center;cursor:pointer;display:flex;flex-shrink:0;margin:0 8px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-choose>div.choose-item:after{content:"";height:100%;left:0;overflow:hidden;position:absolute;top:0;width:100%}.snail-choose>div.choose-item>input::checkmark{background-color:#2196f3;border-color:#2196f3}.snail-choose>div.choose-item>span{margin-left:4px}.snail-choose.readonly>div.choose-item{cursor:not-allowed}
9
11
  /* src:base\footer.vue index:0 */
10
12
  .snail-footer{align-items:center;background-color:#fff;display:flex;flex-shrink:0;height:72px;padding:0 40px;width:100%}.snail-footer>.snail-button:nth-child(n+2){margin-left:20px}.snail-footer.start-divider{border-top:1px solid #dddfed}.snail-footer.left{justify-content:left}.snail-footer.center{justify-content:center}.snail-footer.right{justify-content:right}
11
- /* src:base\search.vue index:0 */
12
- .snail-search{align-items:center;background:#fff;display:flex;flex-shrink:0;height:34px}.snail-search>input{border-radius:0!important;flex:1;height:100%}.snail-search>div{align-items:center;border:1px solid #dddfed;border-left:none;display:flex;flex-shrink:0;height:100%;justify-content:center;width:34px}
13
- /* src:base\select.vue index:0 */
14
- .snail-select{align-items:center;background-color:#fff;border:1px solid #dddfed;border-radius:4px;color:#2e3033;cursor:pointer;display:flex;height:32px;width:100%}.snail-select>div.select-result{align-items:center;display:flex;flex:1;flex-wrap:nowrap;overflow:hidden;padding:0 10px 0 6px}.snail-select>div.select-result>div.select-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-select>svg.snail-icon{flex-shrink:0;margin-right:4px}.snail-select>div.no-items{cursor:text;padding:0 8px}.snail-select.readonly{cursor:auto}.snail-select.readonly>svg.snail-icon{display:none}
15
13
  /* src:base\switch.vue index:0 */
16
14
  .snail-switch{border-radius:10px 10px 10px 10px;cursor:pointer;height:20px!important;overflow:hidden;position:relative;width:36px!important}.snail-switch>div{height:100%;width:100%}.snail-switch>div.on{background-color:#5ca3ff}.snail-switch>div.off{background-color:#c4c8cc;position:absolute;transition:left .2s ease}.snail-switch>div.status{background:#fff;border-radius:10px 10px 10px 10px;height:16px;position:absolute;top:2px;transition:left .2s ease;width:16px}.snail-switch.on>div.off{left:100%;top:0}.snail-switch.on>div.status{left:calc(100% - 18px)}.snail-switch.off>div.off{left:0;top:0}.snail-switch.off>div.status{left:2px}.snail-switch.readonly{cursor:default}
17
- /* src:container\fold.vue index:0 */
18
- .snail-fold{flex-shrink:0}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-fold>div.fold-header>.title{color:#2e3033;font-size:14px;font-weight:bold;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{align-items:right;display:flex;flex:1;justify-content:right}.snail-fold>div.fold-header>div.status>svg.snail-icon{transition:transform .2s ease}.snail-fold>div.fold-body{padding-left:20px}.snail-fold.expand>div.fold-header>div.status>svg.snail-icon{transform:rotate(-90deg)}.snail-fold.fold>div.fold-header>div.status>svg.snail-icon{transform:rotate(90deg)}
19
15
  /* src:container\dynamic.vue index:0 */
20
16
  .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
17
+ /* src:base\search.vue index:0 */
18
+ .snail-search{align-items:center;background:#fff;display:flex;flex-shrink:0;height:34px}.snail-search>input{border-radius:0!important;flex:1;height:100%}.snail-search>div{align-items:center;border:1px solid #dddfed;border-left:none;display:flex;flex-shrink:0;height:100%;justify-content:center;width:34px}
19
+ /* src:container\fold.vue index:0 */
20
+ .snail-fold{flex-shrink:0}.snail-fold>div.fold-header{align-items:center;display:flex;height:32px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-fold>div.fold-header:before{background-color:#2c97fb;content:"";height:18px;left:0;position:absolute;top:7px;width:4px}.snail-fold>div.fold-header>.subtitle,.snail-fold>div.fold-header>.title{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:100%}.snail-fold>div.fold-header>.title{color:#2e3033;font-weight:bold;padding-left:20px}.snail-fold>div.fold-header>.subtitle{color:#8a9099;font-size:13px}.snail-fold>div.fold-header>div.status{align-items:right;display:flex;flex:1;justify-content:right}.snail-fold>div.fold-header>div.status>svg.snail-icon{transition:transform .2s ease}.snail-fold>div.fold-body{padding-left:20px}.snail-fold.expand>div.fold-header>div.status>svg.snail-icon{transform:rotate(-90deg)}.snail-fold.fold>div.fold-header>div.status>svg.snail-icon{transform:rotate(90deg)}
21
21
  /* src:container\scroll.vue index:0 */
22
22
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
23
- /* src:container\sort.vue index:0 */
24
- .snail-sort-drag{background:#fff;border:1px solid #4c9aff;border-radius:4px;cursor:move}.snail-sort-ghost{border:1px dashed #4c9aff;border-radius:4px}
23
+ /* src:container\table.vue index:0 */
24
+ .snail-table{display:flex;flex-direction:column}.snail-table>div.table-footer,.snail-table>div.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>div.table-header{background-color:#fff;position:sticky!important;top:0;z-index:1}.snail-table>div.table-body{flex:1;width:100%}.snail-table.start-border>div.table-body>.table-row>.table-col:nth-child(n+2),.snail-table.start-border>div.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>div.table-header>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>div.table-body>.table-row>.table-col,.snail-table.start-border>div.table-footer>.table-col{border-top:none!important}
25
25
  /* src:container\components\table-row.vue index:0 */
26
26
  .table-row{align-items:center;display:flex}
27
27
  /* src:container\components\table-col.vue index:0 */
28
28
  .table-col{align-items:center;display:flex;height:100%;white-space:nowrap}.table-col.left{justify-content:left}.table-col.center{justify-content:center}.table-col.right{justify-content:right}
29
- /* src:container\table.vue index:0 */
30
- .snail-table{display:flex;flex-direction:column}.snail-table>div.table-footer,.snail-table>div.table-header{align-items:center;display:flex;flex-shrink:0;width:100%}.snail-table>div.table-header{background-color:#fff;position:sticky!important;top:0;z-index:1}.snail-table>div.table-body{flex:1;width:100%}.snail-table.start-border>div.table-body>.table-row>.table-col:nth-child(n+2),.snail-table.start-border>div.table-footer>.table-col:nth-child(n+2),.snail-table.start-border>div.table-header>.table-col:nth-child(n+2){border-left:none!important}.snail-table.start-border>div.table-body>.table-row>.table-col,.snail-table.start-border>div.table-footer>.table-col{border-top:none!important}
31
29
  /* src:container\tree.vue index:0 */
32
- .snail-tree{background-color:#fff;display:flex;flex-direction:column}.snail-tree .snail-search{flex-direction:0;margin:12px}.snail-tree .snail-scroll{flex:1}
30
+ .snail-tree{background-color:#fff;display:flex;flex-direction:column}.snail-tree .snail-search{flex-shrink:0;margin:12px}.snail-tree .snail-scroll{flex:1}
31
+ /* src:container\sort.vue index:0 */
32
+ .snail-sort-drag{background:#fff;border:1px solid #4c9aff;border-radius:4px;cursor:move}.snail-sort-ghost{border:1px dashed #4c9aff;border-radius:4px}
33
33
  /* src:form\input.vue index:0 */
34
- .snail-input{display:inline-flex;min-height:34px}.snail-input>.input-title{flex-shrink:0;font-size:14px;padding-top:6px}.snail-input>.input-title>span.text{color:#2e3033}.snail-input>.input-title>span.required{color:#f74b4b;margin-left:2px}.snail-input>.input-body{align-self:start;display:flex;flex:1;height:32px}.snail-input>.input-body>input{flex:1}.snail-input>.input-body>span{background-color:red;flex-shrink:0}
35
- /* src:prompt\empty.vue index:0 */
36
- .snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;min-height:150px;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-size:14px;font-weight:400;padding:0 10px 10px}
34
+ .snail-input{display:inline-flex;min-height:34px}.snail-input>.input-title{flex-shrink:0;padding-top:6px}.snail-input>.input-title>span.text{color:#2e3033}.snail-input>.input-title>span.required{color:#f74b4b;margin-left:2px}.snail-input>.input-body{align-self:start;display:flex;flex:1;height:32px}.snail-input>.input-body>input{flex:1}.snail-input>.input-body>span{background-color:red;flex-shrink:0}
37
35
  /* src:prompt\drag-verify.vue index:0 */
38
36
  .snail-drag-verify{background:#f8f9fa;border:1px solid #dddfed;border-radius:8px;height:40px;overflow:hidden;position:relative;width:100%}.snail-drag-verify>div{height:100%;width:100%}.snail-drag-verify>.drag-progress{background-color:#0c6;transition:width .5s ease-in-out}.snail-drag-verify>.drag-handle,.snail-drag-verify>.verify-message{left:0;position:absolute;top:0;transition:left .5s ease-in-out}.snail-drag-verify>.verify-message{background-image:-webkit-linear-gradient(left,#666,#666 45%,#fff 50%,#666 55%,#666);-webkit-text-fill-color:transparent;align-items:center;animation:snail-drag-verify 2s linear infinite;-webkit-background-clip:text;background-clip:text;background-size:200% 100%;color:#7e848c;display:flex;font-size:12px;font-weight:400;justify-content:center;-webkit-user-select:none;-moz-user-select:none;user-select:none}.snail-drag-verify>.drag-handle{align-items:center;background-color:#fff;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAnUExURQAAAGBQUGBaWmJZWWJYWGNYWGNZWWJYWGJZWWBYWGNYWGNZWWRYWIqwlb0AAAANdFJOUwAQMMDQoFBgcCCw4ECQ8pPMAAAAP0lEQVQI12NgwATTGBgawAwRBYZwMIPRiYErAcxSFmA0AjN4HBikBcCsUgYmQxQGE0wKphhIQrSzwAyEW4EOACHhB32zIad6AAAAAElFTkSuQmCC);background-position:50%;background-repeat:no-repeat;border-right:1px solid #dddfed;cursor:move;display:flex;justify-content:center;width:40px}.snail-drag-verify.dragging>.drag-handle,.snail-drag-verify.dragging>.drag-progress{transition:none!important}.snail-drag-verify.success>.verify-message{-webkit-text-fill-color:#fff;color:#fff}.snail-drag-verify.success>.drag-handle>svg{background:#76c61d;border-radius:50%;padding:4px}@keyframes snail-drag-verify{0%{background-position:0 0}to{background-position:-200% 0}}
39
37
  /* src:prompt\loading.vue index:0 */
40
38
  .snail-loading{height:100%;left:0;position:absolute;top:0;width:100%;z-index:10000}.snail-loading.show-mask{background-color:rgba(0,0,0,.15)}.snail-loading:after,.snail-loading:before{animation:snail-loading-stretch 1s ease-in-out infinite;border-radius:50%;content:"";display:block;display:inline-block;height:10px;left:50%;margin-left:-18px;margin-top:-6px;position:absolute;top:50%;width:10px}.snail-loading:before{background-color:#279bf1}.snail-loading:after{animation-delay:-.5s;background:#64d214;margin-left:0;margin-right:-18px}@keyframes snail-loading-stretch{0%,to{transform:scale(1)}50%{transform:scale(2)}}.snail-loading-enter-active,.snail-loading-leave-active{transition:opacity .5s ease-in-out}.snail-loading-enter-from,.snail-loading-leave-to{opacity:0}
41
- /* src:popup\components\confirm-container.vue index:0 */
42
- .snail-confirm{background-color:#fff;border-radius:4px;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>div.confirm-body{flex:1;font-size:14px;margin:20px 40px;overflow:auto;word-wrap:break-word}
39
+ /* src:prompt\empty.vue index:0 */
40
+ .snail-empty{align-items:center;display:flex;flex-direction:column;height:100%;justify-content:center;min-height:150px;width:100%}.snail-empty>img{height:60px;width:60px}.snail-empty>div.message{color:#babdc2;font-weight:400;padding:0 10px 10px}
43
41
  /* src:popup\components\dialog-container.vue index:0 */
44
42
  .snail-dialog{align-items:center;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;opacity:1;position:absolute;transition:opacity .4s ease-in-out;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);position:relative}.snail-dialog.unactive:before{opacity:0}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}
45
43
  /* src:popup\components\follow-container.vue index:0 */
46
44
  .snail-follow{background-color:#fff;display:inline-block;max-height:100%;max-width:100%;position:fixed;transition-duration:.5s;transition-property:left,top;transition-timing-function:ease}
47
- /* src:popup\components\popup-container.vue index:0 */
48
- .snail-popup{left:0;position:fixed;top:0}
45
+ /* src:popup\components\confirm-container.vue index:0 */
46
+ .snail-confirm{background-color:#fff;border-radius:4px;color:#2e2f33;display:flex;flex-direction:column;max-height:350px;max-width:548px;min-width:348px}.snail-confirm>div.confirm-body{flex:1;margin:20px 40px;overflow:auto;word-wrap:break-word}
49
47
  /* src:popup\components\toast-container.vue index:0 */
50
48
  .snail-toast{background:rgba(0,0,0,.7);border-radius:10px;color:#fff;display:flex;left:50%;max-height:200px;max-width:400px;min-width:200px;overflow:hidden;padding:20px 35px 20px 15px;position:fixed;top:50%;transform:translate(-50%,-50%)}.snail-toast>svg.close-icon{position:absolute;right:10px;top:12px}.snail-toast>div.icon{align-items:center;align-self:center;background:hsla(0,0%,100%,.15);border-radius:50%;display:flex;height:26px;justify-content:center;margin-right:6px;width:26px}.snail-toast>div.icon>svg{background:#fff;border-radius:50%;cursor:none!important}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
49
+ /* src:popup\components\popup-container.vue index:0 */
50
+ .snail-popup{left:0;position:fixed;top:0}
51
51
  /* src:container\components\tree-node.vue index:0 */
52
52
  .snail-tree-node{align-items:center;display:flex;flex-wrap:nowrap;height:40px;width:100%}.snail-tree-node:hover{background-color:#f8f9fa}.snail-tree-node>.indent,.snail-tree-node>.node-slot,.snail-tree-node>.snail-icon{flex-shrink:0}.snail-tree-node>.node-fold{align-items:center;display:flex;height:100%;justify-content:center;width:24px}.snail-tree-node>.node-fold>.snail-icon{transition:transform .1s ease-in}.snail-tree-node>.node-fold>.snail-icon.fold{transform:rotate(-90deg)}.snail-tree-node>.node-slot,.snail-tree-node>.node-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.snail-tree-node>.node-text{color:#2e3033;flex:1;min-width:30px}.snail-tree-node.clickable>.node-text{cursor:pointer}.snail-tree-children{width:100%}.snail-tree-node.level-1>.indent{padding-left:4px}.snail-tree-node.level-2>.indent{padding-left:24px}.snail-tree-node.level-3>.indent{padding-left:48px}.snail-tree-node.level-4>.indent{padding-left:72px}.snail-tree-node.level-5>.indent{padding-left:96px}.snail-tree-node.level-6>.indent{padding-left:120px}.snail-tree-node.level-7>.indent{padding-left:144px}.snail-tree-node.level-8>.indent{padding-left:168px}.snail-tree-node.level-9>.indent{padding-left:192px}.snail-tree-node.level-10>.indent{padding-left:216px}
53
53
  /* src:base\components\select-popup.vue index:0 */
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "依赖【snail】,基于vue封装常用UI组件",
4
4
  "author": "snail_dev@163.com",
5
5
  "license": "MIT",
6
- "version": "1.0.37",
6
+ "version": "1.0.39",
7
7
  "type": "module",
8
8
  "main": "dist/snail.vue.js",
9
9
  "module": "dist/snail.vue.js",
@@ -15,7 +15,7 @@
15
15
  "dependencies": {
16
16
  "vue": "^3.5.14",
17
17
  "snail.core": ">=2.0.11",
18
- "snail.view": ">=1.0.17",
18
+ "snail.view": ">=1.0.18",
19
19
  "sortablejs": ">=1.15.6"
20
20
  },
21
21
  "devDependencies": {