@operato/form 8.0.0-beta.0 → 8.0.0-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.
Files changed (40) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/package.json +7 -7
  3. package/.editorconfig +0 -29
  4. package/.storybook/main.js +0 -3
  5. package/.storybook/preview.js +0 -52
  6. package/.storybook/server.mjs +0 -8
  7. package/src/components/ox-custom-input.ts +0 -102
  8. package/src/components/ox-custom-select.ts +0 -91
  9. package/src/components/ox-file-uploader.ts +0 -164
  10. package/src/components/ox-form-master.ts +0 -246
  11. package/src/components/ox-form-paginator.ts +0 -60
  12. package/src/components/ox-search-form-paginator.ts +0 -46
  13. package/src/components/ox-search-form.ts +0 -467
  14. package/src/filters/filter-checkbox.ts +0 -34
  15. package/src/filters/filter-input-barcode.ts +0 -35
  16. package/src/filters/filter-input.ts +0 -30
  17. package/src/filters/filter-range-date.ts +0 -81
  18. package/src/filters/filter-range-number.ts +0 -64
  19. package/src/filters/filter-select.ts +0 -56
  20. package/src/filters/filter-styles.ts +0 -127
  21. package/src/filters/index.ts +0 -10
  22. package/src/filters/ox-filter-personalizer.ts +0 -188
  23. package/src/filters/ox-filters-form-base.ts +0 -437
  24. package/src/filters/registry.ts +0 -54
  25. package/src/index.ts +0 -4
  26. package/src/styles/index.ts +0 -3
  27. package/src/styles/multi-column-form-styles.ts +0 -192
  28. package/src/styles/search-form-styles.ts +0 -160
  29. package/src/styles/single-column-form-styles.ts +0 -114
  30. package/src/types.ts +0 -106
  31. package/stories/ox-filters-form-barcode.stories.ts +0 -140
  32. package/stories/ox-filters-form-base-bounded.stories.ts +0 -208
  33. package/stories/ox-filters-form-base-change-handler.stories.ts +0 -220
  34. package/stories/ox-filters-form-base-page-preference.stories.ts +0 -177
  35. package/stories/ox-filters-form-base.stories.ts +0 -179
  36. package/stories/ox-search-form-change-handler.stories.ts +0 -253
  37. package/stories/ox-search-form.stories.ts +0 -258
  38. package/tsconfig.json +0 -24
  39. package/web-dev-server.config.mjs +0 -27
  40. package/web-test-runner.config.mjs +0 -41
