@farris/ui-vue 1.2.9 → 1.3.0

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.
Files changed (236) hide show
  1. package/components/accordion/index.esm.js +63 -63
  2. package/components/accordion/index.umd.cjs +1 -1
  3. package/components/avatar/index.esm.js +402 -323
  4. package/components/avatar/index.umd.cjs +1 -1
  5. package/components/button-edit/index.css +1 -1
  6. package/components/button-edit/index.esm.js +98 -96
  7. package/components/button-edit/index.umd.cjs +1 -1
  8. package/components/calendar/index.esm.js +66 -66
  9. package/components/calendar/index.umd.cjs +1 -1
  10. package/components/capsule/index.esm.js +118 -118
  11. package/components/capsule/index.umd.cjs +1 -1
  12. package/components/checkbox/index.esm.js +539 -460
  13. package/components/checkbox/index.umd.cjs +1 -1
  14. package/components/color-picker/index.esm.js +135 -135
  15. package/components/color-picker/index.umd.cjs +2 -2
  16. package/components/combo-list/index.css +1 -0
  17. package/components/combo-list/index.esm.js +1007 -312
  18. package/components/combo-list/index.umd.cjs +1 -1
  19. package/components/combo-tree/index.esm.js +97 -97
  20. package/components/combo-tree/index.umd.cjs +1 -1
  21. package/components/common/index.esm.js +778 -700
  22. package/components/common/index.umd.cjs +1 -1
  23. package/components/component/index.esm.js +472 -329
  24. package/components/component/index.umd.cjs +1 -1
  25. package/components/condition/index.css +1 -0
  26. package/components/condition/index.esm.js +2231 -1055
  27. package/components/condition/index.umd.cjs +1 -1
  28. package/components/content-container/index.esm.js +79 -79
  29. package/components/content-container/index.umd.cjs +1 -1
  30. package/components/data-grid/index.css +1 -1
  31. package/components/data-grid/index.esm.js +6408 -5034
  32. package/components/data-grid/index.umd.cjs +1 -1
  33. package/components/data-view/index.css +1 -0
  34. package/components/data-view/index.esm.js +4762 -3511
  35. package/components/data-view/index.umd.cjs +1 -1
  36. package/components/date-picker/index.css +1 -1
  37. package/components/date-picker/index.esm.js +3442 -2742
  38. package/components/date-picker/index.umd.cjs +1 -1
  39. package/components/designer-outline/index.esm.js +14 -13
  40. package/components/designer-outline/index.umd.cjs +1 -1
  41. package/components/dropdown/index.esm.js +73 -73
  42. package/components/dropdown/index.umd.cjs +2 -2
  43. package/components/dynamic-form/index.css +1 -0
  44. package/components/dynamic-form/index.esm.js +2597 -1141
  45. package/components/dynamic-form/index.umd.cjs +1 -1
  46. package/components/dynamic-resolver/index.esm.js +114 -71
  47. package/components/dynamic-resolver/index.umd.cjs +1 -1
  48. package/components/dynamic-view/index.esm.js +303 -290
  49. package/components/dynamic-view/index.umd.cjs +1 -1
  50. package/components/events-editor/index.esm.js +171 -171
  51. package/components/events-editor/index.umd.cjs +1 -1
  52. package/components/expression-editor/index.esm.js +65 -65
  53. package/components/expression-editor/index.umd.cjs +1 -1
  54. package/components/external-container/index.css +1 -1
  55. package/components/external-container/index.esm.js +3075 -2586
  56. package/components/external-container/index.umd.cjs +1 -1
  57. package/components/field-selector/index.css +1 -1
  58. package/components/field-selector/index.esm.js +5272 -8511
  59. package/components/field-selector/index.umd.cjs +1 -1
  60. package/components/filter-bar/index.css +1 -1
  61. package/components/filter-bar/index.esm.js +1726 -1822
  62. package/components/filter-bar/index.umd.cjs +1 -1
  63. package/components/image-cropper/index.esm.js +126 -126
  64. package/components/image-cropper/index.umd.cjs +1 -1
  65. package/components/input-group/index.esm.js +620 -540
  66. package/components/input-group/index.umd.cjs +1 -1
  67. package/components/layout/index.esm.js +88 -88
  68. package/components/layout/index.umd.cjs +1 -1
  69. package/components/list-nav/index.esm.js +71 -71
  70. package/components/list-nav/index.umd.cjs +1 -1
  71. package/components/list-view/index.css +1 -1
  72. package/components/list-view/index.esm.js +3582 -2356
  73. package/components/list-view/index.umd.cjs +1 -1
  74. package/components/lookup/index.css +1 -1
  75. package/components/lookup/index.esm.js +10752 -8972
  76. package/components/lookup/index.umd.cjs +1 -1
  77. package/components/mapping-editor/index.css +1 -1
  78. package/components/mapping-editor/index.esm.js +5601 -5329
  79. package/components/mapping-editor/index.umd.cjs +1 -1
  80. package/components/message-box/index.css +1 -1
  81. package/components/message-box/index.esm.js +511 -471
  82. package/components/message-box/index.umd.cjs +1 -1
  83. package/components/modal/index.css +1 -1
  84. package/components/modal/index.esm.js +438 -398
  85. package/components/modal/index.umd.cjs +1 -1
  86. package/components/nav/index.esm.js +535 -452
  87. package/components/nav/index.umd.cjs +2 -2
  88. package/components/notify/index.esm.js +59 -53
  89. package/components/notify/index.umd.cjs +1 -1
  90. package/components/number-range/index.esm.js +556 -477
  91. package/components/number-range/index.umd.cjs +1 -1
  92. package/components/number-spinner/index.esm.js +504 -425
  93. package/components/number-spinner/index.umd.cjs +1 -1
  94. package/components/order/index.css +1 -1
  95. package/components/order/index.esm.js +1833 -1054
  96. package/components/order/index.umd.cjs +1 -1
  97. package/components/page-footer/index.esm.js +100 -100
  98. package/components/page-footer/index.umd.cjs +1 -1
  99. package/components/page-header/index.esm.js +899 -870
  100. package/components/page-header/index.umd.cjs +1 -1
  101. package/components/pagination/index.esm.js +576 -487
  102. package/components/pagination/index.umd.cjs +1 -1
  103. package/components/popover/index.esm.js +71 -70
  104. package/components/popover/index.umd.cjs +1 -1
  105. package/components/progress/index.esm.js +73 -73
  106. package/components/progress/index.umd.cjs +2 -2
  107. package/components/property-editor/index.css +1 -1
  108. package/components/property-editor/index.esm.js +1916 -1220
  109. package/components/property-editor/index.umd.cjs +3 -3
  110. package/components/property-panel/index.esm.js +783 -886
  111. package/components/property-panel/index.umd.cjs +1 -1
  112. package/components/query-solution/index.css +1 -1
  113. package/components/query-solution/index.esm.js +3632 -2556
  114. package/components/query-solution/index.umd.cjs +1 -1
  115. package/components/radio-button/index.esm.js +72 -72
  116. package/components/radio-button/index.umd.cjs +1 -1
  117. package/components/radio-group/index.esm.js +484 -405
  118. package/components/radio-group/index.umd.cjs +1 -1
  119. package/components/rate/index.esm.js +152 -152
  120. package/components/rate/index.umd.cjs +1 -1
  121. package/components/response-layout/index.esm.js +73 -73
  122. package/components/response-layout/index.umd.cjs +1 -1
  123. package/components/response-layout-editor/index.css +1 -1
  124. package/components/response-layout-editor/index.esm.js +1081 -1043
  125. package/components/response-layout-editor/index.umd.cjs +1 -1
  126. package/components/response-toolbar/index.esm.js +753 -738
  127. package/components/response-toolbar/index.umd.cjs +1 -1
  128. package/components/schema-selector/index.css +1 -1
  129. package/components/schema-selector/index.esm.js +4418 -4177
  130. package/components/schema-selector/index.umd.cjs +2 -2
  131. package/components/search-box/index.esm.js +119 -119
  132. package/components/search-box/index.umd.cjs +1 -1
  133. package/components/section/index.esm.js +92 -91
  134. package/components/section/index.umd.cjs +1 -1
  135. package/components/smoke-detector/index.esm.js +59 -59
  136. package/components/smoke-detector/index.umd.cjs +1 -1
  137. package/components/splitter/index.esm.js +103 -103
  138. package/components/splitter/index.umd.cjs +1 -1
  139. package/components/step/index.esm.js +85 -85
  140. package/components/step/index.umd.cjs +1 -1
  141. package/components/switch/index.esm.js +457 -378
  142. package/components/switch/index.umd.cjs +1 -1
  143. package/components/tabs/index.css +1 -1
  144. package/components/tabs/index.esm.js +1696 -1617
  145. package/components/tabs/index.umd.cjs +1 -1
  146. package/components/tags/index.esm.js +53 -53
  147. package/components/tags/index.umd.cjs +1 -1
  148. package/components/text/index.esm.js +268 -268
  149. package/components/text/index.umd.cjs +1 -1
  150. package/components/textarea/index.esm.js +420 -341
  151. package/components/textarea/index.umd.cjs +1 -1
  152. package/components/time-picker/index.css +1 -1
  153. package/components/time-picker/index.esm.js +1062 -981
  154. package/components/time-picker/index.umd.cjs +1 -1
  155. package/components/transfer/index.css +1 -1
  156. package/components/transfer/index.esm.js +381 -379
  157. package/components/transfer/index.umd.cjs +1 -1
  158. package/components/tree-grid/index.css +1 -1
  159. package/components/tree-grid/index.esm.js +5252 -9560
  160. package/components/tree-grid/index.umd.cjs +1 -1
  161. package/components/tree-view/index.css +1 -0
  162. package/components/tree-view/index.esm.js +3920 -2692
  163. package/components/tree-view/index.umd.cjs +1 -1
  164. package/components/uploader/index.esm.js +373 -367
  165. package/components/uploader/index.umd.cjs +2 -2
  166. package/components/verify-detail/index.esm.js +92 -92
  167. package/components/verify-detail/index.umd.cjs +1 -1
  168. package/components/video/index.esm.js +597 -417
  169. package/components/video/index.umd.cjs +1 -1
  170. package/components/weather/index.esm.js +251 -251
  171. package/components/weather/index.umd.cjs +4 -4
  172. package/farris.all.esm.js +17125 -16176
  173. package/farris.all.umd.cjs +8 -8
  174. package/index.css +1 -1
  175. package/package.json +1 -1
  176. package/types/capsule/src/capsule.props.d.ts +2 -2
  177. package/types/combo-list/src/components/list-container.component.d.ts +0 -3
  178. package/types/combo-list/src/components/list-container.props.d.ts +0 -4
  179. package/types/common/index.d.ts +1 -0
  180. package/types/common/types.d.ts +1 -1
  181. package/types/common/utils/encrypt.d.ts +2 -0
  182. package/types/component/src/component.props.d.ts +7 -0
  183. package/types/component/src/designer/use-designer-rules.d.ts +1 -1
  184. package/types/component/src/property-config/component.property-config.d.ts +9 -0
  185. package/types/components.d.ts +1 -0
  186. package/types/data-grid/index.d.ts +5 -2
  187. package/types/data-grid/src/data-grid.component.d.ts +2 -1
  188. package/types/data-grid/src/data-grid.props.d.ts +1 -0
  189. package/types/data-view/composition/types.d.ts +18 -1
  190. package/types/data-view/composition/visualization/use-virtual-scroll.d.ts +0 -15
  191. package/types/designer-canvas/src/composition/dg-control.d.ts +5 -0
  192. package/types/designer-canvas/src/composition/types.d.ts +1 -1
  193. package/types/dynamic-form/src/composition/use-response-form-layout-setting.d.ts +2 -0
  194. package/types/dynamic-form/src/designer/response-form-layout-setting.component.d.ts +8 -0
  195. package/types/dynamic-form/src/designer/response-form-layout-setting.props.d.ts +4 -0
  196. package/types/dynamic-form/src/designer/use-designer-rules.d.ts +2 -2
  197. package/types/dynamic-form/src/property-config/form.property-config.d.ts +9 -0
  198. package/types/dynamic-form/src/schema/schema-mapper.d.ts +1 -0
  199. package/types/dynamic-form/src/schema/schema-resolver.d.ts +1 -0
  200. package/types/dynamic-form/src/types.d.ts +12 -1
  201. package/types/dynamic-resolver/index.d.ts +1 -0
  202. package/types/dynamic-resolver/src/event-handler-resolver.d.ts +4 -0
  203. package/types/dynamic-resolver/src/types.d.ts +9 -0
  204. package/types/dynamic-view/index.d.ts +1 -0
  205. package/types/dynamic-view/src/event-dispatcher.d.ts +1 -1
  206. package/types/index.d.ts +2 -0
  207. package/types/lookup/src/components/favorite/lookup-favorite.component.d.ts +29 -0
  208. package/types/lookup/src/components/favorite/lookup-favorite.props.d.ts +15 -0
  209. package/types/lookup/src/components/modal-container.component.d.ts +25 -0
  210. package/types/lookup/src/components/modal-container.props.d.ts +29 -0
  211. package/types/lookup/src/composition/types.d.ts +8 -0
  212. package/types/lookup/src/composition/use-check-props.d.ts +9 -2
  213. package/types/lookup/src/composition/use-dialog.d.ts +5 -1
  214. package/types/lookup/src/composition/use-favorite.d.ts +12 -0
  215. package/types/lookup/src/composition/use-http.d.ts +9 -5
  216. package/types/lookup/src/composition/use-input-change.d.ts +3 -0
  217. package/types/lookup/src/composition/use-user-data.d.ts +24 -0
  218. package/types/lookup/src/property-config/lookup.property-config.d.ts +6 -4
  219. package/types/mapping-editor/src/mapping-editor.component.d.ts +3 -0
  220. package/types/mapping-editor/src/mapping-editor.props.d.ts +0 -1
  221. package/types/modal/src/composition/use-draggable.d.ts +2 -1
  222. package/types/modal/src/composition/use-shortcut.d.ts +6 -0
  223. package/types/modal/src/modal.component.d.ts +3 -0
  224. package/types/modal/src/modal.props.d.ts +4 -0
  225. package/types/page-header/src/page-header.props.d.ts +1 -0
  226. package/types/property-panel/src/composition/entity/base-property.d.ts +8 -0
  227. package/types/property-panel/src/composition/entity/input-base-property.d.ts +20 -1
  228. package/types/response-layout-editor/src/composition/converter/use-response-layout-editor-setting.d.ts +2 -0
  229. package/types/response-layout-editor/src/type.d.ts +21 -0
  230. package/types/tabs/src/tabs.props.d.ts +1 -0
  231. package/types/tree-grid/index.d.ts +8 -2
  232. package/types/tree-grid/src/tree-grid.component.d.ts +3 -1
  233. package/types/data-grid/src/designer/use-group-column.d.ts +0 -20
  234. package/types/modal/src/composition/use-esc.d.ts +0 -1
  235. package/types/response-layout-editor/src/composition/converter/response-layout-editor.converter.d.ts +0 -3
  236. package/types/response-layout-editor/src/composition/converter/use-convert-property-value.d.ts +0 -20
