@signal24/vue-foundation 3.8.1 → 4.1.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 (127) hide show
  1. package/.eslintrc.cjs +35 -0
  2. package/.prettierrc.json +4 -2
  3. package/dist/src/components/ajax-select.vue.d.ts +21 -0
  4. package/dist/src/components/alert-helpers.d.ts +8 -0
  5. package/dist/src/components/alert-modal.vue.d.ts +27 -0
  6. package/dist/src/components/ez-smart-select.vue.d.ts +27 -0
  7. package/dist/src/components/index.d.ts +8 -0
  8. package/dist/src/components/modal-container.d.ts +33 -0
  9. package/dist/src/components/modal.vue.d.ts +34 -0
  10. package/dist/src/components/smart-select.vue.d.ts +121 -0
  11. package/dist/src/config.d.ts +8 -0
  12. package/dist/src/directives/autofocus.d.ts +2 -0
  13. package/dist/src/directives/confirm-button.d.ts +2 -0
  14. package/dist/src/directives/date-input.d.ts +2 -0
  15. package/dist/src/directives/datetime.d.ts +2 -0
  16. package/dist/src/directives/disabled.d.ts +2 -0
  17. package/dist/src/directives/duration.d.ts +2 -0
  18. package/dist/src/directives/index.d.ts +24 -0
  19. package/dist/src/directives/infinite-scroll.d.ts +3 -0
  20. package/dist/src/directives/readonly.d.ts +2 -0
  21. package/dist/src/directives/tooltip.d.ts +41 -0
  22. package/dist/src/filters/index.d.ts +39 -0
  23. package/dist/src/helpers/array.d.ts +3 -0
  24. package/dist/src/helpers/context-menu.d.ts +13 -0
  25. package/dist/src/helpers/delay.d.ts +2 -0
  26. package/dist/src/helpers/error.d.ts +7 -0
  27. package/dist/src/helpers/index.d.ts +9 -0
  28. package/dist/src/helpers/mask.d.ts +15 -0
  29. package/dist/src/helpers/number.d.ts +1 -0
  30. package/dist/src/helpers/object.d.ts +2 -0
  31. package/dist/src/helpers/openapi.d.ts +34 -0
  32. package/dist/src/helpers/string.d.ts +5 -0
  33. package/dist/src/hooks/index.d.ts +2 -0
  34. package/dist/src/hooks/infinite-scroll.d.ts +30 -0
  35. package/dist/src/hooks/resize-watcher.d.ts +1 -0
  36. package/dist/src/index.d.ts +8 -0
  37. package/dist/src/types.d.ts +14 -0
  38. package/dist/src/vite-plugins/index.d.ts +1 -0
  39. package/dist/src/vite-plugins/index.js +2 -0
  40. package/dist/src/vite-plugins/vite-openapi-plugin.cli.d.ts +2 -0
  41. package/dist/src/vite-plugins/vite-openapi-plugin.cli.js +10 -0
  42. package/dist/src/vite-plugins/vite-openapi-plugin.d.ts +5 -0
  43. package/dist/src/vite-plugins/vite-openapi-plugin.js +58 -0
  44. package/dist/vue-foundation.css +1 -1
  45. package/dist/vue-foundation.es.js +880 -1880
  46. package/package.json +47 -16
  47. package/src/components/ajax-select.vue +44 -23
  48. package/src/components/alert-helpers.ts +45 -0
  49. package/src/components/alert-modal.vue +68 -0
  50. package/src/components/ez-smart-select.vue +51 -0
  51. package/src/components/index.ts +10 -0
  52. package/src/components/modal-container.ts +131 -0
  53. package/src/components/modal.vue +44 -129
  54. package/src/components/smart-select.vue +196 -243
  55. package/src/config.ts +15 -0
  56. package/src/directives/autofocus.ts +20 -0
  57. package/src/directives/confirm-button.ts +50 -0
  58. package/src/directives/date-input.ts +19 -0
  59. package/src/directives/datetime.ts +48 -0
  60. package/src/directives/disabled.ts +30 -0
  61. package/src/directives/duration.ts +79 -0
  62. package/src/directives/index.ts +37 -0
  63. package/src/directives/infinite-scroll.ts +9 -0
  64. package/src/directives/readonly.ts +15 -0
  65. package/src/directives/tooltip.ts +190 -0
  66. package/src/filters/index.ts +79 -0
  67. package/src/helpers/array.ts +7 -0
  68. package/src/helpers/context-menu.ts +108 -0
  69. package/src/helpers/delay.ts +2 -0
  70. package/src/helpers/error.ts +41 -0
  71. package/src/helpers/index.ts +9 -0
  72. package/src/helpers/mask.ts +105 -0
  73. package/src/helpers/number.ts +3 -0
  74. package/src/helpers/object.ts +19 -0
  75. package/src/helpers/openapi.ts +82 -0
  76. package/src/helpers/string.ts +27 -0
  77. package/src/hooks/index.ts +2 -0
  78. package/src/hooks/infinite-scroll.ts +107 -0
  79. package/src/hooks/resize-watcher.ts +8 -0
  80. package/src/index.ts +14 -0
  81. package/src/types.ts +14 -0
  82. package/src/vite-plugins/index.ts +2 -0
  83. package/src/vite-plugins/vite-openapi-plugin.cli.ts +15 -0
  84. package/src/vite-plugins/vite-openapi-plugin.ts +71 -0
  85. package/tsconfig.app.json +22 -0
  86. package/tsconfig.json +14 -0
  87. package/tsconfig.node.json +9 -0
  88. package/tsconfig.vite-plugins.json +10 -0
  89. package/tsconfig.vitest.json +9 -0
  90. package/vite.config.js +37 -35
  91. package/vitest.config.js +17 -0
  92. package/.eslintrc.js +0 -16
  93. package/CHANGES.md +0 -2
  94. package/dist/vue-foundation.cjs.js +0 -5
  95. package/dist/vue-foundation.umd.js +0 -6
  96. package/postcss.config.cjs +0 -5
  97. package/src/app.js +0 -25
  98. package/src/components/alert.vue +0 -130
  99. package/src/components/index.js +0 -12
  100. package/src/config.js +0 -11
  101. package/src/directives/autofocus.js +0 -17
  102. package/src/directives/confirm-button.js +0 -40
  103. package/src/directives/date-input.js +0 -18
  104. package/src/directives/datetime.js +0 -46
  105. package/src/directives/disabled.js +0 -28
  106. package/src/directives/duration.js +0 -72
  107. package/src/directives/index.js +0 -10
  108. package/src/directives/infinite-scroll.js +0 -17
  109. package/src/directives/readonly.js +0 -17
  110. package/src/directives/tooltip.js +0 -178
  111. package/src/directives/user-text.js +0 -11
  112. package/src/filters/index.js +0 -82
  113. package/src/helpers/array.js +0 -99
  114. package/src/helpers/context-menu.js +0 -66
  115. package/src/helpers/delay.js +0 -3
  116. package/src/helpers/error.js +0 -36
  117. package/src/helpers/http.js +0 -44
  118. package/src/helpers/index.js +0 -9
  119. package/src/helpers/mask.js +0 -90
  120. package/src/helpers/number.js +0 -6
  121. package/src/helpers/string.js +0 -36
  122. package/src/helpers/vue.js +0 -5
  123. package/src/index.js +0 -33
  124. package/src/plugins/index.js +0 -10
  125. package/src/plugins/infinite-scroll/hook.js +0 -30
  126. package/src/plugins/infinite-scroll.js +0 -100
  127. package/src/plugins/resize-watcher.js +0 -28