package/CHANGELOG.md CHANGED
@@ -3,6 +3,15 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [8.0.0-beta.1](https://github.com/hatiolab/operato/compare/v8.0.0-beta.0...v8.0.0-beta.1) (2025-01-08)
7
+
8
+
9
+ ### :bug: Bug Fix
10
+
11
+ * missing .npmignore ([be05985](https://github.com/hatiolab/operato/commit/be05985abfae4af53501f718dd52932099f7fbcb))
12
+
13
+
14
+
6
15
  ## [8.0.0-beta.0](https://github.com/hatiolab/operato/compare/v8.0.0-alpha.56...v8.0.0-beta.0) (2025-01-07)
7
16
 
8
17
  **Note:** Version bump only for package @operato/form
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@operato/form",
3
3
  "description": "WebApplication form supporting components following open-wc recommendations",
4
4
  "author": "heartyoh",
5
- "version": "8.0.0-beta.0",
5
+ "version": "8.0.0-beta.1",
6
6
  "main": "dist/src/index.js",
7
7
  "module": "dist/src/index.js",
8
8
  "exports": {
@@ -62,11 +62,11 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@material/web": "^2.0.0",
65
- "@operato/graphql": "^8.0.0-beta.0",
66
- "@operato/input": "^8.0.0-beta.0",
67
- "@operato/p13n": "^8.0.0-beta.0",
68
- "@operato/time-calculator": "^8.0.0-beta.0",
69
- "@operato/utils": "^8.0.0-beta.0",
65
+ "@operato/graphql": "^8.0.0-beta.1",
66
+ "@operato/input": "^8.0.0-beta.1",
67
+ "@operato/p13n": "^8.0.0-beta.1",
68
+ "@operato/time-calculator": "^8.0.0-beta.1",
69
+ "@operato/utils": "^8.0.0-beta.1",
70
70
  "lit": "^3.1.2"
71
71
  },
72
72
  "devDependencies": {
@@ -102,5 +102,5 @@
102
102
  "prettier --write"
103
103
  ]
104
104
  },
105
- "gitHead": "c4e9cc245659d050a9ffd66542083a6daad4bcb9"
105
+ "gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
106
106
  }
package/.editorconfig DELETED
@@ -1,29 +0,0 @@
1
- # EditorConfig helps developers define and maintain consistent
2
- # coding styles between different editors and IDEs
3
- # editorconfig.org
4
-
5
- root = true
6
-
7
-
8
- [*]
9
-
10
- # Change these settings to your own preference
11
- indent_style = space
12
- indent_size = 2
13
-
14
- # We recommend you to keep these unchanged
15
- end_of_line = lf
16
- charset = utf-8
17
- trim_trailing_whitespace = true
18
- insert_final_newline = true
19
-
20
- [*.md]
21
- trim_trailing_whitespace = false
22
-
23
- [*.json]
24
- indent_size = 2
25
-
26
- [*.{html,js,md}]
27
- block_comment_start = /**
28
- block_comment = *
29
- block_comment_end = */
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- stories: ['../dist/stories/**/*.stories.{js,md,mdx}'],
3
- };
@@ -1,52 +0,0 @@
1
- import { i18next } from '@operato/i18n'
2
-
3
- export const globalTypes = {
4
- locale: {
5
- name: 'Locale',
6
- description: 'Internationalization locale',
7
- toolbar: {
8
- icon: 'globe',
9
- items: [
10
- { value: 'en', right: '🇺🇸', title: 'English' },
11
- { value: 'ko', right: '🇰🇷', title: '한국어' },
12
- { value: 'zh', right: '🇨🇳', title: '中文' },
13
- { value: 'ja', right: '🇯🇵', title: '日本語' },
14
- { value: 'ms', right: '🇲🇾', title: 'Bahasa Melayu' }
15
- ],
16
- showName: true
17
- }
18
- },
19
- theme: {
20
- name: 'Theme',
21
- description: 'Global theme for components',
22
- toolbar: {
23
- icon: 'paintbrush',
24
- items: [
25
- { value: 'light', title: 'Light' },
26
- { value: 'dark', title: 'Dark' }
27
- ],
28
- showName: true
29
- }
30
- }
31
- }
32
-
33
- export const decorators = [
34
- (Story, context) => {
35
- const { locale, theme } = context.globals
36
-
37
- if (locale) {
38
- i18next.changeLanguage(locale)
39
- }
40
-
41
- // Set the theme class for the document
42
- if (theme === 'dark') {
43
- document.documentElement.classList.add('dark')
44
- document.documentElement.classList.remove('light')
45
- } else {
46
- document.documentElement.classList.add('light')
47
- document.documentElement.classList.remove('dark')
48
- }
49
-
50
- return Story()
51
- }
52
- ]
@@ -1,8 +0,0 @@
1
- import { storybookPlugin } from '@web/dev-server-storybook';
2
- import baseConfig from '../web-dev-server.config.mjs';
3
-
4
- export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
5
- ...baseConfig,
6
- open: '/',
7
- plugins: [storybookPlugin({ type: 'web-components' }), ...baseConfig.plugins],
8
- });
@@ -1,102 +0,0 @@
1
- import { LitElement, PropertyValues, css, html } from 'lit'
2
- import { customElement, property, query, state } from 'lit/decorators.js'
3
-
4
- @customElement('ox-custom-input')
5
- export class CustomInput extends LitElement {
6
- static styles = css`
7
- input {
8
- margin: auto 0;
9
- border: 1px solid var(--md-sys-color-outline);
10
- padding: 0 var(--spacing-small);
11
- min-width: var(--form-input-width, 300px);
12
- max-width: var(--form-input-width, 300px);
13
- height: var(--form-element-height-medium);
14
- outline: var(--form-input-outline, none);
15
- color: var(--form-input-background-color, var(--md-sys-color-on-surface-variant));
16
- background-color: var(--form-input-background-color, var(--md-sys-color-surface-variant));
17
- }
18
- `
19
-
20
- @property({ type: String }) name?: string
21
- @property({ type: String }) placeholder?: string
22
- @property({ type: String }) type?: string
23
- @property({ type: Object }) props: any
24
- @property({ type: Array }) attrs: any
25
- @property({ type: String }) valueField?: string
26
- @property({ type: Object }) value: any
27
- @property({ type: Boolean }) autofocus: boolean = false
28
-
29
- @query('input') input!: HTMLInputElement
30
-
31
- render() {
32
- return html`
33
- <input
34
- name=${this.name}
35
- placeholder=${this.placeholder}
36
- type=${this.type || 'text'}
37
- value=${this.value || ''}
38
- @input=${(e: InputEvent) => (this.value = (e.currentTarget as HTMLInputElement).value)}
39
- ?autofocus=${this.autofocus}
40
- />
41
- `
42
- }
43
-
44
- get checked() {
45
- return this.input.checked
46
- }
47
-
48
- set checked(checked) {
49
- this.input.checked = checked
50
- }
51
-
52
- firstUpdated() {
53
- this.dispatchEvent(new CustomEvent('load'))
54
- }
55
-
56
- updated(changes: PropertyValues<this>) {
57
- if (changes.has('props')) {
58
- if (this._isObject(this.props)) {
59
- for (let prop in this.props) {
60
- if (this.props[prop]) {
61
- this.input.setAttribute(prop, this.props[prop])
62
- this.setAttribute(prop, this.props[prop])
63
- }
64
- }
65
- }
66
- }
67
-
68
- if (changes.has('attrs')) {
69
- if (this.attrs && Array.isArray(this.attrs)) {
70
- this.attrs.forEach(attr => {
71
- this.input.setAttribute(attr, '')
72
- this.setAttribute(attr, '')
73
- })
74
- }
75
- }
76
-
77
- if (changes.has('value') && this._isObject(this.value)) {
78
- let value = this.value
79
- this.value = (this.valueField && value[this.valueField]) || value[Object.keys(value)[0]]
80
- }
81
- }
82
-
83
- _isObject(v: any) {
84
- return v instanceof Object && !Array.isArray(v)
85
- }
86
-
87
- focus() {
88
- this.input.focus()
89
- }
90
-
91
- select() {
92
- this.input.select()
93
- }
94
-
95
- blur() {
96
- this.input.blur()
97
- }
98
-
99
- checkValidity() {
100
- return this.input.checkValidity()
101
- }
102
- }
@@ -1,91 +0,0 @@
1
- import { LitElement, PropertyValues, css, html } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- @customElement('ox-custom-select')
5
- export class CustomSelect extends LitElement {
6
- static styles = css`
7
- select {
8
- margin: auto 0;
9
- border-style: var(--form-input-border-style, solid);
10
- border-width: var(--form-input-border-width, 1px);
11
- border-color: var(--form-input-border-color, #c4c5c6);
12
- padding: var(--form-input-padding, 5px);
13
- outline: var(--form-input-outline, none);
14
- color: var(--form-input-background-color, var(--md-sys-color-on-surface-variant));
15
- background-color: var(--form-input-background-color, var(--md-sys-color-surface-variant));
16
- min-width: calc(
17
- var(--form-input-width, 300px) + 2 * var(--form-input-padding, 5px) + 2 * var(--form-input-border-width, 1px)
18
- );
19
- max-width: calc(
20
- var(--form-input-width) + 2 * var(--form-input-padding, 5px) + 2 * var(--form-input-border-width, 1px)
21
- );
22
- -webkit-appearance: none;
23
- -webkit-border-radius: 0px;
24
- }
25
- `
26
-
27
- @property({ type: String }) name?: string
28
- @property({ type: Array }) options?: { name: string; value: any }[]
29
- @property({ type: Object }) props: any
30
- @property({ type: Array }) attrs: any
31
- @property({ type: String }) value: any
32
- @property({ type: Boolean }) autofocus: boolean = false
33
-
34
- @query('select') select!: HTMLInputElement
35
-
36
- render() {
37
- return html`
38
- <select
39
- name=${this.name}
40
- ?autofocus=${this.autofocus}
41
- @change=${(e: Event) => (this.value = (e.currentTarget as HTMLSelectElement).value)}
42
- >
43
- ${(this.options || []).map(
44
- option => html`
45
- <option value=${option.value} ?selected=${this.value === option.value}>${option.name}</option>
46
- `
47
- )}
48
- </select>
49
- `
50
- }
51
-
52
- firstUpdated() {
53
- this.dispatchEvent(new CustomEvent('load'))
54
- }
55
-
56
- updated(changes: PropertyValues<this>) {
57
- if (changes.has('props') && this._isObject(this.props)) {
58
- for (let prop in this.props) {
59
- if (this.props[prop]) {
60
- this.select.setAttribute(prop, this.props[prop])
61
- this.setAttribute(prop, this.props[prop])
62
- }
63
- }
64
- }
65
-
66
- if (changes.has('attrs')) {
67
- if (this.attrs && Array.isArray(this.attrs)) {
68
- this.attrs.forEach(attr => {
69
- this.select.setAttribute(attr, '')
70
- this.setAttribute(attr, '')
71
- })
72
- }
73
- }
74
- }
75
-
76
- _isObject(v: any) {
77
- return v instanceof Object && !Array.isArray(v)
78
- }
79
-
80
- focus() {
81
- this.select.focus()
82
- }
83
-
84
- blur() {
85
- this.select.blur()
86
- }
87
-
88
- checkValidity() {
89
- return this.select.checkValidity()
90
- }
91
- }
@@ -1,164 +0,0 @@
1
- import { LitElement, css, html } from 'lit'
2
- import { customElement, property, query } from 'lit/decorators.js'
3
-
4
- import { FileDropHelper } from '@operato/utils'
5
-
6
- @customElement('ox-file-uploader')
7
- export class FileUploader extends LitElement {
8
- static styles = [
9
- css`
10
- :host {
11
- display: flex;
12
- flex-direction: column;
13
- border-radius: var(--border-radius);
14
- text-align: center;
15
- padding-bottom: 5px !important;
16
- text-transform: capitalize;
17
-
18
- border: var(--file-uploader-border);
19
- background-color: var(--md-sys-color-background);
20
- font: var(--file-uploader-font) !important;
21
- color: var(--file-uploader-color);
22
- }
23
- :host > md-icon {
24
- color: var(--file-uploader-icon-color);
25
- }
26
-
27
- :host(.candrop) {
28
- background-color: var(--file-uploader-candrop-background-color);
29
- }
30
-
31
- #input-file {
32
- display: none;
33
- }
34
-
35
- label {
36
- position: relative;
37
- width: auto;
38
- border: none;
39
- text-transform: capitalize;
40
-
41
- padding: var(--file-uploader-label-padding);
42
- border-radius: var(--file-uploader-label-border-radius);
43
- background-color: var(--file-uploader-label-background-color);
44
- color: var(--file-uploader-label-color);
45
- font: var(--file-uploader-label-font) !important;
46
- }
47
-
48
- ul {
49
- max-width: 500px;
50
- list-style: none;
51
- padding: 0;
52
- }
53
- li {
54
- text-align: left;
55
-
56
- padding: var(--file-uploader-li-padding);
57
- border-bottom: var(--file-uploader-li-border-bottom);
58
- display: flex;
59
- align-items: center;
60
- }
61
- li md-icon {
62
- cursor: pointer;
63
- font: var(--file-uploader-li-icon-font);
64
- margin-left: auto;
65
- }
66
- li md-icon:hover,
67
- li md-icon:active {
68
- color: var(--file-uploader-li-icon-focus-color);
69
- }
70
- `
71
- ]
72
-
73
- @property({ type: Boolean }) multiple: boolean = false
74
- @property({ type: String }) accept: string = '*/*'
75
- @property({ type: String }) label?: string
76
-
77
- @property({ type: Array }) _files: File[] = []
78
-
79
- @query('#input-file') fileInput!: HTMLInputElement
80
-
81
- render() {
82
- return html`
83
- <md-icon>post_add</md-icon>
84
- <span>add file or drop files here!</span>
85
- <input
86
- id="input-file"
87
- type="file"
88
- accept=${this.accept}
89
- ?multiple=${this.multiple}
90
- hidden
91
- @change=${(e: Event) => {
92
- const fileInput = e.currentTarget as HTMLInputElement
93
- const files = fileInput.files as FileList
94
- //// Temporary Validation preventing file size more than 10mb to be uploaded
95
- for (let index = 0; index < files.length; index++) {
96
- if (files[index].size > 9999999) {
97
- document.dispatchEvent(
98
- new CustomEvent('notify', {
99
- detail: {
100
- type: 'error',
101
- message: 'File size must be less than 10 MB.'
102
- }
103
- })
104
- )
105
- throw new Error('File size must be less than 10 MB.')
106
- }
107
- }
108
-
109
- this._files = [...this._files, ...Array.from(files)]
110
-
111
- this.dispatchEvent(
112
- new CustomEvent('files-change', {
113
- bubbles: true,
114
- composed: true,
115
- detail: {
116
- files: files
117
- }
118
- })
119
- )
120
-
121
- fileInput.value = ''
122
- }}
123
- />
124
- <label for="input-file">${this.label || 'select file'}</label>
125
-
126
- ${this._files?.length
127
- ? html` <ul>
128
- ${this._files.map(
129
- file => html`
130
- <li>
131
- - ${file.name}
132
- <md-icon
133
- @click=${(e: Event) => {
134
- this._files.splice(this._files.indexOf(file), 1)
135
- this.requestUpdate()
136
- }}
137
- >delete_outline</md-icon
138
- >
139
- </li>
140
- `
141
- )}
142
- </ul>`
143
- : ''}
144
- `
145
- }
146
-
147
- firstUpdated() {
148
- FileDropHelper.set(this)
149
-
150
- this.addEventListener('file-drop', (e: Event) => {
151
- const de = e as any
152
- this._files = this.multiple ? de.detail : de.detail[0] ? [de.detail[0]] : []
153
- })
154
- }
155
-
156
- get files() {
157
- return this._files
158
- }
159
-
160
- reset() {
161
- this.fileInput.value = ''
162
- this._files = []
163
- }
164
- }