@pequity/squirrel 5.2.3 → 5.3.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.
- package/dist/cjs/chunks/component.js +4 -0
- package/dist/cjs/chunks/p-dropdown-select.js +1 -1
- package/dist/cjs/chunks/p-icon.js +2180 -0
- package/dist/cjs/chunks/string.js +13 -0
- package/dist/cjs/component.js +28 -0
- package/dist/cjs/index.js +32 -2188
- package/dist/cjs/p-loading.js +4 -7
- package/dist/cjs/string.js +32 -11
- package/dist/cjs/useSelectList.js +1 -1
- package/dist/es/chunks/component.js +5 -0
- package/dist/es/chunks/p-dropdown-select.js +1 -1
- package/dist/es/chunks/p-icon.js +2181 -0
- package/dist/es/chunks/string.js +14 -0
- package/dist/es/component.js +27 -0
- package/dist/es/index.js +31 -2187
- package/dist/es/p-loading.js +4 -7
- package/dist/es/string.js +32 -12
- package/dist/es/useSelectList.js +1 -1
- package/dist/squirrel/components/p-action-bar/p-action-bar.types.d.ts +3 -2
- package/dist/squirrel/utils/component.d.ts +2 -0
- package/dist/squirrel/utils/component.spec.d.ts +1 -0
- package/dist/squirrel/utils/string.d.ts +1 -0
- package/dist/squirrel/utils/string.spec.d.ts +1 -0
- package/dist/style.css +6 -6
- package/package.json +2 -2
- package/squirrel/components/p-action-bar/p-action-bar.spec.js +46 -14
- package/squirrel/components/p-action-bar/p-action-bar.stories.js +6 -0
- package/squirrel/components/p-action-bar/p-action-bar.types.ts +4 -2
- package/squirrel/components/p-action-bar/p-action-bar.vue +9 -3
- package/squirrel/components/p-avatar/p-avatar.spec.js +15 -0
- package/squirrel/components/p-icon/p-icon.spec.js +0 -1
- package/squirrel/components/p-loading/p-loading.vue +2 -7
- package/squirrel/components/p-table-td/p-table-td.spec.js +0 -1
- package/squirrel/utils/component.spec.ts +29 -0
- package/squirrel/utils/component.ts +5 -0
- package/squirrel/utils/{string.spec.js → string.spec.ts} +19 -1
- package/squirrel/utils/string.ts +2 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const isString = (val) => typeof val === "string";
|
|
2
|
+
const toString = (value) => {
|
|
3
|
+
if (typeof value === "number" && (!isFinite(value) || isNaN(value))) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
7
|
+
return "";
|
|
8
|
+
}
|
|
9
|
+
return String(value);
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
isString as i,
|
|
13
|
+
toString as t
|
|
14
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { _ as _sfc_main } from "./chunks/p-icon.js";
|
|
2
|
+
import { i as isComponent } from "./chunks/component.js";
|
|
3
|
+
describe("isComponent", () => {
|
|
4
|
+
it("should return true for a valid component object", () => {
|
|
5
|
+
expect(isComponent(_sfc_main)).toBe(true);
|
|
6
|
+
});
|
|
7
|
+
it("should return false for null", () => {
|
|
8
|
+
expect(isComponent(null)).toBe(false);
|
|
9
|
+
});
|
|
10
|
+
it.each([
|
|
11
|
+
["string", "string"],
|
|
12
|
+
["number", 123],
|
|
13
|
+
["boolean", true],
|
|
14
|
+
["undefined", void 0],
|
|
15
|
+
["symbol", Symbol("symbol")],
|
|
16
|
+
["function", () => {
|
|
17
|
+
}],
|
|
18
|
+
["array", []],
|
|
19
|
+
["date", /* @__PURE__ */ new Date()],
|
|
20
|
+
["regexp", /regex/],
|
|
21
|
+
["error", new Error("error")],
|
|
22
|
+
["map", /* @__PURE__ */ new Map()],
|
|
23
|
+
["set", /* @__PURE__ */ new Set()]
|
|
24
|
+
])("should return false for a non-component object: %s", (_, value) => {
|
|
25
|
+
expect(isComponent(value)).toBe(false);
|
|
26
|
+
});
|
|
27
|
+
});
|