snail.vue 1.0.41 → 1.0.43

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.
@@ -444,23 +444,70 @@ type ScrollOptions = {
444
444
  */
445
445
  type ScrollEvents = {
446
446
  /**
447
- * 滚动条显示、隐藏事件
448
- * - x轴是否展示,y轴是否显示
447
+ * 【x轴方向】滚动条变化时
448
+ * @param show 是否显示。true 滚动条显示;false 滚动条隐藏
449
449
  */
450
- bar: [x: boolean, y: boolean];
450
+ xbar: [show: boolean];
451
451
  /**
452
- * 滚动条触碰事件,到顶了、到底了
452
+ * 【x轴方向】滚到【最左侧】了
453
453
  */
454
- touch: [type: ScrollTouchType];
454
+ left: [];
455
+ /**
456
+ * 【x轴方向】滚到【最右侧】了
457
+ */
458
+ right: [];
459
+ /**
460
+ * 【y轴方向】滚动条变化时
461
+ * @param show 是否显示。true 滚动条显示;false 滚动条隐藏
462
+ */
463
+ ybar: [show: boolean];
464
+ /**
465
+ * 【y轴方向】滚到【最顶部】了
466
+ */
467
+ top: [];
468
+ /**
469
+ * 【y轴方向】滚到【最底部】了
470
+ */
471
+ bottom: [];
455
472
  };
456
473
  /**
457
- * 滚动触碰类型
458
- * - left 最左侧
459
- * - right 最右侧
460
- * - top 最顶部
461
- * - bottom 最底部
474
+ * 滚动视图状态
475
+ * - 缓存起来 和下次滚动做比对,触发对应事件
462
476
  */
463
- type ScrollTouchType = "left" | "right" | "top" | "bottom";
477
+ type ScrollStatus = {
478
+ /**
479
+ * 水平滚动条是否显示
480
+ */
481
+ xbar: boolean;
482
+ /**
483
+ * 垂直滚动条是否显示
484
+ */
485
+ ybar: boolean;
486
+ /**
487
+ * 滚动到【左侧】了
488
+ */
489
+ left: boolean;
490
+ /**
491
+ * 滚动到【右侧】了
492
+ */
493
+ right: boolean;
494
+ /**
495
+ * 滚动到【顶部】了
496
+ */
497
+ top: boolean;
498
+ /**
499
+ * 滚动到【底部】了
500
+ */
501
+ bottom: boolean;
502
+ /**
503
+ * 滚动视图宽度
504
+ */
505
+ scrollwidth: number;
506
+ /**
507
+ * 滚动视图高度
508
+ */
509
+ scrollheight: number;
510
+ };
464
511
 
465
512
  /**
466
513
  * Table配置选项
@@ -545,19 +592,38 @@ type ComponentOptions = {
545
592
  url?: string;
546
593
  };
547
594
  /**
548
- *
595
+ * 提取【组件事件】类型
596
+ * - 将【组件事件】中的key首字母小写,追加上on前缀;key对应的value为监听函数参数
597
+ * - T的类型约束:Record<string, unknown[]>
549
598
  */
550
- type ComponentMountOptions = ComponentOptions & {
599
+ type EventsType<Events> = Events extends Record<string, unknown[]> ? ({
600
+ [key in keyof Events as `on${Capitalize<string & key>}`]?: (...args: Events[key]) => void;
601
+ }) : never;
602
+ /**
603
+ * 提取组件的props类型
604
+ * - 有效的 Props 类型:extends Record<string, any>
605
+ * - 有效类型则返回 Props 自身;否则无效,为undefined
606
+ */
607
+ type PropsType<Props> = Props extends Record<string, any> ? Props : undefined;
608
+ /**
609
+ * 组件绑定 配置选项
610
+ * - Props、Events、Model 为可选泛型,分别约束 props、events、model 属性
611
+ * - 若泛型类型无效,则对应属性类型强制为undefined;详细参照对应属性说明
612
+ */
613
+ type ComponentBindOptions<Props = void, Model = void> = {
551
614
  /**
552
- * 挂载到哪个dom元素下
615
+ * 传递给组件的属性值,执行 v-bind 绑定
616
+ * - key为属性名称,遵循vue解析规则;若绑定事件,则key为 on事件名称 ,事件名称首字母大写
617
+ * - 通过泛型类型 Props 约束,有效类型:Props extends Record<string, any>
618
+ * @see EventsType<Events> 获取组件事件类型
553
619
  */
554
- target: Element;
620
+ props?: PropsType<Props>;
555
621
  /**
556
- * 传递给组件的属性值,执行v-bind绑定到要显示的组件
557
- * - key为属性名称,遵循vue解析规则
558
- * - 若为事件监听,则使用onXXX
622
+ * 传递给组件的双向绑定数据,执行 v-model 绑定
623
+ * - 使用 ShallowRef/Ref 包裹;推荐 ShallowRef,仅和组件进行.value值交互,避免深层双向影响性能
624
+ * - 通过泛型类型 Model 约束,有效类型: 非void、never、null、undefined等无效类型
559
625
  */
560
- props?: Record<string, any>;
626
+ model?: Model extends (void | never | null | undefined) ? undefined : (ShallowRef<Model> | Ref<Model>);
561
627
  };
562
628
 
563
629
  /**
@@ -1086,14 +1152,19 @@ type SortEvents = {
1086
1152
  };
1087
1153
 
1088
1154
  /**
1089
- * 挂载vue组件
1090
- * - 全新创建一个Vue实例挂载的传入组件
1091
- * - 用于在非vue环境下渲染vue组件内容
1155
+ * 动态加载组件 组件配置选项
1156
+ */
1157
+ type DynamicOptions<Props = void> = ComponentOptions & Pick<ComponentBindOptions<Props>, "props">;
1158
+
1159
+ /**
1160
+ * 挂载指定的Vue组件
1161
+ * - 权限构建的vue app实例,挂载传入的组件
1162
+ * @param target 挂载的目标元素
1092
1163
  * @param options 挂载配置选项
1093
1164
  * @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
1094
- * @returns
1165
+ * @returns 作用域对象,销毁挂载实例
1095
1166
  */
1096
- declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
1167
+ declare function mount<Props>(target: HTMLElement, options: DynamicOptions<Props>, onDestroyed?: (fn: () => void) => void): IScope;
1097
1168
 
1098
1169
  /**
1099
1170
  * 输入框配置选项
@@ -1145,14 +1216,9 @@ type InputEvents = {
1145
1216
  * 弹窗配置选项
1146
1217
  * - 约束弹出组件信息
1147
1218
  * - 弹出组件时传递的参数信息
1219
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1148
1220
  */
1149
- type PopupOptions = ComponentOptions & {
1150
- /**
1151
- * 传递给组件的属性值,执行v-bind绑定到要显示的组件
1152
- * - key为属性名称,遵循vue解析规则
1153
- * - 若为事件监听,则使用onXXX
1154
- */
1155
- props?: Record<string, any>;
1221
+ type PopupOptions<Props = void, Model = void> = ComponentOptions & ComponentBindOptions<Props, Model> & {
1156
1222
  /**
1157
1223
  * 弹窗动画名
1158
1224
  * - 不传则默认“snail-fade”
@@ -1259,8 +1325,9 @@ type PopupDescriptor<Options extends PopupOptions, ExtOptions> = PopupStatusOpti
1259
1325
  /**
1260
1326
  * 模态弹窗 配置选项
1261
1327
  * - 继承 ComponentOptions ,动态加载组件
1328
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1262
1329
  */
1263
- type DialogOptions = PopupOptions & {
1330
+ type DialogOptions<Props = void, Model = void> = PopupOptions<Props, Model> & {
1264
1331
  /**
1265
1332
  * 禁用【遮罩层】
1266
1333
  * - 目前没实现,先忽略
@@ -1322,8 +1389,9 @@ type ToastOptions = {
1322
1389
  /**
1323
1390
  * 跟随弹窗 配置选项
1324
1391
  * - 传入的组件,根据配置跟随 target 位置和大小;
1392
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1325
1393
  */
1326
- type FollowOptions = PopupOptions & {
1394
+ type FollowOptions<Props = void, Model = void> = PopupOptions<Props, Model> & {
1327
1395
  /**
1328
1396
  * 启用【宽度】跟随
1329
1397
  * - 为true则和 target 宽度保持一致
@@ -1477,26 +1545,29 @@ interface IPopupManager {
1477
1545
  /**
1478
1546
  * 弹出
1479
1547
  * - 弹窗位置位置、大小、动画效果等由组件自己完成
1548
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1480
1549
  * @param options 弹窗配置选项
1481
1550
  * @returns 弹窗打开结果,外部可手动关闭弹窗
1482
1551
  */
1483
- popup<T>(options: PopupOptions): IAsyncScope<T>;
1552
+ popup<T, Props = void, Model = void>(options: PopupOptions<Props, Model>): IAsyncScope<T>;
1484
1553
  /**
1485
1554
  * 对话框
1486
1555
  * - 支持指定模态和非模态对话框
1487
1556
  * - 默认垂直水平居中展示
1557
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1488
1558
  * @param options 弹窗配置选项
1489
1559
  * @returns 弹窗打开结果,外部可手动关闭弹窗
1490
1560
  */
1491
- dialog<T>(options: DialogOptions): IAsyncScope<T>;
1561
+ dialog<T, Props = void, Model = void>(options: DialogOptions<Props, Model>): IAsyncScope<T>;
1492
1562
  /**
1493
1563
  * 跟随弹窗
1494
1564
  * - 跟随指定的target对象,可跟随位置、大小
1565
+ * @see ComponentBindOptions 了解 Props、Model 泛型参数的含义
1495
1566
  * @param target 跟随的目标元素
1496
1567
  * @param options 跟随配置选项
1497
1568
  * @returns 弹窗异步作用域,外部可手动关闭弹窗
1498
1569
  */
1499
- follow<T>(target: HTMLElement, options: FollowOptions): IAsyncScope<T>;
1570
+ follow<T, Props = void, Model = void>(target: HTMLElement, options: FollowOptions<Props, Model>): IAsyncScope<T>;
1500
1571
  /**
1501
1572
  * 打开【确认】弹窗
1502
1573
  * @param title 弹窗标题
@@ -1686,18 +1757,18 @@ declare const components: {
1686
1757
  "onUpdate:modelValue"?: (value: boolean) => any;
1687
1758
  }>, {}, {}, {}, {}, string, vue.ComponentProvideOptions, true, {}, any>;
1688
1759
  Dynamic: {
1689
- new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ComponentOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, true, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1760
+ new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ComponentOptions & Pick<ComponentBindOptions<Record<string, any>>, "props">> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, true, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1690
1761
  P: {};
1691
1762
  B: {};
1692
1763
  D: {};
1693
1764
  C: {};
1694
1765
  M: {};
1695
1766
  Defaults: {};
1696
- }, Readonly<ComponentOptions> & Readonly<{}>, {}, {}, {}, {}, {}>;
1767
+ }, Readonly<ComponentOptions & Pick<ComponentBindOptions<Record<string, any>>, "props">> & Readonly<{}>, {}, {}, {}, {}, {}>;
1697
1768
  __isFragment?: never;
1698
1769
  __isTeleport?: never;
1699
1770
  __isSuspense?: never;
1700
- } & vue.ComponentOptionsBase<Readonly<ComponentOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1771
+ } & vue.ComponentOptionsBase<Readonly<ComponentOptions & Pick<ComponentBindOptions<Record<string, any>>, "props">> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1701
1772
  $slots: {
1702
1773
  [x: string]: (props: any) => any;
1703
1774
  [x: number]: (props: any) => any;
@@ -1750,18 +1821,53 @@ declare const components: {
1750
1821
  };
1751
1822
  });
1752
1823
  Scroll: {
1753
- new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ScrollOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, vue.PublicProps, {}, true, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1824
+ new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<ScrollOptions> & Readonly<{
1825
+ onLeft?: () => any;
1826
+ onRight?: () => any;
1827
+ onBottom?: () => any;
1828
+ onTop?: () => any;
1829
+ onXbar?: (show: boolean) => any;
1830
+ onYbar?: (show: boolean) => any;
1831
+ }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1832
+ left: () => any;
1833
+ right: () => any;
1834
+ bottom: () => any;
1835
+ top: () => any;
1836
+ xbar: (show: boolean) => any;
1837
+ ybar: (show: boolean) => any;
1838
+ }, vue.PublicProps, {}, true, {}, {}, vue.GlobalComponents, vue.GlobalDirectives, string, {}, any, vue.ComponentProvideOptions, {
1754
1839
  P: {};
1755
1840
  B: {};
1756
1841
  D: {};
1757
1842
  C: {};
1758
1843
  M: {};
1759
1844
  Defaults: {};
1760
- }, Readonly<ScrollOptions> & Readonly<{}>, {}, {}, {}, {}, {}>;
1845
+ }, Readonly<ScrollOptions> & Readonly<{
1846
+ onLeft?: () => any;
1847
+ onRight?: () => any;
1848
+ onBottom?: () => any;
1849
+ onTop?: () => any;
1850
+ onXbar?: (show: boolean) => any;
1851
+ onYbar?: (show: boolean) => any;
1852
+ }>, {}, {}, {}, {}, {}>;
1761
1853
  __isFragment?: never;
1762
1854
  __isTeleport?: never;
1763
1855
  __isSuspense?: never;
1764
- } & vue.ComponentOptionsBase<Readonly<ScrollOptions> & Readonly<{}>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {}, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1856
+ } & vue.ComponentOptionsBase<Readonly<ScrollOptions> & Readonly<{
1857
+ onLeft?: () => any;
1858
+ onRight?: () => any;
1859
+ onBottom?: () => any;
1860
+ onTop?: () => any;
1861
+ onXbar?: (show: boolean) => any;
1862
+ onYbar?: (show: boolean) => any;
1863
+ }>, {}, {}, {}, {}, vue.ComponentOptionsMixin, vue.ComponentOptionsMixin, {
1864
+ left: () => any;
1865
+ right: () => any;
1866
+ bottom: () => any;
1867
+ top: () => any;
1868
+ xbar: (show: boolean) => any;
1869
+ ybar: (show: boolean) => any;
1870
+ }, string, {}, {}, string, {}, vue.GlobalComponents, vue.GlobalDirectives, string, vue.ComponentProvideOptions> & vue.VNodeProps & vue.AllowedComponentProps & vue.ComponentCustomProps & (new () => {
1765
1871
  $slots: {
1766
1872
  default?: (props: {}) => any;
1767
1873
  };
@@ -1991,4 +2097,4 @@ declare const components: {
1991
2097
  };
1992
2098
 
1993
2099
  export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
1994
- 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 };
2100
+ export type { ButtonOptions, ChooseEvents, ChooseItem, ChooseOptions, ComponentBindOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, 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, LoadingOptions, MessageOptions, 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 };
package/dist/snail.vue.js CHANGED
@@ -1,7 +1,7 @@
1
1
  //@ sourceURL=/snail.vue.js
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';
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, isRef, getCurrentInstance, nextTick, useTemplateRef, resolveComponent, onBeforeUnmount, getCurrentScope, onScopeDispose } from 'vue';
3
3
  import { isArray, newId, throwError, isArrayNotEmpty, isStringNotEmpty, mustFunction, useScope, removeFromArray, mustObject, throwIfFalse, isObject, isNumberNotNaN, mountScope, useScopes, 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",
@@ -152,7 +152,7 @@ var _sfc_main$p = defineComponent({
152
152
  function getSvgDraw(options) {
153
153
  switch (options.type) {
154
154
  case "success":
155
- return ["M384.12 821.116c-11.919 0-23.838-4.527-32.937-13.573L77.63 535.333c-18.196-18.108-18.196-47.457 0-65.558 18.196-18.107 47.675-18.1 65.871-0.007l240.62 239.436 495.173-492.739c18.197-18.107 47.675-18.107 65.871 0 18.197 18.1 18.197 47.45 0 65.557L417.056 807.536c-9.1 9.053-21.018 13.58-32.937 13.58z"];
155
+ return ["M 102.272 613.285 a 48.9258 48.9258 0 0 1 -1.34967 -62.8444 l 26.0656 -31.2113 a 50.6129 50.6129 0 0 1 62.6756 -11.2192 l 199.583 121.218 c 19.4859 11.8097 49.0102 8.26677 65.9655 -8.01371 l 540.714 -519.625 a 40.3216 40.3216 0 0 1 57.9518 1.6871 l 37.9597 43.3583 a 47.5762 47.5762 0 0 1 -0.843545 62.4226 L 452.766 920.675 a 38.4658 38.4658 0 0 1 -56.8553 1.18097 L 102.272 613.285 Z"];
156
156
  case "close":
157
157
  case "error":
158
158
  return ["M 571.733 512 l 187.733 -187.733 c 17.0667 -17.0667 17.0667 -42.6667 0 -59.7333 c -17.0667 -17.0667 -42.6667 -17.0667 -59.7333 0 L 512 452.267 L 324.267 268.8 c -17.0667 -17.0667 -42.6667 -17.0667 -59.7333 0 c -17.0667 17.0667 -17.0667 42.6667 0 59.7333 l 187.733 187.733 l -187.733 187.733 c -17.0667 17.0667 -17.0667 42.6667 0 59.7333 c 17.0667 17.0667 42.6667 17.0667 59.7333 0 l 187.733 -187.733 l 187.733 187.733 c 17.0667 17.0667 42.6667 17.0667 59.7333 0 c 17.0667 -17.0667 17.0667 -42.6667 0 -59.7333 L 571.733 512 Z"];
@@ -688,7 +688,10 @@ var _sfc_main$j = defineComponent({
688
688
  props: {
689
689
  name: {},
690
690
  component: {},
691
- url: {}
691
+ url: {},
692
+ props: {
693
+ default: () => ({})
694
+ }
692
695
  },
693
696
  setup(__props) {
694
697
  const {
@@ -735,10 +738,10 @@ var _sfc_main$j = defineComponent({
735
738
  }
736
739
  });
737
740
  return (_ctx, _cache) => {
738
- return openBlock(), createElementBlock(Fragment, null, [(openBlock(), createBlock(resolveDynamicComponent(dynamicComponentRef.value), mergeProps(_ctx.$attrs, {
741
+ return openBlock(), createElementBlock(Fragment, null, [(openBlock(), createBlock(resolveDynamicComponent(dynamicComponentRef.value), mergeProps({
739
742
  ref_key: "componentRef",
740
743
  ref: componentRef
741
- }), createSlots({
744
+ }, _ctx.props, _ctx.$attrs), createSlots({
742
745
  _: 2
743
746
  }, [renderList(_ctx.$slots, (_, name) => {
744
747
  return {
@@ -772,6 +775,10 @@ var _sfc_main$i = defineComponent({
772
775
  popupTransition: {}
773
776
  },
774
777
  setup(__props) {
778
+ const {
779
+ props,
780
+ model = shallowRef(void 0)
781
+ } = __props.options;
775
782
  const {
776
783
  closePopup,
777
784
  onBeforeClose
@@ -795,15 +802,19 @@ var _sfc_main$i = defineComponent({
795
802
  style: normalizeStyle({
796
803
  "z-index": _ctx.zIndex
797
804
  }),
798
- onClick: _cache[0] || (_cache[0] = withModifiers($event => {
805
+ onClick: _cache[1] || (_cache[1] = withModifiers($event => {
799
806
  _ctx.options.closeOnMask && unref(closePopup)();
800
807
  }, ["self"]))
801
808
  }, [createVNode(_sfc_main$j, mergeProps({
802
809
  class: "dialog-body",
803
810
  name: _ctx.options.name,
804
811
  component: _ctx.options.component,
805
- url: _ctx.options.url
806
- }, _ctx.options.props, unref(dialogExtend)), null, 16, ["name", "component", "url"])], 6);
812
+ url: _ctx.options.url,
813
+ props: unref(props)
814
+ }, unref(dialogExtend), {
815
+ modelValue: unref(model),
816
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => isRef(model) ? model.value = $event : null)
817
+ }), null, 16, ["name", "component", "url", "props", "modelValue"])], 6);
807
818
  };
808
819
  }
809
820
  });
@@ -823,6 +834,10 @@ var _sfc_main$h = defineComponent({
823
834
  popupTransition: {}
824
835
  },
825
836
  setup(__props) {
837
+ const {
838
+ props,
839
+ model = shallowRef(void 0)
840
+ } = __props.options;
826
841
  const {
827
842
  closePopup
828
843
  } = __props.extOptions;
@@ -891,6 +906,7 @@ var _sfc_main$h = defineComponent({
891
906
  width: rootRect.width,
892
907
  height: rootRect.height
893
908
  });
909
+ rootDom.value.classList.remove("initial");
894
910
  console.log("-- content rect: ", rootRect, rootDom.value);
895
911
  }
896
912
  console.groupEnd();
@@ -915,14 +931,18 @@ var _sfc_main$h = defineComponent({
915
931
  });
916
932
  return (_ctx, _cache) => {
917
933
  return openBlock(), createBlock(_sfc_main$j, mergeProps({
918
- class: ["snail-follow", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
934
+ class: ["snail-follow initial", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
919
935
  style: {
920
936
  "z-index": _ctx.zIndex
921
937
  },
922
938
  name: _ctx.options.name,
923
939
  component: _ctx.options.component,
924
- url: _ctx.options.url
925
- }, _ctx.options.props, unref(followExt)), null, 16, ["class", "style", "name", "component", "url"]);
940
+ url: _ctx.options.url,
941
+ props: unref(props)
942
+ }, unref(followExt), {
943
+ modelValue: unref(model),
944
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => isRef(model) ? model.value = $event : null)
945
+ }), null, 16, ["class", "style", "name", "component", "url", "props", "modelValue"]);
926
946
  };
927
947
  }
928
948
  });
@@ -942,8 +962,10 @@ var _sfc_main$g = defineComponent({
942
962
  popupTransition: {}
943
963
  },
944
964
  setup(__props) {
945
- const loadingRef = shallowRef(false);
946
- onMounted(() => loadingRef.value = true);
965
+ const {
966
+ props,
967
+ model = shallowRef(void 0)
968
+ } = __props.options;
947
969
  return (_ctx, _cache) => {
948
970
  return openBlock(), createBlock(_sfc_main$j, mergeProps({
949
971
  class: ["snail-popup", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
@@ -952,11 +974,12 @@ var _sfc_main$g = defineComponent({
952
974
  },
953
975
  name: _ctx.options.name,
954
976
  component: _ctx.options.component,
955
- url: _ctx.options.url
956
- }, _ctx.options.props, {
957
- "in-popup": true,
958
- "close-popup": _ctx.extOptions.closePopup
959
- }), null, 16, ["class", "style", "name", "component", "url", "close-popup"]);
977
+ url: _ctx.options.url,
978
+ props: unref(props)
979
+ }, _ctx.extOptions, {
980
+ modelValue: unref(model),
981
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => isRef(model) ? model.value = $event : null)
982
+ }), null, 16, ["class", "style", "name", "component", "url", "props", "modelValue"]);
960
983
  };
961
984
  }
962
985
  });
@@ -1015,8 +1038,8 @@ var _sfc_main$f = defineComponent({
1015
1038
  })
1016
1039
  }, null, 8, ["fill"]), unref(props).type ? (openBlock(), createElementBlock("div", _hoisted_1$9, [createVNode(_sfc_main$o, {
1017
1040
  type: unref(props).type,
1018
- fill: "black",
1019
- size: 18
1041
+ fill: "#707070",
1042
+ size: 20
1020
1043
  }, null, 8, ["type"])])) : createCommentVNode("", true), createElementVNode("div", {
1021
1044
  class: "message",
1022
1045
  innerHTML: unref(props).message
@@ -1279,7 +1302,7 @@ var _sfc_main$c = defineComponent({
1279
1302
  followY: {},
1280
1303
  pinned: {}
1281
1304
  },
1282
- emits: ["change", "search"],
1305
+ emits: ["change"],
1283
1306
  setup(__props, _ref) {
1284
1307
  let {
1285
1308
  emit: __emit
@@ -1615,16 +1638,15 @@ var _sfc_main$b = defineComponent({
1615
1638
  closeOnMask: true,
1616
1639
  closeOnResize: true,
1617
1640
  closeOnTarget: true,
1618
- props: Object.freeze(Object.assign({
1641
+ props: {
1619
1642
  items: props.items,
1620
1643
  context,
1621
1644
  level: 1,
1622
1645
  search: props.search,
1623
1646
  multiple: props.multiple,
1624
- popupStyle: props.popupStyle
1625
- }, {
1647
+ popupStyle: props.popupStyle,
1626
1648
  onChange: onSelectItemChange
1627
- }))
1649
+ }
1628
1650
  });
1629
1651
  await followScope;
1630
1652
  followScope = void 0;
@@ -1825,18 +1847,81 @@ var _sfc_main$8 = defineComponent({
1825
1847
  type: Boolean
1826
1848
  }
1827
1849
  },
1828
- setup(__props) {
1850
+ emits: ["xbar", "left", "right", "ybar", "top", "bottom"],
1851
+ setup(__props, _ref) {
1852
+ let {
1853
+ emit: __emit
1854
+ } = _ref;
1829
1855
  const props = __props;
1830
- console.warn("scroll 的事件还没实现");
1831
- onActivated(() => console.log("onActivated"));
1832
- onDeactivated(() => console.log("onDeactivated"));
1856
+ const emits = __emit;
1857
+ const rootDom = useTemplateRef("scroll-root");
1858
+ const {
1859
+ onSize
1860
+ } = useObserver();
1861
+ const {
1862
+ onInterval
1863
+ } = useTimer();
1864
+ const classRef = computed(() => ({
1865
+ "scroll-x": props.scrollX == true,
1866
+ "scroll-y": props.scrollY == true
1867
+ }));
1868
+ var preStatus = void 0;
1869
+ function refreshScrollInfo() {
1870
+ const status = {
1871
+ xbar: rootDom.value.scrollWidth > rootDom.value.clientWidth,
1872
+ ybar: rootDom.value.scrollHeight > rootDom.value.clientHeight,
1873
+ left: false,
1874
+ right: false,
1875
+ top: false,
1876
+ bottom: false,
1877
+ scrollwidth: rootDom.value.scrollWidth,
1878
+ scrollheight: rootDom.value.scrollHeight
1879
+ };
1880
+ if (status.xbar == true) {
1881
+ status.left = rootDom.value.scrollLeft == 0;
1882
+ status.right = rootDom.value.scrollLeft + rootDom.value.clientWidth == rootDom.value.scrollWidth;
1883
+ }
1884
+ if (status.ybar == true) {
1885
+ status.top = rootDom.value.scrollTop == 0;
1886
+ status.bottom = rootDom.value.scrollTop + rootDom.value.clientHeight == rootDom.value.scrollHeight;
1887
+ }
1888
+ Object.freeze(status);
1889
+ const events = Object.create(null);
1890
+ if (preStatus != void 0) {
1891
+ preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
1892
+ preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
1893
+ if (preStatus.xbar == true && status.xbar == true) {
1894
+ status.left && preStatus.left !== status.left && (events.left = []);
1895
+ status.right && preStatus.right !== status.right && (events.right = []);
1896
+ }
1897
+ if (preStatus.ybar == true && status.ybar == true) {
1898
+ status.top && preStatus.top !== status.top && (events.top = []);
1899
+ status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
1900
+ }
1901
+ }
1902
+ preStatus = status;
1903
+ preStatus = Object.freeze(status);
1904
+ events.xbar && emits("xbar", ...events.xbar);
1905
+ events.left && emits("left");
1906
+ events.right && emits("right");
1907
+ events.ybar && emits("ybar", ...events.ybar);
1908
+ events.top && emits("top");
1909
+ events.bottom && emits("bottom");
1910
+ }
1911
+ onMounted(() => {
1912
+ refreshScrollInfo();
1913
+ onSize(rootDom.value, refreshScrollInfo);
1914
+ onInterval(() => {
1915
+ const isChange = preStatus.scrollwidth != rootDom.value.scrollWidth || preStatus.scrollheight != rootDom.value.scrollHeight;
1916
+ isChange && refreshScrollInfo();
1917
+ }, 100);
1918
+ });
1833
1919
  return (_ctx, _cache) => {
1834
1920
  return openBlock(), createElementBlock("div", {
1835
- class: normalizeClass(["snail-scroll", {
1836
- "scroll-x": props.scrollX == true,
1837
- "scroll-y": props.scrollY == true
1838
- }])
1839
- }, [renderSlot(_ctx.$slots, "default")], 2);
1921
+ class: normalizeClass(["snail-scroll", classRef.value]),
1922
+ ref: "scroll-root",
1923
+ onScroll: refreshScrollInfo
1924
+ }, [renderSlot(_ctx.$slots, "default")], 34);
1840
1925
  };
1841
1926
  }
1842
1927
  });
@@ -2221,18 +2306,13 @@ var _sfc_main$2 = defineComponent({
2221
2306
  }
2222
2307
  });
2223
2308
 
2224
- function mount(options, onDestroyed) {
2309
+ function mount(target, options, onDestroyed) {
2225
2310
  mustObject(options, "options");
2226
- options.target instanceof HTMLElement || throwError("options.target must be a HTMLElement");
2227
- options.target.classList.add("snail-app");
2228
- const app = createApp(_sfc_main$j, {
2229
- name: options.name,
2230
- compponent: options.component,
2231
- url: options.url,
2232
- ...(options.props || {})
2233
- });
2311
+ target instanceof HTMLElement || throwError("target must be a HTMLElement");
2312
+ target.classList.add("snail-app");
2313
+ const app = createApp(_sfc_main$j, options);
2234
2314
  triggerAppCreated(app);
2235
- app.mount(options.target);
2315
+ app.mount(target);
2236
2316
  const scope = useScope().onDestroy(() => app.unmount());
2237
2317
  isFunction(onDestroyed) && onDestroyed(scope.destroy);
2238
2318
  return scope;
@@ -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",
@@ -154,7 +154,7 @@
154
154
  function getSvgDraw(options) {
155
155
  switch (options.type) {
156
156
  case "success":
157
- return ["M384.12 821.116c-11.919 0-23.838-4.527-32.937-13.573L77.63 535.333c-18.196-18.108-18.196-47.457 0-65.558 18.196-18.107 47.675-18.1 65.871-0.007l240.62 239.436 495.173-492.739c18.197-18.107 47.675-18.107 65.871 0 18.197 18.1 18.197 47.45 0 65.557L417.056 807.536c-9.1 9.053-21.018 13.58-32.937 13.58z"];
157
+ return ["M 102.272 613.285 a 48.9258 48.9258 0 0 1 -1.34967 -62.8444 l 26.0656 -31.2113 a 50.6129 50.6129 0 0 1 62.6756 -11.2192 l 199.583 121.218 c 19.4859 11.8097 49.0102 8.26677 65.9655 -8.01371 l 540.714 -519.625 a 40.3216 40.3216 0 0 1 57.9518 1.6871 l 37.9597 43.3583 a 47.5762 47.5762 0 0 1 -0.843545 62.4226 L 452.766 920.675 a 38.4658 38.4658 0 0 1 -56.8553 1.18097 L 102.272 613.285 Z"];
158
158
  case "close":
159
159
  case "error":
160
160
  return ["M 571.733 512 l 187.733 -187.733 c 17.0667 -17.0667 17.0667 -42.6667 0 -59.7333 c -17.0667 -17.0667 -42.6667 -17.0667 -59.7333 0 L 512 452.267 L 324.267 268.8 c -17.0667 -17.0667 -42.6667 -17.0667 -59.7333 0 c -17.0667 17.0667 -17.0667 42.6667 0 59.7333 l 187.733 187.733 l -187.733 187.733 c -17.0667 17.0667 -17.0667 42.6667 0 59.7333 c 17.0667 17.0667 42.6667 17.0667 59.7333 0 l 187.733 -187.733 l 187.733 187.733 c 17.0667 17.0667 42.6667 17.0667 59.7333 0 c 17.0667 -17.0667 17.0667 -42.6667 0 -59.7333 L 571.733 512 Z"];
@@ -690,7 +690,10 @@
690
690
  props: {
691
691
  name: {},
692
692
  component: {},
693
- url: {}
693
+ url: {},
694
+ props: {
695
+ default: () => ({})
696
+ }
694
697
  },
695
698
  setup(__props) {
696
699
  const {
@@ -737,10 +740,10 @@
737
740
  }
738
741
  });
739
742
  return (_ctx, _cache) => {
740
- return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(dynamicComponentRef.value), vue.mergeProps(_ctx.$attrs, {
743
+ return vue.openBlock(), vue.createElementBlock(vue.Fragment, null, [(vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(dynamicComponentRef.value), vue.mergeProps({
741
744
  ref_key: "componentRef",
742
745
  ref: componentRef
743
- }), vue.createSlots({
746
+ }, _ctx.props, _ctx.$attrs), vue.createSlots({
744
747
  _: 2
745
748
  }, [vue.renderList(_ctx.$slots, (_, name) => {
746
749
  return {
@@ -774,6 +777,10 @@
774
777
  popupTransition: {}
775
778
  },
776
779
  setup(__props) {
780
+ const {
781
+ props,
782
+ model = vue.shallowRef(void 0)
783
+ } = __props.options;
777
784
  const {
778
785
  closePopup,
779
786
  onBeforeClose
@@ -797,15 +804,19 @@
797
804
  style: vue.normalizeStyle({
798
805
  "z-index": _ctx.zIndex
799
806
  }),
800
- onClick: _cache[0] || (_cache[0] = vue.withModifiers($event => {
807
+ onClick: _cache[1] || (_cache[1] = vue.withModifiers($event => {
801
808
  _ctx.options.closeOnMask && vue.unref(closePopup)();
802
809
  }, ["self"]))
803
810
  }, [vue.createVNode(_sfc_main$j, vue.mergeProps({
804
811
  class: "dialog-body",
805
812
  name: _ctx.options.name,
806
813
  component: _ctx.options.component,
807
- url: _ctx.options.url
808
- }, _ctx.options.props, vue.unref(dialogExtend)), null, 16, ["name", "component", "url"])], 6);
814
+ url: _ctx.options.url,
815
+ props: vue.unref(props)
816
+ }, vue.unref(dialogExtend), {
817
+ modelValue: vue.unref(model),
818
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => vue.isRef(model) ? model.value = $event : null)
819
+ }), null, 16, ["name", "component", "url", "props", "modelValue"])], 6);
809
820
  };
810
821
  }
811
822
  });
@@ -825,6 +836,10 @@
825
836
  popupTransition: {}
826
837
  },
827
838
  setup(__props) {
839
+ const {
840
+ props,
841
+ model = vue.shallowRef(void 0)
842
+ } = __props.options;
828
843
  const {
829
844
  closePopup
830
845
  } = __props.extOptions;
@@ -893,6 +908,7 @@
893
908
  width: rootRect.width,
894
909
  height: rootRect.height
895
910
  });
911
+ rootDom.value.classList.remove("initial");
896
912
  console.log("-- content rect: ", rootRect, rootDom.value);
897
913
  }
898
914
  console.groupEnd();
@@ -917,14 +933,18 @@
917
933
  });
918
934
  return (_ctx, _cache) => {
919
935
  return vue.openBlock(), vue.createBlock(_sfc_main$j, vue.mergeProps({
920
- class: ["snail-follow", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
936
+ class: ["snail-follow initial", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
921
937
  style: {
922
938
  "z-index": _ctx.zIndex
923
939
  },
924
940
  name: _ctx.options.name,
925
941
  component: _ctx.options.component,
926
- url: _ctx.options.url
927
- }, _ctx.options.props, vue.unref(followExt)), null, 16, ["class", "style", "name", "component", "url"]);
942
+ url: _ctx.options.url,
943
+ props: vue.unref(props)
944
+ }, vue.unref(followExt), {
945
+ modelValue: vue.unref(model),
946
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => vue.isRef(model) ? model.value = $event : null)
947
+ }), null, 16, ["class", "style", "name", "component", "url", "props", "modelValue"]);
928
948
  };
929
949
  }
930
950
  });
@@ -944,8 +964,10 @@
944
964
  popupTransition: {}
945
965
  },
946
966
  setup(__props) {
947
- const loadingRef = vue.shallowRef(false);
948
- vue.onMounted(() => loadingRef.value = true);
967
+ const {
968
+ props,
969
+ model = vue.shallowRef(void 0)
970
+ } = __props.options;
949
971
  return (_ctx, _cache) => {
950
972
  return vue.openBlock(), vue.createBlock(_sfc_main$j, vue.mergeProps({
951
973
  class: ["snail-popup", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
@@ -954,11 +976,12 @@
954
976
  },
955
977
  name: _ctx.options.name,
956
978
  component: _ctx.options.component,
957
- url: _ctx.options.url
958
- }, _ctx.options.props, {
959
- "in-popup": true,
960
- "close-popup": _ctx.extOptions.closePopup
961
- }), null, 16, ["class", "style", "name", "component", "url", "close-popup"]);
979
+ url: _ctx.options.url,
980
+ props: vue.unref(props)
981
+ }, _ctx.extOptions, {
982
+ modelValue: vue.unref(model),
983
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = $event => vue.isRef(model) ? model.value = $event : null)
984
+ }), null, 16, ["class", "style", "name", "component", "url", "props", "modelValue"]);
962
985
  };
963
986
  }
964
987
  });
@@ -1017,8 +1040,8 @@
1017
1040
  })
1018
1041
  }, null, 8, ["fill"]), vue.unref(props).type ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [vue.createVNode(_sfc_main$o, {
1019
1042
  type: vue.unref(props).type,
1020
- fill: "black",
1021
- size: 18
1043
+ fill: "#707070",
1044
+ size: 20
1022
1045
  }, null, 8, ["type"])])) : vue.createCommentVNode("", true), vue.createElementVNode("div", {
1023
1046
  class: "message",
1024
1047
  innerHTML: vue.unref(props).message
@@ -1281,7 +1304,7 @@
1281
1304
  followY: {},
1282
1305
  pinned: {}
1283
1306
  },
1284
- emits: ["change", "search"],
1307
+ emits: ["change"],
1285
1308
  setup(__props, _ref) {
1286
1309
  let {
1287
1310
  emit: __emit
@@ -1617,16 +1640,15 @@
1617
1640
  closeOnMask: true,
1618
1641
  closeOnResize: true,
1619
1642
  closeOnTarget: true,
1620
- props: Object.freeze(Object.assign({
1643
+ props: {
1621
1644
  items: props.items,
1622
1645
  context,
1623
1646
  level: 1,
1624
1647
  search: props.search,
1625
1648
  multiple: props.multiple,
1626
- popupStyle: props.popupStyle
1627
- }, {
1649
+ popupStyle: props.popupStyle,
1628
1650
  onChange: onSelectItemChange
1629
- }))
1651
+ }
1630
1652
  });
1631
1653
  await followScope;
1632
1654
  followScope = void 0;
@@ -1827,18 +1849,81 @@
1827
1849
  type: Boolean
1828
1850
  }
1829
1851
  },
1830
- setup(__props) {
1852
+ emits: ["xbar", "left", "right", "ybar", "top", "bottom"],
1853
+ setup(__props, _ref) {
1854
+ let {
1855
+ emit: __emit
1856
+ } = _ref;
1831
1857
  const props = __props;
1832
- console.warn("scroll 的事件还没实现");
1833
- vue.onActivated(() => console.log("onActivated"));
1834
- vue.onDeactivated(() => console.log("onDeactivated"));
1858
+ const emits = __emit;
1859
+ const rootDom = vue.useTemplateRef("scroll-root");
1860
+ const {
1861
+ onSize
1862
+ } = snail_view.useObserver();
1863
+ const {
1864
+ onInterval
1865
+ } = snail_core.useTimer();
1866
+ const classRef = vue.computed(() => ({
1867
+ "scroll-x": props.scrollX == true,
1868
+ "scroll-y": props.scrollY == true
1869
+ }));
1870
+ var preStatus = void 0;
1871
+ function refreshScrollInfo() {
1872
+ const status = {
1873
+ xbar: rootDom.value.scrollWidth > rootDom.value.clientWidth,
1874
+ ybar: rootDom.value.scrollHeight > rootDom.value.clientHeight,
1875
+ left: false,
1876
+ right: false,
1877
+ top: false,
1878
+ bottom: false,
1879
+ scrollwidth: rootDom.value.scrollWidth,
1880
+ scrollheight: rootDom.value.scrollHeight
1881
+ };
1882
+ if (status.xbar == true) {
1883
+ status.left = rootDom.value.scrollLeft == 0;
1884
+ status.right = rootDom.value.scrollLeft + rootDom.value.clientWidth == rootDom.value.scrollWidth;
1885
+ }
1886
+ if (status.ybar == true) {
1887
+ status.top = rootDom.value.scrollTop == 0;
1888
+ status.bottom = rootDom.value.scrollTop + rootDom.value.clientHeight == rootDom.value.scrollHeight;
1889
+ }
1890
+ Object.freeze(status);
1891
+ const events = Object.create(null);
1892
+ if (preStatus != void 0) {
1893
+ preStatus.xbar != status.xbar && (events.xbar = [status.xbar]);
1894
+ preStatus.ybar != status.ybar && (events.ybar = [status.ybar]);
1895
+ if (preStatus.xbar == true && status.xbar == true) {
1896
+ status.left && preStatus.left !== status.left && (events.left = []);
1897
+ status.right && preStatus.right !== status.right && (events.right = []);
1898
+ }
1899
+ if (preStatus.ybar == true && status.ybar == true) {
1900
+ status.top && preStatus.top !== status.top && (events.top = []);
1901
+ status.bottom && preStatus.bottom !== status.bottom && (events.bottom = []);
1902
+ }
1903
+ }
1904
+ preStatus = status;
1905
+ preStatus = Object.freeze(status);
1906
+ events.xbar && emits("xbar", ...events.xbar);
1907
+ events.left && emits("left");
1908
+ events.right && emits("right");
1909
+ events.ybar && emits("ybar", ...events.ybar);
1910
+ events.top && emits("top");
1911
+ events.bottom && emits("bottom");
1912
+ }
1913
+ vue.onMounted(() => {
1914
+ refreshScrollInfo();
1915
+ onSize(rootDom.value, refreshScrollInfo);
1916
+ onInterval(() => {
1917
+ const isChange = preStatus.scrollwidth != rootDom.value.scrollWidth || preStatus.scrollheight != rootDom.value.scrollHeight;
1918
+ isChange && refreshScrollInfo();
1919
+ }, 100);
1920
+ });
1835
1921
  return (_ctx, _cache) => {
1836
1922
  return vue.openBlock(), vue.createElementBlock("div", {
1837
- class: vue.normalizeClass(["snail-scroll", {
1838
- "scroll-x": props.scrollX == true,
1839
- "scroll-y": props.scrollY == true
1840
- }])
1841
- }, [vue.renderSlot(_ctx.$slots, "default")], 2);
1923
+ class: vue.normalizeClass(["snail-scroll", classRef.value]),
1924
+ ref: "scroll-root",
1925
+ onScroll: refreshScrollInfo
1926
+ }, [vue.renderSlot(_ctx.$slots, "default")], 34);
1842
1927
  };
1843
1928
  }
1844
1929
  });
@@ -2223,18 +2308,13 @@
2223
2308
  }
2224
2309
  });
2225
2310
 
2226
- function mount(options, onDestroyed) {
2311
+ function mount(target, options, onDestroyed) {
2227
2312
  snail_core.mustObject(options, "options");
2228
- options.target instanceof HTMLElement || snail_core.throwError("options.target must be a HTMLElement");
2229
- options.target.classList.add("snail-app");
2230
- const app = vue.createApp(_sfc_main$j, {
2231
- name: options.name,
2232
- compponent: options.component,
2233
- url: options.url,
2234
- ...(options.props || {})
2235
- });
2313
+ target instanceof HTMLElement || snail_core.throwError("target must be a HTMLElement");
2314
+ target.classList.add("snail-app");
2315
+ const app = vue.createApp(_sfc_main$j, options);
2236
2316
  triggerAppCreated(app);
2237
- app.mount(options.target);
2317
+ app.mount(target);
2238
2318
  const scope = snail_core.useScope().onDestroy(() => app.unmount());
2239
2319
  snail_core.isFunction(onDestroyed) && onDestroyed(scope.destroy);
2240
2320
  return scope;
@@ -1,53 +1,53 @@
1
- /* src:base\choose.vue index:0 */
2
- .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
1
  /* src:base\button.vue index:0 */
4
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}
5
5
  /* src:base\footer.vue index:0 */
6
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
7
  /* src:base\header.vue index:0 */
8
8
  .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}
9
- /* src:base\search.vue index:0 */
10
- .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}
11
9
  /* src:base\icon.vue index:0 */
12
10
  .snail-icon{cursor:pointer;opacity:1}
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
13
  /* src:base\select.vue index:0 */
14
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;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}
15
15
  /* src:base\switch.vue index:0 */
16
16
  .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:not-allowed}
17
- /* src:container\dynamic.vue index:0 */
18
- .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
19
17
  /* src:container\fold.vue index:0 */
20
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-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
19
  /* src:container\scroll.vue index:0 */
22
20
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
21
+ /* src:container\dynamic.vue index:0 */
22
+ .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
23
23
  /* src:container\sort.vue index:0 */
24
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}
25
25
  /* src:container\table.vue index:0 */
26
26
  .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}
27
- /* src:container\components\table-col.vue index:0 */
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
27
  /* src:container\components\table-row.vue index:0 */
30
28
  .table-row{align-items:center;display:flex}
31
- /* src:container\tree.vue index:0 */
32
- .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}
33
29
  /* src:form\input.vue index:0 */
34
30
  .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}
31
+ /* src:container\tree.vue index:0 */
32
+ .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}
33
+ /* src:container\components\table-col.vue index:0 */
34
+ .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}
35
35
  /* src:prompt\drag-verify.vue index:0 */
36
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}}
37
37
  /* src:prompt\empty.vue index:0 */
38
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-weight:400;padding:0 10px 10px}
39
39
  /* src:prompt\loading.vue index:0 */
40
40
  .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;margin:20px 40px;overflow:auto;word-wrap:break-word}
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)}
43
+ /* 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;margin:20px 40px;overflow:auto;word-wrap:break-word}
45
+ /* src:popup\components\follow-container.vue index:0 */
46
+ .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}.snail-follow.initial{top:100%;transition:none}
45
47
  /* src:popup\components\popup-container.vue index:0 */
46
48
  .snail-popup{left:0;position:fixed;top:0}
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\toast-container.vue index:0 */
50
- .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}
50
+ .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;padding:2px}.snail-toast>div.message{flex:1;line-height:24px;overflow:hidden;word-break:break-all}
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.41",
6
+ "version": "1.0.43",
7
7
  "type": "module",
8
8
  "main": "dist/snail.vue.js",
9
9
  "module": "dist/snail.vue.js",