snail.vue 1.0.42 → 1.0.44

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.
@@ -596,7 +596,7 @@ type ComponentOptions = {
596
596
  * - 将【组件事件】中的key首字母小写,追加上on前缀;key对应的value为监听函数参数
597
597
  * - T的类型约束:Record<string, unknown[]>
598
598
  */
599
- type ExtractComponentEvents<Events> = Events extends Record<string, unknown[]> ? ({
599
+ type EventsType<Events> = Events extends Record<string, unknown[]> ? ({
600
600
  [key in keyof Events as `on${Capitalize<string & key>}`]?: (...args: Events[key]) => void;
601
601
  }) : never;
602
602
  /**
@@ -604,7 +604,7 @@ type ExtractComponentEvents<Events> = Events extends Record<string, unknown[]> ?
604
604
  * - 有效的 Props 类型:extends Record<string, any>
605
605
  * - 有效类型则返回 Props 自身;否则无效,为undefined
606
606
  */
607
- type ExtractComponentProps<Props> = Props extends Record<string, any> ? Props : undefined;
607
+ type PropsType<Props> = Props extends Record<string, any> ? Props : undefined;
608
608
  /**
609
609
  * 组件绑定 配置选项
610
610
  * - Props、Events、Model 为可选泛型,分别约束 props、events、model 属性
@@ -615,9 +615,9 @@ type ComponentBindOptions<Props = void, Model = void> = {
615
615
  * 传递给组件的属性值,执行 v-bind 绑定
616
616
  * - key为属性名称,遵循vue解析规则;若绑定事件,则key为 on事件名称 ,事件名称首字母大写
617
617
  * - 通过泛型类型 Props 约束,有效类型:Props extends Record<string, any>
618
- * @see ExtractComponentEvents<Events> 获取组件事件类型
618
+ * @see EventsType<Events> 获取组件事件类型
619
619
  */
620
- props?: ExtractComponentProps<Props>;
620
+ props?: PropsType<Props>;
621
621
  /**
622
622
  * 传递给组件的双向绑定数据,执行 v-model 绑定
623
623
  * - 使用 ShallowRef/Ref 包裹;推荐 ShallowRef,仅和组件进行.value值交互,避免深层双向影响性能
@@ -625,21 +625,6 @@ type ComponentBindOptions<Props = void, Model = void> = {
625
625
  */
626
626
  model?: Model extends (void | never | null | undefined) ? undefined : (ShallowRef<Model> | Ref<Model>);
627
627
  };
628
- /**
629
- *
630
- */
631
- type ComponentMountOptions = ComponentOptions & {
632
- /**
633
- * 挂载到哪个dom元素下
634
- */
635
- target: Element;
636
- /**
637
- * 传递给组件的属性值,执行v-bind绑定到要显示的组件
638
- * - key为属性名称,遵循vue解析规则
639
- * - 若为事件监听,则使用onXXX
640
- */
641
- props?: Record<string, any>;
642
- };
643
628
 
644
629
  /**
645
630
  * 选项菜单 基础配置选项
@@ -1122,13 +1107,6 @@ type SortOptions<T> = DisabledOptions & {
1122
1107
  * - 传入类样式选择器;如 .table-row
1123
1108
  */
1124
1109
  draggable: string;
1125
- /**
1126
- * 哪个元素启动拖拽
1127
- * - 传入类样式选择器;如 .sort-handle
1128
- * - 不传入则默认 draggable
1129
- * - 若自定义,则传入 draggable 下的dom元素作为启动拖拽的句柄
1130
- */
1131
- handle?: string;
1132
1110
  /**
1133
1111
  * 拖动的元素上增加的类样式
1134
1112
  * - 执行拖拽时随着鼠标移动元素,脱离文档流了
@@ -1142,6 +1120,19 @@ type SortOptions<T> = DisabledOptions & {
1142
1120
  * - 默认:snail-sort-ghost
1143
1121
  */
1144
1122
  ghostClass?: string;
1123
+ /**
1124
+ * 哪个元素启动拖拽
1125
+ * - 传入类样式选择器;如 .sort-handle
1126
+ * - 不传入则默认 draggable
1127
+ * - 若自定义,则传入 draggable 下的dom元素作为启动拖拽的句柄
1128
+ */
1129
+ handle?: string;
1130
+ /**
1131
+ * 过滤器,不需要进行拖动的元素
1132
+ * - 传入类样式选择器;如 .sort-handle
1133
+ * - 实现特定子元素不触发拖动排序功能
1134
+ */
1135
+ filter?: string;
1145
1136
  /**
1146
1137
  * 排序组
1147
1138
  * - 组相同时,可跨组拖拽排序
@@ -1167,14 +1158,19 @@ type SortEvents = {
1167
1158
  };
1168
1159
 
1169
1160
  /**
1170
- * 挂载vue组件
1171
- * - 全新创建一个Vue实例挂载的传入组件
1172
- * - 用于在非vue环境下渲染vue组件内容
1161
+ * 动态加载组件 组件配置选项
1162
+ */
1163
+ type DynamicOptions<Props = void> = ComponentOptions & Pick<ComponentBindOptions<Props>, "props">;
1164
+
1165
+ /**
1166
+ * 挂载指定的Vue组件
1167
+ * - 权限构建的vue app实例,挂载传入的组件
1168
+ * @param target 挂载的目标元素
1173
1169
  * @param options 挂载配置选项
1174
1170
  * @param onDestroyed 监听【调用方】的销毁时机,用于自动销毁挂载的实力
1175
- * @returns
1171
+ * @returns 作用域对象,销毁挂载实例
1176
1172
  */
1177
- declare function mount(options: ComponentMountOptions, onDestroyed?: (fn: () => void) => void): IScope;
1173
+ declare function mount<Props>(target: HTMLElement, options: DynamicOptions<Props>, onDestroyed?: (fn: () => void) => void): IScope;
1178
1174
 
1179
1175
  /**
1180
1176
  * 输入框配置选项
@@ -1886,9 +1882,10 @@ declare const components: {
1886
1882
  new (...args: any[]): vue.CreateComponentPublicInstanceWithMixins<Readonly<DisabledOptions & {
1887
1883
  changer: any;
1888
1884
  draggable: string;
1889
- handle?: string;
1890
1885
  dragClass?: string;
1891
1886
  ghostClass?: string;
1887
+ handle?: string;
1888
+ filter?: string;
1892
1889
  group?: string;
1893
1890
  animation?: number;
1894
1891
  }> & Readonly<{
@@ -1905,9 +1902,10 @@ declare const components: {
1905
1902
  }, Readonly<DisabledOptions & {
1906
1903
  changer: any;
1907
1904
  draggable: string;
1908
- handle?: string;
1909
1905
  dragClass?: string;
1910
1906
  ghostClass?: string;
1907
+ handle?: string;
1908
+ filter?: string;
1911
1909
  group?: string;
1912
1910
  animation?: number;
1913
1911
  }> & Readonly<{
@@ -1919,9 +1917,10 @@ declare const components: {
1919
1917
  } & vue.ComponentOptionsBase<Readonly<DisabledOptions & {
1920
1918
  changer: any;
1921
1919
  draggable: string;
1922
- handle?: string;
1923
1920
  dragClass?: string;
1924
1921
  ghostClass?: string;
1922
+ handle?: string;
1923
+ filter?: string;
1925
1924
  group?: string;
1926
1925
  animation?: number;
1927
1926
  }> & Readonly<{
@@ -2107,4 +2106,4 @@ declare const components: {
2107
2106
  };
2108
2107
 
2109
2108
  export { components, getSvgDraw, mount, onAppCreated, triggerAppCreated, usePopup, useReactive, useTreeContext };
2110
- export type { ButtonOptions, ChooseEvents, ChooseItem, ChooseOptions, ComponentBindOptions, ComponentMountOptions, ComponentOptions, ConfirmAreaOptions, ConfirmOptions, DialogHandle, DialogOptions, DisabledOptions, DragVerifyInfo, DragVerifyOptions, EmptyOptions, ExtractComponentEvents, ExtractComponentProps, 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, 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 };
2109
+ 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
@@ -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"];
@@ -906,6 +906,7 @@ var _sfc_main$h = defineComponent({
906
906
  width: rootRect.width,
907
907
  height: rootRect.height
908
908
  });
909
+ rootDom.value.classList.remove("initial");
909
910
  console.log("-- content rect: ", rootRect, rootDom.value);
910
911
  }
911
912
  console.groupEnd();
@@ -930,7 +931,7 @@ var _sfc_main$h = defineComponent({
930
931
  });
931
932
  return (_ctx, _cache) => {
932
933
  return openBlock(), createBlock(_sfc_main$j, mergeProps({
933
- class: ["snail-follow", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
934
+ class: ["snail-follow initial", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
934
935
  style: {
935
936
  "z-index": _ctx.zIndex
936
937
  },
@@ -1037,8 +1038,8 @@ var _sfc_main$f = defineComponent({
1037
1038
  })
1038
1039
  }, null, 8, ["fill"]), unref(props).type ? (openBlock(), createElementBlock("div", _hoisted_1$9, [createVNode(_sfc_main$o, {
1039
1040
  type: unref(props).type,
1040
- fill: "black",
1041
- size: 18
1041
+ fill: "#707070",
1042
+ size: 20
1042
1043
  }, null, 8, ["type"])])) : createCommentVNode("", true), createElementVNode("div", {
1043
1044
  class: "message",
1044
1045
  innerHTML: unref(props).message
@@ -1937,9 +1938,10 @@ var _sfc_main$7 = defineComponent({
1937
1938
  },
1938
1939
  changer: {},
1939
1940
  draggable: {},
1940
- handle: {},
1941
1941
  dragClass: {},
1942
1942
  ghostClass: {},
1943
+ handle: {},
1944
+ filter: {},
1943
1945
  group: {},
1944
1946
  animation: {}
1945
1947
  },
@@ -1953,25 +1955,30 @@ var _sfc_main$7 = defineComponent({
1953
1955
  const {
1954
1956
  watcher
1955
1957
  } = useReactive();
1958
+ const {
1959
+ onTimeout
1960
+ } = useTimer();
1961
+ var MODULE_Sortable = void 0;
1956
1962
  var sortPanel = void 0;
1957
1963
  var sortInstance = void 0;
1958
- async function buildSortable() {
1964
+ function buildSortable() {
1959
1965
  {
1960
1966
  sortInstance && sortInstance.destroy();
1961
1967
  sortInstance = void 0;
1968
+ sortPanel.classList.remove("sortable");
1962
1969
  }
1963
- if (props.disabled != true) {
1964
- const Sortable = await script.load("sortablejs");
1965
- console.log("sort.vue: buildSortable...");
1966
- sortInstance = new Sortable(sortPanel, {
1970
+ if (props.disabled != true && MODULE_Sortable != void 0) {
1971
+ sortPanel.classList.add("sortable");
1972
+ sortInstance = new MODULE_Sortable(sortPanel, {
1967
1973
  group: props.group || newId(),
1968
1974
  draggable: props.draggable,
1969
- handle: props.handle || props.draggable,
1970
1975
  dragClass: props.dragClass || "snail-sort-drag",
1971
1976
  ghostClass: props.ghostClass || "snail-sort-ghost",
1977
+ handle: props.handle || props.draggable,
1978
+ filter: props.filter,
1979
+ preventOnFilter: false,
1972
1980
  animation: props.animation > 0 ? props.animation : 150,
1973
1981
  forceFallback: true,
1974
- preventOnFilter: false,
1975
1982
  fallbackTolerance: 2,
1976
1983
  onUpdate(evt) {
1977
1984
  emits("update", evt.oldIndex, evt.newIndex);
@@ -1979,13 +1986,16 @@ var _sfc_main$7 = defineComponent({
1979
1986
  });
1980
1987
  }
1981
1988
  }
1982
- onMounted(() => {
1989
+ onMounted(async () => {
1983
1990
  const instance = getCurrentInstance();
1984
1991
  sortPanel = instance.vnode.el.parentElement;
1985
- nextTick(() => {
1986
- buildSortable();
1987
- watcher(() => props.disabled, buildSortable);
1988
- watcher(() => props.changer, buildSortable);
1992
+ MODULE_Sortable = await script.load("sortablejs");
1993
+ var timerScope = void 0;
1994
+ buildSortable();
1995
+ watcher(() => props.disabled, buildSortable);
1996
+ watcher(() => props.changer, () => {
1997
+ timerScope && timerScope.destroy();
1998
+ timerScope = onTimeout(() => buildSortable(), 100);
1989
1999
  });
1990
2000
  });
1991
2001
  onBeforeUnmount(() => sortInstance && sortInstance.destroy());
@@ -2305,18 +2315,13 @@ var _sfc_main$2 = defineComponent({
2305
2315
  }
2306
2316
  });
2307
2317
 
2308
- function mount(options, onDestroyed) {
2318
+ function mount(target, options, onDestroyed) {
2309
2319
  mustObject(options, "options");
2310
- options.target instanceof HTMLElement || throwError("options.target must be a HTMLElement");
2311
- options.target.classList.add("snail-app");
2312
- const app = createApp(_sfc_main$j, {
2313
- name: options.name,
2314
- compponent: options.component,
2315
- url: options.url,
2316
- ...(options.props || {})
2317
- });
2320
+ target instanceof HTMLElement || throwError("target must be a HTMLElement");
2321
+ target.classList.add("snail-app");
2322
+ const app = createApp(_sfc_main$j, options);
2318
2323
  triggerAppCreated(app);
2319
- app.mount(options.target);
2324
+ app.mount(target);
2320
2325
  const scope = useScope().onDestroy(() => app.unmount());
2321
2326
  isFunction(onDestroyed) && onDestroyed(scope.destroy);
2322
2327
  return scope;
@@ -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"];
@@ -908,6 +908,7 @@
908
908
  width: rootRect.width,
909
909
  height: rootRect.height
910
910
  });
911
+ rootDom.value.classList.remove("initial");
911
912
  console.log("-- content rect: ", rootRect, rootDom.value);
912
913
  }
913
914
  console.groupEnd();
@@ -932,7 +933,7 @@
932
933
  });
933
934
  return (_ctx, _cache) => {
934
935
  return vue.openBlock(), vue.createBlock(_sfc_main$j, vue.mergeProps({
935
- class: ["snail-follow", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
936
+ class: ["snail-follow initial", [_ctx.popupStatus.value, _ctx.popupTransition.value]],
936
937
  style: {
937
938
  "z-index": _ctx.zIndex
938
939
  },
@@ -1039,8 +1040,8 @@
1039
1040
  })
1040
1041
  }, null, 8, ["fill"]), vue.unref(props).type ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1$9, [vue.createVNode(_sfc_main$o, {
1041
1042
  type: vue.unref(props).type,
1042
- fill: "black",
1043
- size: 18
1043
+ fill: "#707070",
1044
+ size: 20
1044
1045
  }, null, 8, ["type"])])) : vue.createCommentVNode("", true), vue.createElementVNode("div", {
1045
1046
  class: "message",
1046
1047
  innerHTML: vue.unref(props).message
@@ -1939,9 +1940,10 @@
1939
1940
  },
1940
1941
  changer: {},
1941
1942
  draggable: {},
1942
- handle: {},
1943
1943
  dragClass: {},
1944
1944
  ghostClass: {},
1945
+ handle: {},
1946
+ filter: {},
1945
1947
  group: {},
1946
1948
  animation: {}
1947
1949
  },
@@ -1955,25 +1957,30 @@
1955
1957
  const {
1956
1958
  watcher
1957
1959
  } = useReactive();
1960
+ const {
1961
+ onTimeout
1962
+ } = snail_core.useTimer();
1963
+ var MODULE_Sortable = void 0;
1958
1964
  var sortPanel = void 0;
1959
1965
  var sortInstance = void 0;
1960
- async function buildSortable() {
1966
+ function buildSortable() {
1961
1967
  {
1962
1968
  sortInstance && sortInstance.destroy();
1963
1969
  sortInstance = void 0;
1970
+ sortPanel.classList.remove("sortable");
1964
1971
  }
1965
- if (props.disabled != true) {
1966
- const Sortable = await snail_core.script.load("sortablejs");
1967
- console.log("sort.vue: buildSortable...");
1968
- sortInstance = new Sortable(sortPanel, {
1972
+ if (props.disabled != true && MODULE_Sortable != void 0) {
1973
+ sortPanel.classList.add("sortable");
1974
+ sortInstance = new MODULE_Sortable(sortPanel, {
1969
1975
  group: props.group || snail_core.newId(),
1970
1976
  draggable: props.draggable,
1971
- handle: props.handle || props.draggable,
1972
1977
  dragClass: props.dragClass || "snail-sort-drag",
1973
1978
  ghostClass: props.ghostClass || "snail-sort-ghost",
1979
+ handle: props.handle || props.draggable,
1980
+ filter: props.filter,
1981
+ preventOnFilter: false,
1974
1982
  animation: props.animation > 0 ? props.animation : 150,
1975
1983
  forceFallback: true,
1976
- preventOnFilter: false,
1977
1984
  fallbackTolerance: 2,
1978
1985
  onUpdate(evt) {
1979
1986
  emits("update", evt.oldIndex, evt.newIndex);
@@ -1981,13 +1988,16 @@
1981
1988
  });
1982
1989
  }
1983
1990
  }
1984
- vue.onMounted(() => {
1991
+ vue.onMounted(async () => {
1985
1992
  const instance = vue.getCurrentInstance();
1986
1993
  sortPanel = instance.vnode.el.parentElement;
1987
- vue.nextTick(() => {
1988
- buildSortable();
1989
- watcher(() => props.disabled, buildSortable);
1990
- watcher(() => props.changer, buildSortable);
1994
+ MODULE_Sortable = await snail_core.script.load("sortablejs");
1995
+ var timerScope = void 0;
1996
+ buildSortable();
1997
+ watcher(() => props.disabled, buildSortable);
1998
+ watcher(() => props.changer, () => {
1999
+ timerScope && timerScope.destroy();
2000
+ timerScope = onTimeout(() => buildSortable(), 100);
1991
2001
  });
1992
2002
  });
1993
2003
  vue.onBeforeUnmount(() => sortInstance && sortInstance.destroy());
@@ -2307,18 +2317,13 @@
2307
2317
  }
2308
2318
  });
2309
2319
 
2310
- function mount(options, onDestroyed) {
2320
+ function mount(target, options, onDestroyed) {
2311
2321
  snail_core.mustObject(options, "options");
2312
- options.target instanceof HTMLElement || snail_core.throwError("options.target must be a HTMLElement");
2313
- options.target.classList.add("snail-app");
2314
- const app = vue.createApp(_sfc_main$j, {
2315
- name: options.name,
2316
- compponent: options.component,
2317
- url: options.url,
2318
- ...(options.props || {})
2319
- });
2322
+ target instanceof HTMLElement || snail_core.throwError("target must be a HTMLElement");
2323
+ target.classList.add("snail-app");
2324
+ const app = vue.createApp(_sfc_main$j, options);
2320
2325
  triggerAppCreated(app);
2321
- app.mount(options.target);
2326
+ app.mount(target);
2322
2327
  const scope = snail_core.useScope().onDestroy(() => app.unmount());
2323
2328
  snail_core.isFunction(onDestroyed) && onDestroyed(scope.destroy);
2324
2329
  return scope;
@@ -1,23 +1,23 @@
1
1
  /* src:base\button.vue index:0 */
2
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\footer.vue index:0 */
4
- .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}
5
3
  /* src:base\choose.vue index:0 */
6
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}
7
- /* src:base\icon.vue index:0 */
8
- .snail-icon{cursor:pointer;opacity:1}
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}
9
7
  /* src:base\header.vue index:0 */
