snail.vue 1.0.38 → 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.
@@ -166,28 +166,6 @@ 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、封装一些基础实体;如树形节点数据结构
@@ -221,7 +199,7 @@ type TreeNodeExtend = {
221
199
  * 节点Id,确保唯一
222
200
  * - 不传入则内部自动 newId()
223
201
  */
224
- id?: string;
202
+ readonly id?: string;
225
203
  /**
226
204
  * 是否可点击
227
205
  * - true 此节点可点击,点击时触发 click 事件
@@ -255,18 +233,33 @@ interface ITreeBaseContext<T> {
255
233
  */
256
234
  doSearch(text: string): void;
257
235
  /**
258
- * 能否显示指定【树节点】
236
+ * 是否是【补丁】节点
237
+ * - 子节点搜索命中时,父级路径上节点没命中,则作父级路径节点作为路径修补节点存在,避免命中子节点展示不出来
259
238
  * @param node 要判断的节点
239
+ * @returns true 是补丁节点,false 不是补丁节点
240
+ */
241
+ isPatched(node: TreeNode<T>): boolean;
242
+ /**
243
+ * 是否显示【树节点】
244
+ * @param node 要判断的节点
245
+ * @param needPatched 是否需要【补丁】节点。true时(补丁节点始终显示);false时(根据hidden和搜索结果判断)
260
246
  * @returns 能显示返回true;否则返回false
261
247
  */
262
- canShow(node: TreeNode<T, TreeNodeExtend>): boolean;
248
+ isShow(node: TreeNode<T, TreeNodeExtend>, needPatched: boolean): boolean;
263
249
  /**
264
- * 能否显示指定【树节点】的子节点
250
+ * 是否显示指定【树节点】的子节点
265
251
  * - 不会判断node节点自身是否可显示
266
252
  * @param node 要判断的节点
253
+ * @param needPatched 是否需要【补丁】节点。true时(补丁节点始终显示);false时(根据hidden和搜索结果判断)
267
254
  * @returns 能显示返回true;否则返回false
268
255
  */
269
- canShowChildren(node: TreeNode<T, TreeNodeExtend>): boolean;
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
  * 树搜索结果
@@ -280,6 +273,34 @@ type TreeSearchResult<T> = {
280
273
  * 未匹配上的节点集合
281
274
  */
282
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];
283
304
  };
284
305
 
285
306
  /**
@@ -308,7 +329,13 @@ type TreeOptions<T> = {
308
329
  /**
309
330
  * 树组件事件
310
331
  */
311
- type TreeEvents<T> = TreeNodeEvents<T> & {};
332
+ type TreeEvents<T> = TreeNodeEvents<T> & {
333
+ /**
334
+ * 搜索完成后
335
+ * @param text 搜索文本
336
+ */
337
+ (el: "searched", text: string): any;
338
+ };
312
339
  /**
313
340
  * 树节点 组件配置选项
314
341
  */
@@ -593,6 +620,23 @@ type SelectOptions<T> = ReadonlyOptions & PlaceholderOptions & SelectBaseOptions
593
620
  * 选项菜单 组件 事件
594
621
  */
595
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
+ };
596
640
  /**
597
641
  * 【选项菜单】 组件上下文
598
642
  */
@@ -1596,17 +1640,47 @@ declare const components: {
1596
1640
  onSearch?: (value: string) => any;
1597
1641
  "onUpdate:modelValue"?: (value: string) => any;
1598
1642
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
1599
- Select: vue.DefineComponent<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1600
- modelValue?: SelectItem<any>[];
1601
- }, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1602
- change: (values: SelectItem<any>[]) => any;
1603
- "update:modelValue": (value: SelectItem<any>[]) => any;
1604
- }, 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> & {
1605
1669
  modelValue?: SelectItem<any>[];
1606
1670
  }> & Readonly<{
1607
1671
  onChange?: (values: SelectItem<any>[]) => any;
1608
1672
  "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1609
- }>, {}, {}, {}, {}, 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
+ });
1610
1684
  Switch: vue.DefineComponent<ReadonlyOptions & {
1611
1685
  modelValue?: boolean;
1612
1686
  }, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
