@pequity/squirrel 1.0.20 → 1.0.21-beta.1
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/dist/cjs/chunks/_plugin-vue_export-helper.js +9 -0
- package/dist/cjs/chunks/p-action-bar.js +60 -0
- package/dist/cjs/chunks/p-card.js +28 -0
- package/dist/cjs/chunks/p-checkbox.js +24 -0
- package/dist/cjs/chunks/p-dropdown-select.js +414 -0
- package/dist/cjs/chunks/p-input-percent.js +53 -0
- package/dist/cjs/chunks/p-pagination-info.js +66 -0
- package/dist/cjs/chunks/p-pagination.js +122 -0
- package/dist/cjs/chunks/p-ring-loader.js +81 -0
- package/dist/cjs/chunks/p-select-btn.js +97 -0
- package/dist/cjs/chunks/p-select.js +123 -0
- package/dist/cjs/chunks/p-table-loader.js +70 -0
- package/dist/cjs/chunks/p-tabs.js +52 -0
- package/dist/cjs/config.js +105 -0
- package/dist/cjs/currency.js +9 -0
- package/dist/cjs/dom.js +27 -0
- package/dist/cjs/index.js +976 -0
- package/dist/cjs/inputClassesMixin.js +50 -0
- package/dist/cjs/inputClassesShared.js +76 -0
- package/dist/cjs/listKeyboardNavigation.js +110 -0
- package/dist/cjs/number.js +9 -0
- package/dist/cjs/object.js +4 -0
- package/dist/cjs/p-action-bar.js +3 -0
- package/dist/cjs/p-alert.js +65 -0
- package/dist/cjs/p-avatar.js +71 -0
- package/dist/cjs/p-btn.js +361 -0
- package/dist/cjs/p-card.js +3 -0
- package/dist/cjs/p-checkbox.js +3 -0
- package/dist/cjs/p-chips.js +110 -0
- package/dist/cjs/p-close-btn.js +36 -0
- package/dist/cjs/p-date-picker.js +139 -0
- package/dist/cjs/p-drawer.js +253 -0
- package/dist/cjs/p-dropdown-select.js +3 -0
- package/dist/cjs/p-dropdown.js +138 -0
- package/dist/cjs/p-file-upload.js +21 -0
- package/dist/cjs/p-info-icon.js +35 -0
- package/dist/cjs/p-inline-date-picker.js +142 -0
- package/dist/cjs/p-input-number.js +146 -0
- package/dist/cjs/p-input-percent.js +3 -0
- package/dist/cjs/p-input-search.js +110 -0
- package/dist/cjs/p-input.js +89 -0
- package/dist/cjs/p-loading.js +38 -0
- package/dist/cjs/p-modal.js +369 -0
- package/dist/cjs/p-pagination-info.js +3 -0
- package/dist/cjs/p-pagination.js +3 -0
- package/dist/cjs/p-progress-bar.js +41 -0
- package/dist/cjs/p-ring-loader.js +3 -0
- package/dist/cjs/p-select-btn.js +3 -0
- package/dist/cjs/p-select-list.js +4 -0
- package/dist/cjs/p-select-pill.js +111 -0
- package/dist/cjs/p-select.js +3 -0
- package/dist/cjs/p-skeleton-loader.js +73 -0
- package/dist/cjs/p-table-filter-icon.js +20 -0
- package/dist/cjs/p-table-header-cell.js +75 -0
- package/dist/cjs/p-table-loader.js +3 -0
- package/dist/cjs/p-table-sort.js +8 -0
- package/dist/cjs/p-table-td.js +88 -0
- package/dist/cjs/p-table.js +12 -0
- package/dist/cjs/p-tabs.js +3 -0
- package/dist/cjs/p-textarea.js +73 -0
- package/dist/cjs/p-toggle.js +114 -0
- package/dist/cjs/pagination.js +29 -0
- package/dist/cjs/string.js +12 -0
- package/dist/cjs/tailwind.js +4353 -0
- package/dist/cjs/text.js +16 -0
- package/dist/cjs/useInputClasses.js +44 -0
- package/dist/cjs/usePLoading.js +35 -0
- package/dist/cjs/usePModal.js +21 -0
- package/dist/cjs/usePTableColResize.js +81 -0
- package/dist/cjs/usePTableRowVirtualizer.js +31 -0
- package/dist/cjs/useSelectList.js +256 -0
- package/dist/es/chunks/_plugin-vue_export-helper.js +10 -0
- package/dist/es/chunks/p-action-bar.js +61 -0
- package/dist/es/chunks/p-card.js +29 -0
- package/dist/es/chunks/p-checkbox.js +25 -0
- package/dist/es/chunks/p-dropdown-select.js +415 -0
- package/dist/es/chunks/p-input-percent.js +54 -0
- package/dist/es/chunks/p-pagination-info.js +67 -0
- package/dist/es/chunks/p-pagination.js +123 -0
- package/dist/es/chunks/p-ring-loader.js +82 -0
- package/dist/es/chunks/p-select-btn.js +98 -0
- package/dist/es/chunks/p-select.js +124 -0
- package/dist/es/chunks/p-table-loader.js +71 -0
- package/dist/es/chunks/p-tabs.js +53 -0
- package/dist/es/config.js +105 -0
- package/dist/es/currency.js +9 -0
- package/dist/es/dom.js +27 -0
- package/dist/es/index.js +978 -0
- package/dist/es/inputClassesMixin.js +51 -0
- package/dist/es/inputClassesShared.js +76 -0
- package/dist/es/listKeyboardNavigation.js +110 -0
- package/dist/es/number.js +9 -0
- package/dist/es/object.js +4 -0
- package/dist/es/p-action-bar.js +4 -0
- package/dist/es/p-alert.js +66 -0
- package/dist/es/p-avatar.js +72 -0
- package/dist/es/p-btn.js +362 -0
- package/dist/es/p-card.js +4 -0
- package/dist/es/p-checkbox.js +4 -0
- package/dist/es/p-chips.js +111 -0
- package/dist/es/p-close-btn.js +37 -0
- package/dist/es/p-date-picker.js +140 -0
- package/dist/es/p-drawer.js +254 -0
- package/dist/es/p-dropdown-select.js +4 -0
- package/dist/es/p-dropdown.js +139 -0
- package/dist/es/p-file-upload.js +21 -0
- package/dist/es/p-info-icon.js +36 -0
- package/dist/es/p-inline-date-picker.js +143 -0
- package/dist/es/p-input-number.js +147 -0
- package/dist/es/p-input-percent.js +4 -0
- package/dist/es/p-input-search.js +111 -0
- package/dist/es/p-input.js +90 -0
- package/dist/es/p-loading.js +39 -0
- package/dist/es/p-modal.js +370 -0
- package/dist/es/p-pagination-info.js +4 -0
- package/dist/es/p-pagination.js +4 -0
- package/dist/es/p-progress-bar.js +42 -0
- package/dist/es/p-ring-loader.js +4 -0
- package/dist/es/p-select-btn.js +4 -0
- package/dist/es/p-select-list.js +4 -0
- package/dist/es/p-select-pill.js +112 -0
- package/dist/es/p-select.js +4 -0
- package/dist/es/p-skeleton-loader.js +74 -0
- package/dist/es/p-table-filter-icon.js +21 -0
- package/dist/es/p-table-header-cell.js +76 -0
- package/dist/es/p-table-loader.js +4 -0
- package/dist/es/p-table-sort.js +8 -0
- package/dist/es/p-table-td.js +89 -0
- package/dist/es/p-table.js +12 -0
- package/dist/es/p-tabs.js +4 -0
- package/dist/es/p-textarea.js +74 -0
- package/dist/es/p-toggle.js +115 -0
- package/dist/es/pagination.js +29 -0
- package/dist/es/string.js +12 -0
- package/dist/es/tailwind.js +4353 -0
- package/dist/es/text.js +16 -0
- package/dist/es/useInputClasses.js +44 -0
- package/dist/es/usePLoading.js +35 -0
- package/dist/es/usePModal.js +21 -0
- package/dist/es/usePTableColResize.js +81 -0
- package/dist/es/usePTableRowVirtualizer.js +31 -0
- package/dist/es/useSelectList.js +256 -0
- package/dist/style.css +2124 -1
- package/package.json +26 -24
- package/dist/squirrel.cjs.js +0 -5
- package/dist/squirrel.es.js +0 -8220
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { defineComponent, useCssVars, ref, onBeforeMount, onMounted, getCurrentInstance, watch, nextTick, onBeforeUnmount, openBlock, createBlock, Teleport, createVNode, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, vShow, renderSlot, createElementBlock, toDisplayString, createCommentVNode, withModifiers, createTextVNode } from "vue";
|
|
2
|
+
import PAlert from "./p-alert.js";
|
|
3
|
+
import PCloseBtn from "./p-close-btn.js";
|
|
4
|
+
import { usePModal } from "./usePModal.js";
|
|
5
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
6
|
+
const _hoisted_1 = ["data-pm-backdrop-id"];
|
|
7
|
+
const _hoisted_2 = ["data-pm-wrapper-id", "aria-label", "aria-describedby", "aria-labelledby"];
|
|
8
|
+
const _hoisted_3 = ["data-pm-id"];
|
|
9
|
+
const _hoisted_4 = { class: "flex pb-4 pl-8 pr-4 pt-4" };
|
|
10
|
+
const _hoisted_5 = ["id"];
|
|
11
|
+
const _hoisted_6 = { class: "ml-auto" };
|
|
12
|
+
const _hoisted_7 = {
|
|
13
|
+
key: 0,
|
|
14
|
+
class: "mb-4 px-8"
|
|
15
|
+
};
|
|
16
|
+
const _hoisted_8 = ["id"];
|
|
17
|
+
const _hoisted_9 = { class: "mt-6 px-8 pt-6" };
|
|
18
|
+
const FOCUSABLE_ELEMENTS = 'a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
19
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
20
|
+
...{
|
|
21
|
+
name: "PModal"
|
|
22
|
+
},
|
|
23
|
+
__name: "p-modal",
|
|
24
|
+
props: {
|
|
25
|
+
name: {
|
|
26
|
+
type: String,
|
|
27
|
+
default: ""
|
|
28
|
+
},
|
|
29
|
+
title: {
|
|
30
|
+
type: String,
|
|
31
|
+
default: ""
|
|
32
|
+
},
|
|
33
|
+
baseZindex: {
|
|
34
|
+
type: Number,
|
|
35
|
+
default: 1051
|
|
36
|
+
},
|
|
37
|
+
bgClass: {
|
|
38
|
+
type: [String, Object, Array],
|
|
39
|
+
default: "fixed bottom-0 left-0 right-0 top-0 bg-black bg-opacity-20"
|
|
40
|
+
},
|
|
41
|
+
wrapperClass: {
|
|
42
|
+
type: [String, Object, Array],
|
|
43
|
+
default: "fixed bottom-0 left-0 right-0 top-0 flex flex-col items-center justify-center overflow-y-auto overflow-x-hidden outline-none"
|
|
44
|
+
},
|
|
45
|
+
modalClass: {
|
|
46
|
+
type: [String, Object, Array],
|
|
47
|
+
default: "pm relative flex flex-col rounded-2xl pb-6 cursor-default bg-surface shadow-xl"
|
|
48
|
+
},
|
|
49
|
+
modalStyle: {
|
|
50
|
+
type: [String, Object, Array],
|
|
51
|
+
default: ""
|
|
52
|
+
},
|
|
53
|
+
inClass: {
|
|
54
|
+
type: String,
|
|
55
|
+
default: "slideInTop"
|
|
56
|
+
},
|
|
57
|
+
outClass: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "slideOutTop"
|
|
60
|
+
},
|
|
61
|
+
bgInClass: {
|
|
62
|
+
type: String,
|
|
63
|
+
default: "fadeIn"
|
|
64
|
+
},
|
|
65
|
+
bgOutClass: {
|
|
66
|
+
type: String,
|
|
67
|
+
default: "fadeOut"
|
|
68
|
+
},
|
|
69
|
+
appendTo: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "body"
|
|
72
|
+
},
|
|
73
|
+
live: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
default: false
|
|
76
|
+
},
|
|
77
|
+
enableClose: {
|
|
78
|
+
type: Boolean,
|
|
79
|
+
default: true
|
|
80
|
+
},
|
|
81
|
+
modelValue: {
|
|
82
|
+
type: Boolean,
|
|
83
|
+
default: false
|
|
84
|
+
},
|
|
85
|
+
closeLabel: {
|
|
86
|
+
type: String,
|
|
87
|
+
default: "Close"
|
|
88
|
+
},
|
|
89
|
+
disabled: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
errorMsg: {
|
|
94
|
+
type: String,
|
|
95
|
+
default: ""
|
|
96
|
+
},
|
|
97
|
+
maxWidth: {
|
|
98
|
+
type: String,
|
|
99
|
+
default: "500px"
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
emits: [
|
|
103
|
+
"before-open",
|
|
104
|
+
"opening",
|
|
105
|
+
"opened",
|
|
106
|
+
"before-close",
|
|
107
|
+
"closing",
|
|
108
|
+
"closed",
|
|
109
|
+
"update:modelValue"
|
|
110
|
+
],
|
|
111
|
+
setup(__props, { emit: __emit }) {
|
|
112
|
+
useCssVars((_ctx) => ({
|
|
113
|
+
"8a536574": __props.maxWidth
|
|
114
|
+
}));
|
|
115
|
+
let animatingZIndex = 0;
|
|
116
|
+
const emit = __emit;
|
|
117
|
+
const props = __props;
|
|
118
|
+
const modal = usePModal();
|
|
119
|
+
const zIndex = ref(0);
|
|
120
|
+
const id = ref("");
|
|
121
|
+
const show = ref(false);
|
|
122
|
+
const mount = ref(false);
|
|
123
|
+
const elToFocus = ref(null);
|
|
124
|
+
const pmWrapper = ref(null);
|
|
125
|
+
onBeforeMount(() => {
|
|
126
|
+
if (props.live) {
|
|
127
|
+
mount.value = true;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
onMounted(() => {
|
|
131
|
+
var _a;
|
|
132
|
+
id.value = "pm-" + ((_a = getCurrentInstance()) == null ? void 0 : _a.uid);
|
|
133
|
+
const valueToWatch = !props.name ? () => props.modelValue : () => modal.state.modals[props.name];
|
|
134
|
+
watch(
|
|
135
|
+
valueToWatch,
|
|
136
|
+
(newVal) => {
|
|
137
|
+
if (newVal) {
|
|
138
|
+
mount.value = true;
|
|
139
|
+
nextTick(() => {
|
|
140
|
+
show.value = true;
|
|
141
|
+
});
|
|
142
|
+
} else {
|
|
143
|
+
show.value = false;
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
immediate: true
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
onBeforeUnmount(() => {
|
|
152
|
+
elToFocus.value = null;
|
|
153
|
+
props.name && modal.hide(props.name);
|
|
154
|
+
});
|
|
155
|
+
const close = () => {
|
|
156
|
+
if (props.enableClose === true) {
|
|
157
|
+
emit("update:modelValue", false);
|
|
158
|
+
props.name && modal.hide(props.name);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
const clickOutside = (e) => {
|
|
162
|
+
if (e.target === pmWrapper.value) {
|
|
163
|
+
close();
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const keydown = (e) => {
|
|
167
|
+
var _a;
|
|
168
|
+
if (e.which === 27 || e.keyCode === 27) {
|
|
169
|
+
close();
|
|
170
|
+
}
|
|
171
|
+
if (e.which === 9 || e.keyCode === 9) {
|
|
172
|
+
const all = [].slice.call((_a = pmWrapper.value) == null ? void 0 : _a.querySelectorAll(FOCUSABLE_ELEMENTS)).filter(function(el) {
|
|
173
|
+
return !!(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
|
|
174
|
+
});
|
|
175
|
+
if (e.shiftKey) {
|
|
176
|
+
if (e.target === all[0] || e.target === pmWrapper.value) {
|
|
177
|
+
e.preventDefault();
|
|
178
|
+
all[all.length - 1].focus();
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
181
|
+
if (e.target === all[all.length - 1]) {
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
all[0].focus();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
const getAllVisibleWrappers = () => {
|
|
189
|
+
return [].slice.call(document.querySelectorAll("[data-pm-wrapper-id]")).filter((w) => w.style.display !== "none");
|
|
190
|
+
};
|
|
191
|
+
const getTopZindex = () => {
|
|
192
|
+
return getAllVisibleWrappers().reduce((acc, curr) => {
|
|
193
|
+
return parseInt(curr.style.zIndex) > acc ? parseInt(curr.style.zIndex) : acc;
|
|
194
|
+
}, 0);
|
|
195
|
+
};
|
|
196
|
+
const handleFocus = (wrapper) => {
|
|
197
|
+
const autofocus = wrapper.querySelector("[autofocus]");
|
|
198
|
+
if (autofocus) {
|
|
199
|
+
autofocus.focus();
|
|
200
|
+
} else {
|
|
201
|
+
const focusable = wrapper.querySelectorAll(FOCUSABLE_ELEMENTS);
|
|
202
|
+
focusable.length ? focusable[0].focus() : wrapper.focus();
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const beforeOpen = () => {
|
|
206
|
+
elToFocus.value = document.activeElement;
|
|
207
|
+
const lastZindex = getTopZindex();
|
|
208
|
+
if (animatingZIndex) {
|
|
209
|
+
zIndex.value = animatingZIndex + 2;
|
|
210
|
+
} else {
|
|
211
|
+
zIndex.value = lastZindex === 0 ? props.baseZindex : lastZindex + 2;
|
|
212
|
+
}
|
|
213
|
+
animatingZIndex = zIndex.value;
|
|
214
|
+
emit("before-open");
|
|
215
|
+
};
|
|
216
|
+
const opening = () => {
|
|
217
|
+
emit("opening");
|
|
218
|
+
};
|
|
219
|
+
const afterOpen = () => {
|
|
220
|
+
handleFocus(pmWrapper.value);
|
|
221
|
+
emit("opened");
|
|
222
|
+
};
|
|
223
|
+
const beforeClose = () => {
|
|
224
|
+
emit("before-close");
|
|
225
|
+
};
|
|
226
|
+
const closing = () => {
|
|
227
|
+
emit("closing");
|
|
228
|
+
};
|
|
229
|
+
const afterClose = () => {
|
|
230
|
+
zIndex.value = 0;
|
|
231
|
+
if (!props.live) {
|
|
232
|
+
mount.value = false;
|
|
233
|
+
}
|
|
234
|
+
nextTick(() => {
|
|
235
|
+
window.requestAnimationFrame(() => {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
const lastZindex = getTopZindex();
|
|
238
|
+
if (lastZindex > 0) {
|
|
239
|
+
const all = getAllVisibleWrappers();
|
|
240
|
+
for (let i = 0; i < all.length; i++) {
|
|
241
|
+
const wrapper = all[i];
|
|
242
|
+
if (parseInt(wrapper.style.zIndex) === lastZindex) {
|
|
243
|
+
if (wrapper.contains(elToFocus.value)) {
|
|
244
|
+
(_a = elToFocus.value) == null ? void 0 : _a.focus();
|
|
245
|
+
} else {
|
|
246
|
+
handleFocus(wrapper);
|
|
247
|
+
}
|
|
248
|
+
break;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
} else {
|
|
252
|
+
if (document.body.contains(elToFocus.value)) {
|
|
253
|
+
(_b = elToFocus.value) == null ? void 0 : _b.focus();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
animatingZIndex = 0;
|
|
257
|
+
emit("closed");
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
};
|
|
261
|
+
return (_ctx, _cache) => {
|
|
262
|
+
return mount.value ? (openBlock(), createBlock(Teleport, {
|
|
263
|
+
key: 0,
|
|
264
|
+
to: __props.appendTo
|
|
265
|
+
}, [
|
|
266
|
+
createVNode(Transition, {
|
|
267
|
+
name: "pm-backdrop-transition",
|
|
268
|
+
"enter-active-class": __props.bgInClass,
|
|
269
|
+
"leave-active-class": __props.bgOutClass
|
|
270
|
+
}, {
|
|
271
|
+
default: withCtx(() => [
|
|
272
|
+
withDirectives(createElementVNode("div", {
|
|
273
|
+
"data-pm-backdrop-id": id.value,
|
|
274
|
+
class: normalizeClass(__props.bgClass),
|
|
275
|
+
style: normalizeStyle({ "z-index": zIndex.value - 1 })
|
|
276
|
+
}, null, 14, _hoisted_1), [
|
|
277
|
+
[vShow, show.value]
|
|
278
|
+
])
|
|
279
|
+
]),
|
|
280
|
+
_: 1
|
|
281
|
+
}, 8, ["enter-active-class", "leave-active-class"]),
|
|
282
|
+
createVNode(Transition, {
|
|
283
|
+
name: "pm-transition",
|
|
284
|
+
"enter-active-class": __props.inClass,
|
|
285
|
+
"leave-active-class": __props.outClass,
|
|
286
|
+
onBeforeEnter: beforeOpen,
|
|
287
|
+
onEnter: opening,
|
|
288
|
+
onAfterEnter: afterOpen,
|
|
289
|
+
onBeforeLeave: beforeClose,
|
|
290
|
+
onLeave: closing,
|
|
291
|
+
onAfterLeave: afterClose
|
|
292
|
+
}, {
|
|
293
|
+
default: withCtx(() => [
|
|
294
|
+
withDirectives(createElementVNode("div", {
|
|
295
|
+
ref_key: "pmWrapper",
|
|
296
|
+
ref: pmWrapper,
|
|
297
|
+
"data-pm-wrapper-id": id.value,
|
|
298
|
+
tabindex: "-1",
|
|
299
|
+
class: normalizeClass(__props.wrapperClass),
|
|
300
|
+
style: normalizeStyle({ "z-index": zIndex.value, cursor: __props.enableClose ? "pointer" : "default" }),
|
|
301
|
+
role: "dialog",
|
|
302
|
+
"aria-label": __props.title,
|
|
303
|
+
"aria-modal": "true",
|
|
304
|
+
"aria-describedby": `${id.value}-content`,
|
|
305
|
+
"aria-labelledby": `${id.value}-title`,
|
|
306
|
+
onClick: _cache[0] || (_cache[0] = ($event) => clickOutside($event)),
|
|
307
|
+
onKeydown: _cache[1] || (_cache[1] = ($event) => keydown($event))
|
|
308
|
+
}, [
|
|
309
|
+
createElementVNode("div", {
|
|
310
|
+
ref: "pm",
|
|
311
|
+
"data-pm-id": id.value,
|
|
312
|
+
class: normalizeClass(__props.modalClass),
|
|
313
|
+
style: normalizeStyle(__props.modalStyle)
|
|
314
|
+
}, [
|
|
315
|
+
renderSlot(_ctx.$slots, "title-wrapper", {}, () => [
|
|
316
|
+
createElementVNode("div", _hoisted_4, [
|
|
317
|
+
__props.title ? (openBlock(), createElementBlock("h3", {
|
|
318
|
+
key: 0,
|
|
319
|
+
id: `${id.value}-title`,
|
|
320
|
+
class: "mr-auto pt-4 text-xl font-semibold"
|
|
321
|
+
}, toDisplayString(__props.title), 9, _hoisted_5)) : createCommentVNode("", true),
|
|
322
|
+
createElementVNode("div", _hoisted_6, [
|
|
323
|
+
__props.enableClose ? (openBlock(), createBlock(PCloseBtn, {
|
|
324
|
+
key: 0,
|
|
325
|
+
disabled: __props.disabled,
|
|
326
|
+
"aria-label": __props.closeLabel,
|
|
327
|
+
onClick: withModifiers(close, ["prevent"])
|
|
328
|
+
}, null, 8, ["disabled", "aria-label"])) : createCommentVNode("", true)
|
|
329
|
+
])
|
|
330
|
+
])
|
|
331
|
+
], true),
|
|
332
|
+
__props.errorMsg ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
333
|
+
createVNode(PAlert, { type: "error" }, {
|
|
334
|
+
default: withCtx(() => [
|
|
335
|
+
createTextVNode(toDisplayString(__props.errorMsg), 1)
|
|
336
|
+
]),
|
|
337
|
+
_: 1
|
|
338
|
+
})
|
|
339
|
+
])) : createCommentVNode("", true),
|
|
340
|
+
renderSlot(_ctx.$slots, "content-wrapper", {}, () => [
|
|
341
|
+
createElementVNode("div", {
|
|
342
|
+
id: `${id.value}-content`,
|
|
343
|
+
class: normalizeClass([
|
|
344
|
+
"relative grow overflow-y-auto overflow-x-hidden px-8",
|
|
345
|
+
{ "pointer-events-none opacity-50": __props.disabled }
|
|
346
|
+
])
|
|
347
|
+
}, [
|
|
348
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
349
|
+
], 10, _hoisted_8)
|
|
350
|
+
], true),
|
|
351
|
+
_ctx.$slots["footer"] ? renderSlot(_ctx.$slots, "footer-wrapper", { key: 1 }, () => [
|
|
352
|
+
createElementVNode("div", _hoisted_9, [
|
|
353
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
354
|
+
])
|
|
355
|
+
], true) : createCommentVNode("", true)
|
|
356
|
+
], 14, _hoisted_3)
|
|
357
|
+
], 46, _hoisted_2), [
|
|
358
|
+
[vShow, show.value]
|
|
359
|
+
])
|
|
360
|
+
]),
|
|
361
|
+
_: 3
|
|
362
|
+
}, 8, ["enter-active-class", "leave-active-class"])
|
|
363
|
+
], 8, ["to"])) : createCommentVNode("", true);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
const pModal = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-ee599a02"]]);
|
|
368
|
+
export {
|
|
369
|
+
pModal as default
|
|
370
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineComponent, resolveDirective, openBlock, createElementBlock, Fragment, renderList, withDirectives, normalizeStyle } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
+
const _sfc_main = defineComponent({
|
|
4
|
+
name: "PProgressBar",
|
|
5
|
+
props: {
|
|
6
|
+
total: {
|
|
7
|
+
type: Number,
|
|
8
|
+
required: true
|
|
9
|
+
},
|
|
10
|
+
items: {
|
|
11
|
+
type: Array,
|
|
12
|
+
required: true
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const _hoisted_1 = {
|
|
17
|
+
class: "flex justify-start overflow-hidden rounded bg-p-blue-20",
|
|
18
|
+
role: "progressbar"
|
|
19
|
+
};
|
|
20
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
21
|
+
const _directive_tooltip = resolveDirective("tooltip");
|
|
22
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
23
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (item) => {
|
|
24
|
+
return withDirectives((openBlock(), createElementBlock("div", {
|
|
25
|
+
key: `progress-value-${item.color}`,
|
|
26
|
+
class: "h-full",
|
|
27
|
+
style: normalizeStyle({ width: `${item.value / _ctx.total * 100}%`, background: item.color })
|
|
28
|
+
}, null, 4)), [
|
|
29
|
+
[
|
|
30
|
+
_directive_tooltip,
|
|
31
|
+
item.label,
|
|
32
|
+
void 0,
|
|
33
|
+
{ top: true }
|
|
34
|
+
]
|
|
35
|
+
]);
|
|
36
|
+
}), 128))
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
const pProgressBar = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
40
|
+
export {
|
|
41
|
+
pProgressBar as default
|
|
42
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, createElementVNode, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
+
const SIZES = { sm: "h-7 px-4 text-xs", md: "h-9 px-5 text-sm", lg: "h-11 px-7 text-base" };
|
|
4
|
+
const ACTIVE_CLASS = "text-p-purple-60";
|
|
5
|
+
const getOffsetValues = (container) => {
|
|
6
|
+
const el = container.cloneNode(true);
|
|
7
|
+
el.style.visibility = "hidden";
|
|
8
|
+
document.body.appendChild(el);
|
|
9
|
+
const activeBtn = el.querySelector(`button.${ACTIVE_CLASS}`);
|
|
10
|
+
const res = { width: `${activeBtn.offsetWidth}px`, left: `${activeBtn.offsetLeft}px` };
|
|
11
|
+
document.body.removeChild(el);
|
|
12
|
+
return res;
|
|
13
|
+
};
|
|
14
|
+
const _sfc_main = defineComponent({
|
|
15
|
+
props: {
|
|
16
|
+
modelValue: {
|
|
17
|
+
type: [String, Number],
|
|
18
|
+
default: ""
|
|
19
|
+
},
|
|
20
|
+
items: {
|
|
21
|
+
type: Array,
|
|
22
|
+
default: () => []
|
|
23
|
+
},
|
|
24
|
+
itemText: {
|
|
25
|
+
type: String,
|
|
26
|
+
default: "text"
|
|
27
|
+
},
|
|
28
|
+
itemSubtext: {
|
|
29
|
+
type: String,
|
|
30
|
+
default: "subtext"
|
|
31
|
+
},
|
|
32
|
+
itemValue: {
|
|
33
|
+
type: [String, Number],
|
|
34
|
+
default: "value"
|
|
35
|
+
},
|
|
36
|
+
size: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: "md",
|
|
39
|
+
validator(value) {
|
|
40
|
+
return Object.keys(SIZES).includes(value);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
emits: ["update:modelValue"],
|
|
45
|
+
data() {
|
|
46
|
+
return {
|
|
47
|
+
SIZES,
|
|
48
|
+
ACTIVE_CLASS
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
watch: {
|
|
52
|
+
modelValue: {
|
|
53
|
+
handler() {
|
|
54
|
+
setTimeout(() => this.setPillStyle(), 60);
|
|
55
|
+
},
|
|
56
|
+
immediate: true
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
methods: {
|
|
60
|
+
click(e, option) {
|
|
61
|
+
if (!option.disabled) {
|
|
62
|
+
this.$emit("update:modelValue", option[this.itemValue]);
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
setPillStyle() {
|
|
66
|
+
const el = this.$el.querySelector(`button.${ACTIVE_CLASS}`);
|
|
67
|
+
if (!el) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const dimensions = el.offsetWidth !== 0 ? { left: `${el.offsetLeft}px`, width: `${el.offsetWidth}px` } : getOffsetValues(this.$el);
|
|
71
|
+
this.$refs.pill.style.left = dimensions.left;
|
|
72
|
+
this.$refs.pill.style.width = dimensions.width;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
const _hoisted_1 = { class: "relative inline-flex rounded-full border-2 border-p-gray-30 bg-p-gray-30 text-center font-semibold text-p-gray-50" };
|
|
77
|
+
const _hoisted_2 = {
|
|
78
|
+
ref: "pill",
|
|
79
|
+
class: "absolute left-0 top-0 inline-block h-full rounded-full bg-surface duration-200 ease-in-out"
|
|
80
|
+
};
|
|
81
|
+
const _hoisted_3 = ["disabled", "onClick"];
|
|
82
|
+
const _hoisted_4 = { class: "flex" };
|
|
83
|
+
const _hoisted_5 = {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "pl-1 opacity-50"
|
|
86
|
+
};
|
|
87
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
88
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
89
|
+
createElementVNode("div", _hoisted_2, null, 512),
|
|
90
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.items, (o) => {
|
|
91
|
+
return openBlock(), createElementBlock("button", {
|
|
92
|
+
key: o[_ctx.itemValue],
|
|
93
|
+
disabled: o.disabled,
|
|
94
|
+
class: normalizeClass(["z-10 duration-700", [
|
|
95
|
+
_ctx.SIZES[_ctx.size],
|
|
96
|
+
_ctx.modelValue === o[_ctx.itemValue] ? `${_ctx.ACTIVE_CLASS} hover:text-p-purple-70` : "hover:text-p-gray-60",
|
|
97
|
+
{ "opacity-25": o.disabled }
|
|
98
|
+
]]),
|
|
99
|
+
onClick: ($event) => _ctx.click($event, o)
|
|
100
|
+
}, [
|
|
101
|
+
createElementVNode("div", _hoisted_4, [
|
|
102
|
+
createElementVNode("div", null, toDisplayString(o[_ctx.itemText]), 1),
|
|
103
|
+
o[_ctx.itemSubtext] ? (openBlock(), createElementBlock("div", _hoisted_5, toDisplayString(o[_ctx.itemSubtext]), 1)) : createCommentVNode("", true)
|
|
104
|
+
])
|
|
105
|
+
], 10, _hoisted_3);
|
|
106
|
+
}), 128))
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
const pSelectPill = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
110
|
+
export {
|
|
111
|
+
pSelectPill as default
|
|
112
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, renderSlot } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
+
const LOADER_TYPES = {
|
|
4
|
+
rectangle: "rectangle",
|
|
5
|
+
circle: "circle"
|
|
6
|
+
};
|
|
7
|
+
const LOADER_CSS_CLASSES = {
|
|
8
|
+
[LOADER_TYPES.rectangle]: "rounded",
|
|
9
|
+
[LOADER_TYPES.circle]: "rounded-full"
|
|
10
|
+
};
|
|
11
|
+
const SHIMMER_COLOR = "#ffffff";
|
|
12
|
+
const isHexColor = (hexColor) => {
|
|
13
|
+
const hex = hexColor.replace("#", "");
|
|
14
|
+
return typeof hexColor === "string" && hexColor.startsWith("#") && hex.length === 6 && !isNaN(Number("0x" + hex));
|
|
15
|
+
};
|
|
16
|
+
const hexToRgb = (hex) => {
|
|
17
|
+
var _a;
|
|
18
|
+
return `${(_a = hex.match(/\w\w/g)) == null ? void 0 : _a.map((x) => +`0x${x}`)}`;
|
|
19
|
+
};
|
|
20
|
+
const _sfc_main = defineComponent({
|
|
21
|
+
name: "PSkeletonLoader",
|
|
22
|
+
props: {
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: LOADER_TYPES.rectangle,
|
|
26
|
+
validator(value) {
|
|
27
|
+
return Object.values(LOADER_TYPES).includes(value);
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
bgClass: {
|
|
31
|
+
type: String,
|
|
32
|
+
default: "bg-p-gray-30"
|
|
33
|
+
},
|
|
34
|
+
cssClass: {
|
|
35
|
+
type: String,
|
|
36
|
+
default: ""
|
|
37
|
+
},
|
|
38
|
+
shimmerColor: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: SHIMMER_COLOR
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
data() {
|
|
44
|
+
return {
|
|
45
|
+
LOADER_TYPES
|
|
46
|
+
};
|
|
47
|
+
},
|
|
48
|
+
computed: {
|
|
49
|
+
shimmerStyle() {
|
|
50
|
+
const rgb = isHexColor(this.shimmerColor) ? hexToRgb(this.shimmerColor) : SHIMMER_COLOR;
|
|
51
|
+
return {
|
|
52
|
+
backgroundImage: `linear-gradient(90deg, rgba(${rgb}, 0) 0%, rgba(${rgb}, 0.2) 20%, rgba(${rgb}, 0.5) 60%, rgba(${rgb}, 0))`
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
loaderClass() {
|
|
56
|
+
return this.cssClass ? this.cssClass : LOADER_CSS_CLASSES[this.type];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
61
|
+
return openBlock(), createElementBlock("div", {
|
|
62
|
+
class: normalizeClass([_ctx.bgClass, _ctx.loaderClass, "relative overflow-hidden"])
|
|
63
|
+
}, [
|
|
64
|
+
createElementVNode("div", {
|
|
65
|
+
class: "shimmer absolute bottom-0 left-0 right-0 top-0",
|
|
66
|
+
style: normalizeStyle(_ctx.shimmerStyle)
|
|
67
|
+
}, null, 4),
|
|
68
|
+
renderSlot(_ctx.$slots, "default", {}, void 0, true)
|
|
69
|
+
], 2);
|
|
70
|
+
}
|
|
71
|
+
const PSkeletonLoader = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-53e537dc"]]);
|
|
72
|
+
export {
|
|
73
|
+
PSkeletonLoader as default
|
|
74
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { defineComponent, openBlock, createElementBlock, mergeProps } from "vue";
|
|
2
|
+
import { _ as _export_sfc } from "./chunks/_plugin-vue_export-helper.js";
|
|
3
|
+
const _sfc_main = defineComponent({
|
|
4
|
+
name: "PTableFilterIcon",
|
|
5
|
+
inheritAttrs: false,
|
|
6
|
+
props: {
|
|
7
|
+
active: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
default: false
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
});
|
|
13
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
14
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
15
|
+
class: ["h-5 w-5 shrink-0 cursor-pointer filter", { active: _ctx.active }]
|
|
16
|
+
}, _ctx.$attrs), null, 16);
|
|
17
|
+
}
|
|
18
|
+
const PTableFilterIcon = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-cbac2434"]]);
|
|
19
|
+
export {
|
|
20
|
+
PTableFilterIcon as default
|
|
21
|
+
};
|