snail.vue 1.0.47 → 1.0.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.code-snippets CHANGED
@@ -39,5 +39,11 @@
39
39
  "scope": "html",
40
40
  "description": "公共类样式:提示文本",
41
41
  "body": "class=\"text-tips\"",
42
+ },
43
+ ".placeholder":{
44
+ "prefix": ".placeholder",
45
+ "scope": "html",
46
+ "description": "placeholder,针对div、span元素,设置placeholder样式",
47
+ "body": "placeholder",
42
48
  }
43
49
  }
@@ -416,6 +416,12 @@ interface ITreeBaseContext<T> {
416
416
  * @param text 搜索文本
417
417
  */
418
418
  doSearch(text: string): void;
419
+ /**
420
+ * 是否是【已激活】节点
421
+ * @param node 要判断的节点
422
+ * @returns true 是已激活节点,false 否
423
+ */
424
+ isActived(node: TreeNode<T>): boolean;
419
425
  /**
420
426
  * 是否是【补丁】节点
421
427
  * - 子节点搜索命中时,父级路径上节点没命中,则作父级路径节点作为路径修补节点存在,避免命中子节点展示不出来
@@ -444,6 +450,13 @@ interface ITreeBaseContext<T> {
444
450
  * @returns 从【顶级节点】->【指定节点】的全路径数据
445
451
  */
446
452
  getPath(node: TreeNode<T, TreeNodeExtend>): TreeNode<T, TreeNodeExtend>[];
453
+ /**
454
+ * 获取指定【树节点】的唯一Key值
455
+ * - 相同节点确保唯一,且不变;用于唯一标记此节点
456
+ * @param node
457
+ * @returns 返回节点唯一Key值
458
+ */
459
+ getKey(node: TreeNode<T>): string;
447
460
  }
448
461
  /**
449
462
  * 树搜索结果
@@ -568,6 +581,13 @@ type TreeNodeModel<T> = TreeNode<T, TreeNodeExtend>;
568
581
  * 树节点 渲染配置选项
569
582
  */