@@ -1,130 +0,0 @@
1
- <template>
2
- <Modal class="vf-alert" :class="classes">
3
- <template v-if="!this.isBare" v-slot:header>
4
- <h1>{{ title }}</h1>
5
- </template>
6
-
7
- <div v-if="isHtml" v-html="message" class="user-message"></div>
8
- <div v-else v-user-text="message"></div>
9
-
10
- <template v-if="!this.isBare" v-slot:footer>
11
- <template v-if="shouldConfirm">
12
- <button class="primary" @click="ok" v-autofocus>Confirm</button>
13
- <button class="default" @click="$dismiss()">Cancel</button>
14
- </template>
15
- <button v-else class="default" @click="ok" v-autofocus>OK</button>
16
- </template>
17
- </Modal>
18
- </template>
19
-
20
- <script>
21
- import app from '../app';
22
- import Modal from './modal.vue';
23
-
24
- const classDef = {
25
- components: {
26
- Modal
27
- },
28
-
29
- data() {
30
- return {
31
- isBare: false,
32
- isHtml: false,
33
- classes: [],
34
- title: null,
35
- message: null,
36
- shouldConfirm: false
37
- };
38
- },
39
-
40
- created() {
41
- if (typeof this.message == 'object') {
42
- if (this.message.html) {
43
- this.isHtml = true;
44
- this.message = this.message.html;
45
- } else if (this.message instanceof Error) {
46
- let err = this.message;
47
- err.handle();
48
-
49
- this.message = err.userMessage;
50
- }
51
- }
52
- },
53
-
54
- methods: {
55
- ok() {
56
- this.$dismiss(true);
57
- }
58
- }
59
- };
60
-
61
- export default classDef;
62
-
63
- async function launchModal(context, classDef, ...args) {
64
- classDef = { ...classDef, __modalId: Math.random().toString(36).substring(2, 10) };
65
- return await context.$modal.apply(context, [classDef, ...args]);
66
- }
67
-
68
- app.config.globalProperties.$alert = async function (title, message) {
69
- return await launchModal(this, classDef, { title, message });
70
- };
71
-
72
- app.config.globalProperties.$confirm = async function (title, message, options) {
73
- options = options || {};
74
- const result = await launchModal(this, classDef, { title, message, shouldConfirm: true, ...options });
75
- return !!result;
76
- };
77
-
78
- app.config.globalProperties.$confirmDestroy = function (title, message, options) {
79
- options = options || {};
80
- options.classes = options.classes || [];
81
- options.classes.push('destructive');
82
- return this.$confirm(title, message, options);
83
- };
84
-
85
- app.config.globalProperties.$wait = function (title, message) {
86
- if (title && !message) {
87
- message = title;
88
- title = undefined;
89
- } else if (!title && !message) {
90
- message = 'Please wait...';
91
- }
92
-
93
- let resolved = null;
94
- let promise = new Promise((resolve, reject) => {
95
- launchModal(this, classDef, { title, message, isBare: true, classes: ['wait'] }, resolve);
96
- }).then(inResolved => (resolved = inResolved));
97
-
98
- this.$endWait = async () => {
99
- delete this.$endWait;
100
- if (resolved) await resolved.$dismiss();
101
- else await promise.then(() => resolved.$dismiss());
102
- };
103
-
104
- return this.$endWait;
105
- };
106
- </script>
107
-
108
- <style lang="scss">
109
- .vf-modal-wrap.vf-alert {
110
- .vf-modal {
111
- max-width: 800px;
112
-
113
- > .vf-modal-content {
114
- padding: 12px;
115
- }
116
- }
117
-
118
- &.wait {
119
- .vf-modal-content {
120
- text-align: center;
121
- }
122
- }
123
-
124
- &.destructive {
125
- button.primary {
126
- color: red;
127
- }
128
- }
129
- }
130
- </style>
@@ -1,12 +0,0 @@
1
- import app from '../app';
2
- import AjaxSelect from './ajax-select.vue';
3
- app.component('AjaxSelect', AjaxSelect);
4
-
5
- import Alert from './alert.vue';
6
- app.component('Alert', Alert);
7
-
8
- import Modal from './modal.vue';
9
- app.component('Modal', Modal);
10
-
11
- import SmartSelect from './smart-select.vue';
12
- app.component('SmartSelect', SmartSelect);
package/src/config.js DELETED
@@ -1,11 +0,0 @@
1
- let options = {
2
- unhandledErrorSupportText: 'please contact support'
3
- };
4
-
5
- function applyConfiguration(inOptions) {
6
- Object.assign(options, inOptions);
7
- }
8
-
9
- Object.defineProperty(options, 'set', { value: applyConfiguration, enumerable: false });
10
-
11
- export default options;
@@ -1,17 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- app.directive('autofocus', {
6
- mounted: fn,
7
- updated: fn
8
- });
9
-
10
- function fn(el, binding) {
11
- if (binding.value === undefined && el.hasAutoFocused) return;
12
- if (binding.value !== undefined && !binding.value) return;
13
- if (binding.oldValue !== undefined && binding.value == binding.oldValue) return;
14
- el.hasAutoFocused = true;
15
- el = ['BUTTON', 'INPUT', 'TEXTAREA', 'SELECT'].indexOf(el.tagName) > -1 ? el : $(el).find('input:first')[0];
16
- setTimeout(() => el.focus(), 10);
17
- }
@@ -1,40 +0,0 @@
1
- import app from '../app';
2
-
3
- app.directive('confirm-button', {
4
- mounted(el) {
5
- el.addEventListener('click', e => {
6
- let now = Date.now();
7
-
8
- if (el._isConfirming) {
9
- if (now - el._confirmInitTime < 300) {
10
- return;
11
- }
12
-
13
- el._resetHandler();
14
- el.dispatchEvent(new Event('confirm'));
15
- return;
16
- }
17
-
18
- e.preventDefault();
19
- e.stopImmediatePropagation();
20
-
21
- el._resetHandler = () => {
22
- el.innerHTML = el._preConfirmHTML;
23
- el.blur();
24
-
25
- el.removeEventListener('mouseout', el._resetHandler);
26
-
27
- delete el._isConfirming;
28
- delete el._preConfirmHTML;
29
- delete el._resetHandler;
30
- };
31
-
32
- el._isConfirming = true;
33
- el._confirmInitTime = now;
34
- el._preConfirmHTML = el.innerHTML;
35
- el.innerHTML = 'Confirm';
36
-
37
- el.addEventListener('mouseout', el._resetHandler);
38
- });
39
- }
40
- });
@@ -1,18 +0,0 @@
1
- import moment from 'moment';
2
-
3
- import app from '../app';
4
-
5
- app.directive('date-input', {
6
- beforeMount: fn
7
- });
8
-
9
- function fn(el) {
10
- el.addEventListener('blur', () => {
11
- let val = el.value;
12
- if (/^[0-9]{1,2}\/[0-9]{1,2}$/.test(val)) val += '/' + moment().format('YY');
13
- let ts = Date.parse(val);
14
- if (isNaN(ts)) el.value = '';
15
- else el.value = moment(ts).format('MM/DD/YYYY');
16
- el.dispatchEvent(new Event('input'));
17
- });
18
- }
@@ -1,46 +0,0 @@
1
- import moment from 'moment';
2
-
3
- import app from '../app';
4
-
5
- app.directive('datetime', {
6
- beforeMount: applyDateTime,
7
- updated: applyDateTime
8
- });
9
-
10
- function applyDateTime(el, binding) {
11
- if (binding.value == binding.oldValue && el.innerHTML.length) return;
12
- el.innerText = getDateTimeValue(el, binding);
13
- }
14
-
15
- function getDateTimeValue(el, binding) {
16
- if (!binding.value) {
17
- return el.attributes.placeholder ? el.attributes.placeholder.value : '';
18
- }
19
-
20
- let prefix = '';
21
- let thatMoment = el.attributes.local ? moment(binding.value) : moment.utc(binding.value);
22
-
23
- if (!el.attributes['display-utc']) thatMoment.local();
24
-
25
- let format = el.attributes.format ? el.attributes.format.value : null;
26
-
27
- if (!format && el.attributes['relative-date']) {
28
- let thisMoment = moment();
29
- if (
30
- thisMoment.year() == thatMoment.year() &&
31
- thisMoment.month() == thatMoment.month() &&
32
- thisMoment.date() == thatMoment.date()
33
- ) {
34
- prefix = 'at';
35
- format = 'HH:mm';
36
- }
37
- }
38
-
39
- if (!format) format = 'MM/DD/YY HH:mm';
40
-
41
- let result = thatMoment.format(format);
42
-
43
- if (prefix) result = prefix + ' ' + result;
44
-
45
- return result;
46
- }
@@ -1,28 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- app.directive('disabled', {
6
- beforeMount: fn,
7
- updated: fn,
8
- unmounted
9
- });
10
-
11
- function fn(el, binding) {
12
- if (el.tagName == 'LABEL') {
13
- $(el).toggleClass('disabled', !!binding.value);
14
- el = $(el).find('input')[0];
15
- }
16
-
17
- if (binding.value) $(el).attr('disabled', 'disabled');
18
- else $(el).removeAttr('disabled');
19
- }
20
-
21
- function unmounted(el) {
22
- if (el.tagName == 'LABEL') {
23
- $(el).removeClass('disabled');
24
- el = $(el).find('input')[0];
25
- }
26
-
27
- $(el).removeAttr('disabled');
28
- }
@@ -1,72 +0,0 @@
1
- import moment from 'moment';
2
-
3
- import app from '../app';
4
-
5
- let durationEls = [];
6
-
7
- function updateDurations() {
8
- durationEls.forEach(updateDuration);
9
- }
10
-
11
- setInterval(updateDurations, 1000);
12
-
13
- app.directive('duration', {
14
- beforeMount: applyDuration,
15
- updated: applyDuration,
16
- unmounted: removeDuration
17
- });
18
-
19
- function applyDuration(el, binding) {
20
- if (binding.value == binding.oldValue) return;
21
- if (!binding.value) return removeDuration(el);
22
-
23
- el.$includeSeconds = typeof el.attributes['no-seconds'] === 'undefined';
24
-
25
- let baseTimeAttr = el.attributes['base-time'];
26
- if (baseTimeAttr) {
27
- el.$startTs = moment(baseTimeAttr.value).valueOf() - binding.value * 1000;
28
- } else {
29
- el.$startTs = moment(binding.value).valueOf();
30
- }
31
-
32
- if (!el.$isConfigured) {
33
- el.$isConfigured = true;
34
- durationEls.push(el);
35
- }
36
-
37
- updateDuration(el);
38
- }
39
-
40
- function updateDuration(el) {
41
- let ts = el.$startTs;
42
- let diff = Math.round((Date.now() - ts) / 1000);
43
- el.innerText = secondsToString(diff, el.$includeSeconds === false);
44
- }
45
-
46
- function removeDuration(el) {
47
- if (el.$isConfigured) {
48
- durationEls.remove(el);
49
- el.$isConfigured = false;
50
- }
51
-
52
- el.innerText = '-';
53
- }
54
-
55
- function secondsToString(seconds, shouldSkipSeconds) {
56
- let result = [];
57
- let days = Math.floor(seconds / 86400);
58
- days && result.push(days + 'd');
59
- seconds -= days * 86400;
60
- let hours = Math.floor(seconds / 3600);
61
- (days || hours) && result.push(hours + 'h');
62
- seconds -= hours * 3600;
63
- let minutes = Math.floor(seconds / 60);
64
- (days || hours || minutes) && result.push(minutes + 'm');
65
- if (!shouldSkipSeconds) {
66
- seconds -= minutes * 60;
67
- result.push(seconds + 's');
68
- } else if (!result.length) {
69
- result.push('0m');
70
- }
71
- return result.join(' ');
72
- }
@@ -1,10 +0,0 @@
1
- import './autofocus';
2
- import './confirm-button';
3
- import './datetime';
4
- import './date-input';
5
- import './disabled';
6
- import './duration';
7
- import './infinite-scroll';
8
- import './readonly';
9
- import './tooltip';
10
- import './user-text';
@@ -1,17 +0,0 @@
1
- import app from '../app';
2
- import InfiniteScrollHook from '../plugins/infinite-scroll/hook';
3
-
4
- app.directive('infinite-scroll', {
5
- beforeMount(el, binding) {
6
- if (binding.value) {
7
- el._infiniteScrollHook = new InfiniteScrollHook(el, binding.value);
8
- el._infiniteScrollHook.install();
9
- }
10
- },
11
-
12
- unmounted(el) {
13
- if (el._infiniteScrollHook) {
14
- el._infiniteScrollHook.uninstall();
15
- }
16
- }
17
- });
@@ -1,17 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- app.directive('readonly', {
6
- beforeMount: fn,
7
- updated: fn
8
- });
9
-
10
- function fn(el, binding) {
11
- if (el.tagName == 'LABEL') {
12
- el = $(el).find('input')[0];
13
- }
14
-
15
- if (binding.value) $(el).attr('readonly', 'readonly');
16
- else $(el).removeAttr('readonly');
17
- }
@@ -1,178 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- app.directive('tip', {
6
- mounted: createTip,
7
- updated: createTip,
8
- unmounted: destroyTip
9
- });
10
-
11
- function createTip(el, binding) {
12
- let tipText = el.attributes.tip ? el.attributes.tip.value : binding.value;
13
- if (binding.value === false) tipText = null;
14
- if (tipText) {
15
- let config = {};
16
- config[binding.modifiers.html ? 'html' : 'text'] = tipText;
17
- if (el.attributes['tip-class']) config.class = el.attributes['tip-class'].value;
18
- $(el).vfTooltip(config);
19
- } else $(el).vfTooltip('destroy');
20
- }
21
-
22
- function destroyTip(el) {
23
- $(el).vfTooltip('destroy');
24
- }
25
-
26
- $.fn.vfTooltip = function (option) {
27
- return this.each(function (index, el) {
28
- var tooltip = $(el).data('vf-tooltip');
29
-
30
- if (typeof option == 'string') {
31
- if (!tooltip) return;
32
- tooltip[option]();
33
- } else if (tooltip) {
34
- tooltip.configure(option);
35
- } else {
36
- var vfTooltip = new VfTooltip(el, option);
37
- $(el).data('vf-tooltip', vfTooltip);
38
- }
39
- });
40
- };
41
-
42
- function VfTooltip(el, configIn) {
43
- // exports
44
- this.configure = _configure;
45
- this.destroy = _destroy;
46
-
47
- // state
48
- var $tip,
49
- config,
50
- lastMoveEvt,
51
- checkInterval,
52
- shouldShow = false;
53
-
54
- // apply config
55
- this.configure(configIn);
56
-
57
- var $target = $(el);
58
- $target.on('mouseenter', _handleTargetMouseEnter);
59
- $target.on('mouseleave', _handleTargetMouseLeave);
60
-
61
- config.now && _handleTargetMouseEnter(config.now);
62
-
63
- function _configure(configIn) {
64
- config = $.extend(
65
- {
66
- delay: 0
67
- },
68
- configIn
69
- );
70
- }
71
-
72
- function _handleTargetMouseEnter(e) {
73
- if (shouldShow) return;
74
-
75
- shouldShow = true;
76
-
77
- setTimeout(function () {
78
- if (!shouldShow) return;
79
-
80
- _renderTooltip();
81
-
82
- if (config.static) _placeStaticTooltip();
83
- else _handleMouseMove(e);
84
-
85
- $tip.show();
86
- }, config.delay);
87
- }
88
-
89
- function _handleTargetMouseLeave() {
90
- shouldShow = false;
91
- _deferredRemoveTooltip();
92
- }
93
-
94
- function _renderTooltip() {
95
- if (!$tip) config.static || $(window).on('mousemove', _handleMouseMove);
96
- else $tip.remove();
97
-
98
- $tip = $('<div class="vf-tooltip">')
99
- .css('position', 'absolute')
100
- .css('z-index', '1000000')
101
- .addClass(config.class)
102
- .appendTo(document.body);
103
- config.title && $('<div class="title">').text(config.title).appendTo($tip);
104
- var $content = $('<div class="content">').appendTo($tip);
105
-
106
- if (config.callback) config.callback($content[0]);
107
- else if (config.text) $content.text(config.text).html($content.html().replace(/\n/g, '<br>'));
108
- else if (config.html) $content.html(config.html);
109
-
110
- if (config.static) {
111
- $tip.mouseover(function () {
112
- shouldShow = true;
113
- }).mouseout(function () {
114
- shouldShow = false;
115
- _deferredRemoveTooltip();
116
- });
117
- } else {
118
- checkInterval = setInterval(_checkMoveEvent, 250);
119
- }
120
- }
121
-
122
- function _deferredRemoveTooltip() {
123
- if (config.static) setTimeout(_removeTooltip, 50);
124
- else _removeTooltip();
125
- }
126
-
127
- function _removeTooltip() {
128
- if (shouldShow) return;
129
- if (!$tip) return;
130
-
131
- $tip.remove();
132
- $tip = null;
133
-
134
- clearInterval(checkInterval);
135
-
136
- config.static || $(window).off('mousemove', _handleMouseMove);
137
- }
138
-
139
- function _placeStaticTooltip() {
140
- var targetPosition = $target.position();
141
- var tipHeight = $tip.height();
142
- var tipW = $target.outerWidth(true);
143
- var tipX = targetPosition.left;
144
- var tipY = targetPosition.top - tipHeight - 1;
145
- if (tipY - 2 < 0) tipY = targetPosition.top + $target.outerHeight(true) + 1;
146
- $tip.css('min-width', tipW + 'px')
147
- .css('left', tipX + 'px')
148
- .css('top', tipY + 'px');
149
- }
150
-
151
- function _handleMouseMove(e) {
152
- var tipWidth = $tip.outerWidth(),
153
- tipHeight = $tip.outerHeight();
154
- var viewWidth = window.innerWidth,
155
- viewHeight = window.innerHeight;
156
- var tipX = e.pageX + 10,
157
- tipY = e.pageY + 20;
158
- if (tipX + tipWidth > viewWidth) tipX = e.pageX - 5 - tipWidth;
159
- if (tipY + tipHeight > viewHeight) tipY = e.pageY - 5 - tipHeight;
160
- $tip.css('left', tipX + 'px').css('top', tipY + 'px');
161
- lastMoveEvt = e;
162
- }
163
-
164
- function _checkMoveEvent() {
165
- if (!lastMoveEvt) return;
166
- if (el != lastMoveEvt.target && !$.contains(el, lastMoveEvt.target)) _handleTargetMouseLeave();
167
- }
168
-
169
- function _destroy() {
170
- shouldShow = false;
171
-
172
- _removeTooltip();
173
-
174
- $target.off('mouseenter', _handleTargetMouseEnter);
175
- $target.off('mouseleave', _handleTargetMouseLeave);
176
- $target.removeData('vf-tooltip');
177
- }
178
- }
@@ -1,11 +0,0 @@
1
- import app from '../app';
2
-
3
- app.directive('user-text', {
4
- beforeMount: fn,
5
- updated: fn
6
- });
7
-
8
- function fn(el, binding) {
9
- if (binding.value == binding.oldValue) return;
10
- el.innerHTML = binding.value.escapeHtml().nl2br();
11
- }