@@ -1,28 +1,28 @@
1
- import { withInstall as we } from "../common/index.esm.js";
2
- import { ref as i, defineComponent as he, computed as I, watch as q, nextTick as ue, createVNode as T, inject as De, onMounted as Be } from "vue";
3
- import { cloneDeep as Ae } from "lodash-es";
4
- function Ce(a, e, v) {
1
+ import { withInstall as De } from "../common/index.esm.js";
2
+ import { ref as i, defineComponent as ye, computed as I, watch as q, nextTick as ue, createVNode as T, inject as Be, onMounted as Ae } from "vue";
3
+ import { isPlainObject as he, cloneDeep as Ce } from "lodash-es";
4
+ function Se(a, e, v) {
5
5
  return e;
6
6
  }
7
- const ye = {}, be = {};
7
+ const be = {}, Te = {};
8
8
  function fe(a) {
9
- const { properties: e, title: v, ignore: g } = a, n = g && Array.isArray(g), h = Object.keys(e).reduce((y, w) => ((!n || !g.find((C) => C == w)) && (y[w] = e[w].type === "object" && e[w].properties ? fe(e[w]) : Ae(e[w].default)), y), {});
9
+ const { properties: e, title: v, ignore: g } = a, n = g && Array.isArray(g), h = Object.keys(e).reduce((y, w) => ((!n || !g.find((C) => C == w)) && (y[w] = e[w].type === "object" && e[w].properties ? fe(e[w]) : Ce(e[w].default)), y), {});
10
10
  return (!n || !g.find((y) => y == "id")) && (h.id = `${v}-${Date.now()}`), h;
11
11
  }
12
12
  function ie(a, e = {}, v) {
13
- const g = ye[a];
13
+ const g = be[a];
14
14
  if (g) {
15
15
  let n = fe(g);
16
- const h = be[a];
16
+ const h = Te[a];
17
17
  return n = h ? h({ getSchemaByType: ie }, n, e, v) : n, n;
18
18
  }
19
19
  return null;
20
20
  }
21
- function Se(a, e) {
21
+ function Oe(a, e) {
22
22
  const v = fe(e);
23
- return Object.keys(a).reduce((g, n) => (g[n] && typeof g[n] == "object" ? Object.assign(g[n], a[n]) : g[n] = a[n], g), v), v;
23
+ return Object.keys(a).reduce((g, n) => (g[n] && he(g[n]) && he(a[n]) ? Object.assign(g[n], a[n]) : g[n] = a[n], g), v), v;
24
24
  }
25
- function Oe(a, e) {
25
+ function je(a, e) {
26
26
  return Object.keys(a).filter((g) => a[g] != null).reduce((g, n) => {
27
27
  if (e.has(n)) {
28
28
  const h = e.get(n);
@@ -37,11 +37,11 @@ function Oe(a, e) {
37
37
  return g;
38
38
  }, {});
39
39
  }
40
- function je(a, e, v = /* @__PURE__ */ new Map()) {
41
- const g = Se(a, e);
42
- return Oe(g, v);
40
+ function Me(a, e, v = /* @__PURE__ */ new Map()) {
41
+ const g = Oe(a, e);
42
+ return je(g, v);
43
43
  }
44
- function Me(a = {}) {
44
+ function Ee(a = {}) {
45
45
  function e(c, p, d, f) {
46
46
  if (typeof d == "number")
47
47
  return f[c].length === d;
@@ -95,20 +95,20 @@ function Me(a = {}) {
95
95
  }
96
96
  return { parseValueSchema: C };
97
97
  }
98
- const Ee = {}, Pe = {};
99
- Me();
100
- function Ie(a, e, v = /* @__PURE__ */ new Map(), g = (y, w, C) => w, n = {}, h = (y) => y) {
101
- return ye[e.title] = e, be[e.title] = g, Ee[e.title] = n, Pe[e.title] = h, (y = {}) => {
102
- const w = je(y, e, v), C = Object.keys(a).reduce((c, p) => (c[p] = a[p].default, c), {});
98
+ const Pe = {}, Ie = {};
99
+ Ee();
100
+ function Le(a, e, v = /* @__PURE__ */ new Map(), g = (y, w, C) => w, n = {}, h = (y) => y) {
101
+ return be[e.title] = e, Te[e.title] = g, Pe[e.title] = n, Ie[e.title] = h, (y = {}) => {
102
+ const w = Me(y, e, v), C = Object.keys(a).reduce((c, p) => (c[p] = a[p].default, c), {});
103
103
  return Object.assign(C, w);
104
104
  };
105
105
  }
106
- function Le(a, e) {
106
+ function Re(a, e) {
107
107
  return { customClass: e.class, customStyle: e.style };
108
108
  }
109
- const Re = /* @__PURE__ */ new Map([
110
- ["appearance", Le]
111
- ]), Ne = "tags", $e = "A Farris Component", Ve = "object", Fe = {
109
+ const Ne = /* @__PURE__ */ new Map([
110
+ ["appearance", Re]
111
+ ]), $e = "tags", Ve = "A Farris Component", Fe = "object", We = {
112
112
  basic: {
113
113
  description: "Basic Infomation",
114
114
  title: "基本信息",
@@ -130,12 +130,12 @@ const Re = /* @__PURE__ */ new Map([
130
130
  }
131
131
  }
132
132
  }
133
- }, We = {
134
- title: Ne,
135
- description: $e,
136
- type: Ve,
137
- categories: Fe
138
- }, xe = "https://json-schema.org/draft/2020-12/schema", qe = "https://farris-design.gitee.io/tags.schema.json", He = "tags", _e = "A Farris Component", Xe = "object", Je = {
133
+ }, xe = {
134
+ title: $e,
135
+ description: Ve,
136
+ type: Fe,
137
+ categories: We
138
+ }, qe = "https://json-schema.org/draft/2020-12/schema", He = "https://farris-design.gitee.io/tags.schema.json", _e = "tags", Xe = "A Farris Component", Je = "object", ze = {
139
139
  id: {
140
140
  description: "The unique identifier for tags",
141
141
  type: "string"
@@ -197,17 +197,17 @@ const Re = /* @__PURE__ */ new Map([
197
197
  type: "boolean",
198
198
  default: !0
199
199
  }
200
- }, ze = [
200
+ }, Ge = [
201
201
  "id",
202
202
  "type"
203
- ], Ge = {
204
- $schema: xe,
205
- $id: qe,
206
- title: He,
207
- description: _e,
208
- type: Xe,
209
- properties: Je,
210
- required: ze
203
+ ], Qe = {
204
+ $schema: qe,
205
+ $id: He,
206
+ title: _e,
207
+ description: Xe,
208
+ type: Je,
209
+ properties: ze,
210
+ required: Ge
211
211
  }, de = {
212
212
  activeTag: { type: String, default: "" },
213
213
  addButtonText: { type: String, default: "" },
@@ -224,8 +224,8 @@ const Re = /* @__PURE__ */ new Map([
224
224
  wrapText: { type: Boolean, default: !1 },
225
225
  draggable: { type: Boolean, default: !1 },
226
226
  disable: { type: Boolean, default: !1 }
227
- }, Te = Ie(de, Ge, Re, Ce, We);
228
- function ke(a, e, v, g) {
227
+ }, ke = Le(de, Qe, Ne, Se, xe);
228
+ function we(a, e, v, g) {
229
229
  const n = i(-1), h = i(!1);
230
230
  function y(p, d, f) {
231
231
  p.stopPropagation(), d && setTimeout(() => {
@@ -252,7 +252,7 @@ function ke(a, e, v, g) {
252
252
  isDragging: h
253
253
  };
254
254
  }
255
- const G = /* @__PURE__ */ he({
255
+ const G = /* @__PURE__ */ ye({
256
256
  name: "FTags",
257
257
  props: de,
258
258
  emits: ["remove", "selectionChange", "change"],
@@ -273,7 +273,7 @@ const G = /* @__PURE__ */ he({
273
273
  function $(r) {
274
274
  n.value = r, b.value = P();
275
275
  }
276
- const F = I(() => b.value.findIndex((r) => r.type === "Input")), W = ke(a, e, n, b), {
276
+ const F = I(() => b.value.findIndex((r) => r.type === "Input")), W = we(a, e, n, b), {
277
277
  dragstart: L,
278
278
  dragenter: m,
279
279
  dragover: O,
@@ -471,7 +471,7 @@ const G = /* @__PURE__ */ he({
471
471
  }, [J()])]);
472
472
  }
473
473
  });
474
- function Qe(a, e, v) {
474
+ function Ue(a, e, v) {
475
475
  var L;
476
476
  function g() {
477
477
  }
@@ -553,15 +553,15 @@ function Qe(a, e, v) {
553
553
  triggerBelongedComponentToDeleteWhenDeleted: i(!1)
554
554
  }, y;
555
555
  }
556
- const Ue = /* @__PURE__ */ he({
556
+ const Ye = /* @__PURE__ */ ye({
557
557
  name: "FTagsDesign",
558
558
  props: de,
559
559
  emits: ["remove", "selectionChange", "change"],
560
560
  setup(a, e) {
561
561
  const v = i(a.selectable), g = i(a.customClass), n = i(a.data), h = i(a.tagType), y = i(a.tagStyle), w = i(a.showColor), C = i(a.activeTag), c = i(a.customStyle), p = i(a.showClose), d = i(a.showAddButton), f = i(a.showInput), k = i(a.addButtonText), D = i(a.enableAddButton);
562
562
  i(a.placeholder), i(""), i();
563
- const B = i(), P = i(a.wrapText), b = i(), $ = i(), F = De("design-item-context"), W = Qe($, F);
564
- Be(() => {
563
+ const B = i(), P = i(a.wrapText), b = i(), $ = i(), F = Be("design-item-context"), W = Ue($, F);
564
+ Ae(() => {
565
565
  $.value.componentInstance = W;
566
566
  }), e.expose(W.value);
567
567
  function L() {
@@ -577,7 +577,7 @@ const Ue = /* @__PURE__ */ he({
577
577
  function O(t) {
578
578
  n.value = t, m.value = L();
579
579
  }
580
- const A = I(() => m.value.findIndex((t) => t.type === "Input")), M = ke(a, e, n, m), {
580
+ const A = I(() => m.value.findIndex((t) => t.type === "Input")), M = we(a, e, n, m), {
581
581
  dragstart: V,
582
582
  dragenter: R,
583
583
  dragover: H,
@@ -792,15 +792,15 @@ const Ue = /* @__PURE__ */ he({
792
792
  }
793
793
  });
794
794
  G.register = (a, e, v, g) => {
795
- a.tags = G, e.tags = Te;
795
+ a.tags = G, e.tags = ke;
796
796
  };
797
797
  G.registerDesigner = (a, e, v) => {
798
- a.tags = Ue, e.tags = Te;
798
+ a.tags = Ye, e.tags = ke;
799
799
  };
800
- const et = we(G);
800
+ const tt = De(G);
801
801
  export {
802
802
  G as FTags,
803
- et as default,
804
- Te as propsResolver,
803
+ tt as default,
804
+ ke as propsResolver,
805
805
  de as tagsProps
806
806
  };
@@ -1 +1 @@
1
- (function(j,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("../common/index.umd.js"),require("vue"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","../common/index.umd.js","vue","lodash-es"],x):(j=typeof globalThis<"u"?globalThis:j||self,x(j.tags={},j.common,j.Vue,j.LodashES))})(this,function(j,x,e,be){"use strict";function Te(n,t,m){return t}const de={},pe={};function Q(n){const{properties:t,title:m,ignore:p}=n,r=p&&Array.isArray(p),y=Object.keys(t).reduce((v,w)=>((!r||!p.find(A=>A==w))&&(v[w]=t[w].type==="object"&&t[w].properties?Q(t[w]):be.cloneDeep(t[w].default)),v),{});return(!r||!p.find(v=>v=="id"))&&(y.id=`${m}-${Date.now()}`),y}function U(n,t={},m){const p=de[n];if(p){let r=Q(p);const y=pe[n];return r=y?y({getSchemaByType:U},r,t,m):r,r}return null}function we(n,t){const m=Q(t);return Object.keys(n).reduce((p,r)=>(p[r]&&typeof p[r]=="object"?Object.assign(p[r],n[r]):p[r]=n[r],p),m),m}function ke(n,t){return Object.keys(n).filter(p=>n[p]!=null).reduce((p,r)=>{if(t.has(r)){const y=t.get(r);if(typeof y=="string")p[y]=n[r];else{const v=y(r,n[r],n);Object.assign(p,v)}}else p[r]=n[r];return p},{})}function De(n,t,m=new Map){const p=we(n,t);return ke(p,m)}function Be(n={}){function t(i,g,d,f){if(typeof d=="number")return f[i].length===d;if(typeof d=="object"){const T=Object.keys(d)[0],k=d[T];if(T==="not")return Number(f[i].length)!==Number(k);if(T==="moreThan")return Number(f[i].length)>=Number(k);if(T==="lessThan")return Number(f[i].length)<=Number(k)}return!1}function m(i,g,d,f){return f[i]&&f[i].propertyValue&&String(f[i].propertyValue.value)===String(d)}const p=new Map([["length",t],["getProperty",m]]);Object.keys(n).reduce((i,g)=>(i.set(g,n[g]),i),p);function r(i,g){const d=i;return typeof g=="number"?[{target:d,operator:"length",param:null,value:Number(g)}]:typeof g=="boolean"?[{target:d,operator:"getProperty",param:i,value:!!g}]:typeof g=="object"?Object.keys(g).map(f=>{if(f==="length")return{target:d,operator:"length",param:null,value:g[f]};const T=f,k=g[f];return{target:d,operator:"getProperty",param:T,value:k}}):[]}function y(i){return Object.keys(i).reduce((d,f)=>{const T=r(f,i[f]);return d.push(...T),d},[])}function v(i,g){if(p.has(i.operator)){const d=p.get(i.operator);return d&&d(i.target,i.param,i.value,g)||!1}return!1}function w(i,g){return y(i).reduce((T,k)=>T&&v(k,g),!0)}function A(i,g){const d=Object.keys(i),f=d.includes("allOf"),T=d.includes("anyOf"),k=f||T,b=(k?i[k?f?"allOf":"anyOf":"allOf"]:[i]).map(I=>w(I,g));return f?!b.includes(!1):b.includes(!0)}return{parseValueSchema:A}}const Ae={},Ce={};Be();function Se(n,t,m=new Map,p=(v,w,A)=>w,r={},y=v=>v){return de[t.title]=t,pe[t.title]=p,Ae[t.title]=r,Ce[t.title]=y,(v={})=>{const w=De(v,t,m),A=Object.keys(n).reduce((i,g)=>(i[g]=n[g].default,i),{});return Object.assign(A,w)}}function Ne(n,t){return{customClass:t.class,customStyle:t.style}}const je=new Map([["appearance",Ne]]),Oe={title:"tags",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},Ve={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/tags.schema.json",title:"tags",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for tags",type:"string"},type:{description:"The type string of tags",type:"string",default:"tags"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},require:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},H={activeTag:{type:String,default:""},addButtonText:{type:String,default:""},customClass:{type:String,default:""},customStyle:{type:String,default:""},data:{type:Array,default:[{name:"示例1"}]},enableAddButton:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},showAddButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},showColor:{type:Boolean,default:!1},tagType:{type:String,default:""},tagStyle:{type:String,default:""},wrapText:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},disable:{type:Boolean,default:!1}},Y=Se(H,Ve,je,Te,Oe);function ge(n,t,m,p){const r=e.ref(-1),y=e.ref(!1);function v(g,d,f){g.stopPropagation(),d&&setTimeout(()=>{r.value=f,y.value=!0,d.moving=!0})}function w(g,d){if(g.preventDefault(),r.value!==d){const f=p.value[r.value],T=p.value;T.splice(r.value,1),T.splice(d,0,f),r.value=d}}function A(g,d){g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="move")}function i(g,d){d&&(d.moving=!1),m.value=p.value.filter(f=>f.type==="Tag").map(f=>f.payload),y.value=!1,t.emit("change",m.value)}return{dragstart:v,dragenter:w,dragover:A,dragend:i,isDragging:y}}const W=e.defineComponent({name:"FTags",props:H,emits:["remove","selectionChange","change"],setup(n,t){const m=e.ref(n.selectable),p=e.ref(n.customClass),r=e.ref(n.data),y=e.ref(n.tagType),v=e.ref(n.tagStyle),w=e.ref(n.showColor),A=e.ref(n.customStyle),i=e.ref(n.activeTag),g=e.ref(n.showClose),d=e.ref(n.addButtonText),f=e.ref(),T=e.ref(n.wrapText),k=e.ref();e.ref(n.disable);const D=e.ref(!1);function M(){const s=r.value.map(o=>({type:"Tag",payload:o}));return n.showAddButton&&s.push({type:"AddButton"}),s}const b=e.ref(M());function L(s){r.value=s,b.value=M()}const I=e.computed(()=>b.value.findIndex(s=>s.type==="Input")),q=ge(n,t,r,b),{dragstart:E,dragenter:h,dragover:S,dragend:B}=q;e.watch(()=>n.data,s=>L(s)),e.watch(()=>n.showAddButton,()=>{b.value=M()}),e.watch(()=>n.disable,s=>{b.value=M()}),e.watch(()=>n.activeTag,s=>{i.value=s}),e.watch(D,s=>{const o=[...b.value];s?o.length>0&&o[o.length-1].type!=="Input"&&(o.splice(o.length-1,1),o.splice(o.length,0,{type:"Input"}),b.value=o,e.nextTick(()=>{var u;k.value&&((u=k.value)==null||u.focus())})):o.length>0&&o[o.length-1].type!=="AddButton"&&(o.splice(o.length-1,1),o.splice(o.length,0,{type:"AddButton"}),b.value=o)});const O=e.computed(()=>{const s={"farris-tags":!0,"farris-tags-checkable":m.value,"farris-tags-nowrap":!T.value};return p.value.split(" ").reduce((o,u)=>(o[u]=!0,o),s),s});function R(s){const o={"farris-tag-item":!0,"farris-tag-item-checked":m.value&&s.checked,"farris-tag-item-checkable":m.value,"farris-tag-item-has-color":w.value,"farris-tag-item-actived":i.value===s.name};if(y.value){const u=`farris-tag-item-${y.value}`;o[u]=!0}return o}const P=e.computed(()=>{const s={};return A.value&&A.value.split(";").reduce((o,u)=>{const N=u.split(":");return o[N[0]]=N[1],o},s),s});function _(s,o){!n.disable&&m.value&&(!o.hasOwnProperty("selectable")||o.selectable)&&(o.checked=!o.checked,i.value=o.checked?o.name:"",o.checked&&r.value.filter(u=>u.name!==o.name).forEach(u=>{u.checked=!o.checked}),t.emit("change",r.value),t.emit("selectionChange",o))}function Z(s,o){let u;switch(s.key){case"Backspace":r.value=r.value.filter(N=>N.name!==o.name),t.emit("change",r.value);break;case"ArrowLeft":u=Math.max(f.value.scrollLeft+20,0),f.value.scrollLeft=u;break;case"ArrowRight":u=Math.max(f.value.scrollLeft-20,0),f.value.scrollLeft=u}}function K(s,o){const u=r.value.findIndex(N=>N.name===o.name);if(u>-1){const[N]=r.value.splice(u,1);b.value=M(),t.emit("change",r.value),t.emit("remove",{tags:r.value,remove:N})}s.stopPropagation()}const ee=e.computed(()=>({"farris-tag-item":!0,"farris-tag-add-button":!0,"farris-tag-add-button-disabled":!n.enableAddButton}));function te(s){s.stopPropagation(),D.value=!0}function ae(){return!n.disable&&e.createVNode("li",{class:ee.value,onClick:s=>te(s)},[e.createVNode("span",{class:"f-icon f-icon-amplification"},null),d.value&&e.createVNode("span",{class:"farris-tag-add-text"},[d.value])])}function X(s,o,u){s>-1&&(r.value.splice(s,0,{name:o,value:u,selectable:m.value}),b.value=M(),D.value=!1,t.emit("change",r.value))}function J(s){if(s&&s.value){const o=s.value,u=I.value;X(u,o,o),s.innerText=""}else D.value=!1}function ne(s){const o=s.target;o&&o.value?J(o):D.value=!1}function me(s){s.key==="Enter"&&J(s.target)}function re(){return!n.disable&&e.createVNode("li",{class:"farris-tag-input-box"},[e.createVNode("input",{title:"farris-tag-input-box",ref:k,class:"form-control",onKeyup:me,onBlur:ne},null)])}function se(s,o){return e.createVNode("li",{class:R(s),style:P.value,tabindex:0,id:s.name,key:s.name,onClick:u=>_(u,s),onKeydown:u=>Z(u,s),draggable:"true",onDragstart:u=>E(u,s,o),onDragenter:u=>h(u,o),onDragend:u=>B(u,s),onDragover:u=>S(u,o)},[e.createVNode("span",{title:s.name,class:"tag-box"},[s.name]),!n.disable&&g.value&&e.createVNode("span",{class:"tag-delete"},[e.createVNode("i",{class:"f-icon f-icon-close",onClick:u=>K(u,s)},null)])])}function z(){return b.value.map((s,o)=>{switch(s.type){case"Tag":return se(s.payload,o);case"AddButton":return ae();case"Input":return re()}})}const G=e.computed(()=>({"farris-tags-item-container":!0,"farris-tag-item-capsule":v.value==="capsule"}));function oe(s){const o=Math.max(f.value.scrollLeft-s.deltaX,0);f.value.scrollLeft=o}function le(s){var u;s.preventDefault(),s.stopPropagation();const o=(u=s.dataTransfer)==null?void 0:u.getData("Text");if(o){const N=o.split(":"),ie=N[0],F=N[1];[...r.value].findIndex(a=>(console.log(`${a.value} === ${F} is ${a.value===F}`),a.value===F))>-1||X(r.value.length,ie,F)}}function ce(s){s.preventDefault()}return()=>e.createVNode("div",{class:O.value,onDrop:le,onDragover:ce},[e.createVNode("ul",{ref:f,class:G.value,onWheel:s=>oe(s)},[z()])])}});function Me(n,t,m){var E;function p(){}const r="",y="",v=e.ref();function w(){return(t==null?void 0:t.schema.componentType)!=="frame"}function A(){return!1}function i(){return(t==null?void 0:t.schema.componentType)!=="frame"}function g(){return(t==null?void 0:t.schema.componentType)==="frame"}function d(h){if(!h||!h.value)return null;if(h.value.schema&&h.value.schema.type==="component")return h.value;const S=e.ref(h==null?void 0:h.value.parent),B=d(S);return B||null}function f(h=t){const{componentInstance:S,designerItemElementRef:B}=h;return!S||!S.value?null:S.value.canMove?B:f(h.parent)}function T(h){return!!m}function k(){return(t==null?void 0:t.schema.label)||(t==null?void 0:t.schema.title)||(t==null?void 0:t.schema.name)}function D(){}function M(h,S){}function b(h,S){const{componentType:B}=h;let O=U(B,h,S);const R=B.toLowerCase().replace("-","_");return O&&!O.id&&O.type===B&&(O.id=`${R}_${Math.random().toString().slice(2,6)}`),O}function L(h,S){const B=String(h.getAttribute("data-controltype")),O=h.getAttribute("data-feature"),R=O?JSON.parse(O):{};R.parentComponentInstance=v.value;let P=U(B,R);const _=B.toLowerCase().replace("-","_");return P&&!P.id&&P.type===B&&(P.id=`${_}_${Math.random().toString().slice(2,6)}`),P}function I(h){}function q(...h){}return v.value={canMove:w(),canSelectParent:A(),canDelete:i(),canNested:!g(),contents:t==null?void 0:t.schema.contents,elementRef:n,parent:(E=t==null?void 0:t.parent)==null?void 0:E.componentInstance,schema:t==null?void 0:t.schema,styles:r,designerClass:y,canAccepts:T,getBelongedComponentInstance:d,getDraggableDesignItemElement:f,getDraggingDisplayText:k,getPropConfig:q,getDragScopeElement:D,onAcceptMovedChildElement:M,onAcceptNewChildElement:L,onChildElementMovedOut:I,addNewChildComponentSchema:b,updateDragAndDropRules:p,triggerBelongedComponentToMoveWhenMoved:e.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:e.ref(!1)},v}const Ee=e.defineComponent({name:"FTagsDesign",props:H,emits:["remove","selectionChange","change"],setup(n,t){const m=e.ref(n.selectable),p=e.ref(n.customClass),r=e.ref(n.data),y=e.ref(n.tagType),v=e.ref(n.tagStyle),w=e.ref(n.showColor),A=e.ref(n.activeTag),i=e.ref(n.customStyle),g=e.ref(n.showClose),d=e.ref(n.showAddButton),f=e.ref(n.showInput),T=e.ref(n.addButtonText),k=e.ref(n.enableAddButton);e.ref(n.placeholder),e.ref(""),e.ref();const D=e.ref(),M=e.ref(n.wrapText),b=e.ref(),L=e.ref(),I=e.inject("design-item-context"),q=Me(L,I);e.onMounted(()=>{L.value.componentInstance=q}),t.expose(q.value);function E(){const a=r.value.map(l=>({type:"Tag",payload:l}));return d.value&&a.push({type:"AddButton"}),a}const h=e.ref(E());function S(a){r.value=a,h.value=E()}const B=e.computed(()=>h.value.findIndex(a=>a.type==="Input")),O=ge(n,t,r,h),{dragstart:R,dragenter:P,dragover:_,dragend:Z}=O;e.watch(()=>n.data,a=>S(a));const K=e.computed(()=>{const a={"farris-tags":!0,"farris-tags-checkable":m.value,"farris-tags-nowrap":!M.value};return p.value.split(" ").reduce((l,c)=>(l[c]=!0,l),a),a});function ee(a){const l={"farris-tag-item":!0,"farris-tag-item-checked":m.value&&a.checked,"farris-tag-item-checkable":m.value,"farris-tag-item-has-color":w.value,"farris-tag-item-actived":A.value===a.name};if(y.value){const c=`farris-tag-item-${y.value}`;l[c]=!0}return l}const te=e.computed(()=>{const a={};return i.value&&i.value.split(";").reduce((l,c)=>{const C=c.split(":");return l[C[0]]=C[1],l},a),a});function ae(a,l){m.value&&l.selectable&&(l.checked=!l.checked,A.value=l.checked?l.name:"",l.checked&&r.value.filter(c=>c.name!==l.name).forEach(c=>{c.checked=!l.checked}),t.emit("change",r.value),t.emit("selectionChange",l))}function X(a,l){let c;switch(a.key){case"Backspace":r.value=r.value.filter(C=>C.name!==l.name),t.emit("change",r.value);break;case"ArrowLeft":c=Math.max(D.value.scrollLeft+20,0),D.value.scrollLeft=c;break;case"ArrowRight":c=Math.max(D.value.scrollLeft-20,0),D.value.scrollLeft=c}}function J(a,l){const c=r.value.findIndex(C=>C.name===l.name);if(c>-1){const[C]=r.value.splice(c,1);h.value=E(),t.emit("change",r.value),t.emit("remove",r.value,C,c)}a.stopPropagation()}const ne=e.computed(()=>({"farris-tag-item":!0,"farris-tag-add-button":!0,"farris-tag-add-button-disabled":!k.value}));function me(a){}function re(){return e.createVNode("li",{class:ne.value,onClick:a=>void 0},[e.createVNode("span",{class:"f-icon f-icon-amplification"},null),e.createVNode("span",{class:"farris-tag-add-text"},[T.value])])}function se(a){if(a&&!a.innerText){const l=B.value;if(l>0){const[c]=r.value.splice(l-1,1);h.value.splice(l-1,1),t.emit("remove",r.value,c,l-1)}}}function z(a,l,c){a>-1&&(r.value.splice(a,0,{name:l,value:c,selectable:m.value}),h.value=E(),t.emit("change",r.value))}function G(a){if(a&&a.innerText){const l=a.innerText,c=B.value;z(c,l,l),a.innerText=""}}function oe(a){const l=a.target;l&&(l.innerText?G(l):t.emit("change",r.value))}function le(a){a.key==="Enter"&&G(a.target),a.key==="Backspace"&&(se(a.target),e.nextTick(()=>{var l;b.value&&((l=b.value)==null||l.focus())}))}function ce(){return e.createVNode("li",{class:"farris-tag-input-box"},[e.createVNode("div",{ref:b,class:"form-control",contenteditable:"true",onKeyup:le,onBlur:oe},null)])}function s(a,l){return e.createVNode("li",{class:ee(a),style:te.value,tabindex:0,id:a.name,key:a.name,onClick:c=>ae(c,a),onKeydown:c=>X(c,a),draggable:"true",onDragstart:c=>R(c,a,l),onDragenter:c=>P(c,l),onDragend:c=>Z(c,a),onDragover:c=>_(c,l)},[e.createVNode("div",{title:a.name,class:"tag-box"},[a.name]),g.value&&e.createVNode("span",{class:"tag-delete"},[e.createVNode("i",{class:"f-icon f-icon-close",onClick:c=>J(c,a)},null)])])}function o(){return h.value.map((a,l)=>{switch(a.type){case"Tag":return s(a.payload,l);case"AddButton":return re();case"Input":return ce()}})}const u=e.computed(()=>({"farris-tags-item-container":!0,"farris-tag-item-capsule":v.value==="capsule"}));function N(a){const l=Math.max(D.value.scrollLeft-a.deltaX,0);D.value.scrollLeft=l}function ie(a){const l=D.value,c=r.value.length-1;if(l){const C=Array.from(l.children).filter($=>$.className.indexOf("farris-tag-item")>-1).findIndex($=>{const V=$.getBoundingClientRect(),ue=window.getComputedStyle($),ve=parseInt(ue["margin-left"],10)+V.width+parseInt(ue["margin-right"],10);return V.left+ve>a});if(C>-1)return C}return c}function F(a){if(f.value){const c=ie(a.clientX)+1,$=h.value.filter(V=>V.type!=="Input");$.splice(c,0,{type:"Input"}),h.value=$,e.nextTick(()=>{var V;b.value&&((V=b.value)==null||V.focus())})}}function he(a){var c;a.preventDefault(),a.stopPropagation();const l=(c=a.dataTransfer)==null?void 0:c.getData("Text");if(l){const C=l.split(":"),$=C[0],V=C[1];[...r.value].findIndex(fe=>(console.log(`${fe.value} === ${V} is ${fe.value===V}`),fe.value===V))>-1||z(r.value.length,$,V)}}function ye(a){a.preventDefault()}return()=>e.createVNode("div",{ref:L,class:K.value,onClick:F,onDrop:he,onDragover:ye},[e.createVNode("ul",{ref:D,class:u.value,onWheel:a=>N(a)},[o()])])}});W.register=(n,t,m,p)=>{n.tags=W,t.tags=Y},W.registerDesigner=(n,t,m)=>{n.tags=Ee,t.tags=Y};const Pe=x.withInstall(W);j.FTags=W,j.default=Pe,j.propsResolver=Y,j.tagsProps=H,Object.defineProperties(j,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
1
+ (function(O,x){typeof exports=="object"&&typeof module<"u"?x(exports,require("../common/index.umd.js"),require("vue"),require("lodash-es")):typeof define=="function"&&define.amd?define(["exports","../common/index.umd.js","vue","lodash-es"],x):(O=typeof globalThis<"u"?globalThis:O||self,x(O.tags={},O.common,O.Vue,O.LodashES))})(this,function(O,x,e,Q){"use strict";function Te(n,t,m){return t}const pe={},ge={};function U(n){const{properties:t,title:m,ignore:p}=n,r=p&&Array.isArray(p),y=Object.keys(t).reduce((v,w)=>((!r||!p.find(A=>A==w))&&(v[w]=t[w].type==="object"&&t[w].properties?U(t[w]):Q.cloneDeep(t[w].default)),v),{});return(!r||!p.find(v=>v=="id"))&&(y.id=`${m}-${Date.now()}`),y}function Y(n,t={},m){const p=pe[n];if(p){let r=U(p);const y=ge[n];return r=y?y({getSchemaByType:Y},r,t,m):r,r}return null}function we(n,t){const m=U(t);return Object.keys(n).reduce((p,r)=>(p[r]&&Q.isPlainObject(p[r])&&Q.isPlainObject(n[r])?Object.assign(p[r],n[r]):p[r]=n[r],p),m),m}function ke(n,t){return Object.keys(n).filter(p=>n[p]!=null).reduce((p,r)=>{if(t.has(r)){const y=t.get(r);if(typeof y=="string")p[y]=n[r];else{const v=y(r,n[r],n);Object.assign(p,v)}}else p[r]=n[r];return p},{})}function De(n,t,m=new Map){const p=we(n,t);return ke(p,m)}function Be(n={}){function t(i,g,d,f){if(typeof d=="number")return f[i].length===d;if(typeof d=="object"){const T=Object.keys(d)[0],k=d[T];if(T==="not")return Number(f[i].length)!==Number(k);if(T==="moreThan")return Number(f[i].length)>=Number(k);if(T==="lessThan")return Number(f[i].length)<=Number(k)}return!1}function m(i,g,d,f){return f[i]&&f[i].propertyValue&&String(f[i].propertyValue.value)===String(d)}const p=new Map([["length",t],["getProperty",m]]);Object.keys(n).reduce((i,g)=>(i.set(g,n[g]),i),p);function r(i,g){const d=i;return typeof g=="number"?[{target:d,operator:"length",param:null,value:Number(g)}]:typeof g=="boolean"?[{target:d,operator:"getProperty",param:i,value:!!g}]:typeof g=="object"?Object.keys(g).map(f=>{if(f==="length")return{target:d,operator:"length",param:null,value:g[f]};const T=f,k=g[f];return{target:d,operator:"getProperty",param:T,value:k}}):[]}function y(i){return Object.keys(i).reduce((d,f)=>{const T=r(f,i[f]);return d.push(...T),d},[])}function v(i,g){if(p.has(i.operator)){const d=p.get(i.operator);return d&&d(i.target,i.param,i.value,g)||!1}return!1}function w(i,g){return y(i).reduce((T,k)=>T&&v(k,g),!0)}function A(i,g){const d=Object.keys(i),f=d.includes("allOf"),T=d.includes("anyOf"),k=f||T,b=(k?i[k?f?"allOf":"anyOf":"allOf"]:[i]).map(I=>w(I,g));return f?!b.includes(!1):b.includes(!0)}return{parseValueSchema:A}}const Ae={},Ce={};Be();function Se(n,t,m=new Map,p=(v,w,A)=>w,r={},y=v=>v){return pe[t.title]=t,ge[t.title]=p,Ae[t.title]=r,Ce[t.title]=y,(v={})=>{const w=De(v,t,m),A=Object.keys(n).reduce((i,g)=>(i[g]=n[g].default,i),{});return Object.assign(A,w)}}function Ne(n,t){return{customClass:t.class,customStyle:t.style}}const Oe=new Map([["appearance",Ne]]),je={title:"tags",description:"A Farris Component",type:"object",categories:{basic:{description:"Basic Infomation",title:"基本信息",properties:{id:{description:"组件标识",title:"标识",type:"string",readonly:!0},type:{description:"组件类型",title:"控件类型",type:"select",editor:{type:"waiting for modification",enum:[]}}}}}},Ve={$schema:"https://json-schema.org/draft/2020-12/schema",$id:"https://farris-design.gitee.io/tags.schema.json",title:"tags",description:"A Farris Component",type:"object",properties:{id:{description:"The unique identifier for tags",type:"string"},type:{description:"The type string of tags",type:"string",default:"tags"},appearance:{description:"",type:"object",properties:{class:{type:"string"},style:{type:"string"}},default:{}},binding:{description:"",type:"object",default:{}},disable:{type:"string",default:!1},editable:{description:"",type:"boolean",default:!0},placeholder:{description:"",type:"string",default:""},readonly:{description:"",type:"boolean",default:!1},require:{description:"",type:"boolean",default:!1},tabindex:{description:"",type:"number",default:-1},visible:{description:"",type:"boolean",default:!0}},required:["id","type"]},H={activeTag:{type:String,default:""},addButtonText:{type:String,default:""},customClass:{type:String,default:""},customStyle:{type:String,default:""},data:{type:Array,default:[{name:"示例1"}]},enableAddButton:{type:Boolean,default:!1},selectable:{type:Boolean,default:!1},showAddButton:{type:Boolean,default:!1},showClose:{type:Boolean,default:!0},showColor:{type:Boolean,default:!1},tagType:{type:String,default:""},tagStyle:{type:String,default:""},wrapText:{type:Boolean,default:!1},draggable:{type:Boolean,default:!1},disable:{type:Boolean,default:!1}},Z=Se(H,Ve,Oe,Te,je);function me(n,t,m,p){const r=e.ref(-1),y=e.ref(!1);function v(g,d,f){g.stopPropagation(),d&&setTimeout(()=>{r.value=f,y.value=!0,d.moving=!0})}function w(g,d){if(g.preventDefault(),r.value!==d){const f=p.value[r.value],T=p.value;T.splice(r.value,1),T.splice(d,0,f),r.value=d}}function A(g,d){g.preventDefault(),g.dataTransfer&&(g.dataTransfer.dropEffect="move")}function i(g,d){d&&(d.moving=!1),m.value=p.value.filter(f=>f.type==="Tag").map(f=>f.payload),y.value=!1,t.emit("change",m.value)}return{dragstart:v,dragenter:w,dragover:A,dragend:i,isDragging:y}}const W=e.defineComponent({name:"FTags",props:H,emits:["remove","selectionChange","change"],setup(n,t){const m=e.ref(n.selectable),p=e.ref(n.customClass),r=e.ref(n.data),y=e.ref(n.tagType),v=e.ref(n.tagStyle),w=e.ref(n.showColor),A=e.ref(n.customStyle),i=e.ref(n.activeTag),g=e.ref(n.showClose),d=e.ref(n.addButtonText),f=e.ref(),T=e.ref(n.wrapText),k=e.ref();e.ref(n.disable);const D=e.ref(!1);function M(){const s=r.value.map(o=>({type:"Tag",payload:o}));return n.showAddButton&&s.push({type:"AddButton"}),s}const b=e.ref(M());function L(s){r.value=s,b.value=M()}const I=e.computed(()=>b.value.findIndex(s=>s.type==="Input")),q=me(n,t,r,b),{dragstart:P,dragenter:h,dragover:S,dragend:B}=q;e.watch(()=>n.data,s=>L(s)),e.watch(()=>n.showAddButton,()=>{b.value=M()}),e.watch(()=>n.disable,s=>{b.value=M()}),e.watch(()=>n.activeTag,s=>{i.value=s}),e.watch(D,s=>{const o=[...b.value];s?o.length>0&&o[o.length-1].type!=="Input"&&(o.splice(o.length-1,1),o.splice(o.length,0,{type:"Input"}),b.value=o,e.nextTick(()=>{var u;k.value&&((u=k.value)==null||u.focus())})):o.length>0&&o[o.length-1].type!=="AddButton"&&(o.splice(o.length-1,1),o.splice(o.length,0,{type:"AddButton"}),b.value=o)});const j=e.computed(()=>{const s={"farris-tags":!0,"farris-tags-checkable":m.value,"farris-tags-nowrap":!T.value};return p.value.split(" ").reduce((o,u)=>(o[u]=!0,o),s),s});function R(s){const o={"farris-tag-item":!0,"farris-tag-item-checked":m.value&&s.checked,"farris-tag-item-checkable":m.value,"farris-tag-item-has-color":w.value,"farris-tag-item-actived":i.value===s.name};if(y.value){const u=`farris-tag-item-${y.value}`;o[u]=!0}return o}const E=e.computed(()=>{const s={};return A.value&&A.value.split(";").reduce((o,u)=>{const N=u.split(":");return o[N[0]]=N[1],o},s),s});function _(s,o){!n.disable&&m.value&&(!o.hasOwnProperty("selectable")||o.selectable)&&(o.checked=!o.checked,i.value=o.checked?o.name:"",o.checked&&r.value.filter(u=>u.name!==o.name).forEach(u=>{u.checked=!o.checked}),t.emit("change",r.value),t.emit("selectionChange",o))}function K(s,o){let u;switch(s.key){case"Backspace":r.value=r.value.filter(N=>N.name!==o.name),t.emit("change",r.value);break;case"ArrowLeft":u=Math.max(f.value.scrollLeft+20,0),f.value.scrollLeft=u;break;case"ArrowRight":u=Math.max(f.value.scrollLeft-20,0),f.value.scrollLeft=u}}function ee(s,o){const u=r.value.findIndex(N=>N.name===o.name);if(u>-1){const[N]=r.value.splice(u,1);b.value=M(),t.emit("change",r.value),t.emit("remove",{tags:r.value,remove:N})}s.stopPropagation()}const te=e.computed(()=>({"farris-tag-item":!0,"farris-tag-add-button":!0,"farris-tag-add-button-disabled":!n.enableAddButton}));function ae(s){s.stopPropagation(),D.value=!0}function ne(){return!n.disable&&e.createVNode("li",{class:te.value,onClick:s=>ae(s)},[e.createVNode("span",{class:"f-icon f-icon-amplification"},null),d.value&&e.createVNode("span",{class:"farris-tag-add-text"},[d.value])])}function X(s,o,u){s>-1&&(r.value.splice(s,0,{name:o,value:u,selectable:m.value}),b.value=M(),D.value=!1,t.emit("change",r.value))}function J(s){if(s&&s.value){const o=s.value,u=I.value;X(u,o,o),s.innerText=""}else D.value=!1}function re(s){const o=s.target;o&&o.value?J(o):D.value=!1}function he(s){s.key==="Enter"&&J(s.target)}function se(){return!n.disable&&e.createVNode("li",{class:"farris-tag-input-box"},[e.createVNode("input",{title:"farris-tag-input-box",ref:k,class:"form-control",onKeyup:he,onBlur:re},null)])}function oe(s,o){return e.createVNode("li",{class:R(s),style:E.value,tabindex:0,id:s.name,key:s.name,onClick:u=>_(u,s),onKeydown:u=>K(u,s),draggable:"true",onDragstart:u=>P(u,s,o),onDragenter:u=>h(u,o),onDragend:u=>B(u,s),onDragover:u=>S(u,o)},[e.createVNode("span",{title:s.name,class:"tag-box"},[s.name]),!n.disable&&g.value&&e.createVNode("span",{class:"tag-delete"},[e.createVNode("i",{class:"f-icon f-icon-close",onClick:u=>ee(u,s)},null)])])}function z(){return b.value.map((s,o)=>{switch(s.type){case"Tag":return oe(s.payload,o);case"AddButton":return ne();case"Input":return se()}})}const G=e.computed(()=>({"farris-tags-item-container":!0,"farris-tag-item-capsule":v.value==="capsule"}));function le(s){const o=Math.max(f.value.scrollLeft-s.deltaX,0);f.value.scrollLeft=o}function ce(s){var u;s.preventDefault(),s.stopPropagation();const o=(u=s.dataTransfer)==null?void 0:u.getData("Text");if(o){const N=o.split(":"),ue=N[0],F=N[1];[...r.value].findIndex(a=>(console.log(`${a.value} === ${F} is ${a.value===F}`),a.value===F))>-1||X(r.value.length,ue,F)}}function ie(s){s.preventDefault()}return()=>e.createVNode("div",{class:j.value,onDrop:ce,onDragover:ie},[e.createVNode("ul",{ref:f,class:G.value,onWheel:s=>le(s)},[z()])])}});function Me(n,t,m){var P;function p(){}const r="",y="",v=e.ref();function w(){return(t==null?void 0:t.schema.componentType)!=="frame"}function A(){return!1}function i(){return(t==null?void 0:t.schema.componentType)!=="frame"}function g(){return(t==null?void 0:t.schema.componentType)==="frame"}function d(h){if(!h||!h.value)return null;if(h.value.schema&&h.value.schema.type==="component")return h.value;const S=e.ref(h==null?void 0:h.value.parent),B=d(S);return B||null}function f(h=t){const{componentInstance:S,designerItemElementRef:B}=h;return!S||!S.value?null:S.value.canMove?B:f(h.parent)}function T(h){return!!m}function k(){return(t==null?void 0:t.schema.label)||(t==null?void 0:t.schema.title)||(t==null?void 0:t.schema.name)}function D(){}function M(h,S){}function b(h,S){const{componentType:B}=h;let j=Y(B,h,S);const R=B.toLowerCase().replace("-","_");return j&&!j.id&&j.type===B&&(j.id=`${R}_${Math.random().toString().slice(2,6)}`),j}function L(h,S){const B=String(h.getAttribute("data-controltype")),j=h.getAttribute("data-feature"),R=j?JSON.parse(j):{};R.parentComponentInstance=v.value;let E=Y(B,R);const _=B.toLowerCase().replace("-","_");return E&&!E.id&&E.type===B&&(E.id=`${_}_${Math.random().toString().slice(2,6)}`),E}function I(h){}function q(...h){}return v.value={canMove:w(),canSelectParent:A(),canDelete:i(),canNested:!g(),contents:t==null?void 0:t.schema.contents,elementRef:n,parent:(P=t==null?void 0:t.parent)==null?void 0:P.componentInstance,schema:t==null?void 0:t.schema,styles:r,designerClass:y,canAccepts:T,getBelongedComponentInstance:d,getDraggableDesignItemElement:f,getDraggingDisplayText:k,getPropConfig:q,getDragScopeElement:D,onAcceptMovedChildElement:M,onAcceptNewChildElement:L,onChildElementMovedOut:I,addNewChildComponentSchema:b,updateDragAndDropRules:p,triggerBelongedComponentToMoveWhenMoved:e.ref(!1),triggerBelongedComponentToDeleteWhenDeleted:e.ref(!1)},v}const Pe=e.defineComponent({name:"FTagsDesign",props:H,emits:["remove","selectionChange","change"],setup(n,t){const m=e.ref(n.selectable),p=e.ref(n.customClass),r=e.ref(n.data),y=e.ref(n.tagType),v=e.ref(n.tagStyle),w=e.ref(n.showColor),A=e.ref(n.activeTag),i=e.ref(n.customStyle),g=e.ref(n.showClose),d=e.ref(n.showAddButton),f=e.ref(n.showInput),T=e.ref(n.addButtonText),k=e.ref(n.enableAddButton);e.ref(n.placeholder),e.ref(""),e.ref();const D=e.ref(),M=e.ref(n.wrapText),b=e.ref(),L=e.ref(),I=e.inject("design-item-context"),q=Me(L,I);e.onMounted(()=>{L.value.componentInstance=q}),t.expose(q.value);function P(){const a=r.value.map(l=>({type:"Tag",payload:l}));return d.value&&a.push({type:"AddButton"}),a}const h=e.ref(P());function S(a){r.value=a,h.value=P()}const B=e.computed(()=>h.value.findIndex(a=>a.type==="Input")),j=me(n,t,r,h),{dragstart:R,dragenter:E,dragover:_,dragend:K}=j;e.watch(()=>n.data,a=>S(a));const ee=e.computed(()=>{const a={"farris-tags":!0,"farris-tags-checkable":m.value,"farris-tags-nowrap":!M.value};return p.value.split(" ").reduce((l,c)=>(l[c]=!0,l),a),a});function te(a){const l={"farris-tag-item":!0,"farris-tag-item-checked":m.value&&a.checked,"farris-tag-item-checkable":m.value,"farris-tag-item-has-color":w.value,"farris-tag-item-actived":A.value===a.name};if(y.value){const c=`farris-tag-item-${y.value}`;l[c]=!0}return l}const ae=e.computed(()=>{const a={};return i.value&&i.value.split(";").reduce((l,c)=>{const C=c.split(":");return l[C[0]]=C[1],l},a),a});function ne(a,l){m.value&&l.selectable&&(l.checked=!l.checked,A.value=l.checked?l.name:"",l.checked&&r.value.filter(c=>c.name!==l.name).forEach(c=>{c.checked=!l.checked}),t.emit("change",r.value),t.emit("selectionChange",l))}function X(a,l){let c;switch(a.key){case"Backspace":r.value=r.value.filter(C=>C.name!==l.name),t.emit("change",r.value);break;case"ArrowLeft":c=Math.max(D.value.scrollLeft+20,0),D.value.scrollLeft=c;break;case"ArrowRight":c=Math.max(D.value.scrollLeft-20,0),D.value.scrollLeft=c}}function J(a,l){const c=r.value.findIndex(C=>C.name===l.name);if(c>-1){const[C]=r.value.splice(c,1);h.value=P(),t.emit("change",r.value),t.emit("remove",r.value,C,c)}a.stopPropagation()}const re=e.computed(()=>({"farris-tag-item":!0,"farris-tag-add-button":!0,"farris-tag-add-button-disabled":!k.value}));function he(a){}function se(){return e.createVNode("li",{class:re.value,onClick:a=>void 0},[e.createVNode("span",{class:"f-icon f-icon-amplification"},null),e.createVNode("span",{class:"farris-tag-add-text"},[T.value])])}function oe(a){if(a&&!a.innerText){const l=B.value;if(l>0){const[c]=r.value.splice(l-1,1);h.value.splice(l-1,1),t.emit("remove",r.value,c,l-1)}}}function z(a,l,c){a>-1&&(r.value.splice(a,0,{name:l,value:c,selectable:m.value}),h.value=P(),t.emit("change",r.value))}function G(a){if(a&&a.innerText){const l=a.innerText,c=B.value;z(c,l,l),a.innerText=""}}function le(a){const l=a.target;l&&(l.innerText?G(l):t.emit("change",r.value))}function ce(a){a.key==="Enter"&&G(a.target),a.key==="Backspace"&&(oe(a.target),e.nextTick(()=>{var l;b.value&&((l=b.value)==null||l.focus())}))}function ie(){return e.createVNode("li",{class:"farris-tag-input-box"},[e.createVNode("div",{ref:b,class:"form-control",contenteditable:"true",onKeyup:ce,onBlur:le},null)])}function s(a,l){return e.createVNode("li",{class:te(a),style:ae.value,tabindex:0,id:a.name,key:a.name,onClick:c=>ne(c,a),onKeydown:c=>X(c,a),draggable:"true",onDragstart:c=>R(c,a,l),onDragenter:c=>E(c,l),onDragend:c=>K(c,a),onDragover:c=>_(c,l)},[e.createVNode("div",{title:a.name,class:"tag-box"},[a.name]),g.value&&e.createVNode("span",{class:"tag-delete"},[e.createVNode("i",{class:"f-icon f-icon-close",onClick:c=>J(c,a)},null)])])}function o(){return h.value.map((a,l)=>{switch(a.type){case"Tag":return s(a.payload,l);case"AddButton":return se();case"Input":return ie()}})}const u=e.computed(()=>({"farris-tags-item-container":!0,"farris-tag-item-capsule":v.value==="capsule"}));function N(a){const l=Math.max(D.value.scrollLeft-a.deltaX,0);D.value.scrollLeft=l}function ue(a){const l=D.value,c=r.value.length-1;if(l){const C=Array.from(l.children).filter($=>$.className.indexOf("farris-tag-item")>-1).findIndex($=>{const V=$.getBoundingClientRect(),fe=window.getComputedStyle($),be=parseInt(fe["margin-left"],10)+V.width+parseInt(fe["margin-right"],10);return V.left+be>a});if(C>-1)return C}return c}function F(a){if(f.value){const c=ue(a.clientX)+1,$=h.value.filter(V=>V.type!=="Input");$.splice(c,0,{type:"Input"}),h.value=$,e.nextTick(()=>{var V;b.value&&((V=b.value)==null||V.focus())})}}function ye(a){var c;a.preventDefault(),a.stopPropagation();const l=(c=a.dataTransfer)==null?void 0:c.getData("Text");if(l){const C=l.split(":"),$=C[0],V=C[1];[...r.value].findIndex(de=>(console.log(`${de.value} === ${V} is ${de.value===V}`),de.value===V))>-1||z(r.value.length,$,V)}}function ve(a){a.preventDefault()}return()=>e.createVNode("div",{ref:L,class:ee.value,onClick:F,onDrop:ye,onDragover:ve},[e.createVNode("ul",{ref:D,class:u.value,onWheel:a=>N(a)},[o()])])}});W.register=(n,t,m,p)=>{n.tags=W,t.tags=Z},W.registerDesigner=(n,t,m)=>{n.tags=Pe,t.tags=Z};const Ee=x.withInstall(W);O.FTags=W,O.default=Ee,O.propsResolver=Z,O.tagsProps=H,Object.defineProperties(O,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});