cnhis-design-vue 3.1.15-beta.4 → 3.1.15-beta.7

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 (154) hide show
  1. package/es/packages/bpmn-workflow/src/BpmnWorkflow.js +2 -2
  2. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/BpmnRenderer.js +8 -8
  3. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomContextPadProvider.js +2 -2
  4. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomPalette.js +1 -1
  5. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRenderer.js +4 -3
  6. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRules.js +2 -2
  7. package/es/packages/bpmn-workflow/src/custom/customModeler/index.js +1 -1
  8. package/es/packages/bpmn-workflow/src/custom/customOtherModule/CustomPopupMenu.js +2 -2
  9. package/es/packages/bpmn-workflow/src/custom/customOtherModule/zoomScroll.js +3 -3
  10. package/es/packages/field-set/index.d.ts +4365 -0
  11. package/es/packages/field-set/src/FieldSet.js +53 -54
  12. package/es/packages/field-set/src/FieldSet.vue.d.ts +4365 -0
  13. package/es/packages/field-set/style/index.css +0 -9
  14. package/es/packages/form-render/index.d.ts +24 -3
  15. package/es/packages/form-render/src/FormRender.js +10 -6
  16. package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
  17. package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.d.ts +5 -0
  18. package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.js +32 -0
  19. package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts} +7 -1
  20. package/es/packages/form-render/src/components/renderer/combination/index.js +157 -0
  21. package/es/packages/form-render/src/components/renderer/index.js +1 -1
  22. package/es/packages/form-render/src/components/renderer/radio.js +4 -1
  23. package/es/packages/form-render/src/components/renderer/select.d.ts +9 -0
  24. package/es/packages/form-render/src/components/renderer/select.js +6 -2
  25. package/es/packages/form-render/src/constants/index.d.ts +2 -1
  26. package/es/packages/form-render/src/hooks/useAnchor.d.ts +7 -6
  27. package/es/packages/form-render/src/hooks/useAnchor.js +1 -2
  28. package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +6 -1
  29. package/es/packages/form-render/src/hooks/useAsyncQueue.js +12 -3
  30. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +2 -4
  31. package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
  32. package/es/packages/form-render/src/hooks/useFormContext.js +15 -3
  33. package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +13 -0
  34. package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.js +10 -0
  35. package/es/packages/form-render/src/types/fieldItem.d.ts +8 -0
  36. package/es/packages/form-render/src/types/index.d.ts +25 -1
  37. package/es/packages/form-render/src/utils/index.d.ts +3 -3
  38. package/es/packages/form-render/src/utils/index.js +1 -4
  39. package/es/packages/index.css +1 -10
  40. package/es/packages/info-header/index.d.ts +1 -3
  41. package/es/packages/info-header/src/HiddenContent.js +1 -1
  42. package/es/packages/info-header/src/HiddenContent.vue.d.ts +1 -3
  43. package/es/packages/info-header/src/InfoHeader.vue.d.ts +1 -3
  44. package/es/packages/info-header/style/index.css +1 -1
  45. package/es/packages/shortcut-setter/index.d.ts +25 -4
  46. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +25 -4
  47. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +2 -2
  48. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +1 -1
  49. package/global.d.ts +8 -8
  50. package/package.json +9 -1
  51. package/es/_virtual/_commonjsHelpers.js +0 -7
  52. package/es/_virtual/css.escape.js +0 -3
  53. package/es/_virtual/inherits.js +0 -3
  54. package/es/_virtual/inherits_browser.js +0 -3
  55. package/es/node_modules/@formily/path/esm/contexts.js +0 -22
  56. package/es/node_modules/@formily/path/esm/destructor.js +0 -124
  57. package/es/node_modules/@formily/path/esm/index.js +0 -579
  58. package/es/node_modules/@formily/path/esm/matcher.js +0 -199
  59. package/es/node_modules/@formily/path/esm/parser.js +0 -402
  60. package/es/node_modules/@formily/path/esm/shared.js +0 -73
  61. package/es/node_modules/@formily/path/esm/tokenizer.js +0 -287
  62. package/es/node_modules/@formily/path/esm/tokens.js +0 -240
  63. package/es/node_modules/@formily/path/esm/types.js +0 -17
  64. package/es/node_modules/css.escape/css.escape.js +0 -110
  65. package/es/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -6
  66. package/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -18
  67. package/es/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +0 -17
  68. package/es/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +0 -27
  69. package/es/node_modules/date-fns/esm/_lib/getUTCWeek/index.js +0 -17
  70. package/es/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +0 -38
  71. package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -7
  72. package/es/node_modules/date-fns/esm/_lib/setUTCDay/index.js +0 -27
  73. package/es/node_modules/date-fns/esm/_lib/setUTCISODay/index.js +0 -23
  74. package/es/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js +0 -15
  75. package/es/node_modules/date-fns/esm/_lib/setUTCWeek/index.js +0 -15
  76. package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +0 -15
  77. package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +0 -15
  78. package/es/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +0 -25
  79. package/es/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +0 -21
  80. package/es/node_modules/date-fns/esm/_lib/toInteger/index.js +0 -15
  81. package/es/node_modules/date-fns/esm/compareAsc/index.js +0 -52
  82. package/es/node_modules/date-fns/esm/constants/index.js +0 -40
  83. package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.js +0 -49
  84. package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.js +0 -35
  85. package/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +0 -33
  86. package/es/node_modules/date-fns/esm/differenceInDays/index.js +0 -86
  87. package/es/node_modules/date-fns/esm/differenceInMonths/index.js +0 -59
  88. package/es/node_modules/date-fns/esm/differenceInYears/index.js +0 -43
  89. package/es/node_modules/date-fns/esm/endOfDay/index.js +0 -30
  90. package/es/node_modules/date-fns/esm/endOfMonth/index.js +0 -32
  91. package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.js +0 -30
  92. package/es/node_modules/date-fns/esm/parse/_lib/Parser.js +0 -32
  93. package/es/node_modules/date-fns/esm/parse/_lib/Setter.js +0 -37
  94. package/es/node_modules/date-fns/esm/parse/_lib/constants.js +0 -48
  95. package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
  96. package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js +0 -55
  97. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js +0 -55
  98. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js +0 -52
  99. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js +0 -80
  100. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js +0 -56
  101. package/es/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js +0 -53
  102. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js +0 -30
  103. package/es/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js +0 -29
  104. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js +0 -48
  105. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js +0 -41
  106. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js +0 -42
  107. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js +0 -50
  108. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js +0 -99
  109. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js +0 -46
  110. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -46
  111. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js +0 -43
  112. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js +0 -33
  113. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js +0 -96
  114. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js +0 -43
  115. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js +0 -61
  116. package/es/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js +0 -41
  117. package/es/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js +0 -80
  118. package/es/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js +0 -73
  119. package/es/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js +0 -41
  120. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -96
  121. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js +0 -80
  122. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js +0 -73
  123. package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -26
  124. package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js +0 -26
  125. package/es/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js +0 -66
  126. package/es/node_modules/date-fns/esm/parse/_lib/parsers/index.js +0 -109
  127. package/es/node_modules/date-fns/esm/parse/_lib/utils.js +0 -133
  128. package/es/node_modules/date-fns/esm/startOfDay/index.js +0 -30
  129. package/es/node_modules/date-fns/esm/toDate/index.js +0 -55
  130. package/es/node_modules/diagram-js/lib/command/CommandInterceptor.js +0 -139
  131. package/es/node_modules/diagram-js/lib/draw/BaseRenderer.js +0 -88
  132. package/es/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js +0 -591
  133. package/es/node_modules/diagram-js/lib/features/rules/RuleProvider.js +0 -88
  134. package/es/node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js +0 -120
  135. package/es/node_modules/diagram-js/lib/navigation/movecanvas/index.js +0 -8
  136. package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js +0 -227
  137. package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js +0 -24
  138. package/es/node_modules/diagram-js/lib/util/ClickTrap.js +0 -23
  139. package/es/node_modules/diagram-js/lib/util/Cursor.js +0 -20
  140. package/es/node_modules/diagram-js/lib/util/Event.js +0 -22
  141. package/es/node_modules/diagram-js/lib/util/Math.js +0 -9
  142. package/es/node_modules/diagram-js/lib/util/Mouse.js +0 -30
  143. package/es/node_modules/diagram-js/lib/util/Platform.js +0 -5
  144. package/es/node_modules/diagram-js/lib/util/PositionUtil.js +0 -8
  145. package/es/node_modules/diagram-js/lib/util/RenderUtil.js +0 -25
  146. package/es/node_modules/diagram-js/lib/util/SvgTransformUtil.js +0 -48
  147. package/es/node_modules/ids/dist/index.esm.js +0 -164
  148. package/es/node_modules/inherits/inherits.js +0 -19
  149. package/es/node_modules/inherits/inherits_browser.js +0 -38
  150. package/es/node_modules/inherits-browser/dist/index.es.js +0 -3
  151. package/es/node_modules/min-dash/dist/index.esm.js +0 -169
  152. package/es/node_modules/min-dom/dist/index.esm.js +0 -588
  153. package/es/node_modules/tiny-svg/dist/index.esm.js +0 -525
  154. package/es/packages/form-render/src/components/renderer/combination.js +0 -171