570
583
  type TreeNodeRenderOptions = {
584
+ /**
585
+ * 节点展开层级
586
+ * - 不传入则默认展开所有
587
+ * - 否则展开传入的层级;从2开始;第一级始终展开;如2则1、2层级展开
588
+ * -
589
+ */
590
+ expandLevel?: number;
571
591
  /**
572
592
  * 是否禁用【折叠】子节点操作
573
593
  * - true 时禁用 折叠操作
@@ -585,8 +605,8 @@ type TreeNodeRenderOptions = {
585
605
  */
586
606
  type TreeNodeSlotOptions<Node> = {
587
607
  /**
588
- * 当前节点
589
- */
608
+ * 当前节点
609
+ */
590
610
  node: Node;
591
611
  /**
592
612
  * 父节点
@@ -764,6 +784,12 @@ type SelectBaseOptions<T> = {
764
784
  * - 仅针对【单选模式】生效
765
785
  */
766
786
  showPath?: boolean;
787
+ /**
788
+ * 是否显示【清空已选】按钮
789
+ * - true:则在弹窗的底部显示【清空已选】按钮,点击时清空所有已选选项
790
+ * - 若存在多级选项,仅在第一级弹窗中显示
791
+ */
792
+ showClear?: boolean;
767
793
  /**
768
794
  * 选择项 follow弹窗样式
769
795
  * - 支持指定弹窗高度,如最大高度,不指定则默认尽可能展示全
@@ -776,7 +802,7 @@ type SelectBaseOptions<T> = {
776
802
  type SelectBaseEvents<T> = {
777
803
  /**
778
804
  * 选中的【选择项】改变时
779
- * - @param values 已选的【选择项】:多级单选时,为【选择项】路径(父->子);其他情况为已选的【选择项】
805
+ * - @param values 已选的【选择项】:单选时,为【选择项】路径(父->子);其他情况为已选的【选择项】
780
806
  */
781
807
  change: [values: SelectItem<T>[]];
782
808
  };
@@ -794,7 +820,22 @@ type SelectItem<T> = TreeNode<T, TreeNodeExtend & {
794
820
  /**
795
821
  * 选项菜单组件 配置选项
796
822
  */
797
- type SelectOptions<T> = ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<T> & {};
823
+ type SelectOptions<T> = ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<T> & {
824
+ /** 父类<see cref="SelectBaseOptions"/>已有属性:
825
+ * items 【选择项】集合
826
+ * search 启用 【搜索】功能
827
+ * searchPlaceholder 搜索框提示语
828
+ * multiple 是否【多选模式】
829
+ * showPath 显示选项路径
830
+ * popupStyle 弹出的选项选择窗体样式
831
+ */
832
+ /**
833
+ * 禁用【值的路径】
834
+ * - 仅在 multiple 不为 true 时生效
835
+ * - 为true时,则v-model绑定时为单个值而非数组
836
+ */
837
+ valuePathDisabled?: boolean;
838
+ };
798
839
  /**
799
840
  * 选项菜单 组件 事件
800
841
  */
@@ -849,6 +890,20 @@ type SelectPopupOptions<T> = SelectBaseOptions<T> & {
849
890
  */
850
891
  level: number;
851
892
  };
893
+ /**
894
+ * 【选项菜单】 弹窗组件事件
895
+ */
896
+ type SelectPopupEvents<T> = {
897
+ /**
898
+ * 清空选项
899
+ */
900
+ clear: [];
901
+ /**
902
+ * 选项点击事件
903
+ * @param path 选中的【选择项】路径;父->子
904
+ */
905
+ click: [path: SelectItem<T>[]];
906
+ };
852
907
  /**
853
908
  * 【选项菜单】 弹窗组件扩展
854
909
  */
@@ -926,6 +981,18 @@ type IconOptions = TitleOptions & {
926
981
  * 图标大小:默认24
927
982
  */
928
983
  size?: number;
984
+ /**
985
+ * 轮廓描边颜色
986
+ * - 配合 strokeWidth 使用,完成图标加粗效果等
987
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Reference/Attribute/stroke
988
+ */
989
+ stroke?: string;
990
+ /**
991
+ * 轮廓宽度
992
+ * - 配合 stroke 使用,完成图标加粗效果等
993
+ * @see https://developer.mozilla.org/zh-CN/docs/Web/SVG/Reference/Attribute/stroke-width
994
+ */
995
+ strokeWidth?: number;
929
996
  /**
930
997
  * 图标绘制路径
931
998
  * - 等效 svg-path的d属性
@@ -955,10 +1022,12 @@ type IconOptions = TitleOptions & {
955
1022
  * - 指向类:
956
1023
  * - - arrow 向右箭头
957
1024
  * - 其他类:
1025
+ * - - plus 加号
1026
+ * - - subtract 减号
958
1027
  * - - grip 紧握图标,垂直方向,一般用于拖动句柄
959
1028
  * - - custom 自定义图标:此时IconOptions.draw属性传入绘制路径
960
1029
  */
961
- type IconType = "success" | "error" | "warn" | "close" | "trash" | "download" | "print" | "edit" | "arrow" | "grip" | "custom";
1030
+ type IconType = "success" | "error" | "warn" | "close" | "trash" | "download" | "print" | "edit" | "arrow" | "plus" | "subtract" | "grip" | "custom";
962
1031
 
963
1032
  /**
964
1033
  * 检查选项 数据结构
@@ -1177,9 +1246,10 @@ type SwitchEvents = {
1177
1246
  /**
1178
1247
  * 使用【树上下文】
1179
1248
  * @param nodes 树节点集合
1249
+ * @param activeNodeRef 当前激活的树节点引用;不传入,则无法实现 isActived 判断
1180
1250
  * @returns 上下文对象+作用域
1181
1251
  */
1182
- declare function useTreeContext<T>(nodes: TreeNode<T, TreeNodeExtend>[]): ITreeBaseContext<T> & IScope;
1252
+ declare function useTreeContext<T>(nodes: TreeNode<T, TreeNodeExtend>[], activeNodeRef?: ShallowRef<TreeNode<T, TreeNodeExtend>>): ITreeBaseContext<T> & IScope;
1183
1253
 
1184
1254
  /**
1185
1255
  * 使用【响应式管理器】
@@ -1217,11 +1287,11 @@ declare function triggerAppCreated(app: App, type?: AppType): App;
1217
1287
 
1218
1288
  /**
1219
1289
  * 基于类型获取Svg图标绘制路径
1220
- * @param type 图标类型
1221
- * @param color 填充颜色,不传入则使用默认的
1290
+ * @param iconType 图标类型
1291
+ * @param draw 绘制路径;自定义时生效
1222
1292
  * @returns 图标路径
1223
1293
  */
1224
- declare function getSvgDraw(options: IconOptions): string[];
1294
+ declare function getSvgDraw(iconType: IconType, draw: string[] | string): string[];
1225
1295
 
1226
1296
  /**
1227
1297
  * 排序组件 配置选项
@@ -1720,8 +1790,9 @@ interface IPopupManager {
1720
1790
  * @param type 提示类型:成功、失败、、、
1721
1791
  * @param message 提示消息
1722
1792
  * @param options 提示框配置选项
1793
+ * @returns 弹窗打开结果,外部可手动关闭弹窗
1723
1794
  */
1724
- toast(type: IconType, message: string, options?: Omit<ToastOptions, "type" | "message">): void;
1795
+ toast(type: IconType, message: string, options?: Omit<ToastOptions, "type" | "message">): IScope;
1725
1796
  }
1726
1797
 
1727
1798
  /**
@@ -1848,13 +1919,15 @@ declare const components: {
1848
1919
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
1849
1920
  Select: {
1850
1921
  new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1851
- modelValue?: SelectItem<any>[];
1922
+ valuePathDisabled?: boolean;
1923
+ } & {
1924
+ modelValue?: SelectItem<any>[] | SelectItem<any>;
1852
1925
  }> & Readonly<{
1853
1926
  onChange?: (values: SelectItem<any>[]) => any;
1854
- "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1927
+ "onUpdate:modelValue"?: (value: SelectItem<any> | SelectItem<any>[]) => any;
1855
1928
  }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1856
1929
  change: (values: SelectItem<any>[]) => any;
1857
- "update:modelValue": (value: SelectItem<any>[]) => any;
1930
+ "update:modelValue": (value: SelectItem<any> | SelectItem<any>[]) => any;
1858
1931
  }, vue.PublicProps, {}, false, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1859
1932
  P: {};
1860
1933
  B: {};
@@ -1863,22 +1936,26 @@ declare const components: {
1863
1936
  M: {};
1864
1937
  Defaults: {};
1865
1938
  }, Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1866
- modelValue?: SelectItem<any>[];
1939
+ valuePathDisabled?: boolean;
1940
+ } & {
1941
+ modelValue?: SelectItem<any>[] | SelectItem<any>;
1867
1942
  }> & Readonly<{
1868
1943
  onChange?: (values: SelectItem<any>[]) => any;
1869
- "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1944
+ "onUpdate:modelValue"?: (value: SelectItem<any> | SelectItem<any>[]) => any;
1870
1945
  }>, {}, {}, {}, {}, {}>;
1871
1946
  __isFragment?: never;
1872
1947
  __isTeleport?: never;
1873
1948
  __isSuspense?: never;
1874
1949
  } & vue.ComponentOptionsBase<Readonly<ReadonlyOptions & PlaceholderOptions & SelectBaseOptions<any> & {
1875
- modelValue?: SelectItem<any>[];
1950
+ valuePathDisabled?: boolean;
1951
+ } & {
1952
+ modelValue?: SelectItem<any>[] | SelectItem<any>;
1876
1953
  }> & Readonly<{
1877
1954
  onChange?: (values: SelectItem<any>[]) => any;
1878
- "onUpdate:modelValue"?: (value: SelectItem<any>[]) => any;
1955
+ "onUpdate:modelValue"?: (value: SelectItem<any> | SelectItem<any>[]) => any;
1879
1956
  }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1880
1957
  change: (values: SelectItem<any>[]) => any;
1881
- "update:modelValue": (value: SelectItem<any>[]) => any;
1958
+ "update:modelValue": (value: SelectItem<any> | SelectItem<any>[]) => any;
1882
1959
  }, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1883
1960
  $slots: {
1884
1961
  default?: (props: {
@@ -1990,7 +2067,10 @@ declare const components: {
1990
2067
  onTop?: () => any;
1991
2068
  onXbar?: (show: boolean) => any;
1992
2069
  onYbar?: (show: boolean) => any;
1993
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2070
+ }>, {
2071
+ scroll: (left?: number, top?: number) => void;
2072
+ scrollTo: (left?: number, top?: number) => void;
2073
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1994
2074
  left: () => any;
1995
2075
  right: () => any;
1996
2076
  bottom: () => any;
@@ -2011,7 +2091,10 @@ declare const components: {
2011
2091
  onTop?: () => any;
2012
2092
  onXbar?: (show: boolean) => any;
2013
2093
  onYbar?: (show: boolean) => any;
2014
- }>, {}, {}, {}, {}, {}>;
2094
+ }>, {
2095
+ scroll: (left?: number, top?: number) => void;
2096
+ scrollTo: (left?: number, top?: number) => void;
2097
+ }, {}, {}, {}, {}>;
2015
2098
  __isFragment?: never;
2016
2099
  __isTeleport?: never;
2017
2100
  __isSuspense?: never;
@@ -2022,7 +2105,10 @@ declare const components: {
2022
2105
  onTop?: () => any;
2023
2106
  onXbar?: (show: boolean) => any;
2024
2107
  onYbar?: (show: boolean) => any;
2025
- }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2108
+ }>, {
2109
+ scroll: (left?: number, top?: number) => void;
2110
+ scrollTo: (left?: number, top?: number) => void;
2111
+ }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2026
2112
  left: () => any;
2027
2113
  right: () => any;
2028
2114
  bottom: () => any;
@@ -2153,6 +2239,7 @@ declare const components: {
2153
2239
  onSearched?: (text: string) => any;
2154
2240
  }>, {
2155
2241
  context: ITreeBaseContext<any>;
2242
+ onTreeNodeClick: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => void;
2156
2243
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2157
2244
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
2158
2245
  searched: (text: string) => any;
@@ -2172,6 +2259,7 @@ declare const components: {
2172
2259
  onSearched?: (text: string) => any;
2173
2260
  }>, {
2174
2261
  context: ITreeBaseContext<any>;
2262
+ onTreeNodeClick: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => void;
2175
2263
  }, {}, {}, {}, {}>;
2176
2264
  __isFragment?: never;
2177
2265
  __isTeleport?: never;
@@ -2185,6 +2273,7 @@ declare const components: {
2185
2273
  onSearched?: (text: string) => any;
2186
2274
  }>, {
2187
2275
  context: ITreeBaseContext<any>;
2276
+ onTreeNodeClick: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => void;
2188
2277
  }, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
2189
2278
  click: (node: TreeNodeModel<any>, parents?: TreeNodeModel<any>[]) => any;
2190
2279
  searched: (text: string) => any;
@@ -2294,4 +2383,4 @@ declare const components: {
2294
2383
  };
2295
2384
 
2296
2385
  export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
2297
- export type { ButtonOptions, ChangeEvents, ChooseEvents, ChooseItem, ChooseOptions, ClickEvents, CloseEvents, ComponentBindOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, DeleteEvents, DialogHandle, DialogOptions, DisabledOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, EventsType, FoldEvents, FoldOptions, FoldStatus, FollowElectResult, FollowExtend, FollowHandle, FollowOptions, FollowStrategy, FollowStrategyOptions, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IPopupManager, IReactiveManager, ISelectContext, ITreeBaseContext, IconOptions, IconType, InputEvents, InputOptions, LayoutOptions, LoadingOptions, MessageOptions, MoveEvents, PlaceholderOptions, PopupDescriptor, PopupHandle, PopupOptions, PopupStatus, PopupStatusOptions, PropsType, ReactiveVar, ReadonlyOptions, ScrollEvents, ScrollOptions, ScrollStatus, 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, WrapperEvents, WrapperOptions };
2386
+ export type { ButtonOptions, ChangeEvents, ChooseEvents, ChooseItem, ChooseOptions, ClickEvents, CloseEvents, ComponentBindOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, DeleteEvents, DialogHandle, DialogOptions, DisabledOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, EventsType, FoldEvents, FoldOptions, FoldStatus, FollowElectResult, FollowExtend, FollowHandle, FollowOptions, FollowStrategy, FollowStrategyOptions, FooterEvents, FooterOptions, HeaderEvents, HeaderOptions, IPopupManager, IReactiveManager, ISelectContext, ITreeBaseContext, IconOptions, IconType, InputEvents, InputOptions, LayoutOptions, LoadingOptions, MessageOptions, MoveEvents, PlaceholderOptions, PopupDescriptor, PopupHandle, PopupOptions, PopupStatus, PopupStatusOptions, PropsType, ReactiveVar, ReadonlyOptions, ScrollEvents, ScrollOptions, ScrollStatus, SearchEvents, SearchOptions, SelectBaseEvents, SelectBaseOptions, SelectEvents, SelectItem, SelectNodeEvents, SelectNodeOptions, SelectOptions, SelectPopupEvents, SelectPopupExtend, SelectPopupOptions, SelectSlotOptions, SortEvents, SortOptions, SwitchEvents, SwitchOptions, TableColOptions, TableOptions, TableRowOptions, TitleOptions, ToastOptions, TreeEvents, TreeNode, TreeNodeEvents, TreeNodeExtend, TreeNodeModel, TreeNodeOptions, TreeNodeRenderOptions, TreeNodeSlotOptions, TreeOptions, TreeSearchResult, WrapperEvents, WrapperOptions };