cnhis-design-vue 3.1.14 → 3.1.15-beta.10

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 (221) hide show
  1. package/es/packages/annotation-edit/src/AnnotationEdit.js +2 -1
  2. package/es/packages/big-table/index.d.ts +8 -11
  3. package/es/packages/big-table/src/BigTable.vue.d.ts +24 -19
  4. package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +17 -11
  5. package/es/packages/big-table/src/bigTableProps.d.ts +4 -3
  6. package/es/packages/big-table/src/bigTableProps.js +1 -1
  7. package/es/packages/big-table/src/components/edit-form/edit-date.js +13 -4
  8. package/es/packages/big-table/src/components/edit-form/edit-select.js +2 -1
  9. package/es/packages/big-table/src/components/edit-form/edit-separate.js +18 -9
  10. package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +3 -1
  11. package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
  12. package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
  13. package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +51 -36
  14. package/es/packages/big-table/src/hooks/useEdit.d.ts +3 -1
  15. package/es/packages/big-table/src/hooks/useFormat.js +8 -1
  16. package/es/packages/big-table/style/index.css +38 -1
  17. package/es/packages/bpmn-workflow/src/BpmnWorkflow.js +2 -2
  18. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/BpmnRenderer.js +8 -8
  19. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomContextPadProvider.js +2 -2
  20. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomPalette.js +1 -1
  21. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRenderer.js +4 -3
  22. package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRules.js +2 -2
  23. package/es/packages/bpmn-workflow/src/custom/customModeler/index.js +1 -1
  24. package/es/packages/bpmn-workflow/src/custom/customOtherModule/CustomPopupMenu.js +2 -2
  25. package/es/packages/bpmn-workflow/src/custom/customOtherModule/zoomScroll.js +3 -3
  26. package/es/packages/button-print/src/utils/print.d.ts +1 -1
  27. package/es/packages/button-print/src/utils/print.js +1 -1
  28. package/es/packages/fabric-chart/index.d.ts +1 -0
  29. package/es/packages/fabric-chart/src/FabricChart.js +17 -17
  30. package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +12 -10
  31. package/es/packages/fabric-chart/src/hooks/useCenter.js +35 -73
  32. package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
  33. package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
  34. package/es/packages/fabric-chart/src/hooks/useLeft.js +5 -4
  35. package/es/packages/field-set/index.d.ts +4365 -0
  36. package/es/packages/field-set/src/FieldSet.js +53 -54
  37. package/es/packages/field-set/src/FieldSet.vue.d.ts +4365 -0
  38. package/es/packages/field-set/style/index.css +0 -9
  39. package/es/packages/form-config/index.d.ts +12111 -0
  40. package/es/packages/form-config/index.js +10 -0
  41. package/es/packages/form-config/src/FormConfig.js +113 -0
  42. package/es/packages/form-config/src/FormConfig.vue.d.ts +12113 -0
  43. package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
  44. package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
  45. package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
  46. package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3591 -0
  47. package/es/packages/form-config/src/constants/index.d.ts +28 -0
  48. package/es/packages/form-config/src/constants/index.js +28 -0
  49. package/es/packages/form-config/src/hooks/index.d.ts +2 -0
  50. package/es/packages/form-config/src/hooks/index.js +2 -0
  51. package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
  52. package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
  53. package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
  54. package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
  55. package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
  56. package/es/packages/form-config/src/hooks/useSortable.js +31 -0
  57. package/es/packages/form-config/src/types/index.d.ts +18 -0
  58. package/es/packages/form-config/src/types/index.js +1 -0
  59. package/es/packages/form-config/style/index.css +108 -0
  60. package/es/packages/form-render/index.d.ts +24 -3
  61. package/es/packages/form-render/src/FormRender.js +25 -6
  62. package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
  63. package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
  64. package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.d.ts +5 -0
  65. package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.js +32 -0
  66. package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts} +7 -1
  67. package/es/packages/form-render/src/components/renderer/combination/index.js +157 -0
  68. package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
  69. package/es/packages/form-render/src/components/renderer/complex.js +2 -5
  70. package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
  71. package/es/packages/form-render/src/components/renderer/date.js +63 -56
  72. package/es/packages/form-render/src/components/renderer/formItem.js +3 -3
  73. package/es/packages/form-render/src/components/renderer/index.js +1 -1
  74. package/es/packages/form-render/src/components/renderer/radio.js +4 -1
  75. package/es/packages/form-render/src/components/renderer/select.d.ts +9 -0
  76. package/es/packages/form-render/src/components/renderer/select.js +28 -17
  77. package/es/packages/form-render/src/constants/index.d.ts +2 -1
  78. package/es/packages/form-render/src/hooks/useAnchor.d.ts +7 -6
  79. package/es/packages/form-render/src/hooks/useAnchor.js +1 -2
  80. package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +6 -1
  81. package/es/packages/form-render/src/hooks/useAsyncQueue.js +12 -7
  82. package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
  83. package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
  84. package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +9 -7
  85. package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
  86. package/es/packages/form-render/src/hooks/useFormContext.js +21 -3
  87. package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +13 -0
  88. package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.js +10 -0
  89. package/es/packages/form-render/src/types/fieldItem.d.ts +33 -4
  90. package/es/packages/form-render/src/types/index.d.ts +30 -2
  91. package/es/packages/form-render/src/utils/index.d.ts +8 -5
  92. package/es/packages/form-render/src/utils/index.js +64 -13
  93. package/es/packages/form-render/style/index.css +11 -10
  94. package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
  95. package/es/packages/index.css +158 -21
  96. package/es/packages/index.d.ts +3 -1
  97. package/es/packages/index.js +4 -1
  98. package/es/packages/info-header/index.d.ts +1 -3
  99. package/es/packages/info-header/src/HiddenContent.js +1 -1
  100. package/es/packages/info-header/src/HiddenContent.vue.d.ts +1 -3
  101. package/es/packages/info-header/src/InfoHeader.vue.d.ts +1 -3
  102. package/es/packages/info-header/style/index.css +1 -1
  103. package/es/packages/shortcut-provider/index.d.ts +2 -11
  104. package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
  105. package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
  106. package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
  107. package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
  108. package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
  109. package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
  110. package/es/packages/shortcut-provider/src/utils/index.js +15 -5
  111. package/es/packages/shortcut-setter/index.d.ts +32 -9
  112. package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +32 -9
  113. package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +8 -6
  114. package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +8 -6
  115. package/es/src/utils/state.d.ts +29 -0
  116. package/es/src/utils/state.js +44 -0
  117. package/package.json +10 -1
  118. package/es/_virtual/_commonjsHelpers.js +0 -7
  119. package/es/_virtual/css.escape.js +0 -3
  120. package/es/_virtual/inherits.js +0 -3
  121. package/es/_virtual/inherits_browser.js +0 -3
  122. package/es/node_modules/@formily/path/esm/contexts.js +0 -22
  123. package/es/node_modules/@formily/path/esm/destructor.js +0 -124
  124. package/es/node_modules/@formily/path/esm/index.js +0 -579
  125. package/es/node_modules/@formily/path/esm/matcher.js +0 -199
  126. package/es/node_modules/@formily/path/esm/parser.js +0 -402
  127. package/es/node_modules/@formily/path/esm/shared.js +0 -73
  128. package/es/node_modules/@formily/path/esm/tokenizer.js +0 -287
  129. package/es/node_modules/@formily/path/esm/tokens.js +0 -240
  130. package/es/node_modules/@formily/path/esm/types.js +0 -17
  131. package/es/node_modules/css.escape/css.escape.js +0 -110
  132. package/es/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -6
  133. package/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -18
  134. package/es/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +0 -17
  135. package/es/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +0 -27
  136. package/es/node_modules/date-fns/esm/_lib/getUTCWeek/index.js +0 -17
  137. package/es/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +0 -38
  138. package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -7
  139. package/es/node_modules/date-fns/esm/_lib/setUTCDay/index.js +0 -27
  140. package/es/node_modules/date-fns/esm/_lib/setUTCISODay/index.js +0 -23
  141. package/es/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js +0 -15
  142. package/es/node_modules/date-fns/esm/_lib/setUTCWeek/index.js +0 -15
  143. package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +0 -15
  144. package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +0 -15
  145. package/es/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +0 -25
  146. package/es/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +0 -21
  147. package/es/node_modules/date-fns/esm/_lib/toInteger/index.js +0 -15
  148. package/es/node_modules/date-fns/esm/compareAsc/index.js +0 -52
  149. package/es/node_modules/date-fns/esm/constants/index.js +0 -40
  150. package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.js +0 -49
  151. package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.js +0 -35
  152. package/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +0 -33
  153. package/es/node_modules/date-fns/esm/differenceInDays/index.js +0 -86
  154. package/es/node_modules/date-fns/esm/differenceInMonths/index.js +0 -59
  155. package/es/node_modules/date-fns/esm/differenceInYears/index.js +0 -43
  156. package/es/node_modules/date-fns/esm/endOfDay/index.js +0 -30
  157. package/es/node_modules/date-fns/esm/endOfMonth/index.js +0 -32
  158. package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.js +0 -30
  159. package/es/node_modules/date-fns/esm/parse/_lib/Parser.js +0 -32
  160. package/es/node_modules/date-fns/esm/parse/_lib/Setter.js +0 -37
  161. package/es/node_modules/date-fns/esm/parse/_lib/constants.js +0 -48
  162. package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
  163. package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js +0 -55
  164. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js +0 -55
  165. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js +0 -52
  166. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js +0 -80
  167. package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js +0 -56
  168. package/es/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js +0 -53
  169. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js +0 -30
  170. package/es/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js +0 -29
  171. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js +0 -48
  172. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js +0 -41
  173. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js +0 -42
  174. package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js +0 -50
  175. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js +0 -99
  176. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js +0 -46
  177. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -46
  178. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js +0 -43
  179. package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js +0 -33
  180. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js +0 -96
  181. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js +0 -43
  182. package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js +0 -61
  183. package/es/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js +0 -41
  184. package/es/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js +0 -80
  185. package/es/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js +0 -73
  186. package/es/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js +0 -41
  187. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -96
  188. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js +0 -80
  189. package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js +0 -73
  190. package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -26
  191. package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js +0 -26
  192. package/es/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js +0 -66
  193. package/es/node_modules/date-fns/esm/parse/_lib/parsers/index.js +0 -109
  194. package/es/node_modules/date-fns/esm/parse/_lib/utils.js +0 -133
  195. package/es/node_modules/date-fns/esm/startOfDay/index.js +0 -30
  196. package/es/node_modules/date-fns/esm/toDate/index.js +0 -55
  197. package/es/node_modules/diagram-js/lib/command/CommandInterceptor.js +0 -139
  198. package/es/node_modules/diagram-js/lib/draw/BaseRenderer.js +0 -88
  199. package/es/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js +0 -591
  200. package/es/node_modules/diagram-js/lib/features/rules/RuleProvider.js +0 -88
  201. package/es/node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js +0 -120
  202. package/es/node_modules/diagram-js/lib/navigation/movecanvas/index.js +0 -8
  203. package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js +0 -227
  204. package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js +0 -24
  205. package/es/node_modules/diagram-js/lib/util/ClickTrap.js +0 -23
  206. package/es/node_modules/diagram-js/lib/util/Cursor.js +0 -20
  207. package/es/node_modules/diagram-js/lib/util/Event.js +0 -22
  208. package/es/node_modules/diagram-js/lib/util/Math.js +0 -9
  209. package/es/node_modules/diagram-js/lib/util/Mouse.js +0 -30
  210. package/es/node_modules/diagram-js/lib/util/Platform.js +0 -5
  211. package/es/node_modules/diagram-js/lib/util/PositionUtil.js +0 -8
  212. package/es/node_modules/diagram-js/lib/util/RenderUtil.js +0 -25
  213. package/es/node_modules/diagram-js/lib/util/SvgTransformUtil.js +0 -48
  214. package/es/node_modules/ids/dist/index.esm.js +0 -164
  215. package/es/node_modules/inherits/inherits.js +0 -19
  216. package/es/node_modules/inherits/inherits_browser.js +0 -38
  217. package/es/node_modules/inherits-browser/dist/index.es.js +0 -3
  218. package/es/node_modules/min-dash/dist/index.esm.js +0 -169
  219. package/es/node_modules/min-dom/dist/index.esm.js +0 -588
  220. package/es/node_modules/tiny-svg/dist/index.esm.js +0 -525
  221. package/es/packages/form-render/src/components/renderer/combination.js +0 -148
