@signal24/vue-foundation 3.8.0 → 4.0.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 (122) 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.d.ts +4 -0
  41. package/dist/src/vite-plugins/vite-openapi-plugin.js +58 -0
  42. package/dist/vue-foundation.css +1 -0
  43. package/dist/vue-foundation.es.js +1129 -0
  44. package/package.json +44 -16
  45. package/src/components/ajax-select.vue +44 -23
  46. package/src/components/alert-helpers.ts +45 -0
  47. package/src/components/alert-modal.vue +68 -0
  48. package/src/components/ez-smart-select.vue +51 -0
  49. package/src/components/index.ts +10 -0
  50. package/src/components/modal-container.ts +131 -0
  51. package/src/components/modal.vue +44 -129
  52. package/src/components/smart-select.vue +196 -243
  53. package/src/config.ts +15 -0
  54. package/src/directives/autofocus.ts +20 -0
  55. package/src/directives/confirm-button.ts +50 -0
  56. package/src/directives/date-input.ts +19 -0
  57. package/src/directives/datetime.ts +48 -0
  58. package/src/directives/disabled.ts +30 -0
  59. package/src/directives/duration.ts +79 -0
  60. package/src/directives/index.ts +37 -0
  61. package/src/directives/infinite-scroll.ts +9 -0
  62. package/src/directives/readonly.ts +15 -0
  63. package/src/directives/tooltip.ts +190 -0
  64. package/src/filters/index.ts +79 -0
  65. package/src/helpers/array.ts +7 -0
  66. package/src/helpers/context-menu.ts +108 -0
  67. package/src/helpers/delay.ts +2 -0
  68. package/src/helpers/error.ts +41 -0
  69. package/src/helpers/index.ts +9 -0
  70. package/src/helpers/mask.ts +105 -0
  71. package/src/helpers/number.ts +3 -0
  72. package/src/helpers/object.ts +19 -0
  73. package/src/helpers/openapi.ts +82 -0
  74. package/src/helpers/string.ts +27 -0
  75. package/src/hooks/index.ts +2 -0
  76. package/src/hooks/infinite-scroll.ts +107 -0
  77. package/src/hooks/resize-watcher.ts +8 -0
  78. package/src/index.ts +14 -0
  79. package/src/types.ts +14 -0
  80. package/src/vite-plugins/index.ts +2 -0
  81. package/src/vite-plugins/vite-openapi-plugin.ts +71 -0
  82. package/tsconfig.app.json +22 -0
  83. package/tsconfig.json +14 -0
  84. package/tsconfig.node.json +9 -0
  85. package/tsconfig.vite-plugins.json +10 -0
  86. package/tsconfig.vitest.json +9 -0
  87. package/vite.config.js +37 -35
  88. package/vitest.config.js +17 -0
  89. package/.eslintrc.js +0 -16
  90. package/CHANGES.md +0 -13
  91. package/postcss.config.cjs +0 -5
  92. package/src/app.js +0 -25
  93. package/src/components/alert.vue +0 -130
  94. package/src/components/index.js +0 -12
  95. package/src/config.js +0 -11
  96. package/src/directives/autofocus.js +0 -17
  97. package/src/directives/confirm-button.js +0 -40
  98. package/src/directives/date-input.js +0 -18
  99. package/src/directives/datetime.js +0 -46
  100. package/src/directives/disabled.js +0 -28
  101. package/src/directives/duration.js +0 -72
  102. package/src/directives/index.js +0 -10
  103. package/src/directives/infinite-scroll.js +0 -17
  104. package/src/directives/readonly.js +0 -17
  105. package/src/directives/tooltip.js +0 -178
  106. package/src/directives/user-text.js +0 -11
  107. package/src/filters/index.js +0 -82
  108. package/src/helpers/array.js +0 -99
  109. package/src/helpers/context-menu.js +0 -66
  110. package/src/helpers/delay.js +0 -3
  111. package/src/helpers/error.js +0 -36
  112. package/src/helpers/http.js +0 -44
  113. package/src/helpers/index.js +0 -9
  114. package/src/helpers/mask.js +0 -90
  115. package/src/helpers/number.js +0 -6
  116. package/src/helpers/string.js +0 -36
  117. package/src/helpers/vue.js +0 -5
  118. package/src/index.js +0 -33
  119. package/src/plugins/index.js +0 -10
  120. package/src/plugins/infinite-scroll/hook.js +0 -30
  121. package/src/plugins/infinite-scroll.js +0 -100
  122. package/src/plugins/resize-watcher.js +0 -28
