@windwalker-io/unicorn-next 0.1.2 → 0.1.3
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.
- package/.editorconfig +18 -18
- package/.gulp.json +7 -7
- package/bin/release.mjs +47 -47
- package/dist/chunks/button-radio.js.map +1 -1
- package/dist/chunks/checkboxes-multi-select.js.map +1 -1
- package/dist/chunks/field-cascade-select.js.map +1 -1
- package/dist/chunks/field-file-drag.js +34 -31
- package/dist/chunks/field-file-drag.js.map +1 -1
- package/dist/chunks/field-flatpickr.js +10 -3
- package/dist/chunks/field-flatpickr.js.map +1 -1
- package/dist/chunks/field-modal-select.js +6 -2
- package/dist/chunks/field-modal-select.js.map +1 -1
- package/dist/chunks/field-modal-tree.js +8 -5
- package/dist/chunks/field-modal-tree.js.map +1 -1
- package/dist/chunks/field-multi-uploader.js +6 -3
- package/dist/chunks/field-multi-uploader.js.map +1 -1
- package/dist/chunks/field-repeatable.js.map +1 -1
- package/dist/chunks/field-single-image-drag.js +12 -7
- package/dist/chunks/field-single-image-drag.js.map +1 -1
- package/dist/chunks/form.js.map +1 -1
- package/dist/chunks/grid.js.map +1 -1
- package/dist/chunks/http-client.js.map +1 -1
- package/dist/chunks/iframe-modal.js +27 -24
- package/dist/chunks/iframe-modal.js.map +1 -1
- package/dist/chunks/keep-tab.js.map +1 -1
- package/dist/chunks/legacy.js.map +1 -1
- package/dist/chunks/list-dependent.js.map +1 -1
- package/dist/chunks/s3-multipart-uploader.js.map +1 -1
- package/dist/chunks/s3-uploader.js.map +1 -1
- package/dist/chunks/show-on.js.map +1 -1
- package/dist/chunks/tinymce.js.map +1 -1
- package/dist/chunks/ui-bootstrap5.js.map +1 -1
- package/dist/chunks/unicorn.js +6 -4
- package/dist/chunks/unicorn.js.map +1 -1
- package/dist/chunks/validation.js.map +1 -1
- package/dist/index.d.ts +25 -19
- package/dist/unicorn.js +3 -3
- package/fusionfile.mjs +155 -155
- package/package.json +103 -103
- package/scss/bootstrap/multi-level-menu.scss +121 -121
- package/scss/editor.scss +116 -116
- package/scss/field/file-drag.scss +102 -102
- package/scss/field/single-image-drag.scss +88 -88
- package/scss/field/vue-drag-uploader.scss +160 -160
- package/scss/switcher.scss +156 -156
- package/src/app.ts +128 -128
- package/src/bootstrap/button-radio.ts +208 -208
- package/src/bootstrap/keep-tab.ts +155 -155
- package/src/composable/index.ts +21 -21
- package/src/composable/useCheckboxesMultiSelect.ts +22 -22
- package/src/composable/useFieldCascadeSelect.ts +9 -9
- package/src/composable/useFieldFileDrag.ts +9 -9
- package/src/composable/useFieldFlatpickr.ts +3 -3
- package/src/composable/useFieldModalSelect.ts +6 -6
- package/src/composable/useFieldModalTree.ts +3 -3
- package/src/composable/useFieldMultiUploader.ts +3 -3
- package/src/composable/useFieldRepeatable.ts +9 -9
- package/src/composable/useFieldSingleImageDrag.ts +9 -5
- package/src/composable/useForm.ts +43 -43
- package/src/composable/useGrid.ts +57 -57
- package/src/composable/useHttp.ts +9 -9
- package/src/composable/useIframeModal.ts +10 -10
- package/src/composable/useListDependent.ts +26 -26
- package/src/composable/useQueue.ts +13 -13
- package/src/composable/useS3Uploader.ts +32 -32
- package/src/composable/useShowOn.ts +9 -9
- package/src/composable/useStack.ts +13 -13
- package/src/composable/useTinymce.ts +29 -29
- package/src/composable/useTomSelect.ts +72 -72
- package/src/composable/useUIBootstrap5.ts +48 -48
- package/src/composable/useUniDirective.ts +32 -32
- package/src/composable/useValidation.ts +39 -39
- package/src/data.ts +34 -34
- package/src/events.ts +82 -82
- package/src/legacy/legacy.ts +190 -190
- package/src/legacy/loader.ts +125 -125
- package/src/module/checkboxes-multi-select.ts +54 -54
- package/src/module/field-cascade-select.ts +292 -292
- package/src/module/field-file-drag.ts +295 -292
- package/src/module/field-flatpickr.ts +130 -127
- package/src/module/field-modal-select.ts +179 -174
- package/src/module/field-modal-tree.ts +31 -27
- package/src/module/field-multi-uploader.ts +363 -361
- package/src/module/field-repeatable.ts +202 -202
- package/src/module/field-single-image-drag.ts +475 -468
- package/src/module/form.ts +223 -223
- package/src/module/grid.ts +465 -465
- package/src/module/http-client.ts +248 -248
- package/src/module/iframe-modal.ts +170 -167
- package/src/module/list-dependent.ts +321 -321
- package/src/module/s3-multipart-uploader.ts +300 -300
- package/src/module/s3-uploader.ts +234 -234
- package/src/module/show-on.ts +175 -175
- package/src/module/tinymce.ts +276 -276
- package/src/module/ui-bootstrap5.ts +116 -116
- package/src/module/validation.ts +1026 -1026
- package/src/plugin/index.ts +1 -1
- package/src/plugin/php-adapter.ts +72 -72
- package/src/polyfill/form-request-submit.ts +31 -31
- package/src/polyfill/index.ts +9 -9
- package/src/service/animate.ts +58 -58
- package/src/service/crypto.ts +27 -27
- package/src/service/dom-watcher.ts +62 -62
- package/src/service/dom.ts +265 -265
- package/src/service/helper.ts +48 -48
- package/src/service/index.ts +10 -10
- package/src/service/lang.ts +122 -122
- package/src/service/loader.ts +152 -152
- package/src/service/router.ts +118 -118
- package/src/service/ui.ts +525 -525
- package/src/service/uri.ts +106 -106
- package/src/types/base.ts +9 -9
- package/src/types/index.ts +4 -4
- package/src/types/modal-tree.ts +12 -12
- package/src/types/plugin.ts +6 -6
- package/src/types/shims.d.ts +18 -18
- package/src/types/ui.ts +6 -6
- package/src/unicorn.ts +79 -79
- package/src/utilities/arr.ts +25 -25
- package/src/utilities/base.ts +9 -9
- package/src/utilities/data.ts +48 -48
- package/src/utilities/index.ts +5 -5
- package/src/utilities/tree.ts +20 -20
- package/src/vue/components/ModalTree/ModalTreeApp.vue +175 -175
- package/src/vue/components/ModalTree/TreeItem.vue +262 -262
- package/src/vue/components/ModalTree/TreeModal.vue +225 -225
- package/tests/test.js +4 -4
- package/tsconfig.js.json +25 -25
- package/tsconfig.json +17 -17
- package/vite.assets.config.ts +61 -61
- package/vite.config.test.ts +36 -36
- package/vite.config.ts +112 -112
package/src/legacy/legacy.ts
CHANGED
|
@@ -1,190 +1,190 @@
|
|
|
1
|
-
import { numberFormat } from '@lyrasoft/ts-toolkit/generic';
|
|
2
|
-
import { sprintf, vsprintf } from 'sprintf-js';
|
|
3
|
-
import {
|
|
4
|
-
addGlobalValidator,
|
|
5
|
-
useBs5ButtonRadio,
|
|
6
|
-
useBs5KeepTab,
|
|
7
|
-
useBs5Tooltip,
|
|
8
|
-
useCheckboxesMultiSelect,
|
|
9
|
-
useFieldValidationSync,
|
|
10
|
-
useForm,
|
|
11
|
-
useFormAsync,
|
|
12
|
-
useFormValidation,
|
|
13
|
-
useFormValidationInstance,
|
|
14
|
-
useGrid,
|
|
15
|
-
useGridAsync,
|
|
16
|
-
useHttpClient,
|
|
17
|
-
useQueue,
|
|
18
|
-
useStack,
|
|
19
|
-
useTomSelect,
|
|
20
|
-
useUniDirective
|
|
21
|
-
} from '../composable';
|
|
22
|
-
import {
|
|
23
|
-
__,
|
|
24
|
-
animateTo,
|
|
25
|
-
base64UrlDecode,
|
|
26
|
-
base64UrlEncode,
|
|
27
|
-
clearMessages,
|
|
28
|
-
clearNotifies,
|
|
29
|
-
debounce,
|
|
30
|
-
delegate,
|
|
31
|
-
domready,
|
|
32
|
-
fadeIn,
|
|
33
|
-
fadeOut,
|
|
34
|
-
getBoundedInstance,
|
|
35
|
-
getBoundedInstanceList,
|
|
36
|
-
h,
|
|
37
|
-
highlight,
|
|
38
|
-
html,
|
|
39
|
-
initAlpineComponent,
|
|
40
|
-
isDebug,
|
|
41
|
-
loadAlpine,
|
|
42
|
-
mark,
|
|
43
|
-
module,
|
|
44
|
-
prepareAlpine,
|
|
45
|
-
renderMessage,
|
|
46
|
-
route,
|
|
47
|
-
selectAll,
|
|
48
|
-
selectOne,
|
|
49
|
-
serial,
|
|
50
|
-
simpleAlert,
|
|
51
|
-
simpleConfirm,
|
|
52
|
-
simpleNotify,
|
|
53
|
-
slideDown,
|
|
54
|
-
slideToggle,
|
|
55
|
-
slideUp,
|
|
56
|
-
throttle,
|
|
57
|
-
tid,
|
|
58
|
-
uid,
|
|
59
|
-
useAssetUri,
|
|
60
|
-
useColorPicker,
|
|
61
|
-
useDisableIfStackNotEmpty,
|
|
62
|
-
useDisableOnSubmit,
|
|
63
|
-
useKeepAlive,
|
|
64
|
-
useSystemUri
|
|
65
|
-
} from '../service';
|
|
66
|
-
import { LegacyLoader } from './loader';
|
|
67
|
-
|
|
68
|
-
export async function useLegacyMethods(app: any) {
|
|
69
|
-
const http = await useHttpClient();
|
|
70
|
-
|
|
71
|
-
app.use(LegacyLoader);
|
|
72
|
-
|
|
73
|
-
handleUri(app);
|
|
74
|
-
handlerHelper(app);
|
|
75
|
-
handleCrypto(app);
|
|
76
|
-
|
|
77
|
-
app.__ = __;
|
|
78
|
-
app.trans = __;
|
|
79
|
-
app.route = route;
|
|
80
|
-
app.$http = http;
|
|
81
|
-
app.directive = useUniDirective;
|
|
82
|
-
|
|
83
|
-
app.animate = animateTo;
|
|
84
|
-
app.$animation = { to: animateTo };
|
|
85
|
-
|
|
86
|
-
app.addMessage = renderMessage;
|
|
87
|
-
app.clearMessages = clearMessages;
|
|
88
|
-
app.notify = simpleNotify;
|
|
89
|
-
app.clearNotifies = clearNotifies;
|
|
90
|
-
|
|
91
|
-
app.loadAlpine = loadAlpine;
|
|
92
|
-
app.initAlpine = initAlpineComponent;
|
|
93
|
-
app.beforeAlpineInit = prepareAlpine;
|
|
94
|
-
app.prepareAlpine = prepareAlpine;
|
|
95
|
-
|
|
96
|
-
handleUI(app);
|
|
97
|
-
|
|
98
|
-
await handleFormGrid(app);
|
|
99
|
-
|
|
100
|
-
app.formValidation = useFormValidation;
|
|
101
|
-
app.$validation = {
|
|
102
|
-
get: useFormValidationInstance,
|
|
103
|
-
getField: useFieldValidationSync,
|
|
104
|
-
addGlobalValidator: addGlobalValidator,
|
|
105
|
-
import: () => useFormValidation()
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
app.stack = useStack;
|
|
109
|
-
app.queue = useQueue;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function handleCrypto(app: any) {
|
|
113
|
-
app.base64Encode = base64UrlEncode;
|
|
114
|
-
app.base64Decode = base64UrlDecode;
|
|
115
|
-
// app.uuid4 = uuid4;
|
|
116
|
-
app.uid = uid;
|
|
117
|
-
app.tid = tid;
|
|
118
|
-
// app.md5 = md5;
|
|
119
|
-
app.serial = serial;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
function handleUri(app: any) {
|
|
123
|
-
app.uri = useSystemUri;
|
|
124
|
-
app.asset = useAssetUri;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
function handlerHelper(app: any) {
|
|
128
|
-
app.domready = domready;
|
|
129
|
-
app.selectOne = selectOne;
|
|
130
|
-
app.selectAll = selectAll;
|
|
131
|
-
app.each = selectAll;
|
|
132
|
-
app.getBoundedInstance = getBoundedInstance;
|
|
133
|
-
app.getBoundedInstanceList = getBoundedInstanceList;
|
|
134
|
-
app.module = module;
|
|
135
|
-
app.h = h;
|
|
136
|
-
app.html = html;
|
|
137
|
-
// app.$get = get;
|
|
138
|
-
// app.$set = set;
|
|
139
|
-
app.delegate = delegate;
|
|
140
|
-
app.debounce = debounce;
|
|
141
|
-
app.throttle = throttle;
|
|
142
|
-
app.isDebug = isDebug;
|
|
143
|
-
app.confirm = simpleConfirm;
|
|
144
|
-
app.alert = simpleAlert;
|
|
145
|
-
app.numberFormat = numberFormat;
|
|
146
|
-
app.sprintf = sprintf;
|
|
147
|
-
app.vsprintf = vsprintf;
|
|
148
|
-
// app.genRandomString = genRandomString;
|
|
149
|
-
// app.defaultsDeep = defaultsDeep;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function handleUI(app: any) {
|
|
153
|
-
app.$ui ??= {};
|
|
154
|
-
app.$ui.addMessage = renderMessage;
|
|
155
|
-
app.$ui.clearMessages = clearMessages;
|
|
156
|
-
app.$ui.notify = simpleNotify;
|
|
157
|
-
app.$ui.clearNotifies = clearNotifies;
|
|
158
|
-
|
|
159
|
-
app.$ui.loadAlpine = loadAlpine;
|
|
160
|
-
app.$ui.initAlpine = initAlpineComponent;
|
|
161
|
-
app.$ui.beforeAlpineInit = prepareAlpine;
|
|
162
|
-
app.$ui.prepareAlpine = prepareAlpine;
|
|
163
|
-
|
|
164
|
-
app.$ui.mark = mark;
|
|
165
|
-
app.$ui.tomSelect = useTomSelect;
|
|
166
|
-
app.$ui.slideUp = slideUp;
|
|
167
|
-
app.$ui.slideDown = slideDown;
|
|
168
|
-
app.$ui.slideToggle = slideToggle;
|
|
169
|
-
app.$ui.fadeOut = fadeOut;
|
|
170
|
-
app.$ui.fadeIn = fadeIn;
|
|
171
|
-
app.$ui.highlight = highlight;
|
|
172
|
-
app.$ui.colorPicker = useColorPicker;
|
|
173
|
-
app.$ui.disableOnSubmit = useDisableOnSubmit;
|
|
174
|
-
app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;
|
|
175
|
-
app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;
|
|
176
|
-
app.$ui.keepAlive = useKeepAlive;
|
|
177
|
-
app.$ui.bootstrap = {
|
|
178
|
-
tooltip: useBs5Tooltip,
|
|
179
|
-
buttonRadio: useBs5ButtonRadio,
|
|
180
|
-
keepTab: useBs5KeepTab,
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
async function handleFormGrid(app: any) {
|
|
185
|
-
await useFormAsync();
|
|
186
|
-
await useGridAsync();
|
|
187
|
-
|
|
188
|
-
app.form = useForm;
|
|
189
|
-
app.grid = useGrid;
|
|
190
|
-
}
|
|
1
|
+
import { numberFormat } from '@lyrasoft/ts-toolkit/generic';
|
|
2
|
+
import { sprintf, vsprintf } from 'sprintf-js';
|
|
3
|
+
import {
|
|
4
|
+
addGlobalValidator,
|
|
5
|
+
useBs5ButtonRadio,
|
|
6
|
+
useBs5KeepTab,
|
|
7
|
+
useBs5Tooltip,
|
|
8
|
+
useCheckboxesMultiSelect,
|
|
9
|
+
useFieldValidationSync,
|
|
10
|
+
useForm,
|
|
11
|
+
useFormAsync,
|
|
12
|
+
useFormValidation,
|
|
13
|
+
useFormValidationInstance,
|
|
14
|
+
useGrid,
|
|
15
|
+
useGridAsync,
|
|
16
|
+
useHttpClient,
|
|
17
|
+
useQueue,
|
|
18
|
+
useStack,
|
|
19
|
+
useTomSelect,
|
|
20
|
+
useUniDirective
|
|
21
|
+
} from '../composable';
|
|
22
|
+
import {
|
|
23
|
+
__,
|
|
24
|
+
animateTo,
|
|
25
|
+
base64UrlDecode,
|
|
26
|
+
base64UrlEncode,
|
|
27
|
+
clearMessages,
|
|
28
|
+
clearNotifies,
|
|
29
|
+
debounce,
|
|
30
|
+
delegate,
|
|
31
|
+
domready,
|
|
32
|
+
fadeIn,
|
|
33
|
+
fadeOut,
|
|
34
|
+
getBoundedInstance,
|
|
35
|
+
getBoundedInstanceList,
|
|
36
|
+
h,
|
|
37
|
+
highlight,
|
|
38
|
+
html,
|
|
39
|
+
initAlpineComponent,
|
|
40
|
+
isDebug,
|
|
41
|
+
loadAlpine,
|
|
42
|
+
mark,
|
|
43
|
+
module,
|
|
44
|
+
prepareAlpine,
|
|
45
|
+
renderMessage,
|
|
46
|
+
route,
|
|
47
|
+
selectAll,
|
|
48
|
+
selectOne,
|
|
49
|
+
serial,
|
|
50
|
+
simpleAlert,
|
|
51
|
+
simpleConfirm,
|
|
52
|
+
simpleNotify,
|
|
53
|
+
slideDown,
|
|
54
|
+
slideToggle,
|
|
55
|
+
slideUp,
|
|
56
|
+
throttle,
|
|
57
|
+
tid,
|
|
58
|
+
uid,
|
|
59
|
+
useAssetUri,
|
|
60
|
+
useColorPicker,
|
|
61
|
+
useDisableIfStackNotEmpty,
|
|
62
|
+
useDisableOnSubmit,
|
|
63
|
+
useKeepAlive,
|
|
64
|
+
useSystemUri
|
|
65
|
+
} from '../service';
|
|
66
|
+
import { LegacyLoader } from './loader';
|
|
67
|
+
|
|
68
|
+
export async function useLegacyMethods(app: any) {
|
|
69
|
+
const http = await useHttpClient();
|
|
70
|
+
|
|
71
|
+
app.use(LegacyLoader);
|
|
72
|
+
|
|
73
|
+
handleUri(app);
|
|
74
|
+
handlerHelper(app);
|
|
75
|
+
handleCrypto(app);
|
|
76
|
+
|
|
77
|
+
app.__ = __;
|
|
78
|
+
app.trans = __;
|
|
79
|
+
app.route = route;
|
|
80
|
+
app.$http = http;
|
|
81
|
+
app.directive = useUniDirective;
|
|
82
|
+
|
|
83
|
+
app.animate = animateTo;
|
|
84
|
+
app.$animation = { to: animateTo };
|
|
85
|
+
|
|
86
|
+
app.addMessage = renderMessage;
|
|
87
|
+
app.clearMessages = clearMessages;
|
|
88
|
+
app.notify = simpleNotify;
|
|
89
|
+
app.clearNotifies = clearNotifies;
|
|
90
|
+
|
|
91
|
+
app.loadAlpine = loadAlpine;
|
|
92
|
+
app.initAlpine = initAlpineComponent;
|
|
93
|
+
app.beforeAlpineInit = prepareAlpine;
|
|
94
|
+
app.prepareAlpine = prepareAlpine;
|
|
95
|
+
|
|
96
|
+
handleUI(app);
|
|
97
|
+
|
|
98
|
+
await handleFormGrid(app);
|
|
99
|
+
|
|
100
|
+
app.formValidation = useFormValidation;
|
|
101
|
+
app.$validation = {
|
|
102
|
+
get: useFormValidationInstance,
|
|
103
|
+
getField: useFieldValidationSync,
|
|
104
|
+
addGlobalValidator: addGlobalValidator,
|
|
105
|
+
import: () => useFormValidation()
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
app.stack = useStack;
|
|
109
|
+
app.queue = useQueue;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function handleCrypto(app: any) {
|
|
113
|
+
app.base64Encode = base64UrlEncode;
|
|
114
|
+
app.base64Decode = base64UrlDecode;
|
|
115
|
+
// app.uuid4 = uuid4;
|
|
116
|
+
app.uid = uid;
|
|
117
|
+
app.tid = tid;
|
|
118
|
+
// app.md5 = md5;
|
|
119
|
+
app.serial = serial;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function handleUri(app: any) {
|
|
123
|
+
app.uri = useSystemUri;
|
|
124
|
+
app.asset = useAssetUri;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function handlerHelper(app: any) {
|
|
128
|
+
app.domready = domready;
|
|
129
|
+
app.selectOne = selectOne;
|
|
130
|
+
app.selectAll = selectAll;
|
|
131
|
+
app.each = selectAll;
|
|
132
|
+
app.getBoundedInstance = getBoundedInstance;
|
|
133
|
+
app.getBoundedInstanceList = getBoundedInstanceList;
|
|
134
|
+
app.module = module;
|
|
135
|
+
app.h = h;
|
|
136
|
+
app.html = html;
|
|
137
|
+
// app.$get = get;
|
|
138
|
+
// app.$set = set;
|
|
139
|
+
app.delegate = delegate;
|
|
140
|
+
app.debounce = debounce;
|
|
141
|
+
app.throttle = throttle;
|
|
142
|
+
app.isDebug = isDebug;
|
|
143
|
+
app.confirm = simpleConfirm;
|
|
144
|
+
app.alert = simpleAlert;
|
|
145
|
+
app.numberFormat = numberFormat;
|
|
146
|
+
app.sprintf = sprintf;
|
|
147
|
+
app.vsprintf = vsprintf;
|
|
148
|
+
// app.genRandomString = genRandomString;
|
|
149
|
+
// app.defaultsDeep = defaultsDeep;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
function handleUI(app: any) {
|
|
153
|
+
app.$ui ??= {};
|
|
154
|
+
app.$ui.addMessage = renderMessage;
|
|
155
|
+
app.$ui.clearMessages = clearMessages;
|
|
156
|
+
app.$ui.notify = simpleNotify;
|
|
157
|
+
app.$ui.clearNotifies = clearNotifies;
|
|
158
|
+
|
|
159
|
+
app.$ui.loadAlpine = loadAlpine;
|
|
160
|
+
app.$ui.initAlpine = initAlpineComponent;
|
|
161
|
+
app.$ui.beforeAlpineInit = prepareAlpine;
|
|
162
|
+
app.$ui.prepareAlpine = prepareAlpine;
|
|
163
|
+
|
|
164
|
+
app.$ui.mark = mark;
|
|
165
|
+
app.$ui.tomSelect = useTomSelect;
|
|
166
|
+
app.$ui.slideUp = slideUp;
|
|
167
|
+
app.$ui.slideDown = slideDown;
|
|
168
|
+
app.$ui.slideToggle = slideToggle;
|
|
169
|
+
app.$ui.fadeOut = fadeOut;
|
|
170
|
+
app.$ui.fadeIn = fadeIn;
|
|
171
|
+
app.$ui.highlight = highlight;
|
|
172
|
+
app.$ui.colorPicker = useColorPicker;
|
|
173
|
+
app.$ui.disableOnSubmit = useDisableOnSubmit;
|
|
174
|
+
app.$ui.disableIfStackNotEmpty = useDisableIfStackNotEmpty;
|
|
175
|
+
app.$ui.checkboxesMultiSelect = useCheckboxesMultiSelect;
|
|
176
|
+
app.$ui.keepAlive = useKeepAlive;
|
|
177
|
+
app.$ui.bootstrap = {
|
|
178
|
+
tooltip: useBs5Tooltip,
|
|
179
|
+
buttonRadio: useBs5ButtonRadio,
|
|
180
|
+
keepTab: useBs5KeepTab,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
async function handleFormGrid(app: any) {
|
|
185
|
+
await useFormAsync();
|
|
186
|
+
await useGridAsync();
|
|
187
|
+
|
|
188
|
+
app.form = useForm;
|
|
189
|
+
app.grid = useGrid;
|
|
190
|
+
}
|
package/src/legacy/loader.ts
CHANGED
|
@@ -1,125 +1,125 @@
|
|
|
1
|
-
import { isDebug } from '../service';
|
|
2
|
-
|
|
3
|
-
const imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};
|
|
4
|
-
|
|
5
|
-
export class LegacyLoader {
|
|
6
|
-
static install(app: any) {
|
|
7
|
-
const loader = app.$loader = new this(app);
|
|
8
|
-
|
|
9
|
-
app.import = loader.import.bind(loader);
|
|
10
|
-
app.importSync = loader.importSync.bind(loader);
|
|
11
|
-
app.importCSS = loader.importCSS.bind(loader);
|
|
12
|
-
app.minFileName = loader.minFileName.bind(loader);
|
|
13
|
-
app.afterImported = loader.afterImported.bind(loader);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
constructor(protected app: any) {
|
|
17
|
-
//
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
doImport(src: string): Promise<any> {
|
|
21
|
-
return S.import(src);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Import modules or scripts.
|
|
26
|
-
*/
|
|
27
|
-
import(...src: any[]): Promise<any|any[]> {
|
|
28
|
-
if (src.length === 1) {
|
|
29
|
-
return this.doImport(src[0]);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
const promises: Promise<any>[] = [];
|
|
33
|
-
|
|
34
|
-
src.forEach((link) => {
|
|
35
|
-
promises.push(
|
|
36
|
-
link instanceof Promise ? link : this.doImport(link)
|
|
37
|
-
);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return Promise.all(promises);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Import sync.
|
|
45
|
-
*/
|
|
46
|
-
importSync(...src: any): Promise<any|any[]> {
|
|
47
|
-
let promise: Promise<any> = Promise.resolve();
|
|
48
|
-
let url: string[];
|
|
49
|
-
const modules: any[] = [];
|
|
50
|
-
|
|
51
|
-
while (url = src.shift()) {
|
|
52
|
-
if (!Array.isArray(url)) {
|
|
53
|
-
url = [ url ];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const target = url;
|
|
57
|
-
promise = promise.then(
|
|
58
|
-
() => this.import(...target).then((m) => {
|
|
59
|
-
modules.push(m);
|
|
60
|
-
return modules;
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
return promise;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Import CSS files.
|
|
70
|
-
*/
|
|
71
|
-
async importCSS(...src: any): Promise<any|any[]> {
|
|
72
|
-
let modules: any = await this.import(...src);
|
|
73
|
-
|
|
74
|
-
if (!Array.isArray(modules)) {
|
|
75
|
-
modules = [modules];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);
|
|
79
|
-
|
|
80
|
-
document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
minFileName(fileName: string): string {
|
|
84
|
-
const segments = fileName.split('.');
|
|
85
|
-
const ext = segments.pop();
|
|
86
|
-
|
|
87
|
-
if (isDebug()) {
|
|
88
|
-
return segments.join('.') + '.min.' + ext;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
return fileName;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
asImported(name: string) {
|
|
95
|
-
if (!imports[name]) {
|
|
96
|
-
imports[name] = {
|
|
97
|
-
promise: Promise.resolve(),
|
|
98
|
-
resolve: undefined
|
|
99
|
-
};
|
|
100
|
-
} else {
|
|
101
|
-
imports[name]?.resolve?.();
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* Add after import hook for some url or id.
|
|
107
|
-
*/
|
|
108
|
-
afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {
|
|
109
|
-
if (!imports[name]) {
|
|
110
|
-
let r;
|
|
111
|
-
imports[name] = {
|
|
112
|
-
promise: new Promise((resolve) => {
|
|
113
|
-
r = resolve;
|
|
114
|
-
}),
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
imports[name].resolve = r;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
imports[name].promise.then(callback);
|
|
121
|
-
|
|
122
|
-
return imports[name].promise;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
1
|
+
import { isDebug } from '../service';
|
|
2
|
+
|
|
3
|
+
const imports: Record<string, { promise: Promise<any>; resolve?: Function; }> = {};
|
|
4
|
+
|
|
5
|
+
export class LegacyLoader {
|
|
6
|
+
static install(app: any) {
|
|
7
|
+
const loader = app.$loader = new this(app);
|
|
8
|
+
|
|
9
|
+
app.import = loader.import.bind(loader);
|
|
10
|
+
app.importSync = loader.importSync.bind(loader);
|
|
11
|
+
app.importCSS = loader.importCSS.bind(loader);
|
|
12
|
+
app.minFileName = loader.minFileName.bind(loader);
|
|
13
|
+
app.afterImported = loader.afterImported.bind(loader);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
constructor(protected app: any) {
|
|
17
|
+
//
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
doImport(src: string): Promise<any> {
|
|
21
|
+
return S.import(src);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Import modules or scripts.
|
|
26
|
+
*/
|
|
27
|
+
import(...src: any[]): Promise<any|any[]> {
|
|
28
|
+
if (src.length === 1) {
|
|
29
|
+
return this.doImport(src[0]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const promises: Promise<any>[] = [];
|
|
33
|
+
|
|
34
|
+
src.forEach((link) => {
|
|
35
|
+
promises.push(
|
|
36
|
+
link instanceof Promise ? link : this.doImport(link)
|
|
37
|
+
);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return Promise.all(promises);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Import sync.
|
|
45
|
+
*/
|
|
46
|
+
importSync(...src: any): Promise<any|any[]> {
|
|
47
|
+
let promise: Promise<any> = Promise.resolve();
|
|
48
|
+
let url: string[];
|
|
49
|
+
const modules: any[] = [];
|
|
50
|
+
|
|
51
|
+
while (url = src.shift()) {
|
|
52
|
+
if (!Array.isArray(url)) {
|
|
53
|
+
url = [ url ];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const target = url;
|
|
57
|
+
promise = promise.then(
|
|
58
|
+
() => this.import(...target).then((m) => {
|
|
59
|
+
modules.push(m);
|
|
60
|
+
return modules;
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return promise;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Import CSS files.
|
|
70
|
+
*/
|
|
71
|
+
async importCSS(...src: any): Promise<any|any[]> {
|
|
72
|
+
let modules: any = await this.import(...src);
|
|
73
|
+
|
|
74
|
+
if (!Array.isArray(modules)) {
|
|
75
|
+
modules = [modules];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const styles: CSSStyleSheet[] = (modules as any[]).map(module => module.default);
|
|
79
|
+
|
|
80
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, ...styles];
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
minFileName(fileName: string): string {
|
|
84
|
+
const segments = fileName.split('.');
|
|
85
|
+
const ext = segments.pop();
|
|
86
|
+
|
|
87
|
+
if (isDebug()) {
|
|
88
|
+
return segments.join('.') + '.min.' + ext;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return fileName;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
asImported(name: string) {
|
|
95
|
+
if (!imports[name]) {
|
|
96
|
+
imports[name] = {
|
|
97
|
+
promise: Promise.resolve(),
|
|
98
|
+
resolve: undefined
|
|
99
|
+
};
|
|
100
|
+
} else {
|
|
101
|
+
imports[name]?.resolve?.();
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Add after import hook for some url or id.
|
|
107
|
+
*/
|
|
108
|
+
afterImported(name: string, callback: (resolve: Function, reject?: Function) => void): Promise<any> {
|
|
109
|
+
if (!imports[name]) {
|
|
110
|
+
let r;
|
|
111
|
+
imports[name] = {
|
|
112
|
+
promise: new Promise((resolve) => {
|
|
113
|
+
r = resolve;
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
imports[name].resolve = r;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
imports[name].promise.then(callback);
|
|
121
|
+
|
|
122
|
+
return imports[name].promise;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|