@@ -1,579 +0,0 @@
1
- import { Parser } from './parser.js';
2
- import { isStr, isArr, isRegExp, isFn, isEqual, isNum, isObj } from './shared.js';
3
- import { getDestructor, getInByDestructor, setInByDestructor, deleteInByDestructor, existInByDestructor } from './destructor.js';
4
- import { Matcher } from './matcher.js';
5
-
6
- var __read = (undefined && undefined.__read) || function (o, n) {
7
- var m = typeof Symbol === "function" && o[Symbol.iterator];
8
- if (!m) return o;
9
- var i = m.call(o), r, ar = [], e;
10
- try {
11
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
- }
13
- catch (error) { e = { error: error }; }
14
- finally {
15
- try {
16
- if (r && !r.done && (m = i["return"])) m.call(i);
17
- }
18
- finally { if (e) throw e.error; }
19
- }
20
- return ar;
21
- };
22
- var __spreadArray = (undefined && undefined.__spreadArray) || function (to, from, pack) {
23
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
24
- if (ar || !(i in from)) {
25
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
26
- ar[i] = from[i];
27
- }
28
- }
29
- return to.concat(ar || Array.prototype.slice.call(from));
30
- };
31
- var pathCache = new Map();
32
- var isMatcher = Symbol('PATH_MATCHER');
33
- var isValid = function (val) { return val !== undefined && val !== null; };
34
- var isSimplePath = function (val) {
35
- return val.indexOf('*') === -1 &&
36
- val.indexOf('~') === -1 &&
37
- val.indexOf('[') === -1 &&
38
- val.indexOf(']') === -1 &&
39
- val.indexOf(',') === -1 &&
40
- val.indexOf(':') === -1 &&
41
- val.indexOf(' ') === -1 &&
42
- val[0] !== '.';
43
- };
44
- var isAssignable = function (val) {
45
- return typeof val === 'object' || typeof val === 'function';
46
- };
47
- var isNumberIndex = function (val) {
48
- return isStr(val) ? /^\d+$/.test(val) : isNum(val);
49
- };
50
- var getIn = function (segments, source) {
51
- for (var i = 0; i < segments.length; i++) {
52
- var index = segments[i];
53
- var rules = getDestructor(index);
54
- if (!rules) {
55
- if (!isValid(source)) {
56
- if (i !== segments.length - 1) {
57
- return source;
58
- }
59
- break;
60
- }
61
- source = source[index];
62
- }
63
- else {
64
- source = getInByDestructor(source, rules, { setIn: setIn, getIn: getIn });
65
- break;
66
- }
67
- }
68
- return source;
69
- };
70
- var setIn = function (segments, source, value) {
71
- for (var i = 0; i < segments.length; i++) {
72
- var index = segments[i];
73
- var rules = getDestructor(index);
74
- if (!rules) {
75
- if (!isValid(source) || !isAssignable(source))
76
- return;
77
- if (isArr(source) && !isNumberIndex(index)) {
78
- return;
79
- }
80
- if (!isValid(source[index])) {
81
- if (value === undefined) {
82
- if (source[index] === null)
83
- source[index] = value;
84
- return;
85
- }
86
- if (i < segments.length - 1) {
87
- source[index] = isNum(segments[i + 1]) ? [] : {};
88
- }
89
- }
90
- if (i === segments.length - 1) {
91
- source[index] = value;
92
- }
93
- source = source[index];
94
- }
95
- else {
96
- setInByDestructor(source, rules, value, { setIn: setIn, getIn: getIn });
97
- break;
98
- }
99
- }
100
- };
101
- var deleteIn = function (segments, source) {
102
- for (var i = 0; i < segments.length; i++) {
103
- var index = segments[i];
104
- var rules = getDestructor(index);
105
- if (!rules) {
106
- if (i === segments.length - 1 && isValid(source)) {
107
- delete source[index];
108
- return;
109
- }
110
- if (!isValid(source) || !isAssignable(source))
111
- return;
112
- source = source[index];
113
- if (!isObj(source)) {
114
- return;
115
- }
116
- }
117
- else {
118
- deleteInByDestructor(source, rules, {
119
- setIn: setIn,
120
- getIn: getIn,
121
- deleteIn: deleteIn,
122
- });
123
- break;
124
- }
125
- }
126
- };
127
- var hasOwnProperty = Object.prototype.hasOwnProperty;
128
- var existIn = function (segments, source, start) {
129
- if (start instanceof Path) {
130
- start = start.length;
131
- }
132
- for (var i = start; i < segments.length; i++) {
133
- var index = segments[i];
134
- var rules = getDestructor(index);
135
- if (!rules) {
136
- if (i === segments.length - 1) {
137
- return hasOwnProperty.call(source, index);
138
- }
139
- if (!isValid(source) || !isAssignable(source))
140
- return false;
141
- source = source[index];
142
- if (!isObj(source)) {
143
- return false;
144
- }
145
- }
146
- else {
147
- return existInByDestructor(source, rules, start, {
148
- setIn: setIn,
149
- getIn: getIn,
150
- deleteIn: deleteIn,
151
- existIn: existIn,
152
- });
153
- }
154
- }
155
- };
156
- var parse = function (pattern, base) {
157
- if (pattern instanceof Path) {
158
- return {
159
- entire: pattern.entire,
160
- segments: pattern.segments.slice(),
161
- isRegExp: false,
162
- haveRelativePattern: pattern.haveRelativePattern,
163
- isWildMatchPattern: pattern.isWildMatchPattern,
164
- isMatchPattern: pattern.isMatchPattern,
165
- haveExcludePattern: pattern.haveExcludePattern,
166
- tree: pattern.tree,
167
- };
168
- }
169
- else if (isStr(pattern)) {
170
- if (!pattern) {
171
- return {
172
- entire: '',
173
- segments: [],
174
- isRegExp: false,
175
- isWildMatchPattern: false,
176
- haveExcludePattern: false,
177
- isMatchPattern: false,
178
- };
179
- }
180
- if (isSimplePath(pattern)) {
181
- return {
182
- entire: pattern,
183
- segments: pattern.split('.'),
184
- isRegExp: false,
185
- isWildMatchPattern: false,
186
- haveExcludePattern: false,
187
- isMatchPattern: false,
188
- };
189
- }
190
- var parser = new Parser(pattern, Path.parse(base));
191
- var tree = parser.parse();
192
- if (!parser.isMatchPattern) {
193
- var segments = parser.data.segments;
194
- return {
195
- entire: segments.join('.'),
196
- segments: segments,
197
- tree: tree,
198
- isRegExp: false,
199
- haveRelativePattern: parser.haveRelativePattern,
200
- isWildMatchPattern: false,
201
- haveExcludePattern: false,
202
- isMatchPattern: false,
203
- };
204
- }
205
- else {
206
- return {
207
- entire: pattern,
208
- segments: [],
209
- isRegExp: false,
210
- haveRelativePattern: false,
211
- isWildMatchPattern: parser.isWildMatchPattern,
212
- haveExcludePattern: parser.haveExcludePattern,
213
- isMatchPattern: true,
214
- tree: tree,
215
- };
216
- }
217
- }
218
- else if (isFn(pattern) && pattern[isMatcher]) {
219
- return parse(pattern['path']);
220
- }
221
- else if (isArr(pattern)) {
222
- return {
223
- entire: pattern.join('.'),
224
- segments: pattern.reduce(function (buf, key) {
225
- return buf.concat(parseString(key));
226
- }, []),
227
- isRegExp: false,
228
- haveRelativePattern: false,
229
- isWildMatchPattern: false,
230
- haveExcludePattern: false,
231
- isMatchPattern: false,
232
- };
233
- }
234
- else if (isRegExp(pattern)) {
235
- return {
236
- entire: pattern,
237
- segments: [],
238
- isRegExp: true,
239
- haveRelativePattern: false,
240
- isWildMatchPattern: false,
241
- haveExcludePattern: false,
242
- isMatchPattern: true,
243
- };
244
- }
245
- else {
246
- return {
247
- entire: '',
248
- isRegExp: false,
249
- segments: pattern !== undefined ? [pattern] : [],
250
- haveRelativePattern: false,
251
- isWildMatchPattern: false,
252
- haveExcludePattern: false,
253
- isMatchPattern: false,
254
- };
255
- }
256
- };
257
- var parseString = function (source) {
258
- if (isStr(source)) {
259
- source = source.replace(/\s*/g, '');
260
- try {
261
- var _a = parse(source), segments = _a.segments, isMatchPattern = _a.isMatchPattern;
262
- return !isMatchPattern ? segments : source;
263
- }
264
- catch (e) {
265
- return source;
266
- }
267
- }
268
- else if (source instanceof Path) {
269
- return source.segments;
270
- }
271
- return source;
272
- };
273
- var Path = /** @class */ (function () {
274
- function Path(input, base) {
275
- var _this = this;
276
- this.concat = function () {
277
- var _a;
278
- var args = [];
279
- for (var _i = 0; _i < arguments.length; _i++) {
280
- args[_i] = arguments[_i];
281
- }
282
- if (_this.isMatchPattern || _this.isRegExp) {
283
- throw new Error("".concat(_this.entire, " cannot be concat"));
284
- }
285
- var path = new Path('');
286
- path.segments = (_a = _this.segments).concat.apply(_a, __spreadArray([], __read(args.map(function (s) { return parseString(s); })), false));
287
- path.entire = path.segments.join('.');
288
- return path;
289
- };
290
- this.slice = function (start, end) {
291
- if (_this.isMatchPattern || _this.isRegExp) {
292
- throw new Error("".concat(_this.entire, " cannot be slice"));
293
- }
294
- var path = new Path('');
295
- path.segments = _this.segments.slice(start, end);
296
- path.entire = path.segments.join('.');
297
- return path;
298
- };
299
- this.push = function () {
300
- var items = [];
301
- for (var _i = 0; _i < arguments.length; _i++) {
302
- items[_i] = arguments[_i];
303
- }
304
- return _this.concat.apply(_this, __spreadArray([], __read(items), false));
305
- };
306
- this.pop = function () {
307
- if (_this.isMatchPattern || _this.isRegExp) {
308
- throw new Error("".concat(_this.entire, " cannot be pop"));
309
- }
310
- return new Path(_this.segments.slice(0, _this.segments.length - 1));
311
- };
312
- this.splice = function (start, deleteCount) {
313
- var items = [];
314
- for (var _i = 2; _i < arguments.length; _i++) {
315
- items[_i - 2] = arguments[_i];
316
- }
317
- if (_this.isMatchPattern || _this.isRegExp) {
318
- throw new Error("".concat(_this.entire, " cannot be splice"));
319
- }
320
- items = items.reduce(function (buf, item) { return buf.concat(parseString(item)); }, []);
321
- var segments_ = _this.segments.slice();
322
- segments_.splice.apply(segments_, __spreadArray([start, deleteCount], __read(items), false));
323
- return new Path(segments_);
324
- };
325
- this.forEach = function (callback) {
326
- if (_this.isMatchPattern || _this.isRegExp) {
327
- throw new Error("".concat(_this.entire, " cannot be each"));
328
- }
329
- _this.segments.forEach(callback);
330
- };
331
- this.map = function (callback) {
332
- if (_this.isMatchPattern || _this.isRegExp) {
333
- throw new Error("".concat(_this.entire, " cannot be map"));
334
- }
335
- return _this.segments.map(callback);
336
- };
337
- this.reduce = function (callback, initial) {
338
- if (_this.isMatchPattern || _this.isRegExp) {
339
- throw new Error("".concat(_this.entire, " cannot be reduce"));
340
- }
341
- return _this.segments.reduce(callback, initial);
342
- };
343
- this.parent = function () {
344
- return _this.slice(0, _this.length - 1);
345
- };
346
- this.includes = function (pattern) {
347
- var _a = Path.parse(pattern), entire = _a.entire, segments = _a.segments, isMatchPattern = _a.isMatchPattern;
348
- var cache = _this.includesCache.get(entire);
349
- if (cache !== undefined)
350
- return cache;
351
- var cacheWith = function (value) {
352
- _this.includesCache.set(entire, value);
353
- return value;
354
- };
355
- if (_this.isMatchPattern) {
356
- if (!isMatchPattern) {
357
- return cacheWith(_this.match(segments));
358
- }
359
- else {
360
- throw new Error("".concat(_this.entire, " cannot be used to match ").concat(entire));
361
- }
362
- }
363
- if (isMatchPattern) {
364
- throw new Error("".concat(_this.entire, " cannot be used to match ").concat(entire));
365
- }
366
- if (segments.length > _this.segments.length)
367
- return cacheWith(false);
368
- for (var i = 0; i < segments.length; i++) {
369
- if (!isEqual(String(segments[i]), String(_this.segments[i]))) {
370
- return cacheWith(false);
371
- }
372
- }
373
- return cacheWith(true);
374
- };
375
- this.transform = function (regexp, callback) {
376
- if (!isFn(callback))
377
- return '';
378
- if (_this.isMatchPattern) {
379
- throw new Error("".concat(_this.entire, " cannot be transformed"));
380
- }
381
- var args = _this.segments.reduce(function (buf, key) {
382
- return new RegExp(regexp).test(key) ? buf.concat(key) : buf;
383
- }, []);
384
- return callback.apply(void 0, __spreadArray([], __read(args), false));
385
- };
386
- this.match = function (pattern) {
387
- var _a, _b;
388
- var path = Path.parse(pattern);
389
- var cache = _this.matchCache.get(path.entire);
390
- if (cache !== undefined) {
391
- if (cache.record && cache.record.score !== undefined) {
392
- _this.matchScore = cache.record.score;
393
- }
394
- return cache.matched;
395
- }
396
- var cacheWith = function (value) {
397
- _this.matchCache.set(path.entire, value);
398
- return value;
399
- };
400
- if (path.isMatchPattern) {
401
- if (_this.isMatchPattern) {
402
- throw new Error("".concat(path.entire, " cannot match ").concat(_this.entire));
403
- }
404
- else {
405
- _this.matchScore = 0;
406
- return cacheWith(path.match(_this.segments));
407
- }
408
- }
409
- else {
410
- if (_this.isMatchPattern) {
411
- if (_this.isRegExp) {
412
- try {
413
- return (_b = (_a = _this['entire']) === null || _a === void 0 ? void 0 : _a['test']) === null || _b === void 0 ? void 0 : _b.call(_a, path.entire);
414
- }
415
- finally {
416
- _this.entire.lastIndex = 0;
417
- }
418
- }
419
- var record = {
420
- score: 0,
421
- };
422
- var result = cacheWith(new Matcher(_this.tree, record).match(path.segments));
423
- _this.matchScore = record.score;
424
- return result.matched;
425
- }
426
- else {
427
- var record = {
428
- score: 0,
429
- };
430
- var result = cacheWith(Matcher.matchSegments(_this.segments, path.segments, record));
431
- _this.matchScore = record.score;
432
- return result.matched;
433
- }
434
- }
435
- };
436
- //别名组匹配
437
- this.matchAliasGroup = function (name, alias) {
438
- var namePath = Path.parse(name);
439
- var aliasPath = Path.parse(alias);
440
- var nameMatched = _this.match(namePath);
441
- var nameMatchedScore = _this.matchScore;
442
- var aliasMatched = _this.match(aliasPath);
443
- var aliasMatchedScore = _this.matchScore;
444
- if (_this.haveExcludePattern) {
445
- if (nameMatchedScore >= aliasMatchedScore) {
446
- return nameMatched;
447
- }
448
- else {
449
- return aliasMatched;
450
- }
451
- }
452
- else {
453
- return nameMatched || aliasMatched;
454
- }
455
- };
456
- this.existIn = function (source, start) {
457
- if (start === void 0) { start = 0; }
458
- return existIn(_this.segments, source, start);
459
- };
460
- this.getIn = function (source) {
461
- return getIn(_this.segments, source);
462
- };
463
- this.setIn = function (source, value) {
464
- setIn(_this.segments, source, value);
465
- return source;
466
- };
467
- this.deleteIn = function (source) {
468
- deleteIn(_this.segments, source);
469
- return source;
470
- };
471
- this.ensureIn = function (source, defaults) {
472
- var results = _this.getIn(source);
473
- if (results === undefined) {
474
- _this.setIn(source, defaults);
475
- return _this.getIn(source);
476
- }
477
- return results;
478
- };
479
- var _a = parse(input, base), tree = _a.tree, segments = _a.segments, entire = _a.entire, isRegExp = _a.isRegExp, isMatchPattern = _a.isMatchPattern, isWildMatchPattern = _a.isWildMatchPattern, haveRelativePattern = _a.haveRelativePattern, haveExcludePattern = _a.haveExcludePattern;
480
- this.entire = entire;
481
- this.segments = segments;
482
- this.isMatchPattern = isMatchPattern;
483
- this.isWildMatchPattern = isWildMatchPattern;
484
- this.haveRelativePattern = haveRelativePattern;
485
- this.isRegExp = isRegExp;
486
- this.haveExcludePattern = haveExcludePattern;
487
- this.tree = tree;
488
- this.matchCache = new Map();
489
- this.includesCache = new Map();
490
- }
491
- Path.prototype.toString = function () {
492
- var _a;
493
- return (_a = this.entire) === null || _a === void 0 ? void 0 : _a.toString();
494
- };
495
- Path.prototype.toArr = function () {
496
- var _a;
497
- return (_a = this.segments) === null || _a === void 0 ? void 0 : _a.slice();
498
- };
499
- Object.defineProperty(Path.prototype, "length", {
500
- get: function () {
501
- return this.segments.length;
502
- },
503
- enumerable: false,
504
- configurable: true
505
- });
506
- Path.match = function (pattern) {
507
- var path = Path.parse(pattern);
508
- var matcher = function (target) {
509
- return path.match(target);
510
- };
511
- matcher[isMatcher] = true;
512
- matcher.path = path;
513
- return matcher;
514
- };
515
- Path.isPathPattern = function (target) {
516
- if (isStr(target) ||
517
- isArr(target) ||
518
- isRegExp(target) ||
519
- (isFn(target) && target[isMatcher])) {
520
- return true;
521
- }
522
- return false;
523
- };
524
- Path.transform = function (pattern, regexp, callback) {
525
- return Path.parse(pattern).transform(regexp, callback);
526
- };
527
- Path.parse = function (path, base) {
528
- if (path === void 0) { path = ''; }
529
- if (path instanceof Path) {
530
- var found = pathCache.get(path.entire);
531
- if (found) {
532
- return found;
533
- }
534
- else {
535
- pathCache.set(path.entire, path);
536
- return path;
537
- }
538
- }
539
- else if (path && path[isMatcher]) {
540
- return Path.parse(path['path']);
541
- }
542
- else {
543
- var key_ = base ? Path.parse(base) : '';
544
- var key = "".concat(path, ":").concat(key_);
545
- var found = pathCache.get(key);
546
- if (found) {
547
- return found;
548
- }
549
- else {
550
- path = new Path(path, base);
551
- pathCache.set(key, path);
552
- return path;
553
- }
554
- }
555
- };
556
- Path.getIn = function (source, pattern) {
557
- var path = Path.parse(pattern);
558
- return path.getIn(source);
559
- };
560
- Path.setIn = function (source, pattern, value) {
561
- var path = Path.parse(pattern);
562
- return path.setIn(source, value);
563
- };
564
- Path.deleteIn = function (source, pattern) {
565
- var path = Path.parse(pattern);
566
- return path.deleteIn(source);
567
- };
568
- Path.existIn = function (source, pattern, start) {
569
- var path = Path.parse(pattern);
570
- return path.existIn(source, start);
571
- };
572
- Path.ensureIn = function (source, pattern, defaultValue) {
573
- var path = Path.parse(pattern);
574
- return path.ensureIn(source, defaultValue);
575
- };
576
- return Path;
577
- }());
578
-
579
- export { Path };