@@ -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
- }
@@ -1,82 +0,0 @@
1
- import app from '../app';
2
-
3
- const filterFns = {
4
- bytes(value) {
5
- var i = Math.floor(Math.log(value) / Math.log(1024));
6
- return (value / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['B', 'KB', 'MB', 'GB', 'TB'][i];
7
- },
8
-
9
- dash(value) {
10
- return value !== null && value !== undefined && String(value).length ? value : '-';
11
- },
12
-
13
- dashZeros(value) {
14
- return value ? value : '-';
15
- },
16
-
17
- grammarcase(value) {
18
- return value ? value.grammarcase() : null;
19
- },
20
-
21
- lowercase(value) {
22
- return value ? value.toLowerCase() : null;
23
- },
24
-
25
- number(value) {
26
- if (value === null || !/^[0-9]+$/.test(value)) return value;
27
- return value.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
28
- },
29
-
30
- phone(value) {
31
- if (!value) return value;
32
- let cleanValue = value.replace(/[^0-9]/g, '').replace(/^1/, '');
33
- if (cleanValue.length != 10) return value;
34
- return '(' + cleanValue.substr(0, 3) + ') ' + cleanValue.substr(3, 3) + '-' + cleanValue.substr(6);
35
- },
36
-
37
- ucfirst(value) {
38
- return value ? value.ucfirst() : null;
39
- },
40
-
41
- ucwords(value) {
42
- return value ? value.ucwords() : null;
43
- },
44
-
45
- uppercase(value) {
46
- return value ? value.toUpperCase() : null;
47
- },
48
-
49
- unsnake(value) {
50
- return value ? value.unsnake() : null;
51
- },
52
-
53
- usCurrency(value) {
54
- return (
55
- '$' +
56
- Number(value)
57
- .toFixed(3)
58
- .replace(/0$/, '')
59
- .replace(/\B(?=(\d{3})+(?!\d))/g, ',')
60
- );
61
- }
62
- };
63
-
64
- function registerFilters(filters) {
65
- for (let filterName of Object.keys(filters)) {
66
- registerFilter(filterName, filters[filterName]);
67
- }
68
- }
69
-
70
- function registerFilter(name, fn) {
71
- filterFns[name] = fn;
72
- }
73
-
74
- app.config.globalProperties.$filter = (value, ...filters) => {
75
- for (let filter of filters) {
76
- value = filterFns[filter](value);
77
- }
78
-
79
- return value;
80
- };
81
-
82
- export { registerFilter, registerFilters };
@@ -1,99 +0,0 @@
1
- Object.defineProperty(Array.prototype, 'diff', {
2
- enumerable: false,
3
- value: function (...args) {
4
- return this.filter(val => {
5
- for (let i = 0; i < args.length; i++) {
6
- if (args[i].includes(val)) {
7
- return false;
8
- }
9
- }
10
-
11
- return true;
12
- });
13
- }
14
- });
15
-
16
- Object.defineProperty(Array.prototype, 'first', {
17
- enumerable: false,
18
- value: function () {
19
- return this[0] || undefined;
20
- }
21
- });
22
-
23
- Object.defineProperty(Array.prototype, 'intersect', {
24
- enumerable: false,
25
- value: function (...args) {
26
- return this.filter(val => {
27
- for (let i = 0; i < args.length; i++) {
28
- if (args[i].includes(val)) {
29
- return true;
30
- }
31
- }
32
-
33
- return false;
34
- });
35
- }
36
- });
37
-
38
- Object.defineProperty(Array.prototype, 'keyBy', {
39
- enumerable: false,
40
- value: function (keyProp) {
41
- let result = {};
42
- this.forEach(elem => {
43
- result[elem[keyProp]] = elem;
44
- });
45
- return result;
46
- }
47
- });
48
-
49
- Object.defineProperty(Array.prototype, 'last', {
50
- enumerable: false,
51
- value: function () {
52
- return this.length ? this[this.length - 1] : undefined;
53
- }
54
- });
55
-
56
- Object.defineProperty(Array.prototype, 'pluck', {
57
- enumerable: false,
58
- value: function (prop, keyProp) {
59
- if (typeof keyProp === 'undefined') return this.map(elem => elem[prop]);
60
-
61
- let result = {};
62
- this.forEach(elem => {
63
- result[elem[keyProp]] = elem[prop];
64
- });
65
- return result;
66
- }
67
- });
68
-
69
- Object.defineProperty(Array.prototype, 'remove', {
70
- enumerable: false,
71
- value: function (element) {
72
- const index = this.indexOf(element);
73
- index > -1 && this.splice(index, 1);
74
- }
75
- });
76
-
77
- Object.defineProperty(Array.prototype, 'replace', {
78
- enumerable: false,
79
- value: function (element, replacement) {
80
- const index = this.indexOf(element);
81
- index > -1 && this.splice(index, 1, replacement);
82
- }
83
- });
84
-
85
- Object.defineProperty(Array.prototype, 'sortBy', {
86
- enumerable: false,
87
- value: function (key) {
88
- this.sort((a, b) => {
89
- return String(a[key]).toLowerCase().localeCompare(String(b[key]).toLowerCase());
90
- });
91
- }
92
- });
93
-
94
- Object.defineProperty(Array.prototype, 'unique', {
95
- enumerable: false,
96
- value: function () {
97
- return [...new Set(this)];
98
- }
99
- });
@@ -1,66 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- app.config.globalProperties.$contextMenu = function (e, config) {
6
- var $wrapper = $('<div class="vf-overlay">').click(_closeMenu).appendTo(document.body);
7
- var $menu = $('<div class="vf-context-menu">').css('position', 'absolute').appendTo($wrapper);
8
-
9
- var $target = $(e.currentTarget);
10
- $target.css('user-select', 'none');
11
-
12
- $target.addClass('context-menu-active');
13
-
14
- config.targetClass && $target.addClass(config.targetClass);
15
- config.class && $menu.addClass(config.class);
16
-
17
- config.items &&
18
- config.items.forEach(item => {
19
- if (item == '-') return $('<div class="separator">').appendTo($menu);
20
- var $item = $('<div class="item">').css('user-select', 'none').text(item.title).appendTo($menu);
21
- item.class && $item.addClass(item.class);
22
- if (item.shouldConfirm) $item.data('handler', item.handler).click(_confirmAction);
23
- else if (item.handler) $item.click(item.handler);
24
- });
25
-
26
- const dx = window.innerWidth - e.clientX;
27
- const dy = window.innerHeight - e.clientY;
28
- const menuHeight = $menu.outerHeight();
29
- const menuWidth = $menu.outerWidth();
30
-
31
- const left = dx < menuWidth ? e.clientX - menuWidth - 1 : e.clientX + 1;
32
- const top = dy < menuHeight ? e.clientY - menuHeight - 1 : e.clientY + 1;
33
-
34
- $menu.css('left', left + 'px');
35
- $menu.css('top', top + 'px');
36
-
37
- config.onCreate && config.onCreate($menu[0]);
38
-
39
- setTimeout(() => {
40
- $menu.css('width', $menu.outerWidth() + 'px');
41
- }, 50);
42
-
43
- function _closeMenu() {
44
- config.targetClass && $target.removeClass(config.targetClass);
45
- $target.removeClass('context-menu-active');
46
- $target.css('user-select', '');
47
- $wrapper.remove();
48
- }
49
-
50
- function _confirmAction(e) {
51
- var $item = $(e.currentTarget);
52
- if ($item.hasClass('pending-confirm')) {
53
- var handler = $item.data('handler');
54
- handler && handler();
55
- } else {
56
- var originalContent = $item.html();
57
- $item.addClass('pending-confirm').text('Confirm');
58
- $item.one('mouseleave', function () {
59
- $item.removeClass('pending-confirm').html(originalContent);
60
- });
61
- e.stopPropagation();
62
- }
63
- }
64
- };
65
-
66
- // TODO: actually de-select text rather than just using CSS to hide its selection
@@ -1,3 +0,0 @@
1
- import app from '../app';
2
-
3
- app.config.globalProperties.$delay = ms => new Promise(resolve => setTimeout(resolve, ms));
@@ -1,36 +0,0 @@
1
- import app from '../app';
2
- import vfConfig from '../config';
3
-
4
- app.config.globalProperties.$reportError = err => {
5
- if (!(err instanceof Error)) {
6
- err = new Error(err);
7
- }
8
-
9
- if (vfConfig.reportErrorHandler) {
10
- vfConfig.reportErrorHandler(err);
11
- } else {
12
- console.error(err);
13
- }
14
- };
15
-
16
- app.config.globalProperties.$throwUserError = msg => {
17
- let err = new Error(msg);
18
- err.code = 'USERERR';
19
- throw err;
20
- };
21
-
22
- Object.defineProperty(Error.prototype, 'userMessage', {
23
- get() {
24
- if (this.code == 'USERERR') return this.message;
25
- else
26
- return `An application error has occurred:\n\n${this.message}\n\nPlease refresh the page and try again. If this error persists, ${vfConfig.unhandledErrorSupportText}.`;
27
- }
28
- });
29
-
30
- Error.prototype.handle = function () {
31
- if (this.code != 'USERERR') {
32
- app.config.globalProperties.$reportError(this);
33
- }
34
-
35
- return this;
36
- };
@@ -1,44 +0,0 @@
1
- import axios from 'axios';
2
-
3
- import app from '../app';
4
- app.config.globalProperties.$http = axios;
5
-
6
- axios.postOrPut = (baseUrl, id, ...args) => {
7
- const method = id ? 'put' : 'post';
8
- const url = id ? `${baseUrl}/${id}` : baseUrl;
9
- return axios[method](url, ...args);
10
- };
11
-
12
- import vfConfig from '../config';
13
-
14
- axios.interceptors.response.use(
15
- response => {
16
- // TODO: will Axios auto-reject non-JSON?
17
- if (response.data && typeof response.data != 'object') {
18
- throw new Error('response was not JSON');
19
- }
20
-
21
- return response;
22
- },
23
-
24
- err => {
25
- if (err.response && err.response.status == 401) {
26
- if (vfConfig.unauthorizedHttpResponseHandler) {
27
- const result = vfConfig.unauthorizedHttpResponseHandler(err.response);
28
-
29
- // if the handler said "ok, handled", then we're going to
30
- // return a promise that never resolves to prevent the userland code
31
- // from ever proceeding
32
- if (result) return new Promise(() => {});
33
- }
34
- }
35
-
36
- if (err.response && err.response.data && err.response.data.error) {
37
- err.code = err.response.status == 422 ? 'USERERR' : 'APIERR';
38
- err.message = err.response.data.error;
39
- err.field = err.response.data.errorField;
40
- }
41
-
42
- throw err;
43
- }
44
- );
@@ -1,9 +0,0 @@
1
- import './array';
2
- import './context-menu';
3
- import './delay';
4
- import './error';
5
- import './http';
6
- import './mask';
7
- import './number';
8
- import './string';
9
- import './vue';
@@ -1,90 +0,0 @@
1
- import $ from 'jquery';
2
-
3
- import app from '../app';
4
-
5
- /*///////////////////////////////////////////////
6
- Masking
7
- //////////////////////////////////////////////*/
8
- app.config.globalProperties.$mask = function (message) {
9
- let $el = $(this.$el);
10
- this.$maskEl($el.hasClass('vf-overlay') ? $el.find('.vf-modal')[0] : this.$el, message);
11
- };
12
-
13
- app.config.globalProperties.$maskEl = function (el, message) {
14
- if (this._currentMask) return;
15
- this._currentMask = $('<div class="mask">')
16
- .text(message || 'Please wait...')
17
- .appendTo(el);
18
- };
19
-
20
- app.config.globalProperties.$unmask = function () {
21
- if (!this._currentMask) return;
22
- $(this._currentMask).remove();
23
- delete this._currentMask;
24
- };
25
-
26
- app.config.globalProperties.$maskForm = function (waitButton, waitText) {
27
- let el = this.$el;
28
-
29
- if (waitButton !== undefined && waitButton.tagName == 'FORM') {
30
- el = waitButton;
31
- waitButton = undefined;
32
- }
33
-
34
- let $form = el.tagName == 'FORM' ? $(el) : $(el).find('form');
35
- let $inputs = $form.find('input, select, textarea, button').not('[disabled]');
36
- $form.addClass('masked');
37
- $form.data('vf-masked-inputs', $inputs);
38
- $inputs.attr('disabled', 'disabled');
39
-
40
- if (waitButton === undefined) {
41
- waitButton = $form.find('button:first');
42
- }
43
-
44
- if (waitButton) {
45
- let $waitButton = $form.find(waitButton);
46
- $waitButton.disable(waitText || 'Please wait...');
47
- $form.data('vf-masked-wait-btn', $waitButton);
48
- }
49
- };
50
-
51
- app.config.globalProperties.$unmaskForm = function () {
52
- let $form = this.$el.tagName == 'FORM' ? $(this.$el) : $(this.$el).find('form.masked');
53
- if (!$form.length) return;
54
- let $inputs = $form.data('vf-masked-inputs');
55
- $inputs.removeAttr('disabled');
56
- $form.removeData('vf-masked-inputs');
57
- let $waitButton = $form.data('vf-masked-wait-btn');
58
- if ($waitButton) {
59
- $form.removeData('vf-masked-wait-btn');
60
- $waitButton.enable();
61
- }
62
- $form.removeClass('masked');
63
- };
64
-
65
- /*///////////////////////////////////////////////
66
- Button Enable/Disable
67
- //////////////////////////////////////////////*/
68
- $.fn.disable = function (newText) {
69
- this.each(function (index, item) {
70
- var $item = $(item);
71
- var isInput = item.tagName == 'INPUT';
72
- newText &&
73
- $item.data('originalValue', isInput ? $item.val() : $item.html()) &&
74
- $item[isInput ? 'val' : 'text'](newText);
75
- $item.attr('disabled', 'disabled');
76
- });
77
- return this;
78
- };
79
-
80
- $.fn.enable = function () {
81
- this.each(function (index, item) {
82
- var $item = $(item);
83
- $item.removeAttr('disabled');
84
- var originalValue = $item.data('originalValue');
85
- originalValue != undefined &&
86
- $item[item.tagName == 'INPUT' ? 'val' : 'html'](originalValue) &&
87
- $item.removeData('originalValue');
88
- });
89
- return this;
90
- };
@@ -1,6 +0,0 @@
1
- /*///////////////////////////////////////////////
2
- Number Prototype Functions
3
- ///////////////////////////////////////////////*/
4
- Number.prototype.format = function () {
5
- return this.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ',');
6
- };
@@ -1,36 +0,0 @@
1
- String.prototype.escapeHtml = function () {
2
- return this.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
3
- };
4
-
5
- String.prototype.nl2br = function () {
6
- return this.replace(/\n/g, '<br>');
7
- };
8
-
9
- // this isn't implemented in Vue filters because why would you ever turn something _into_ kebab case for user display?
10
- String.prototype.kebab = function () {
11
- return this.replace(/ /g, '-');
12
- };
13
-
14
- // TODO: what would this be used for?
15
- String.prototype.lcfirst = function () {
16
- return this.substr(0, 1).toLowerCase() + this.substr(1);
17
- };
18
-
19
- // this isn't implemented in Vue filters because why would you ever turn something _into_ Snake case for user display?
20
- String.prototype.snake = function () {
21
- return this.replace(/ /g, '_');
22
- };
23
-
24
- String.prototype.ucfirst = function () {
25
- return this.substr(0, 1).toUpperCase() + this.substr(1);
26
- };
27
-
28
- String.prototype.ucwords = function () {
29
- return this.replace(/^[a-z]| [a-z]/gi, function (value) {
30
- return value.toUpperCase();
31
- });
32
- };
33
-
34
- String.prototype.unsnake = function () {
35
- return this.replace(/_/g, ' ');
36
- };
@@ -1,5 +0,0 @@
1
- import app from '../app';
2
-
3
- app.config.globalProperties.$isPropTruthy = function (value) {
4
- return value !== undefined && (value === '' || value);
5
- };