@operato/form 8.0.0-alpha.6 → 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 (44) hide show
  1. package/CHANGELOG.md +156 -0
  2. package/dist/src/filters/ox-filters-form-base.js +2 -1
  3. package/dist/src/filters/ox-filters-form-base.js.map +1 -1
  4. package/dist/tsconfig.tsbuildinfo +1 -1
  5. package/package.json +15 -15
  6. package/themes/calendar-theme.css +3 -1
  7. package/.editorconfig +0 -29
  8. package/.storybook/main.js +0 -3
  9. package/.storybook/preview.js +0 -52
  10. package/.storybook/server.mjs +0 -8
  11. package/src/components/ox-custom-input.ts +0 -102
  12. package/src/components/ox-custom-select.ts +0 -91
  13. package/src/components/ox-file-uploader.ts +0 -164
  14. package/src/components/ox-form-master.ts +0 -246
  15. package/src/components/ox-form-paginator.ts +0 -60
  16. package/src/components/ox-search-form-paginator.ts +0 -46
  17. package/src/components/ox-search-form.ts +0 -467
  18. package/src/filters/filter-checkbox.ts +0 -34
  19. package/src/filters/filter-input-barcode.ts +0 -35
  20. package/src/filters/filter-input.ts +0 -30
  21. package/src/filters/filter-range-date.ts +0 -81
  22. package/src/filters/filter-range-number.ts +0 -64
  23. package/src/filters/filter-select.ts +0 -56
  24. package/src/filters/filter-styles.ts +0 -127
  25. package/src/filters/index.ts +0 -10
  26. package/src/filters/ox-filter-personalizer.ts +0 -188
  27. package/src/filters/ox-filters-form-base.ts +0 -436
  28. package/src/filters/registry.ts +0 -54
  29. package/src/index.ts +0 -4
  30. package/src/styles/index.ts +0 -3
  31. package/src/styles/multi-column-form-styles.ts +0 -192
  32. package/src/styles/search-form-styles.ts +0 -160
  33. package/src/styles/single-column-form-styles.ts +0 -114
  34. package/src/types.ts +0 -106
  35. package/stories/ox-filters-form-barcode.stories.ts +0 -140
  36. package/stories/ox-filters-form-base-bounded.stories.ts +0 -208
  37. package/stories/ox-filters-form-base-change-handler.stories.ts +0 -220
  38. package/stories/ox-filters-form-base-page-preference.stories.ts +0 -177
  39. package/stories/ox-filters-form-base.stories.ts +0 -179
  40. package/stories/ox-search-form-change-handler.stories.ts +0 -253
  41. package/stories/ox-search-form.stories.ts +0 -258
  42. package/tsconfig.json +0 -24
  43. package/web-dev-server.config.mjs +0 -27
  44. package/web-test-runner.config.mjs +0 -41
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-alpha.6",
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,25 +62,25 @@
62
62
  },
63
63
  "dependencies": {
64
64
  "@material/web": "^2.0.0",
65
- "@operato/graphql": "^8.0.0-alpha.0",
66
- "@operato/input": "^8.0.0-alpha.4",
67
- "@operato/p13n": "^8.0.0-alpha.4",
68
- "@operato/time-calculator": "^8.0.0-alpha.6",
69
- "@operato/utils": "^8.0.0-alpha.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": {
73
- "@custom-elements-manifest/analyzer": "^0.9.2",
73
+ "@custom-elements-manifest/analyzer": "^0.10.0",
74
74
  "@hatiolab/prettier-config": "^1.0.0",
75
75
  "@open-wc/eslint-config": "^12.0.3",
76
- "@open-wc/testing": "^3.1.6",
77
- "@typescript-eslint/eslint-plugin": "^7.0.1",
78
- "@typescript-eslint/parser": "^7.0.1",
79
- "@web/dev-server": "^0.3.0",
76
+ "@open-wc/testing": "^4.0.0",
77
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
78
+ "@typescript-eslint/parser": "^8.0.0",
79
+ "@web/dev-server": "^0.4.0",
80
80
  "@web/dev-server-storybook": "^2.0.1",
81
- "@web/test-runner": "^0.18.0",
82
- "concurrently": "^8.0.1",
83
- "eslint": "^8.39.0",
81
+ "@web/test-runner": "^0.19.0",
82
+ "concurrently": "^9.0.0",
83
+ "eslint": "^9.0.0",
84
84
  "eslint-config-prettier": "^9.1.0",
85
85
  "husky": "^9.0.11",
86
86
  "json5": "^2.2.0",
@@ -102,5 +102,5 @@
102
102
  "prettier --write"
103
103
  ]
104
104
  },
105
- "gitHead": "f0c1979adcf64df1f543f383ae7385a56df1e57a"
105
+ "gitHead": "d5b28a2e9deb632c0dc80132f6a7196dd6fe4220"
106
106
  }
@@ -9,7 +9,8 @@ body {
9
9
  /* monthly layout */
10
10
  --calendar-monthly-ol-margin: var(--margin-default) 0;
11
11
  --calendar-monthly-ol-top-border: 2px solid var(--md-sys-color-secondary);
12
- --calendar-current-monty-background-color: var(--md-sys-color-surface-variant);
12
+ --calendar-current-month-background-color: var(--md-sys-color-surface-variant);
13
+ --calendar-current-month-color: var(--md-sys-color-on-surface);
13
14
  --calendar-monthly-label-align: left;
14
15
  --calendar-monthly-label-padding: var(--padding-narrow) 0;
15
16
  --calendar-monthly-label-color: var(--md-sys-color-secondary);
@@ -35,6 +36,7 @@ body {
35
36
  --calendar-weekly-ol-margin: var(--margin-default) 0;
36
37
  --calendar-weekly-ol-top-border: 2px solid var(--md-sys-color-secondary);
37
38
  --calendar-current-week-background-color: var(--md-sys-color-surface-variant);
39
+ --calendar-current-week-color: var(--md-sys-color-on-surface);
38
40
  --calendar-weekly-label-align: center;
39
41
  --calendar-weekly-label-padding: var(--padding-narrow) 0;
40
42
  --calendar-weekly-label-color: var(--md-sys-color-secondary);
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
- }