10
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\icon.vue index:0 */
10
+ .snail-icon{cursor:pointer;opacity:1}
11
11
  /* src:base\search.vue index:0 */
12
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)}
19
+ /* src:container\dynamic.vue index:0 */
20
+ .snail-dynamic-error{color:red}.snail-dynamic-error>span{color:gray}
21
21
  /* src:container\scroll.vue index:0 */
22
22
  .snail-scroll{overflow:hidden}.snail-scroll.scroll-x{overflow-x:auto}.snail-scroll.scroll-y{overflow-y:auto}
23
23
  /* src:container\sort.vue index:0 */
@@ -26,10 +26,10 @@
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
27
  /* src:container\components\table-row.vue index:0 */
28
28
  .table-row{align-items:center;display:flex}
29
- /* src:container\components\table-col.vue index:0 */
30
- .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
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\components\table-col.vue index:0 */
32
+ .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}
33
33
  /* src:form\input.vue index:0 */
34
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}
35
35
  /* src:prompt\drag-verify.vue index:0 */
@@ -43,11 +43,11 @@
43
43
  /* src:popup\components\dialog-container.vue index:0 */
44
44
  .snail-dialog{align-items:center;display:flex;height:100%;justify-content:center;left:0;position:fixed;top:0;width:100%}.snail-dialog:before{background-color:rgba(24,27,33,.45);content:"";height:100%;opacity:1;position:absolute;transition:opacity .4s ease-in-out;width:100%}.snail-dialog>.dialog-body{background-color:#fff;border-radius:4px;box-shadow:0 0 15px rgba(0,0,0,.3);position:relative}.snail-dialog.unactive:before{opacity:0}.snail-dialog.unactive>.dialog-body{box-shadow:0 0 4px rgba(0,0,0,.3)}
45
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}
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}
47
47
  /* src:popup\components\popup-container.vue index:0 */
48
48
  .snail-popup{left:0;position:fixed;top:0}
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.42",
6
+ "version": "1.0.44",
7
7
  "type": "module",
8
8
  "main": "dist/snail.vue.js",
9
9
  "module": "dist/snail.vue.js",