@@ -1,525 +0,0 @@
1
- function ensureImported(element, target) {
2
-
3
- if (element.ownerDocument !== target.ownerDocument) {
4
- try {
5
- // may fail on webkit
6
- return target.ownerDocument.importNode(element, true);
7
- } catch (e) {
8
- // ignore
9
- }
10
- }
11
-
12
- return element;
13
- }
14
-
15
- /**
16
- * appendTo utility
17
- */
18
-
19
- /**
20
- * Append a node to a target element and return the appended node.
21
- *
22
- * @param {SVGElement} element
23
- * @param {SVGElement} target
24
- *
25
- * @return {SVGElement} the appended node
26
- */
27
- function appendTo(element, target) {
28
- return target.appendChild(ensureImported(element, target));
29
- }
30
-
31
- /**
32
- * append utility
33
- */
34
-
35
- /**
36
- * Append a node to an element
37
- *
38
- * @param {SVGElement} element
39
- * @param {SVGElement} node
40
- *
41
- * @return {SVGElement} the element
42
- */
43
- function append(target, node) {
44
- appendTo(node, target);
45
- return target;
46
- }
47
-
48
- /**
49
- * attribute accessor utility
50
- */
51
-
52
- var LENGTH_ATTR = 2;
53
-
54
- var CSS_PROPERTIES = {
55
- 'alignment-baseline': 1,
56
- 'baseline-shift': 1,
57
- 'clip': 1,
58
- 'clip-path': 1,
59
- 'clip-rule': 1,
60
- 'color': 1,
61
- 'color-interpolation': 1,
62
- 'color-interpolation-filters': 1,
63
- 'color-profile': 1,
64
- 'color-rendering': 1,
65
- 'cursor': 1,
66
- 'direction': 1,
67
- 'display': 1,
68
- 'dominant-baseline': 1,
69
- 'enable-background': 1,
70
- 'fill': 1,
71
- 'fill-opacity': 1,
72
- 'fill-rule': 1,
73
- 'filter': 1,
74
- 'flood-color': 1,
75
- 'flood-opacity': 1,
76
- 'font': 1,
77
- 'font-family': 1,
78
- 'font-size': LENGTH_ATTR,
79
- 'font-size-adjust': 1,
80
- 'font-stretch': 1,
81
- 'font-style': 1,
82
- 'font-variant': 1,
83
- 'font-weight': 1,
84
- 'glyph-orientation-horizontal': 1,
85
- 'glyph-orientation-vertical': 1,
86
- 'image-rendering': 1,
87
- 'kerning': 1,
88
- 'letter-spacing': 1,
89
- 'lighting-color': 1,
90
- 'marker': 1,
91
- 'marker-end': 1,
92
- 'marker-mid': 1,
93
- 'marker-start': 1,
94
- 'mask': 1,
95
- 'opacity': 1,
96
- 'overflow': 1,
97
- 'pointer-events': 1,
98
- 'shape-rendering': 1,
99
- 'stop-color': 1,
100
- 'stop-opacity': 1,
101
- 'stroke': 1,
102
- 'stroke-dasharray': 1,
103
- 'stroke-dashoffset': 1,
104
- 'stroke-linecap': 1,
105
- 'stroke-linejoin': 1,
106
- 'stroke-miterlimit': 1,
107
- 'stroke-opacity': 1,
108
- 'stroke-width': LENGTH_ATTR,
109
- 'text-anchor': 1,
110
- 'text-decoration': 1,
111
- 'text-rendering': 1,
112
- 'unicode-bidi': 1,
113
- 'visibility': 1,
114
- 'word-spacing': 1,
115
- 'writing-mode': 1
116
- };
117
-
118
-
119
- function getAttribute(node, name) {
120
- if (CSS_PROPERTIES[name]) {
121
- return node.style[name];
122
- } else {
123
- return node.getAttributeNS(null, name);
124
- }
125
- }
126
-
127
- function setAttribute(node, name, value) {
128
- var hyphenated = name.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
129
-
130
- var type = CSS_PROPERTIES[hyphenated];
131
-
132
- if (type) {
133
- // append pixel unit, unless present
134
- if (type === LENGTH_ATTR && typeof value === 'number') {
135
- value = String(value) + 'px';
136
- }
137
-
138
- node.style[hyphenated] = value;
139
- } else {
140
- node.setAttributeNS(null, name, value);
141
- }
142
- }
143
-
144
- function setAttributes(node, attrs) {
145
-
146
- var names = Object.keys(attrs), i, name;
147
-
148
- for (i = 0, name; (name = names[i]); i++) {
149
- setAttribute(node, name, attrs[name]);
150
- }
151
- }
152
-
153
- /**
154
- * Gets or sets raw attributes on a node.
155
- *
156
- * @param {SVGElement} node
157
- * @param {Object} [attrs]
158
- * @param {String} [name]
159
- * @param {String} [value]
160
- *
161
- * @return {String}
162
- */
163
- function attr(node, name, value) {
164
- if (typeof name === 'string') {
165
- if (value !== undefined) {
166
- setAttribute(node, name, value);
167
- } else {
168
- return getAttribute(node, name);
169
- }
170
- } else {
171
- setAttributes(node, name);
172
- }
173
-
174
- return node;
175
- }
176
-
177
- /**
178
- * Clear utility
179
- */
180
- function index(arr, obj) {
181
- if (arr.indexOf) {
182
- return arr.indexOf(obj);
183
- }
184
-
185
-
186
- for (var i = 0; i < arr.length; ++i) {
187
- if (arr[i] === obj) {
188
- return i;
189
- }
190
- }
191
-
192
- return -1;
193
- }
194
-
195
- var re = /\s+/;
196
-
197
- var toString = Object.prototype.toString;
198
-
199
- function defined(o) {
200
- return typeof o !== 'undefined';
201
- }
202
-
203
- /**
204
- * Wrap `el` in a `ClassList`.
205
- *
206
- * @param {Element} el
207
- * @return {ClassList}
208
- * @api public
209
- */
210
-
211
- function classes(el) {
212
- return new ClassList(el);
213
- }
214
-
215
- function ClassList(el) {
216
- if (!el || !el.nodeType) {
217
- throw new Error('A DOM element reference is required');
218
- }
219
- this.el = el;
220
- this.list = el.classList;
221
- }
222
-
223
- /**
224
- * Add class `name` if not already present.
225
- *
226
- * @param {String} name
227
- * @return {ClassList}
228
- * @api public
229
- */
230
-
231
- ClassList.prototype.add = function(name) {
232
-
233
- // classList
234
- if (this.list) {
235
- this.list.add(name);
236
- return this;
237
- }
238
-
239
- // fallback
240
- var arr = this.array();
241
- var i = index(arr, name);
242
- if (!~i) {
243
- arr.push(name);
244
- }
245
-
246
- if (defined(this.el.className.baseVal)) {
247
- this.el.className.baseVal = arr.join(' ');
248
- } else {
249
- this.el.className = arr.join(' ');
250
- }
251
-
252
- return this;
253
- };
254
-
255
- /**
256
- * Remove class `name` when present, or
257
- * pass a regular expression to remove
258
- * any which match.
259
- *
260
- * @param {String|RegExp} name
261
- * @return {ClassList}
262
- * @api public
263
- */
264
-
265
- ClassList.prototype.remove = function(name) {
266
- if ('[object RegExp]' === toString.call(name)) {
267
- return this.removeMatching(name);
268
- }
269
-
270
- // classList
271
- if (this.list) {
272
- this.list.remove(name);
273
- return this;
274
- }
275
-
276
- // fallback
277
- var arr = this.array();
278
- var i = index(arr, name);
279
- if (~i) {
280
- arr.splice(i, 1);
281
- }
282
- this.el.className.baseVal = arr.join(' ');
283
- return this;
284
- };
285
-
286
- /**
287
- * Remove all classes matching `re`.
288
- *
289
- * @param {RegExp} re
290
- * @return {ClassList}
291
- * @api private
292
- */
293
-
294
- ClassList.prototype.removeMatching = function(re) {
295
- var arr = this.array();
296
- for (var i = 0; i < arr.length; i++) {
297
- if (re.test(arr[i])) {
298
- this.remove(arr[i]);
299
- }
300
- }
301
- return this;
302
- };
303
-
304
- /**
305
- * Toggle class `name`, can force state via `force`.
306
- *
307
- * For browsers that support classList, but do not support `force` yet,
308
- * the mistake will be detected and corrected.
309
- *
310
- * @param {String} name
311
- * @param {Boolean} force
312
- * @return {ClassList}
313
- * @api public
314
- */
315
-
316
- ClassList.prototype.toggle = function(name, force) {
317
- // classList
318
- if (this.list) {
319
- if (defined(force)) {
320
- if (force !== this.list.toggle(name, force)) {
321
- this.list.toggle(name); // toggle again to correct
322
- }
323
- } else {
324
- this.list.toggle(name);
325
- }
326
- return this;
327
- }
328
-
329
- // fallback
330
- if (defined(force)) {
331
- if (!force) {
332
- this.remove(name);
333
- } else {
334
- this.add(name);
335
- }
336
- } else {
337
- if (this.has(name)) {
338
- this.remove(name);
339
- } else {
340
- this.add(name);
341
- }
342
- }
343
-
344
- return this;
345
- };
346
-
347
- /**
348
- * Return an array of classes.
349
- *
350
- * @return {Array}
351
- * @api public
352
- */
353
-
354
- ClassList.prototype.array = function() {
355
- var className = this.el.getAttribute('class') || '';
356
- var str = className.replace(/^\s+|\s+$/g, '');
357
- var arr = str.split(re);
358
- if ('' === arr[0]) {
359
- arr.shift();
360
- }
361
- return arr;
362
- };
363
-
364
- /**
365
- * Check if class `name` is present.
366
- *
367
- * @param {String} name
368
- * @return {ClassList}
369
- * @api public
370
- */
371
-
372
- ClassList.prototype.has =
373
- ClassList.prototype.contains = function(name) {
374
- return (
375
- this.list ?
376
- this.list.contains(name) :
377
- !! ~index(this.array(), name)
378
- );
379
- };
380
-
381
- var ns = {
382
- svg: 'http://www.w3.org/2000/svg'
383
- };
384
-
385
- /**
386
- * DOM parsing utility
387
- */
388
-
389
- var SVG_START = '<svg xmlns="' + ns.svg + '"';
390
-
391
- function parse(svg) {
392
-
393
- var unwrap = false;
394
-
395
- // ensure we import a valid svg document
396
- if (svg.substring(0, 4) === '<svg') {
397
- if (svg.indexOf(ns.svg) === -1) {
398
- svg = SVG_START + svg.substring(4);
399
- }
400
- } else {
401
- // namespace svg
402
- svg = SVG_START + '>' + svg + '</svg>';
403
- unwrap = true;
404
- }
405
-
406
- var parsed = parseDocument(svg);
407
-
408
- if (!unwrap) {
409
- return parsed;
410
- }
411
-
412
- var fragment = document.createDocumentFragment();
413
-
414
- var parent = parsed.firstChild;
415
-
416
- while (parent.firstChild) {
417
- fragment.appendChild(parent.firstChild);
418
- }
419
-
420
- return fragment;
421
- }
422
-
423
- function parseDocument(svg) {
424
-
425
- var parser;
426
-
427
- // parse
428
- parser = new DOMParser();
429
- parser.async = false;
430
-
431
- return parser.parseFromString(svg, 'text/xml');
432
- }
433
-
434
- /**
435
- * Create utility for SVG elements
436
- */
437
-
438
-
439
- /**
440
- * Create a specific type from name or SVG markup.
441
- *
442
- * @param {String} name the name or markup of the element
443
- * @param {Object} [attrs] attributes to set on the element
444
- *
445
- * @returns {SVGElement}
446
- */
447
- function create(name, attrs) {
448
- var element;
449
-
450
- if (name.charAt(0) === '<') {
451
- element = parse(name).firstChild;
452
- element = document.importNode(element, true);
453
- } else {
454
- element = document.createElementNS(ns.svg, name);
455
- }
456
-
457
- if (attrs) {
458
- attr(element, attrs);
459
- }
460
-
461
- return element;
462
- }
463
-
464
- /**
465
- * Geometry helpers
466
- */
467
-
468
- // fake node used to instantiate svg geometry elements
469
- var node = create('svg');
470
-
471
- function createTransform(matrix) {
472
- if (matrix) {
473
- return node.createSVGTransformFromMatrix(matrix);
474
- } else {
475
- return node.createSVGTransform();
476
- }
477
- }
478
-
479
- /**
480
- * transform accessor utility
481
- */
482
-
483
- function wrapMatrix(transformList, transform) {
484
- if (transform instanceof SVGMatrix) {
485
- return transformList.createSVGTransformFromMatrix(transform);
486
- }
487
-
488
- return transform;
489
- }
490
-
491
-
492
- function setTransforms(transformList, transforms) {
493
- var i, t;
494
-
495
- transformList.clear();
496
-
497
- for (i = 0; (t = transforms[i]); i++) {
498
- transformList.appendItem(wrapMatrix(transformList, t));
499
- }
500
- }
501
-
502
- /**
503
- * Get or set the transforms on the given node.
504
- *
505
- * @param {SVGElement} node
506
- * @param {SVGTransform|SVGMatrix|Array<SVGTransform|SVGMatrix>} [transforms]
507
- *
508
- * @return {SVGTransform} the consolidated transform
509
- */
510
- function transform(node, transforms) {
511
- var transformList = node.transform.baseVal;
512
-
513
- if (transforms) {
514
-
515
- if (!Array.isArray(transforms)) {
516
- transforms = [ transforms ];
517
- }
518
-
519
- setTransforms(transformList, transforms);
520
- }
521
-
522
- return transformList.consolidate();
523
- }
524
-
525
- export { append, appendTo, attr, classes, create, createTransform, transform };
@@ -1,171 +0,0 @@
1
- import { defineComponent, onMounted, ref, computed, watch, createVNode, createTextVNode } from 'vue';
2
- import { isField } from '@formily/core';
3
- import { Path } from '../../../../../node_modules/@formily/path/esm/index.js';
4
- import { flatten, isNumber } from 'lodash-es';
5
- import { useFormField } from '../../../../../packages/form-render';
6
- import { arrayed, assignUpdateValue, mergeDeepProperties, formRenderLog } from '../../utils/index.js';
7
- import { connect, mapProps } from '@formily/vue';
8
- import { useDebounceFn, isObject } from '@vueuse/core';
9
- import { NButton } from 'naive-ui';
10
- import FormRender from '../../FormRender.js';
11
-
12
- const script = defineComponent({
13
- name: "FormCombination",
14
- props: {
15
- title: {
16
- type: String,
17
- default: ""
18
- },
19
- value: {
20
- type: String
21
- },
22
- maxGroupNum: {
23
- type: Number
24
- },
25
- getProperties: {
26
- type: Function,
27
- default: () => []
28
- }
29
- },
30
- emits: ["update:value"],
31
- setup(props, {
32
- emit
33
- }) {
34
- const emitChange = useDebounceFn(function emitChange2() {
35
- emit("update:value", JSON.stringify(_values.value));
36
- formRenderRefs.value.splice(groupNum.value);
37
- }, 300);
38
- const {
39
- field
40
- } = useFormField();
41
- onMounted(() => {
42
- if (!isField(field.value))
43
- return;
44
- const tempValidator = field.value.validator;
45
- field.value.validator = [{
46
- async validator() {
47
- return Promise.allSettled(formRenderRefs.value.map((formRenderRef) => formRenderRef.validate())).then((resultList) => {
48
- const rejected = resultList.filter((res) => res.status === "rejected");
49
- if (!rejected.length)
50
- return "";
51
- return flatten(rejected.map((res) => res.reason));
52
- });
53
- }
54
- }, ...tempValidator ? arrayed(tempValidator) : []];
55
- });
56
- const formRenderRefs = ref([]);
57
- const groupNum = ref(1);
58
- const maxGroupNum = computed(() => {
59
- if (!isNumber(props.maxGroupNum))
60
- return Infinity;
61
- if (props.maxGroupNum < 1)
62
- return 0;
63
- return ~~props.maxGroupNum;
64
- });
65
- function add() {
66
- groupNum.value++;
67
- _values.value.push(mergeDeepProperties({}, props.getProperties()));
68
- emitChange();
69
- }
70
- function remove(idx) {
71
- groupNum.value--;
72
- _values.value.splice(idx, 1);
73
- emitChange();
74
- }
75
- watch(maxGroupNum, (value) => {
76
- if (groupNum.value <= value)
77
- return;
78
- groupNum.value = value;
79
- _values.value.splice(value);
80
- emitChange();
81
- }, {
82
- immediate: true
83
- });
84
- const _values = ref([{}]);
85
- function initValues(data, withInitialData = false) {
86
- if (!data)
87
- return;
88
- try {
89
- const parsed = JSON.parse(data);
90
- if (!Array.isArray(parsed))
91
- throw new Error();
92
- parsed.forEach((v, idx) => {
93
- if (idx > maxGroupNum.value - 1)
94
- return;
95
- if (isObject(v)) {
96
- _values.value[idx] = v;
97
- withInitialData && mergeDeepProperties(v, props.getProperties());
98
- }
99
- });
100
- groupNum.value = Math.min(_values.value.length, maxGroupNum.value);
101
- } catch (e) {
102
- formRenderLog(`invalid JSON value ${data} in COMBINATION => ${props.title}`, "warn");
103
- } finally {
104
- setFormValueByInitValue();
105
- }
106
- function setFormValueByInitValue() {
107
- _values.value.forEach((item, idx) => {
108
- var _a;
109
- (_a = formRenderRefs.value[idx]) == null ? void 0 : _a.setFieldState("*", (state) => {
110
- if (!isField(state))
111
- return;
112
- state.value = Path.getIn(item, state.path);
113
- });
114
- });
115
- }
116
- }
117
- watch(() => props.value, (value) => initValues(value));
118
- onMounted(() => {
119
- initValues(props.value || "[{}]", true);
120
- emitChange();
121
- });
122
- function stop(event) {
123
- event.stopPropagation();
124
- }
125
- function onChange(idx, {
126
- fieldKey,
127
- value
128
- }) {
129
- !_values.value[idx] && (_values.value[idx] = {});
130
- Path.setIn(_values.value[idx], fieldKey, value);
131
- emitChange();
132
- }
133
- const FormRenderComponent = FormRender;
134
- return () => {
135
- return createVNode("section", {
136
- "class": "form-render__combination"
137
- }, [createVNode("header", {
138
- "class": "form-render__combinationHeader"
139
- }, [createVNode("div", {
140
- "class": "form-render__combinationHeaderText"
141
- }, [props.title]), createVNode(NButton, {
142
- "onClick": add,
143
- "type": "info",
144
- "text": true,
145
- "disabled": groupNum.value >= maxGroupNum.value
146
- }, {
147
- default: () => [createTextVNode("\u65B0\u589E")]
148
- })]), Array.from({
149
- length: groupNum.value
150
- }).map((_, idx) => {
151
- return createVNode("section", {
152
- "class": "form-render__combinationContent"
153
- }, [createVNode(FormRenderComponent, {
154
- "ref": (_ref) => formRenderRefs.value[idx] = _ref,
155
- "fieldList": props.getProperties(),
156
- "onUpdateValue": () => false,
157
- "onInput": stop,
158
- "onBlur": stop,
159
- "onChange": stop,
160
- "onFormChange": (payload) => onChange(idx, payload)
161
- }, null), idx !== 0 ? createVNode("i", {
162
- "class": "form-render__combinationClose",
163
- "onClick": () => remove(idx)
164
- }, ["-"]) : null]);
165
- })]);
166
- };
167
- }
168
- });
169
- const COMBINATION = connect(script, mapProps(assignUpdateValue));
170
-
171
- export { COMBINATION };