@@ -1812,8 +1886,12 @@ declare const components: {
1812
1886
  nodeOptions?: TreeNodeRenderOptions;
1813
1887
  }> & Readonly<{
1814
1888
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1815
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1889
+ onSearched?: (text: string) => any;
1890
+ }>, {
1891
+ context: ITreeBaseContext<any>;
1892
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1816
1893
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1894
+ searched: (text: string) => any;
1817
1895
  }, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1818
1896
  P: {};
1819
1897
  B: {};
@@ -1827,7 +1905,10 @@ declare const components: {
1827
1905
  nodeOptions?: TreeNodeRenderOptions;
1828
1906
  }> & Readonly<{
1829
1907
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1830
- }>, {}, {}, {}, {}, {}>;
1908
+ onSearched?: (text: string) => any;
1909
+ }>, {
1910
+ context: ITreeBaseContext<any>;
1911
+ }, {}, {}, {}, {}>;
1831
1912
  __isFragment?: never;
1832
1913
  __isTeleport?: never;
1833
1914
  __isSuspense?: never;
@@ -1837,11 +1918,21 @@ declare const components: {
1837
1918
  nodeOptions?: TreeNodeRenderOptions;
1838
1919
  }> & Readonly<{
1839
1920
  onClick?: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1840
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1921
+ onSearched?: (text: string) => any;
1922
+ }>, {
1923
+ context: ITreeBaseContext<any>;
1924
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {} & {
1841
1925
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
1926
+ searched: (text: string) => any;
1842
1927
  }, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1843
1928
  $slots: {
1844
- 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;
1845
1936
  };
1846
1937
  });
1847
1938
  Input: vue.DefineComponent<ReadonlyOptions & PlaceholderOptions & TitleOptions & {
@@ -1907,4 +1998,4 @@ declare const components: {
1907
1998
  };
1908
1999
 
1909
2000
  export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
1910
- 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, SortEvents, SortOptions, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, TitleOptions, ToastOptions, TreeEvents, TreeNode, TreeNodeEvents, TreeNodeExtend, TreeNodeModel, TreeNodeOptions, TreeNodeRenderOptions, TreeNodeSlotOptions, TreeOptions, TreeSearchResult };
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
@@ -1,7 +1,7 @@
1
1
  //@ sourceURL=/snail.vue.js
2
2
  import { defineComponent, createElementBlock, openBlock, normalizeClass, renderSlot, createTextVNode, mergeModels, useModel, computed, Fragment, renderList, normalizeStyle, unref, createElementVNode, createCommentVNode, toDisplayString, createBlock, shallowRef, withDirectives, vModelText, createVNode, createApp, Transition, withCtx, normalizeProps, guardReactiveProps, watch, ref, onErrorCaptured, resolveDynamicComponent, mergeProps, createSlots, onMounted, withModifiers, getCurrentInstance, nextTick, useTemplateRef, resolveComponent, onActivated, onDeactivated, onBeforeUnmount, getCurrentScope, onScopeDispose } from 'vue';
3
3
  import { isArray, newId, throwError, isArrayNotEmpty, isStringNotEmpty, mustFunction, useScope, removeFromArray, mustObject, throwIfFalse, isObject, isNumberNotNaN, useScopes, mountScope, isPromise, wait, script, delay, useTimer, defer, useAsyncScope, useHook, hasAny, throwIfTrue, isFunction, onMountScope } from 'snail.core';
4
- import { css, link, useObserver, useAnimation } from 'snail.view';
4
+ import { link, css, useObserver, useAnimation } from 'snail.view';
5
5
 
6
6
  var _sfc_main$r = defineComponent({
7
7
  ...{
@@ -23,6 +23,10 @@ var _sfc_main$r = defineComponent({
23
23
  }
24
24
  });
25
25
 
26
+ var addLink = href => setTimeout(link.register, 0, href);
27
+
28
+ addLink("/styles/snail.vue.vue.css");
29
+
26
30
  const _hoisted_1$e = ["onClick"];
27
31
  const _hoisted_2$9 = ["type", "checked"];
28
32
  const _hoisted_3$6 = ["textContent"];
@@ -96,10 +100,6 @@ var _sfc_main$q = defineComponent({
96
100
  }
97
101
  });
98
102
 
99
- var addLink = href => setTimeout(link.register, 0, href);
100
-
101
- addLink("/styles/snail.vue.vue.css");
102
-
103
103
  var _sfc_main$p = defineComponent({
104
104
  ...{
105
105
  name: "Footer",
@@ -1207,8 +1207,8 @@ var _sfc_main$d = defineComponent({
1207
1207
  const emits = __emit;
1208
1208
  const rootDom = useTemplateRef("select-node");
1209
1209
  const selectedRef = computed(() => __props.context.selected(__props.multiple, __props.item));
1210
- const showRef = computed(() => __props.context.canShow(__props.item));
1211
- const showChildrenRef = __props.showChildren == true && __props.item.type == "group" ? computed(() => (__props.item.children || []).filter(__props.context.canShow)) : [];
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))) : [];
1212
1212
  const classRef = computed(() => ({
1213
1213
  child: __props.showChildren != true,
1214
1214
  clickable: __props.item.clickable,
@@ -1301,7 +1301,7 @@ var _sfc_main$c = defineComponent({
1301
1301
  pinned,
1302
1302
  parentPinned
1303
1303
  } = props;
1304
- const itemsRef = computed(() => (props.items || []).filter(context.canShow));
1304
+ const itemsRef = computed(() => (props.items || []).filter(item => context.isShow(item, true)));
1305
1305
  const classRef = computed(() => ({
1306
1306
  "snail-select-popup": true,
1307
1307
  "child-popup": props.level > 1,
@@ -1421,49 +1421,80 @@ var _sfc_main$c = defineComponent({
1421
1421
  function useTreeContext(nodes) {
1422
1422
  const scopes = useScopes();
1423
1423
  const failed = shallowRef();
1424
+ const patched = shallowRef();
1424
1425
  function doSearch(text) {
1425
1426
  text = isStringNotEmpty(text) ? text.toLowerCase() : void 0;
1426
1427
  const result = searchTree(nodes, text);
1427
1428
  failed.value = result.failed;
1429
+ patched.value = result.patched;
1430
+ }
1431
+ function isPatched(node) {
1432
+ return patched.value ? patched.value.includes(node) : false;
1433
+ }
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;
1428
1442
  }
1429
- function canShow(node) {
1430
- return node.hidden != true && (failed.value == void 0 || failed.value.includes(node) == false);
1443
+ function isShowChildren(node, needPatched) {
1444
+ return node.children ? node.children.find(child => isShow(child, needPatched)) != void 0 : false;
1431
1445
  }
1432
- function canShowChildren(node) {
1433
- return node.children ? node.children.filter(canShow).length > 0 : false;
1446
+ function getPath(node) {
1447
+ return searchPath(nodes, node);
1434
1448
  }
1435
1449
  const context = mountScope({
1436
1450
  doSearch,
1437
- canShow,
1438
- canShowChildren
1451
+ isPatched,
1452
+ isShow,
1453
+ isShowChildren,
1454
+ getPath
1439
1455
  });
1440
1456
  context.onDestroy(() => {
1441
1457
  scopes.destroy();
1442
1458
  failed.value = void 0;
1459
+ patched.value = void 0;
1443
1460
  });
1444
1461
  return Object.freeze(context);
1445
1462
  }
1446
1463
  function searchTree(nodes, text) {
1447
1464
  const result = Object.freeze({
1448
1465
  matched: [],
1449
- failed: []
1466
+ failed: [],
1467
+ patched: []
1450
1468
  });
1451
1469
  for (const node of nodes || []) {
1452
- 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;
1453
1473
  if (hasAny(node.children) == true) {
1454
1474
  const childResult = searchTree(node.children, text);
1455
1475
  result.matched.push(...childResult.matched);
1456
1476
  result.failed.push(...childResult.failed);
1457
- matched = childResult.matched.length > 0;
1458
- }
1459
- matched = matched || node.fixed == true;
1460
- if (matched == false && node.searchable == true) {
1461
- matched = text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1477
+ result.patched.push(...childResult.patched);
1478
+ childMatched = childResult.matched.length > 0 || childResult.patched.length > 0;
1462
1479
  }
1463
- matched ? result.matched.push(node) : result.failed.push(node);
1480
+ childMatched && matched == false && result.patched.push(node);
1464
1481
  }
1465
1482
  return result;
1466
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
+ }
1467
1498
 
1468
1499
  function useSelectContext(items, selectsRef) {
1469
1500
  const treeContxt = useTreeContext(items);
@@ -1486,8 +1517,11 @@ function useSelectContext(items, selectsRef) {
1486
1517
  });
1487
1518
  }
1488
1519
 
1489
- const _hoisted_1$6 = ["title"];
1490
- const _hoisted_2$3 = ["textContent"];
1520
+ const _hoisted_1$6 = {
1521
+ key: 0,
1522
+ class: "select-result"
1523
+ };
1524
+ const _hoisted_2$3 = ["title", "textContent"];
1491
1525
  const _hoisted_3$3 = ["textContent"];
1492
1526
  const _hoisted_4$3 = {
1493
1527
  key: 1,
@@ -1533,18 +1567,35 @@ var _sfc_main$b = defineComponent({
1533
1567
  const {
1534
1568
  follow
1535
1569
  } = usePopup();
1570
+ const {
1571
+ onTimeout
1572
+ } = useTimer();
1536
1573
  const rootDom = useTemplateRef("select");
1537
- const selectsRef = shallowRef([...valuesModel.value]);
1538
- const context = useSelectContext(props.items, selectsRef);
1574
+ const context = useSelectContext(props.items, valuesModel);
1539
1575
  const selectTextRef = computed(() => context.selectedText(props.multiple, props.showPath));
1576
+ const slotOptions = Object.freeze({
1577
+ closeFollow,
1578
+ stopPropagation
1579
+ });
1540
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
+ }
1541
1594
  async function onClick() {
1542
1595
  if (props.readonly == true || rootDom.value == void 0) {
1543
1596
  return;
1544
1597
  }
1545
- if (followScope != void 0) {
1546
- followScope.destroy();
1547
- followScope = void 0;
1598
+ if (closeFollow() == true || stopPropagationScope != void 0) {
1548
1599
  return;
1549
1600
  }
1550
1601
  const values = valuesModel.value && valuesModel.value.length > 0 ? [...valuesModel.value] : [];
@@ -1575,7 +1626,6 @@ var _sfc_main$b = defineComponent({
1575
1626
  }
1576
1627
  function onSelectItemChange(items) {
1577
1628
  items = hasAny(items) ? [...items] : [];
1578
- selectsRef.value = items;
1579
1629
  valuesModel.value = items;
1580
1630
  emits("change", items);
1581
1631
  }
@@ -1588,14 +1638,11 @@ var _sfc_main$b = defineComponent({
1588
1638
  ref: "select"
1589
1639
  }, [unref(hasAny)(props.items) == true ? (openBlock(), createElementBlock(Fragment, {
1590
1640
  key: 0
1591
- }, [unref(hasAny)(selectsRef.value) ? (openBlock(), createElementBlock("div", {
1592
- key: 0,
1593
- class: "select-result",
1594
- title: selectTextRef.value
1595
- }, [createElementVNode("div", {
1641
+ }, [unref(hasAny)(valuesModel.value) ? (openBlock(), createElementBlock("div", _hoisted_1$6, [renderSlot(_ctx.$slots, "default", normalizeProps(guardReactiveProps(unref(slotOptions))), () => [createElementVNode("div", {
1596
1642
  class: "select-text",
1643
+ title: selectTextRef.value,
1597
1644
  textContent: toDisplayString(selectTextRef.value)
1598
- }, null, 8, _hoisted_2$3)], 8, _hoisted_1$6)) : (openBlock(), createElementBlock("div", {
1645
+ }, null, 8, _hoisted_2$3)])])) : (openBlock(), createElementBlock("div", {
1599
1646
  key: 1,
1600
1647
  class: "select-result text-tips",
1601
1648
  textContent: toDisplayString(props.placeholder || "请选择")
@@ -2013,8 +2060,8 @@ var _sfc_main$3 = defineComponent({
2013
2060
  const {
2014
2061
  transition
2015
2062
  } = useAnimation();
2016
- const showRef = computed(() => __props.context.canShow(__props.node));
2017
- const showChildrenRef = computed(() => __props.context.canShowChildren(__props.node));
2063
+ const showRef = computed(() => __props.context.isShow(__props.node, true));
2064
+ const showChildrenRef = computed(() => __props.context.isShowChildren(__props.node, true));
2018
2065
  const classRef = computed(() => {
2019
2066
  const array = [`level-${__props.level}`];
2020
2067
  __props.node.clickable && array.push("clickable");
@@ -2123,20 +2170,28 @@ var _sfc_main$2 = defineComponent({
2123
2170
  search: {},
2124
2171
  nodeOptions: {}
2125
2172
  },
2126
- emits: ["click"],
2173
+ emits: ["click", "searched"],
2127
2174
  setup(__props, _ref) {
2128
2175
  let {
2176
+ expose: __expose,
2129
2177
  emit: __emit
2130
2178
  } = _ref;
2131
2179
  const props = __props;
2132
2180
  const emits = __emit;
2133
2181
  const context = useTreeContext(props.nodes);
2182
+ __expose({
2183
+ context
2184
+ });
2185
+ function onSearch(text) {
2186
+ context.doSearch(text);
2187
+ emits("searched", text);
2188
+ }
2134
2189
  return (_ctx, _cache) => {
2135
2190
  return openBlock(), createElementBlock("div", _hoisted_1$2, [props.search ? (openBlock(), createBlock(_sfc_main$m, mergeProps({
2136
2191
  key: 0
2137
2192
  }, props.search, {
2138
- onSearch: unref(context).doSearch
2139
- }), null, 16, ["onSearch"])) : createCommentVNode("", true), createVNode(_sfc_main$8, {
2193
+ onSearch
2194
+ }), null, 16)) : createCommentVNode("", true), createVNode(_sfc_main$8, {
2140
2195
  "scroll-y": true
2141
2196
  }, {
2142
2197
  default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.nodes || [], node => {
@@ -25,6 +25,10 @@
25
25
  }
26
26
  });
27
27
 
28
+ var addLink = href => setTimeout(snail_view.link.register, 0, href);
29
+
30
+ addLink("/styles/snail.vue.vue.css");
31
+
28
32
  const _hoisted_1$e = ["onClick"];
29
33
  const _hoisted_2$9 = ["type", "checked"];
30
34
  const _hoisted_3$6 = ["textContent"];
@@ -98,10 +102,6 @@
98
102
  }
99
103
  });
100
104
 
101
- var addLink = href => setTimeout(snail_view.link.register, 0, href);
102
-
103
- addLink("/styles/snail.vue.vue.css");
104
-
105
105
  var _sfc_main$p = vue.defineComponent({
106
106
  ...{
107
107
  name: "Footer",
@@ -1209,8 +1209,8 @@
1209
1209
  const emits = __emit;
1210
1210
  const rootDom = vue.useTemplateRef("select-node");
1211
1211
  const selectedRef = vue.computed(() => __props.context.selected(__props.multiple, __props.item));
1212
- const showRef = vue.computed(() => __props.context.canShow(__props.item));
1213
- const showChildrenRef = __props.showChildren == true && __props.item.type == "group" ? vue.computed(() => (__props.item.children || []).filter(__props.context.canShow)) : [];
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))) : [];
1214
1214
  const classRef = vue.computed(() => ({
1215
1215
  child: __props.showChildren != true,
1216
1216
  clickable: __props.item.clickable,
@@ -1303,7 +1303,7 @@
1303
1303
  pinned,
1304
1304
  parentPinned
1305
1305
  } = props;
1306
- const itemsRef = vue.computed(() => (props.items || []).filter(context.canShow));
1306
+ const itemsRef = vue.computed(() => (props.items || []).filter(item => context.isShow(item, true)));
1307
1307
  const classRef = vue.computed(() => ({
1308
1308
  "snail-select-popup": true,
1309
1309
  "child-popup": props.level > 1,
@@ -1423,49 +1423,80 @@
1423
1423
  function useTreeContext(nodes) {
1424
1424
  const scopes = snail_core.useScopes();
1425
1425
  const failed = vue.shallowRef();
1426
+ const patched = vue.shallowRef();
1426
1427
  function doSearch(text) {
1427
1428
  text = snail_core.isStringNotEmpty(text) ? text.toLowerCase() : void 0;
1428
1429
  const result = searchTree(nodes, text);
1429
1430
  failed.value = result.failed;
1431
+ patched.value = result.patched;
1432
+ }
1433
+ function isPatched(node) {
1434
+ return patched.value ? patched.value.includes(node) : false;
1435
+ }
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;
1430
1444
  }
1431
- function canShow(node) {
1432
- return node.hidden != true && (failed.value == void 0 || failed.value.includes(node) == false);
1445
+ function isShowChildren(node, needPatched) {
1446
+ return node.children ? node.children.find(child => isShow(child, needPatched)) != void 0 : false;
1433
1447
  }
1434
- function canShowChildren(node) {
1435
- return node.children ? node.children.filter(canShow).length > 0 : false;
1448
+ function getPath(node) {
1449
+ return searchPath(nodes, node);
1436
1450
  }
1437
1451
  const context = snail_core.mountScope({
1438
1452
  doSearch,
1439
- canShow,
1440
- canShowChildren
1453
+ isPatched,
1454
+ isShow,
1455
+ isShowChildren,
1456
+ getPath
1441
1457
  });
1442
1458
  context.onDestroy(() => {
1443
1459
  scopes.destroy();
1444
1460
  failed.value = void 0;
1461
+ patched.value = void 0;
1445
1462
  });
1446
1463
  return Object.freeze(context);
1447
1464
  }
1448
1465
  function searchTree(nodes, text) {
1449
1466
  const result = Object.freeze({
1450
1467
  matched: [],
1451
- failed: []
1468
+ failed: [],
1469
+ patched: []
1452
1470
  });
1453
1471
  for (const node of nodes || []) {
1454
- 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;
1455
1475
  if (snail_core.hasAny(node.children) == true) {
1456
1476
  const childResult = searchTree(node.children, text);
1457
1477
  result.matched.push(...childResult.matched);
1458
1478
  result.failed.push(...childResult.failed);
1459
- matched = childResult.matched.length > 0;
1460
- }
1461
- matched = matched || node.fixed == true;
1462
- if (matched == false && node.searchable == true) {
1463
- matched = text == void 0 || (node.text || "").toLowerCase().indexOf(text) != -1;
1479
+ result.patched.push(...childResult.patched);
1480
+ childMatched = childResult.matched.length > 0 || childResult.patched.length > 0;
1464
1481
  }
1465
- matched ? result.matched.push(node) : result.failed.push(node);
1482
+ childMatched && matched == false && result.patched.push(node);
1466
1483
  }
1467
1484
  return result;
1468
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
+ }
1469
1500
 
1470
1501
  function useSelectContext(items, selectsRef) {
1471
1502
  const treeContxt = useTreeContext(items);
@@ -1488,8 +1519,11 @@
1488
1519
  });
1489
1520
  }
1490
1521
 
1491
- const _hoisted_1$6 = ["title"];
1492
- const _hoisted_2$3 = ["textContent"];
1522
+ const _hoisted_1$6 = {
1523
+ key: 0,
1524
+ class: "select-result"
1525
+ };
1526
+ const _hoisted_2$3 = ["title", "textContent"];
1493
1527
  const _hoisted_3$3 = ["textContent"];
1494
1528
  const _hoisted_4$3 = {
1495
1529
  key: 1,
@@ -1535,18 +1569,35 @@
1535
1569
  const {
1536
1570
  follow
1537
1571
  } = usePopup();
1572
+ const {
1573
+ onTimeout
1574
+ } = snail_core.useTimer();
1538
1575
  const rootDom = vue.useTemplateRef("select");
1539
- const selectsRef = vue.shallowRef([...valuesModel.value]);
1540
- const context = useSelectContext(props.items, selectsRef);
1576
+ const context = useSelectContext(props.items, valuesModel);
1541
1577
  const selectTextRef = vue.computed(() => context.selectedText(props.multiple, props.showPath));
1578
+ const slotOptions = Object.freeze({
1579
+ closeFollow,
1580
+ stopPropagation
1581
+ });
1542
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
+ }
1543
1596
  async function onClick() {
1544
1597
  if (props.readonly == true || rootDom.value == void 0) {
1545
1598
  return;
1546
1599
  }
1547
- if (followScope != void 0) {
1548
- followScope.destroy();
1549
- followScope = void 0;
1600
+ if (closeFollow() == true || stopPropagationScope != void 0) {
1550
1601
  return;
1551
1602
  }
1552
1603
  const values = valuesModel.value && valuesModel.value.length > 0 ? [...valuesModel.value] : [];
@@ -1577,7 +1628,6 @@
1577
1628
  }
1578
1629
  function onSelectItemChange(items) {
1579
1630
  items = snail_core.hasAny(items) ? [...items] : [];
1580
- selectsRef.value = items;
1581
1631
  valuesModel.value = items;
1582
1632
  emits("change", items);
1583
1633
  }
@@ -1590,14 +1640,11 @@
1590
1640
  ref: "select"
1591
1641
  }, [vue.unref(snail_core.hasAny)(props.items) == true ? (vue.openBlock(), vue.createElementBlock(vue.Fragment, {
1592
1642
  key: 0
1593
- }, [vue.unref(snail_core.hasAny)(selectsRef.value) ? (vue.openBlock(), vue.createElementBlock("div", {
1594
- key: 0,
1595
- class: "select-result",
1596
- title: selectTextRef.value
1597
- }, [vue.createElementVNode("div", {
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", {
1598
1644
  class: "select-text",
1645
+ title: selectTextRef.value,
1599
1646
  textContent: vue.toDisplayString(selectTextRef.value)
1600
- }, null, 8, _hoisted_2$3)], 8, _hoisted_1$6)) : (vue.openBlock(), vue.createElementBlock("div", {
1647
+ }, null, 8, _hoisted_2$3)])])) : (vue.openBlock(), vue.createElementBlock("div", {
1601
1648
  key: 1,
1602
1649
  class: "select-result text-tips",
1603
1650
  textContent: vue.toDisplayString(props.placeholder || "请选择")
@@ -2015,8 +2062,8 @@
2015
2062
  const {
2016
2063
  transition
2017
2064
  } = snail_view.useAnimation();
2018
- const showRef = vue.computed(() => __props.context.canShow(__props.node));
2019
- const showChildrenRef = vue.computed(() => __props.context.canShowChildren(__props.node));
2065
+ const showRef = vue.computed(() => __props.context.isShow(__props.node, true));
2066
+ const showChildrenRef = vue.computed(() => __props.context.isShowChildren(__props.node, true));
2020
2067
  const classRef = vue.computed(() => {
2021
2068
  const array = [`level-${__props.level}`];
2022
2069
  __props.node.clickable && array.push("clickable");
@@ -2125,20 +2172,28 @@
2125
2172
  search: {},
2126
2173
  nodeOptions: {}
2127
2174
  },
2128
- emits: ["click"],
2175
+ emits: ["click", "searched"],
2129
2176
  setup(__props, _ref) {
2130
2177
  let {
2178
+ expose: __expose,
2131
2179
  emit: __emit
2132
2180
  } = _ref;
2133
2181
  const props = __props;
2134
2182
  const emits = __emit;
2135
2183
  const context = useTreeContext(props.nodes);
2184
+ __expose({
2185
+ context
2186
+ });
2187
+ function onSearch(text) {
2188
+ context.doSearch(text);
2189
+ emits("searched", text);
2190
+ }
2136
2191
  return (_ctx, _cache) => {
2137
2192
  return vue.openBlock(), vue.createElementBlock("div", _hoisted_1$2, [props.search ? (vue.openBlock(), vue.createBlock(_sfc_main$m, vue.mergeProps({
2138
2193
  key: 0
2139
2194
  }, props.search, {
2140
- onSearch: vue.unref(context).doSearch
2141
- }), null, 16, ["onSearch"])) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$8, {
2195
+ onSearch
2196
+ }), null, 16)) : vue.createCommentVNode("", true), vue.createVNode(_sfc_main$8, {
2142
2197
  "scroll-y": true
2143
2198
  }, {
2144
2199
  default: vue.withCtx(() => [(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(props.nodes || [], node => {
@@ -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,25 +1,23 @@
1
+ /* src:base\button.vue index:0 */
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}
1
3
  /* src:base\choose.vue index:0 */
2
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
- /* src:base\button.vue index:0 */
4
- .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}
5
- /* src:base\footer.vue index:0 */
6
- .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}
7
5
  /* src:base\header.vue index:0 */
8
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}
9
9
  /* src:base\icon.vue index:0 */
10
10
  .snail-icon{cursor:pointer;opacity:1}
11
+ /* src:base\footer.vue index:0 */
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
13
  /* src:base\switch.vue index:0 */
12
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}
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
15
  /* src:container\dynamic.vue index:0 */
16
16
  .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
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
17
  /* src:base\search.vue index:0 */
20
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}
21
- /* src:container\sort.vue index:0 */
22
- .snail-sort-drag{background:#fff;border:1px solid #4c9aff;border-radius:4px;cursor:move}.snail-sort-ghost{border:1px dashed #4c9aff;border-radius:4px}
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)}
23
21
  /* src:container\scroll.vue index:0 */
24
22
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
25
23
  /* src:container\table.vue index:0 */
@@ -29,23 +27,25 @@
29
27
  /* src:container\components\table-col.vue index:0 */
30
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}
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
+ /* src:form\input.vue index:0 */
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}
33
35
  /* src:prompt\drag-verify.vue index:0 */
34
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}}
35
- /* src:form\input.vue index:0 */
36
- .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}
37
- /* src:prompt\empty.vue index:0 */
38
- .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}
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}
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}
41
41
  /* src:popup\components\dialog-container.vue index:0 */
42
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)}
43
+ /* src:popup\components\follow-container.vue index:0 */
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}
43
45
  /* src:popup\components\confirm-container.vue index:0 */
44
- .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}
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}
45
47
  /* src:popup\components\toast-container.vue index:0 */
46
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}
47
- /* src:popup\components\follow-container.vue index:0 */
48
- .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}
49
49
  /* src:popup\components\popup-container.vue index:0 */
50
50
  .snail-popup{left:0;position:fixed;top:0}
51
51
  /* src:container\components\tree-node.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.38",
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": {